コード例 #1
0
        public RconServerManager()
        {
            instance = this;
            servers  = new RconServerCollection();

            rconDataFilePath = Path.Combine(Application.UserAppDataPath, "RconServers.json");
        }
コード例 #2
0
        public void Save()
        {
            string data = JsonConvert.SerializeObject(servers);

            File.WriteAllText(rconDataFilePath, data);
            previouslySavedServers = servers;
            unsavedChanges         = false;
        }
コード例 #3
0
        public void Load()
        {
            if (!File.Exists(rconDataFilePath))
            {
                //Test();
                return;
            }

            string data = File.ReadAllText(rconDataFilePath);

            RconServer[] rconServers = JsonConvert.DeserializeObject <RconServer[]>(data);
            servers.AddRange(rconServers);
            previouslySavedServers = servers;
        }
コード例 #4
0
 public void RevertUnsavedChanges()
 {
     servers = previouslySavedServers;
 }