Files
Sourcetrail/deployment/windows/CoatiSetup/SetupApplicationSettingsLib/SetupApplicationSettings.cs
T
Manuel Dobusch 04196db81d ui: windows installer
Created a windows installer (vs deployment project).
2015-12-02 14:50:02 +01:00

46 lines
1.6 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
namespace SetupApplicationSettingsLib
{
[RunInstaller(true)]
public partial class SetupApplicationSettings : System.Configuration.Install.Installer
{
public SetupApplicationSettings()
{
InitializeComponent();
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
string appDataCoatiPath = Environment.GetEnvironmentVariable("APPDATA") + "\\..\\local\\Coati Software\\Coati\\";
string appSettingsPath = appDataCoatiPath + "ApplicationSettings.xml";
string projectsPath = appDataCoatiPath + "projects\\";
XmlDocument appSettings = new XmlDocument();
appSettings.Load(@appSettingsPath);
XmlNode recentProjects = appSettings.SelectSingleNode("config/user/recent_projects");
recentProjects.RemoveAll();
XmlNode tutorial = appSettings.CreateElement("recent_project");
tutorial.InnerText = projectsPath + "tutorial\\tutorial.coatiproject";
recentProjects.AppendChild(tutorial);
XmlNode tictactoe = appSettings.CreateElement("recent_project");
tictactoe.InnerText = projectsPath + "tictactoe\\tictactoe.coatiproject";
recentProjects.AppendChild(tictactoe);
appSettings.Save(appSettingsPath);
}
}
}