예제 #1
0
 private void DoSave(BinaryWriter writer)
 {
     try
     {
         if (this.SaveData.SinceLastSaved.HasValue)
         {
             this.tempSaveData.PlayTime += DateTime.Now.Ticks - this.SaveData.SinceLastSaved.Value;
             this.SaveData.PlayTime      = this.tempSaveData.PlayTime;
         }
         this.SaveData.SinceLastSaved = new long?(DateTime.Now.Ticks);
         SaveFileOperations.Write(new CrcWriter(writer), this.tempSaveData);
     }
     catch (Exception ex)
     {
         Logger.Log("Saving", LogSeverity.Error, ((object)ex).ToString());
     }
 }
예제 #2
0
        private void ChooseSaveSlot(SaveSlotInfo slot, SaveManagementLevel.SMOperation operation)
        {
            switch (operation)
            {
            case SaveManagementLevel.SMOperation.Change:
                this.GameState.SaveSlot = slot.Index;
                this.GameState.LoadSaveFile((Action)(() =>
                {
                    this.GameState.Save();
                    this.GameState.DoSave();
                    this.GameState.SaveToCloud(true);
                    this.GameState.Restart();
                }));
                break;

            case SaveManagementLevel.SMOperation.CopySource:
                this.CopySourceSlot = slot;
                this.RefreshSlotsFor(this.CopyDestLevel, SaveManagementLevel.SMOperation.CopyDestination, (Func <SaveSlotInfo, bool>)(s => this.CopySourceSlot != s));
                this.Menu.ChangeMenuLevel(this.CopyDestLevel, false);
                break;

            case SaveManagementLevel.SMOperation.CopyDestination:
                new PCSaveDevice("FEZ").Save("SaveSlot" + (object)slot.Index, (SaveAction)(writer => SaveFileOperations.Write(new CrcWriter(writer), this.CopySourceSlot.SaveData)));
                this.GameState.SaveToCloud(true);
                this.ReloadSlots();
                this.Menu.ChangeMenuLevel((MenuLevel)this, false);
                break;

            case SaveManagementLevel.SMOperation.Clear:
                new PCSaveDevice("FEZ").Delete("SaveSlot" + (object)slot.Index);
                if (this.GameState.SaveSlot == slot.Index)
                {
                    this.GameState.LoadSaveFile((Action)(() =>
                    {
                        this.GameState.Save();
                        this.GameState.DoSave();
                        this.GameState.SaveToCloud(true);
                        this.GameState.Restart();
                    }));
                    break;
                }
                else
                {
                    this.ReloadSlots();
                    this.Menu.ChangeMenuLevel((MenuLevel)this, false);
                    break;
                }
            }
        }