mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-17 00:31:42 +02:00
Configuration
Arguments.cs
LockManager.cs
SystemConfig.cs
UserConfig.cs
Core
Data
Plugins
Properties
Resources
Updates
bld
lib
subprocess
video
.gitattributes
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
packages.config
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using TweetDuck.Core;
|
|
using TweetDuck.Data.Serialization;
|
|
|
|
namespace TweetDuck.Configuration{
|
|
sealed class SystemConfig{
|
|
private static readonly FileSerializer<SystemConfig> Serializer = new FileSerializer<SystemConfig>();
|
|
|
|
// CONFIGURATION DATA
|
|
|
|
public bool HardwareAcceleration { get; set; } = true;
|
|
|
|
public bool ClearCacheAutomatically { get; set; } = true;
|
|
public int ClearCacheThreshold { get; set; } = 250;
|
|
|
|
public FormBrowser.ThrottleBehavior ThrottleBehavior { get; set; } = FormBrowser.ThrottleBehavior.Covered;
|
|
|
|
// END OF CONFIG
|
|
|
|
private readonly string file;
|
|
|
|
private SystemConfig(string file){
|
|
this.file = file;
|
|
}
|
|
|
|
public void Save(){
|
|
try{
|
|
Serializer.Write(file, this);
|
|
}catch(Exception e){
|
|
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
|
}
|
|
}
|
|
|
|
public static SystemConfig Load(string file){
|
|
SystemConfig config = new SystemConfig(file);
|
|
|
|
try{
|
|
Serializer.ReadIfExists(file, config);
|
|
}catch(Exception e){
|
|
Program.Reporter.HandleException("Configuration Error", "Could not open the system configuration file. If you continue, you will lose system specific configuration such as Hardware Acceleration.", true, e);
|
|
}
|
|
|
|
return config;
|
|
}
|
|
}
|
|
}
|