コード例 #1
0
        internal static PetCampaign Deserialize(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                return(new PetCampaign());
            }
            string[]    parts       = Conv.StringPartsFromBase64(base64String, "PetCampaign");
            PetCampaign petCampaign = new PetCampaign();

            petCampaign.Type            = (Campaigns)Conv.getIntFromParts(parts, "a");
            petCampaign.Difficulty      = Conv.getCDoubleFromParts(parts, "b", false);
            petCampaign.CurrentDuration = Conv.getCDoubleFromParts(parts, "c", false);
            string stringFromParts = Conv.getStringFromParts(parts, "d");

            string[] array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string value = array2[i];
                if (!string.IsNullOrEmpty(value))
                {
                    petCampaign.PetIdsCampaign.Add((PetType)Conv.StringToInt(value));
                }
            }
            petCampaign.TotalDuration     = Conv.getCDoubleFromParts(parts, "e", false);
            petCampaign.CampaingsFinished = Conv.getCDoubleFromParts(parts, "f", false);
            stringFromParts = Conv.getStringFromParts(parts, "g");
            array           = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array3 = array;
            for (int j = 0; j < array3.Length; j++)
            {
                string value2 = array3[j];
                if (!string.IsNullOrEmpty(value2))
                {
                    petCampaign.RandomChances.Add(Conv.StringToInt(value2));
                }
            }
            petCampaign.SelectedGrowth = (Growth)Conv.getIntFromParts(parts, "h");
            return(petCampaign);
        }
コード例 #2
0
        internal static State2 Deserialize(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("State2.FromString with empty value!");
                return(new State2());
            }
            string[] parts           = Conv.StringPartsFromBase64(base64String, "State2");
            State2   state           = new State2();
            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))
                {
                    state.AllPets.Add(Pet.Deserialize(text));
                }
            }
            Pet.CheckIfAllAdded(ref state.AllPets);
            state.PunyFood      = Conv.getCDoubleFromParts(parts, "c", false);
            state.StrongFood    = Conv.getCDoubleFromParts(parts, "d", false);
            state.MightyFood    = Conv.getCDoubleFromParts(parts, "e", false);
            state.PetIdInAvatar = Conv.getIntFromParts(parts, "f");
            stringFromParts     = Conv.getStringFromParts(parts, "g");
            array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array3 = array;
            for (int j = 0; j < array3.Length; j++)
            {
                string value = array3[j];
                if (!string.IsNullOrEmpty(value))
                {
                    state.RandomValues.Add(Conv.StringToFloat(value));
                }
            }
            if (state.RandomValues == null || state.RandomValues.Count == 0)
            {
                state.RandomizeNumbers();
            }
            state.CurrentRandomNumber = Conv.getIntFromParts(parts, "h");
            state.FacebookClicked     = Conv.getStringFromParts(parts, "i").ToLower().Equals("true");
            state.TwitterClicked      = Conv.getStringFromParts(parts, "j").ToLower().Equals("true");
            state.Lucky = LuckyDraw.Deserialize(Conv.getStringFromParts(parts, "k"));
            state.ImportedSaveFromKongToSteam = Conv.getStringFromParts(parts, "l").ToLower().Equals("true");
            state.SteamCurrency   = (Currency)Conv.getIntFromParts(parts, "m");
            state.SteamCountry    = Conv.getStringFromParts(parts, "n");
            state.KongConvertId   = Conv.getIntFromParts(parts, "o");
            state.TimeSinceSteam  = Conv.getLongFromParts(parts, "p");
            state.AdPoints        = Conv.getCDoubleFromParts(parts, "q", false);
            state.AdsWatched      = Conv.getIntFromParts(parts, "r");
            state.TotalAdsWatched = Conv.getIntFromParts(parts, "s");
            state.AfkGame         = AfkyGame.FromString(Conv.getStringFromParts(parts, "t"));
            state.RateDialogShown = Conv.getStringFromParts(parts, "u").ToLower().Equals("true");
            state.Chocolate       = Conv.getCDoubleFromParts(parts, "v", false);
            state.Factory         = CrystalFactory.Deserialize(Conv.getStringFromParts(parts, "w"));
            stringFromParts       = Conv.getStringFromParts(parts, "x");
            array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array4 = array;
            for (int k = 0; k < array4.Length; k++)
            {
                string text2 = array4[k];
                if (!string.IsNullOrEmpty(text2))
                {
                    state.AllCampaigns.Add(PetCampaign.Deserialize(text2));
                }
            }
            if (state.AllCampaigns.Count == 0)
            {
                state.AllCampaigns = PetCampaign.Initial;
            }
            state.PetStones      = Conv.getCDoubleFromParts(parts, "y", false);
            state.PetStonesSpent = Conv.getCDoubleFromParts(parts, "z", false);
            if (state.RandomValues == null || state.RandomValues.Count == 0)
            {
                state.RandomizeNumbers();
            }
            if (state.TimeSinceSteam < 5184000000L)
            {
                state.TimeSinceSteam = 5184000000L;
            }
            state.PetPowerMultiGods      = Conv.getCDoubleFromParts(parts, "A", false);
            state.PetPowerMultiCampaigns = Conv.getCDoubleFromParts(parts, "B", false);
            return(state);
        }