mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 03:58:45 +08:00
@@ -20,47 +20,59 @@ namespace mRemoteNG.Config.Settings
|
||||
|
||||
public void LoadExternalAppsFromXML()
|
||||
{
|
||||
var oldPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GeneralAppInfo.ProductName + "\\" + SettingsFileInfo.ExtAppsFilesName;
|
||||
var newPath = SettingsFileInfo.SettingsPath + "\\" + SettingsFileInfo.ExtAppsFilesName;
|
||||
#if !PORTABLE
|
||||
var oldPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GeneralAppInfo.ProductName, SettingsFileInfo.ExtAppsFilesName);
|
||||
#endif
|
||||
var newPath = Path.Combine(SettingsFileInfo.SettingsPath, SettingsFileInfo.ExtAppsFilesName);
|
||||
var xDom = new XmlDocument();
|
||||
if (File.Exists(newPath))
|
||||
{
|
||||
// TODO: Log message here
|
||||
xDom.Load(newPath);
|
||||
}
|
||||
#if !PORTABLE
|
||||
}
|
||||
else if (File.Exists(oldPath))
|
||||
{
|
||||
xDom.Load(oldPath);
|
||||
// TODO: Log message here
|
||||
xDom.Load(oldPath);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Log message here
|
||||
return;
|
||||
}
|
||||
|
||||
if (xDom.DocumentElement != null)
|
||||
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
|
||||
if (xDom.DocumentElement == null)
|
||||
{
|
||||
// TODO: Log message here
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes)
|
||||
{
|
||||
var extA = new ExternalTool
|
||||
{
|
||||
var extA = new ExternalTool
|
||||
{
|
||||
DisplayName = xEl.Attributes["DisplayName"].Value,
|
||||
FileName = xEl.Attributes["FileName"].Value,
|
||||
Arguments = xEl.Attributes["Arguments"].Value
|
||||
};
|
||||
DisplayName = xEl.Attributes["DisplayName"].Value,
|
||||
FileName = xEl.Attributes["FileName"].Value,
|
||||
Arguments = xEl.Attributes["Arguments"].Value
|
||||
};
|
||||
|
||||
if (xEl.HasAttribute("WaitForExit"))
|
||||
{
|
||||
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
|
||||
}
|
||||
|
||||
if (xEl.HasAttribute("TryToIntegrate"))
|
||||
{
|
||||
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
|
||||
}
|
||||
|
||||
Runtime.ExternalTools.Add(extA);
|
||||
if (xEl.HasAttribute("WaitForExit"))
|
||||
{
|
||||
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);
|
||||
}
|
||||
|
||||
if (xEl.HasAttribute("TryToIntegrate"))
|
||||
{
|
||||
extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value);
|
||||
}
|
||||
|
||||
// TODO: Log message here
|
||||
Runtime.ExternalTools.Add(extA);
|
||||
}
|
||||
|
||||
_MainForm.SwitchToolBarText(Convert.ToBoolean(mRemoteNG.Settings.Default.ExtAppsTBShowText));
|
||||
|
||||
frmMain.Default.AddExternalToolsToToolBar();
|
||||
|
||||
Reference in New Issue
Block a user