hxp
5 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: 
#
# @author: Alee
# @date 2018-1-3 ÏÂÎç05:52:47
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
 
import ConfigParser
import logging
 
class AppConfig():
    def __init__(self, filePath, sectionName):
        self.config = ConfigParser.ConfigParser()
        self.config.read(filePath)
        self.sectionName = sectionName
        
    def SetSection(self, sectionName):
        self.sectionName = sectionName
        
    def GetValue(self, key):
        return self.config.get(self.sectionName, key) 
    
    def GetIntValue(self, key):
        return self.config.getint(self.sectionName, key) 
 
__gGameConfig = None
 
 
        
def GetConfig():
    global __gGameConfig
    if not __gGameConfig:
        FilePath = ".\Config.ini"
        SectionName = "VoiceConfig"
        __gGameConfig = AppConfig (FilePath, SectionName)
    return __gGameConfig