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

            avatarOptions.GenderChosen = Conv.getStringFromParts(parts, "a").ToLower().Equals("true");
            avatarOptions.IsFemale     = Conv.getStringFromParts(parts, "b").ToLower().Equals("true");
            string stringFromParts = Conv.getStringFromParts(parts, "c");

            string[] array = stringFromParts.Split(new char[]
            {
                '&'
            });
            List <ClothingPart> list = new List <ClothingPart>();

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!string.IsNullOrEmpty(text))
                {
                    list.Add(ClothingPart.FromString(text));
                }
            }
            avatarOptions.ClothingPartsOld  = list;
            avatarOptions.HasLongHair       = Conv.getStringFromParts(parts, "d").ToLower().Equals("true");
            avatarOptions.HasBoughtLongHair = Conv.getStringFromParts(parts, "e").ToLower().Equals("true");
            stringFromParts = Conv.getStringFromParts(parts, "f");
            array           = stringFromParts.Split(new char[]
            {
                '&'
            });
            List <ClothingPart> list2 = new List <ClothingPart>();

            string[] array3 = array;
            for (int j = 0; j < array3.Length; j++)
            {
                string text2 = array3[j];
                if (!string.IsNullOrEmpty(text2))
                {
                    list2.Add(ClothingPart.FromString(text2));
                }
            }
            avatarOptions.ClothingParts = list2;
            AvatarOptions.CheckIfAllAdded(ref avatarOptions.ClothingParts);
            avatarOptions.HasBoughtHair3 = Conv.getStringFromParts(parts, "g").ToLower().Equals("true");
            avatarOptions.HairStyle      = Conv.getIntFromParts(parts, "h");
            return(avatarOptions);
        }
        internal static void CheckIfAllAdded(ref List <ClothingPart> allParts)
        {
            if (allParts == null || allParts.Count == 0)
            {
                allParts = AvatarOptions.InitialParts();
                return;
            }
            List <ClothingPart> list = AvatarOptions.InitialParts();

            foreach (ClothingPart current in list)
            {
                AvatarOptions.AddIfMissing(ref allParts, list, current.Id);
            }
        }
 public AvatarOptions()
 {
     this.ClothingParts = AvatarOptions.InitialParts();
 }