176 lines
5.5 KiB
C#
176 lines
5.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms.Design;
|
|
using System.Xml.Serialization;
|
|
using System.Xml;
|
|
using System.IO;
|
|
|
|
namespace ITFInstaller
|
|
{
|
|
|
|
public class Settings
|
|
{
|
|
public Settings()
|
|
{
|
|
makeDestinationDataPath();
|
|
}
|
|
|
|
[EditorAttribute(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
|
public string ExePath
|
|
{
|
|
get { return m_ExePath; }
|
|
set { m_ExePath = value; }
|
|
}
|
|
|
|
[EditorAttribute(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
|
public string DataPath
|
|
{
|
|
get { return m_DataPath; }
|
|
set { m_DataPath = value; makeDestinationDataPath(); }
|
|
}
|
|
|
|
[EditorAttribute(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
|
public string CoreConfigPath
|
|
{
|
|
get { return m_CoreConfigPath; }
|
|
set { m_CoreConfigPath = value; }
|
|
}
|
|
|
|
public String RootDestination
|
|
{
|
|
get { return m_RootDestination; }
|
|
set { m_RootDestination = value; makeRootStart(); }
|
|
}
|
|
|
|
public bool RemoteExe
|
|
{
|
|
get { return m_RemoteExe; }
|
|
set { m_RemoteExe = value; }
|
|
}
|
|
|
|
public int Version
|
|
{
|
|
get { return m_Version; }
|
|
set { m_Version = value; }
|
|
}
|
|
|
|
//default path
|
|
protected String m_ExePath = @"X:\_TOOLS_ENGINE_\UA_Bin";
|
|
protected String m_DataPath = @"X:\_RAYMAN_ORIGINS_";
|
|
protected String m_CoreConfigPath = @"X:\_TOOLS_ENGINE_\UA_Bin\coreConfig";
|
|
protected String m_RootDestination;
|
|
protected bool m_RemoteExe;
|
|
protected bool m_RunCook;
|
|
protected bool m_UsePack = false;
|
|
protected int m_Version;
|
|
protected string m_ConsoleIP = "";
|
|
protected string m_DestinationConsoleDataPath = "";
|
|
protected string m_RootStart = "";
|
|
readonly protected string m_TechnoName = "technowithtools";
|
|
|
|
public string RootStart
|
|
{
|
|
get { return m_RootStart; }
|
|
}
|
|
|
|
public string TechnoName
|
|
{
|
|
get { return m_TechnoName; }
|
|
}
|
|
|
|
public bool RunCook
|
|
{
|
|
set { m_RunCook = value; }
|
|
get { return m_RunCook; }
|
|
}
|
|
|
|
public string ConsoleIP
|
|
{
|
|
set { m_ConsoleIP = value; }
|
|
get { return m_ConsoleIP; }
|
|
}
|
|
|
|
public void makeRootStart()
|
|
{
|
|
m_RootStart = RootDestination + @"\" + m_TechnoName;
|
|
}
|
|
|
|
public void makeDestinationDataPath()
|
|
{
|
|
m_DestinationConsoleDataPath = m_DataPath.Replace(Path.GetDirectoryName(m_DataPath),"");
|
|
}
|
|
|
|
public string DestinationConsoleDataPath
|
|
{
|
|
get { return m_DestinationConsoleDataPath; }
|
|
}
|
|
|
|
public bool UsePack
|
|
{
|
|
set { m_UsePack = value; }
|
|
get { return m_UsePack; }
|
|
}
|
|
|
|
public void save(string filePath)
|
|
{
|
|
|
|
XmlTextWriter filexml = new XmlTextWriter(filePath, null);
|
|
filexml.Formatting = Formatting.Indented;
|
|
filexml.WriteStartDocument(true);
|
|
filexml.WriteStartElement("root");
|
|
filexml.WriteStartElement("Settings");
|
|
filexml.WriteAttributeString("ExePath", m_ExePath);
|
|
filexml.WriteAttributeString("DataPath", m_DataPath);
|
|
filexml.WriteAttributeString("CoreConfigPath", m_CoreConfigPath);
|
|
filexml.WriteAttributeString("RootDestination", m_RootDestination);
|
|
filexml.WriteAttributeString("RemoteExe", m_RemoteExe.ToString());
|
|
filexml.WriteAttributeString("Version", m_Version.ToString());
|
|
filexml.WriteAttributeString("RunCook", RunCook.ToString());
|
|
filexml.WriteAttributeString("ConsoleIP", m_ConsoleIP.ToString());
|
|
filexml.WriteAttributeString("UsePack", UsePack.ToString());
|
|
filexml.WriteEndElement();
|
|
filexml.WriteEndDocument();
|
|
filexml.Close();
|
|
}
|
|
|
|
public void load(string filePath)
|
|
{
|
|
if (File.Exists(filePath))
|
|
{
|
|
|
|
|
|
XmlTextReader filexml = new XmlTextReader(filePath);
|
|
filexml.WhitespaceHandling = WhitespaceHandling.None;
|
|
|
|
while (filexml.Read())
|
|
{
|
|
|
|
if (filexml.LocalName == "Settings")
|
|
{
|
|
ExePath = filexml.GetAttribute("ExePath");
|
|
DataPath = filexml.GetAttribute("DataPath");
|
|
CoreConfigPath = filexml.GetAttribute("CoreConfigPath");
|
|
RootDestination = filexml.GetAttribute("RootDestination");
|
|
ConsoleIP = filexml.GetAttribute("ConsoleIP");
|
|
RunCook = bool.Parse(filexml.GetAttribute("RunCook"));
|
|
RemoteExe = bool.Parse(filexml.GetAttribute("RemoteExe"));
|
|
Version = int.Parse(filexml.GetAttribute("Version"));
|
|
|
|
string attr = filexml.GetAttribute("UsePack");
|
|
if (attr != null)
|
|
UsePack = bool.Parse(attr);
|
|
}
|
|
}
|
|
|
|
filexml.Close();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|