79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
namespace ProjectScannerP4V
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main(string[] args)
|
|
{
|
|
string SettingFileName = "settings.xml";
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
string DefaultDataPath = "//Main/data/";
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
XmlNode XmlDataPath;
|
|
if (!File.Exists(SettingFileName))
|
|
{
|
|
xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", null, null));
|
|
XmlElement rootNode = xmlDoc.CreateElement("settings");
|
|
xmlDoc.AppendChild(rootNode);
|
|
XmlDataPath = xmlDoc.CreateElement("DefaultDataPath");
|
|
XmlDataPath.InnerText = DefaultDataPath;
|
|
rootNode.AppendChild(XmlDataPath);
|
|
xmlDoc.Save(SettingFileName);
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
xmlDoc.Load(SettingFileName);
|
|
XmlDataPath = xmlDoc.SelectSingleNode("/settings/DefaultDataPath");
|
|
DefaultDataPath = XmlDataPath.InnerText;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if (args[0].Equals("change"))
|
|
{
|
|
FrmChangePath frm = new FrmChangePath();
|
|
frm.DefaultDataPath = DefaultDataPath;
|
|
frm.Args = args;
|
|
Application.Run(frm);
|
|
}
|
|
else if (args[0].Equals("move"))
|
|
{
|
|
if (args.Length == 5)
|
|
{
|
|
FrmMoveFile frm = new FrmMoveFile();
|
|
frm.Args = args;
|
|
frm.DefaultDataPath = DefaultDataPath;
|
|
Application.Run(frm);
|
|
}
|
|
else
|
|
{
|
|
FrmMoveMultiplePaths frm = new FrmMoveMultiplePaths();
|
|
frm.Args = args;
|
|
frm.DefaultDataPath = DefaultDataPath;
|
|
Application.Run(frm);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|