예제 #1
0
    // Token: 0x06000655 RID: 1621 RVA: 0x00025DD4 File Offset: 0x000241D4
    public SaveDataFormat Load_Binary(bool back)
    {
        string text = Define.SaveName_Binary;

        if (back)
        {
            text += ".back";
        }
        SaveDataFormat saveDataFormat = new SaveDataFormat();

        saveDataFormat.initialize();
        try
        {
            byte[] array = new byte[0];
            array = File.ReadAllBytes(text);
            saveDataFormat.ConvertBinary_Main(false, array);
            this.Save_Binary_BackUp(new SaveDataFormat(saveDataFormat));
            Debug.Log(string.Concat(new object[]
            {
                "[SaveManager] Binary ロードしました:",
                text,
                "[",
                array.Length,
                "]"
            }));
        }
        catch (FileNotFoundException ex)
        {
            saveDataFormat.initialize();
            this.Save_Binary(new SaveDataFormat(saveDataFormat));
            this.Save_Binary_BackUp(new SaveDataFormat(saveDataFormat));
            Debug.Log("[SaveManager] Binary データを新規作成しました (FileNotFoundException):" + text + " / " + ex.ToString());
        }
        catch (IsolatedStorageException ex2)
        {
            saveDataFormat.initialize();
            this.Save_Binary(new SaveDataFormat(saveDataFormat));
            this.Save_Binary_BackUp(new SaveDataFormat(saveDataFormat));
            Debug.Log("[SaveManager] Binary データを新規作成しました (IsolatedStorageException):" + text + " / " + ex2.ToString());
        }
        catch (Exception ex3)
        {
            if (back)
            {
                Debug.LogError("[SaveManager] Binary バックアップからの読み込みに失敗しました:" + text + " / " + ex3.ToString());
                throw;
            }
            Debug.LogWarning("[SaveManager] Binary データの読み込みに失敗しました。バックアップから復元します。" + text + " / " + ex3.ToString());
            return(this.Load_Binary_BackUp());
        }
        this.load_Binary_Version = saveDataFormat.version;
        saveDataFormat.versionFix();
        saveDataFormat.DataDiffCheck();
        return(saveDataFormat);
    }
예제 #2
0
    // Token: 0x06000668 RID: 1640 RVA: 0x00026AF0 File Offset: 0x00024EF0
    public SaveDataFormat Load_Serialize(bool back)
    {
        string text = Define.SaveName_Serialize;

        if (back)
        {
            text += ".back";
        }
        SaveDataFormat saveDataFormat = new SaveDataFormat();

        try
        {
            Debug.Log("[SaveManager] Serialize ロード開始:" + text);
            using (FileStream fileStream = new FileStream(text, FileMode.Open, FileAccess.Read))
            {
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                saveDataFormat = (binaryFormatter.Deserialize(fileStream) as SaveDataFormat);
            }
            Debug.Log("[SaveManager] Serialize ロードしました:" + text);
            if (saveDataFormat != null)
            {
                this.Save_Serialize(new SaveDataFormat(saveDataFormat), true);
            }
        }
        catch (FileNotFoundException ex)
        {
            saveDataFormat.initialize();
            this.Save_Serialize(new SaveDataFormat(saveDataFormat));
            this.Save_Serialize_BackUp(new SaveDataFormat(saveDataFormat));
            Debug.Log("[SaveManager] Serialize データを新規作成しました (FileNotFoundException):" + text + " / " + ex.ToString());
        }
        catch (IsolatedStorageException ex2)
        {
            saveDataFormat.initialize();
            this.Save_Serialize(new SaveDataFormat(saveDataFormat));
            this.Save_Serialize_BackUp(new SaveDataFormat(saveDataFormat));
            Debug.Log("[SaveManager] Serialize データを新規作成しました (IsolatedStorageException):" + text + " / " + ex2.ToString());
        }
        catch (Exception ex3)
        {
            if (text.Remove(0, text.Length - 5) == ".back")
            {
                Debug.LogError("[SaveManager] Serialize バックアップからの読み込みに失敗しました:" + text + " / " + ex3.ToString());
                throw;
            }
            Debug.LogWarning("[SaveManager] Serialize データの読み込みに失敗しました。バックアップから復元します。:" + text + " / " + ex3.ToString());
            return(this.Load_Serialize_BackUp());
        }
        saveDataFormat.DataDiffCheck();
        return(saveDataFormat);
    }