Ejemplo n.º 1
0
    public void Load()
    {
        string text = string.Format("{0}/{1}", FileUtils.ConfigDataPath, CONFIG_FILE_NAME);

        if (File.Exists(text))
        {
            this.m_logInfos.Clear();
            FileUtils.ParseConfigFile(text, new FileUtils.ConfigFileEntryParseCallback(this.OnConfigFileEntryParsed));
        }
        LogInfo[] dEFAULT_LOG_INFOS = this.DEFAULT_LOG_INFOS;
        for (int i = 0; i < dEFAULT_LOG_INFOS.Length; i++)
        {
            LogInfo logInfo = dEFAULT_LOG_INFOS[i];
            if (!this.m_logInfos.ContainsKey(logInfo.GetName()))
            {
                this.m_logInfos.Add(logInfo.GetName(), logInfo);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnConfigFileEntryParsed(string baseKey, string subKey, string val, object userData)
    {
        LogInfo logInfo;

        if (!this.m_logInfos.TryGetValue(baseKey, out logInfo))
        {
            logInfo = new LogInfo(baseKey);
            this.m_logInfos.Add(logInfo.GetName(), logInfo);
        }
        if (subKey.Equals("ConsolePrinting"))
        {
            logInfo.SetConsolePrintingEnabled(GeneralUtils.ForceBool(val));
        }
        else
        {
            if (subKey.Equals("ScreenPrinting"))
            {
                logInfo.SetScreenPrintingEnabled(GeneralUtils.ForceBool(val));
            }
            else
            {
                if (subKey.Equals("FilePrinting"))
                {
                    logInfo.SetFilePrintingEnabled(GeneralUtils.ForceBool(val));
                }
                else
                {
                    if (subKey.Equals("LogLevel"))
                    {
                        try {
                            LogLevel @enum = EnumUtils.GetEnum <LogLevel>(val);
                            logInfo.SetLogLevel(@enum);
                        } catch (ArgumentException) {
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
	private void OnConfigFileEntryParsed(string baseKey, string subKey, string val, object userData) {
		LogInfo logInfo;
		if (!this.m_logInfos.TryGetValue(baseKey, out logInfo)) {
			logInfo = new LogInfo(baseKey);
			this.m_logInfos.Add(logInfo.GetName(), logInfo);
		}
		if (subKey.Equals("ConsolePrinting")) {
			logInfo.SetConsolePrintingEnabled(GeneralUtils.ForceBool(val));
		} else {
			if (subKey.Equals("ScreenPrinting")) {
				logInfo.SetScreenPrintingEnabled(GeneralUtils.ForceBool(val));
			} else {
				if (subKey.Equals("FilePrinting")) {
					logInfo.SetFilePrintingEnabled(GeneralUtils.ForceBool(val));
				} else {
					if (subKey.Equals("LogLevel")) {
						try {
							LogLevel @enum = EnumUtils.GetEnum<LogLevel>(val);
							logInfo.SetLogLevel(@enum);
						} catch (ArgumentException) {
						}
					}
				}
			}
		}
	}