Ejemplo n.º 1
0
        public static SaveFileManifest DeserializeSafe(string data)
        {
            SaveFileManifest saveFileManifest = new SaveFileManifest();

            string[] strArray = data.Split(new string[1] {
                "\r\n%------%"
            }, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length <= 1)
            {
                return((SaveFileManifest)null);
            }
            string str = strArray[0];

            saveFileManifest.Accounts.Clear();
            for (int index = 1; index < strArray.Length; ++index)
            {
                try
                {
                    SaveAccountData fromString = SaveAccountData.ParseFromString(strArray[index]);
                    saveFileManifest.Accounts.Add(fromString);
                    if (fromString.Username == str)
                    {
                        saveFileManifest.LastLoggedInUser = fromString;
                    }
                }
                catch (FormatException ex)
                {
                }
                catch (NullReferenceException ex)
                {
                }
            }
            return(saveFileManifest);
        }
Ejemplo n.º 2
0
        public static SaveFileManifest Deserialize(string data)
        {
            var saveFileManifest = new SaveFileManifest();
            var strArray         = data.Split(new string[1]
            {
                "\r\n%------%"
            }, StringSplitOptions.RemoveEmptyEntries);

            if (strArray.Length <= 1)
            {
                return(null);
            }
            var str = strArray[0];

            saveFileManifest.Accounts.Clear();
            for (var index = 1; index < strArray.Length; ++index)
            {
                var saveAccountData = SaveAccountData.ParseFromString(strArray[index]);
                saveFileManifest.Accounts.Add(saveAccountData);
                if (saveAccountData.Username == str)
                {
                    saveFileManifest.LastLoggedInUser = saveAccountData;
                }
            }
            return(saveFileManifest);
        }