internal static FactoryModule Deserialize(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("FactoryModule.FromString with empty value!");
                return(new FactoryModule());
            }
            string[]      parts         = Conv.StringPartsFromBase64(base64String, "FactoryModule");
            FactoryModule factoryModule = new FactoryModule();

            factoryModule.Type            = (ModuleType)Conv.getIntFromParts(parts, "a");
            factoryModule.MaxLevel        = new CDouble(Conv.getStringFromParts(parts, "b"));
            factoryModule.ShadowClones    = Conv.getCDoubleFromParts(parts, "c", false);
            factoryModule.CurrentDuration = Conv.getLongFromParts(parts, "d");
            factoryModule.Crystals        = new List <Crystal>();
            string stringFromParts = Conv.getStringFromParts(parts, "e");

            string[] array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!string.IsNullOrEmpty(text))
                {
                    factoryModule.Crystals.Add(Crystal.Deserialize(text));
                }
            }
            factoryModule.Level = new CDouble(Conv.getStringFromParts(parts, "f"));
            return(factoryModule);
        }
Ejemplo n.º 2
0
        internal static CrystalFactory Deserialize(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("CrystalFactory.FromString with empty value!");
                return(new CrystalFactory());
            }
            string[]       parts          = Conv.StringPartsFromBase64(base64String, "CrystalFactory");
            CrystalFactory crystalFactory = new CrystalFactory();

            crystalFactory.DefenderClones = new CDouble(Conv.getStringFromParts(parts, "a"));
            crystalFactory.AllModules     = new List <FactoryModule>();
            string stringFromParts = Conv.getStringFromParts(parts, "b");

            string[] array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!string.IsNullOrEmpty(text))
                {
                    crystalFactory.AllModules.Add(FactoryModule.Deserialize(text));
                }
            }
            if (crystalFactory.AllModules.Count == 0)
            {
                crystalFactory.AllModules = crystalFactory.Initial();
            }
            crystalFactory.Energy           = new CDouble(Conv.getStringFromParts(parts, "c"));
            crystalFactory.LastUBAttack     = Conv.getLongFromParts(parts, "d");
            crystalFactory.EquippedCrystals = new List <Crystal>();
            stringFromParts = Conv.getStringFromParts(parts, "e");
            array           = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array3 = array;
            for (int j = 0; j < array3.Length; j++)
            {
                string text2 = array3[j];
                if (!string.IsNullOrEmpty(text2))
                {
                    crystalFactory.EquippedCrystals.Add(Crystal.Deserialize(text2));
                }
            }
            return(crystalFactory);
        }