Esempio n. 1
0
        public Dictionary <uint, Dictionary <T, string> > LoadConfig(TLMConfigWarehouse.ConfigIndex idx, bool global = false)
        {
            var result = new Dictionary <uint, Dictionary <T, string> >();

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("{0} load()", idx);
            }
            string[] itemListLvl1;
            if (global && !AllowGlobal)
            {
                throw new Exception("CONFIGURAÇÂO NÃO GLOBAL TENTOU SER CARREGADA COMO GLOBAL: " + typeof(U));
            }
            if (global)
            {
                itemListLvl1 = TLMConfigWarehouse.getConfig().getString(idx).Split(ItSepLvl1.ToCharArray());
            }
            else
            {
                itemListLvl1 = TLMConfigWarehouse.getCurrentConfigString(idx).Split(ItSepLvl1.ToCharArray());
            }

            if (itemListLvl1.Length > 0)
            {
                if (TLMSingleton.instance != null && TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("{0} load(): file.Length > 0", idx);
                }
                foreach (string s in itemListLvl1)
                {
                    uint key   = GetIndexFromStringArray(s);
                    var  value = GetValueFromStringArray(s);
                    result[key] = value;
                }
                if (TLMSingleton.instance != null && TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("{0} load(): dic done", idx);
                }
                result.Remove(~0u);
            }
            return(result);
        }
Esempio n. 2
0
        protected List <Dictionary <T, string> > LoadConfigList(K idx, bool global = false)
        {
            var result = new List <Dictionary <T, string> >();

            KlyteUtils.doLog("{0} load()", idx);
            string[] itemListLvl1;
            if (global && !AllowGlobal)
            {
                throw new Exception("CONFIGURAÇÂO NÃO GLOBAL TENTOU SER CARREGADA COMO GLOBAL: " + typeof(U));
            }
            if (global)
            {
                itemListLvl1 = Singleton <I> .instance.getConfig2().getString(idx).Split(ItSepLvl1.ToCharArray());
            }
            else
            {
                itemListLvl1 = Singleton <I> .instance.currentLoadedCityConfig.getString(idx).Split(ItSepLvl1.ToCharArray());
            }

            if (itemListLvl1.Length > 0)
            {
                KlyteUtils.doLog("{0} load(): file.Length > 0", idx);
                foreach (string s in itemListLvl1)
                {
                    var value = GetValueFromStringArray(s);
                    result.Add(value);
                }
                KlyteUtils.doLog("{0} load(): dic done", idx);
            }
            return(result);
        }