private Settings LoadSettings() { try { var json = FileIO.ReadFile(REALTIVE_SETTINGS_PATH, true) .Replace("/", "\\"); //.Replace("\r\n", ""); //.Replace("\\\"", "\""); Settings set = StaticSerializer.Deserialize <Settings>(json); return(set); } catch (Exception e) { Console.WriteLine("Loading " + REALTIVE_SETTINGS_PATH + " failed! Default settings has been loaded. >> " + e.StackTrace); settings = new Settings() { RestApiPort = DEFAULT_UI_REST_PORT, UIHomePath = DEFAULT_UI_INDEX_PATH.Replace("/", "\\"), UIRelJavascriptPath = "ui/resource/app".Replace("/", "\\"), DefaultOutputIp = "0.0.0.0", ArtNetBindIp = "0.0.0.0", ArtNetBroadcastIp = "255.255.255.255", ArtNetPollReplyBindIp = "0.0.0.0", CurrentProject = "default", CloseHash = "-2342-", Password = "******", AutoSave = 0 }; Save(); return(settings); } }
public void Save() { FileIO.WriteFile(REALTIVE_SETTINGS_PATH, true, StaticSerializer.Serialize(settings)); }
public static void StoreTemplate(FixtureTemplate f) { var path = FIXTURE_TEMPLATE_PATH + f.Name + ".json"; FileIO.WriteFile(FIXTURE_TEMPLATE_PATH + FormatNameForWritting(f.Name) + ".json", true, StaticSerializer.Serialize(f)); }