/// <summary> /// Saves the agent settings to the local machine. /// </summary> /// <param name="settings">The settings object to save.</param> internal static void Save(AgentSettings settings) { using (StreamWriter sw = new StreamWriter(SettingsFile)) { XmlSerializer xs = new XmlSerializer(typeof(AgentSettings)); xs.Serialize(sw, settings); } }
/// <summary> /// Saves the GhostBuster Agent settings passed to the method. /// </summary> /// <param name="settings">An Agent Settings object fully populated.</param> /// <returns>A message about success or failure.</returns> public string SetAgentSettings(AgentSettings settings) { settings.GhostCastServerExePath = settings.GhostCastServerExePath.Trim('"'); settings.GhostImageFileRootPathPrimary = settings.GhostImageFileRootPathPrimary.Trim('"'); settings.GhostImageFileRootPathSecondary = settings.GhostImageFileRootPathSecondary.Trim('"'); AgentSettings.Save(settings); string message = String.Format("GhostBuster Agent settings saved at {0}.", DateTime.Now.ToString("hh:mm:ss")); Log.Write(message); return message; }