Пример #1
0
 public static SaveStrategyTypes GetSaveType(SaveStrategy saveStrategy)
 {
     if (saveStrategy is StandardSaveStrategy)
         return SaveStrategyTypes.StandardSaveStrategy;
     else if (saveStrategy is DualSaveStrategy)
         return SaveStrategyTypes.StandardSaveStrategy;
     else if (saveStrategy is DynamicSaveStrategy)
         return SaveStrategyTypes.DynamicSaveStrategy;
     else if (saveStrategy is ParallelSaveStrategy)
         return SaveStrategyTypes.ParallelSaveStrategy;
     else
         return SaveStrategyTypes.StandardSaveStrategy;
 }
Пример #2
0
 public SaveSettings(bool savesEnabled = true, AccessLevel saveAccessLevel = AccessLevel.Administrator,
     SaveStrategy saveStrategy = SaveStrategy.Acquire(), bool allowBackgroundWrite = false,
     TimeSpan saveDelay = TimeSpan.FromHours(1.0), int noIOHour = -1,
     List<TimeSpan> warningDelays = new List<TimeSpan>() { TimeSpan.FromMinutes(1.0), TimeSpan.FromSeconds(30.0) },
     bool enableEmergencyBackups = true, int emergencyBackupHour = 3,
     CompressionLevel compressionLevel = CompressionLevel.Normal)
 {
     this.m_SavesEnabled = savesEnabled;
     this.m_SaveAccessLevel = saveAccessLevel;
     this.m_SaveStrategy = saveStrategy;
     this.m_AllowBackgroundWrite = allowBackgroundWrite;
     this.m_SaveDelay = saveDelay;
     this.m_WarningDelays = warningDelays;
     this.m_NoIOHour = noIOHour;
     this.m_EnableEmergencyBackups = enableEmergencyBackups;
     this.m_EmergencyBackupHour = emergencyBackupHour;
     this.m_CompressionLevel = compressionLevel;
 }
Пример #3
0
		public SaveSettings(
			SaveStrategy saveStrategy,
			List<TimeSpan> warningDelays,
			TimeSpan saveDelay,
			bool savesEnabled = true,
			AccessLevel saveAccessLevel = AccessLevel.Administrator,
			bool allowBackgroundWrite = false,
			int noIOHour = -1,
			bool enableEmergencyBackups = true,
			int emergencyBackupHour = 3,
			CompressionLevel compressionLevel = CompressionLevel.Normal)
		{
			SavesEnabled = savesEnabled;
			SaveAccessLevel = saveAccessLevel;
			_SaveStrategy = saveStrategy;
			AllowBackgroundWrite = allowBackgroundWrite;
			SaveDelay = saveDelay;
			WarningDelays = warningDelays;
			NoIOHour = noIOHour;
			EnableEmergencyBackups = enableEmergencyBackups;
			EmergencyBackupHour = emergencyBackupHour;
			Compression = compressionLevel;
		}
Пример #4
0
        protected override sealed void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        this.m_SavesEnabled = reader.ReadBool();
                        this.m_SaveAccessLevel = (AccessLevel)reader.ReadByte();
                        this.m_SaveStrategy = Utilities.GetSaveStrategy((SaveStrategyTypes)reader.ReadByte());
                        this.m_AllowBackgroundWrite = reader.ReadBool();
                        this.m_SaveDelay = reader.ReadTimeSpan();

                        this.m_WarningDelays = new List<TimeSpan>();
                        int count = reader.ReadInt();

                        for (int i = 0; i < count; i++)
                        {
                            this.m_WarningDelays.Add(reader.ReadTimeSpan());
                        }

                        this.m_NoIOHour = reader.ReadInt();

                        this.m_EnableEmergencyBackups = reader.ReadBool();
                        this.m_EmergencyBackupHour = reader.ReadInt();
                        this.m_CompressionLevel = (CompressionLevel)reader.ReadByte();
                        break;
                    }
            }
        }
Пример #5
0
		public override void Deserialize(GenericReader reader)
		{
			int version = reader.ReadInt();

			switch (version)
			{
				case 0:
					{
						SavesEnabled = reader.ReadBool();
						SaveAccessLevel = (AccessLevel)reader.ReadByte();
						_SaveStrategy = ((SaveStrategyTypes)reader.ReadByte()).GetSaveStrategy();
						AllowBackgroundWrite = reader.ReadBool();
						SaveDelay = reader.ReadTimeSpan();
						WarningDelays = new List<TimeSpan>();

						int count = reader.ReadInt();

						for (int i = 0; i < count; i++)
						{
							WarningDelays.Add(reader.ReadTimeSpan());
						}

						NoIOHour = reader.ReadInt();

						EnableEmergencyBackups = reader.ReadBool();
						EmergencyBackupHour = reader.ReadInt();
						Compression = (CompressionLevel)reader.ReadByte();
						break;
					}
			}
		}