mirror of
https://github.com/thunderspynetwork/creamsoda
synced 2026-01-16 20:04:49 -05:00
Added multiple manifest functionality.
Added the ability to change the current installation directory from the options screen. If the manifest has a Forum URL, it is now loaded in the built-in browser. Windows can now be resized. Fixed a bug where -m URL would not work if it was not the first parameter in the parameter list. Any manifest passed through -m will be added to the manifest list. Tequila now loads the built-in browser URL from the XML manifest, out of the website node.
This commit is contained in:
@@ -30,28 +30,12 @@ public class Fingerprint
|
||||
public string Checksum { get { return m_Checksum; } }
|
||||
public bool Mismatch { get { return m_mismatch; } set { m_mismatch = value; } }
|
||||
public bool Warn { get { return m_warn; } set { m_warn = Warn; } }
|
||||
|
||||
|
||||
private int URLRandomIndex = -1;
|
||||
private int URLOffset = 0;
|
||||
|
||||
public string DownloadURL {
|
||||
get {
|
||||
|
||||
if (m_DownloadURLs.Count >= 1 && URLOffset < m_DownloadURLs.Count)
|
||||
if (m_DownloadURLs.Count >= 1)
|
||||
{
|
||||
if(URLRandomIndex == -1) URLRandomIndex = rand.Next(0, m_DownloadURLs.Count);
|
||||
|
||||
|
||||
string returnURL = m_DownloadURLs[(URLRandomIndex + URLOffset) % m_DownloadURLs.Count].ToString();
|
||||
|
||||
// Increasing this offset, if we are called again, we will use this new offset
|
||||
URLOffset++;
|
||||
|
||||
|
||||
return returnURL;
|
||||
|
||||
|
||||
int randomIndex = rand.Next(0, m_DownloadURLs.Count);
|
||||
return m_DownloadURLs[randomIndex].ToString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ class MyToolkit
|
||||
/// <returns>False if we cant write to the path.</returns>
|
||||
public static bool InstallDirSafe(string path) {
|
||||
try {
|
||||
File.Move(Path.Combine(path, "icon.exe"), Path.Combine(path, "icon_rename.exe"));
|
||||
if (File.Exists(Path.Combine(path, "icon_rename.exe")))
|
||||
File.Move(Path.Combine(path, "Tequila.exe"), Path.Combine(path, "Tequila_rename.exe"));
|
||||
if (File.Exists(Path.Combine(path, "Tequila_rename.exe")))
|
||||
{
|
||||
File.Move(Path.Combine(path, "icon_rename.exe"), Path.Combine(path, "icon.exe"));
|
||||
File.Move(Path.Combine(path, "Tequila_rename.exe"), Path.Combine(path, "Tequila.exe"));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -13,18 +13,6 @@ namespace Tequila
|
||||
|
||||
public static bool SetupNeeded {
|
||||
get {
|
||||
}
|
||||
}
|
||||
|
||||
public static string MainRepo
|
||||
{
|
||||
get
|
||||
{
|
||||
return TequilaRegistry.GetValue("MainRepo", "").ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
TequilaRegistry.SetValue("MainRepo", value);
|
||||
return GamePath == "" || !File.Exists(Path.Combine(GamePath, "icon.exe"));
|
||||
}
|
||||
}
|
||||
@@ -100,19 +88,35 @@ namespace Tequila
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int DefaultProfile
|
||||
public static List<string> Manifests
|
||||
{
|
||||
get
|
||||
{
|
||||
int indx;
|
||||
bool success = int.TryParse(TequilaRegistry.GetValue("DefaultProfile", -1).ToString(), out indx);
|
||||
if (success) return indx;
|
||||
else return 0;
|
||||
char[] splitChars = {'\n'};
|
||||
return TequilaRegistry.GetValue("Manifests", "").ToString().Split(splitChars, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
|
||||
}
|
||||
set
|
||||
{
|
||||
TequilaRegistry.SetValue("DefaultProfile", value);
|
||||
string strManifests = "";
|
||||
foreach (string Manifest in value)
|
||||
{
|
||||
strManifests += Manifest.Trim() + "\n";
|
||||
}
|
||||
|
||||
if (strManifests.EndsWith("\n")) strManifests = strManifests.Substring(0, strManifests.Length - 1);
|
||||
TequilaRegistry.SetValue("Manifests", strManifests);
|
||||
}
|
||||
}
|
||||
|
||||
public static string LastManifest
|
||||
{
|
||||
get
|
||||
{
|
||||
return TequilaRegistry.GetValue("LastManifest", "").ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
TequilaRegistry.SetValue("LastManifest", value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,5 +153,6 @@ namespace Tequila
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Tequila
|
||||
|
||||
public string LocalManifest = "";
|
||||
public string PathRoot = "";
|
||||
public string ForumURL = "";
|
||||
public string ManifestURL;
|
||||
|
||||
private XElement Log;
|
||||
@@ -258,81 +259,45 @@ namespace Tequila
|
||||
|
||||
HTTP client = new HTTP();
|
||||
|
||||
bool keepTrying = true;
|
||||
string DownloadURL = file.DownloadURL;;
|
||||
if (client.StartDownload(new AsyncCompletedEventHandler(DownloadFileComplete),
|
||||
new DownloadProgressChangedEventHandler(dlProgress),
|
||||
file.DownloadURL,
|
||||
file.FullName + ".download")){
|
||||
m_Status = "Downloading";
|
||||
m_DownloadActive = true;
|
||||
}
|
||||
|
||||
while (keepTrying)
|
||||
{
|
||||
try
|
||||
m_current = file.FullName;
|
||||
|
||||
while (m_DownloadActive) {
|
||||
if (Kill)
|
||||
{
|
||||
if (client.StartDownload(new AsyncCompletedEventHandler(DownloadFileComplete),
|
||||
new DownloadProgressChangedEventHandler(dlProgress),
|
||||
DownloadURL,
|
||||
file.FullName + ".download"))
|
||||
{
|
||||
m_Status = "Downloading";
|
||||
m_DownloadActive = true;
|
||||
}
|
||||
client.CancelDownload();
|
||||
return;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}
|
||||
|
||||
string er = ex.Message;
|
||||
|
||||
}
|
||||
Fingerprint Downloaded = new Fingerprint(file.RootPath, file.FileName + ".download");
|
||||
|
||||
m_current = file.FullName;
|
||||
if (!Downloaded.Equals(file)) {
|
||||
File.Delete(file.FullName + ".download");
|
||||
string Msg = "Download error: " + file.FileName;
|
||||
|
||||
while (client.Active)
|
||||
if (Downloaded.Size != file.Size) Msg += "\r\nSize mismatch (" + Downloaded.Size + " vs " + file.Size + ")";
|
||||
if (Downloaded.Checksum != file.Checksum) Msg += "\r\nChecksum Mismatch (" + Downloaded.Checksum + " vs " + file.Checksum + ")";
|
||||
|
||||
if (file.Warn) m_ErrorLog.Add(Msg);
|
||||
else m_WarningLog.Add(Msg);
|
||||
} else {
|
||||
if (File.Exists(file.FullName))
|
||||
{
|
||||
if (Kill)
|
||||
{
|
||||
client.CancelDownload();
|
||||
return;
|
||||
}
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}
|
||||
|
||||
Fingerprint Downloaded = new Fingerprint(file.RootPath, file.FileName + ".download");
|
||||
|
||||
if (!Downloaded.Equals(file))
|
||||
{
|
||||
// OK this file is no good, delete it.
|
||||
File.Delete(file.FullName + ".download");
|
||||
|
||||
// lets try a different url...
|
||||
DownloadURL = file.DownloadURL;
|
||||
|
||||
// Did we get a blank URL?
|
||||
if (DownloadURL == "")
|
||||
{
|
||||
// OK stop trying and report error...
|
||||
keepTrying = false;
|
||||
|
||||
string Msg = "Download error: " + file.FileName;
|
||||
if (Downloaded.Size == 0) Msg += "\r\nWas unable to download file";
|
||||
else
|
||||
{
|
||||
if (Downloaded.Size != file.Size) Msg += "\r\nSize mismatch (" + Downloaded.Size + " vs " + file.Size + ")";
|
||||
if (Downloaded.Checksum != file.Checksum) Msg += "\r\nChecksum Mismatch (" + Downloaded.Checksum + " vs " + file.Checksum + ")";
|
||||
}
|
||||
if (file.Warn) m_ErrorLog.Add(Msg);
|
||||
else m_WarningLog.Add(Msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(file.FullName))
|
||||
{
|
||||
File.SetAttributes(file.FullName, File.GetAttributes(file.FullName) & ~FileAttributes.ReadOnly);
|
||||
File.Delete(file.FullName);
|
||||
}
|
||||
|
||||
// We are done, we dont need to keep trying (infinite loop if we dont set this)
|
||||
keepTrying = false;
|
||||
File.Move(file.FullName + ".download", file.FullName);
|
||||
FlagVerified(file.FullName, file.Size, file.Checksum);
|
||||
File.SetAttributes(file.FullName, File.GetAttributes(file.FullName) & ~FileAttributes.ReadOnly);
|
||||
File.Delete(file.FullName);
|
||||
}
|
||||
|
||||
File.Move(file.FullName + ".download", file.FullName);
|
||||
FlagVerified(file.FullName, file.Size, file.Checksum);
|
||||
}
|
||||
|
||||
m_Downloaded += file.Size;
|
||||
@@ -362,7 +327,7 @@ namespace Tequila
|
||||
}
|
||||
|
||||
m_Status = "Fetching manifest...";
|
||||
LocalManifest = MyToolkit.ValidPath(Path.Combine(PathRoot, "rspatcher.xml"));
|
||||
LocalManifest = MyToolkit.ValidPath(Path.Combine(PathRoot, "tequila.xml"));
|
||||
client.StartDownload(new AsyncCompletedEventHandler(ManifestDownloadComplete),
|
||||
new DownloadProgressChangedEventHandler(dlProgress),
|
||||
ManifestURL,
|
||||
@@ -403,6 +368,18 @@ namespace Tequila
|
||||
{
|
||||
m_manifest = XElement.Load(LocalManifest);
|
||||
|
||||
|
||||
// try to get the forum URL
|
||||
|
||||
IEnumerable<XElement> forumLinks = m_manifest.Descendants("webpage");
|
||||
|
||||
foreach (XElement forumLink in forumLinks)
|
||||
{
|
||||
ForumURL = forumLink.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SelfPatch();
|
||||
|
||||
m_Status = "Reading Manifest";
|
||||
|
||||
193
TequilaPC/Preferences.Designer.cs
generated
193
TequilaPC/Preferences.Designer.cs
generated
@@ -39,6 +39,19 @@
|
||||
this.btnTextColor = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btnRevalidate = new System.Windows.Forms.Button();
|
||||
this.lbManifests = new System.Windows.Forms.ListBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.btnAddManifest = new System.Windows.Forms.Button();
|
||||
this.txtNewManifest = new System.Windows.Forms.TextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.btnInstallPathBrowse = new System.Windows.Forms.Button();
|
||||
this.lblInstallPath = new System.Windows.Forms.Label();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// colorDialog1
|
||||
@@ -47,7 +60,9 @@
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(141, 137);
|
||||
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnOK.Location = new System.Drawing.Point(685, 409);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(131, 33);
|
||||
this.btnOK.TabIndex = 0;
|
||||
@@ -58,9 +73,9 @@
|
||||
// btnColor
|
||||
//
|
||||
this.btnColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
|
||||
this.btnColor.Location = new System.Drawing.Point(104, 64);
|
||||
this.btnColor.Location = new System.Drawing.Point(83, 11);
|
||||
this.btnColor.Name = "btnColor";
|
||||
this.btnColor.Size = new System.Drawing.Size(168, 23);
|
||||
this.btnColor.Size = new System.Drawing.Size(67, 23);
|
||||
this.btnColor.TabIndex = 1;
|
||||
this.btnColor.UseVisualStyleBackColor = false;
|
||||
this.btnColor.Click += new System.EventHandler(this.btnColor_Click);
|
||||
@@ -68,16 +83,16 @@
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 69);
|
||||
this.label1.Location = new System.Drawing.Point(12, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(92, 13);
|
||||
this.label1.Size = new System.Drawing.Size(65, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Background Color";
|
||||
this.label1.Text = "Background";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 15);
|
||||
this.label2.Location = new System.Drawing.Point(6, 16);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(99, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
@@ -85,16 +100,18 @@
|
||||
//
|
||||
// txtParameters
|
||||
//
|
||||
this.txtParameters.Location = new System.Drawing.Point(111, 12);
|
||||
this.txtParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtParameters.Location = new System.Drawing.Point(111, 13);
|
||||
this.txtParameters.Name = "txtParameters";
|
||||
this.txtParameters.Size = new System.Drawing.Size(161, 20);
|
||||
this.txtParameters.Size = new System.Drawing.Size(692, 20);
|
||||
this.txtParameters.TabIndex = 4;
|
||||
this.txtParameters.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
//
|
||||
// ckbQuitOnLaunch
|
||||
//
|
||||
this.ckbQuitOnLaunch.AutoSize = true;
|
||||
this.ckbQuitOnLaunch.Location = new System.Drawing.Point(9, 41);
|
||||
this.ckbQuitOnLaunch.Location = new System.Drawing.Point(9, 42);
|
||||
this.ckbQuitOnLaunch.Name = "ckbQuitOnLaunch";
|
||||
this.ckbQuitOnLaunch.Size = new System.Drawing.Size(154, 17);
|
||||
this.ckbQuitOnLaunch.TabIndex = 6;
|
||||
@@ -105,9 +122,9 @@
|
||||
// btnTextColor
|
||||
//
|
||||
this.btnTextColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
|
||||
this.btnTextColor.Location = new System.Drawing.Point(104, 93);
|
||||
this.btnTextColor.Location = new System.Drawing.Point(190, 11);
|
||||
this.btnTextColor.Name = "btnTextColor";
|
||||
this.btnTextColor.Size = new System.Drawing.Size(168, 23);
|
||||
this.btnTextColor.Size = new System.Drawing.Size(67, 23);
|
||||
this.btnTextColor.TabIndex = 7;
|
||||
this.btnTextColor.UseVisualStyleBackColor = false;
|
||||
this.btnTextColor.Click += new System.EventHandler(this.btnTextColor_Click);
|
||||
@@ -115,16 +132,17 @@
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 98);
|
||||
this.label3.Location = new System.Drawing.Point(156, 16);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(55, 13);
|
||||
this.label3.Size = new System.Drawing.Size(28, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Text Color";
|
||||
this.label3.Text = "Text";
|
||||
//
|
||||
// btnRevalidate
|
||||
//
|
||||
this.btnRevalidate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnRevalidate.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
|
||||
this.btnRevalidate.Location = new System.Drawing.Point(6, 137);
|
||||
this.btnRevalidate.Location = new System.Drawing.Point(553, 409);
|
||||
this.btnRevalidate.Name = "btnRevalidate";
|
||||
this.btnRevalidate.Size = new System.Drawing.Size(129, 33);
|
||||
this.btnRevalidate.TabIndex = 9;
|
||||
@@ -132,31 +150,145 @@
|
||||
this.btnRevalidate.UseVisualStyleBackColor = true;
|
||||
this.btnRevalidate.Click += new System.EventHandler(this.btnRevalidate_Click);
|
||||
//
|
||||
// lbManifests
|
||||
//
|
||||
this.lbManifests.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbManifests.FormattingEnabled = true;
|
||||
this.lbManifests.Location = new System.Drawing.Point(6, 46);
|
||||
this.lbManifests.Name = "lbManifests";
|
||||
this.lbManifests.Size = new System.Drawing.Size(797, 173);
|
||||
this.lbManifests.TabIndex = 10;
|
||||
this.lbManifests.KeyUp += new System.Windows.Forms.KeyEventHandler(this.lbManifests_KeyUp);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.btnAddManifest);
|
||||
this.groupBox1.Controls.Add(this.txtNewManifest);
|
||||
this.groupBox1.Controls.Add(this.lbManifests);
|
||||
this.groupBox1.Location = new System.Drawing.Point(7, 178);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(809, 225);
|
||||
this.groupBox1.TabIndex = 11;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Manifests";
|
||||
//
|
||||
// btnAddManifest
|
||||
//
|
||||
this.btnAddManifest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnAddManifest.Location = new System.Drawing.Point(753, 16);
|
||||
this.btnAddManifest.Name = "btnAddManifest";
|
||||
this.btnAddManifest.Size = new System.Drawing.Size(50, 23);
|
||||
this.btnAddManifest.TabIndex = 12;
|
||||
this.btnAddManifest.Text = "Add";
|
||||
this.btnAddManifest.UseVisualStyleBackColor = true;
|
||||
this.btnAddManifest.Click += new System.EventHandler(this.btnAddManifest_Click);
|
||||
//
|
||||
// txtNewManifest
|
||||
//
|
||||
this.txtNewManifest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtNewManifest.Location = new System.Drawing.Point(6, 18);
|
||||
this.txtNewManifest.Name = "txtNewManifest";
|
||||
this.txtNewManifest.Size = new System.Drawing.Size(741, 20);
|
||||
this.txtNewManifest.TabIndex = 11;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.btnColor);
|
||||
this.groupBox2.Controls.Add(this.label1);
|
||||
this.groupBox2.Controls.Add(this.btnTextColor);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Location = new System.Drawing.Point(7, 130);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(809, 42);
|
||||
this.groupBox2.TabIndex = 12;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Colors";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox3.Controls.Add(this.btnInstallPathBrowse);
|
||||
this.groupBox3.Controls.Add(this.lblInstallPath);
|
||||
this.groupBox3.Location = new System.Drawing.Point(9, 78);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(807, 46);
|
||||
this.groupBox3.TabIndex = 13;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Install Path";
|
||||
//
|
||||
// btnInstallPathBrowse
|
||||
//
|
||||
this.btnInstallPathBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnInstallPathBrowse.Location = new System.Drawing.Point(751, 11);
|
||||
this.btnInstallPathBrowse.Name = "btnInstallPathBrowse";
|
||||
this.btnInstallPathBrowse.Size = new System.Drawing.Size(50, 32);
|
||||
this.btnInstallPathBrowse.TabIndex = 1;
|
||||
this.btnInstallPathBrowse.Text = "Browse";
|
||||
this.btnInstallPathBrowse.UseVisualStyleBackColor = true;
|
||||
this.btnInstallPathBrowse.Click += new System.EventHandler(this.btnInstallPathBrowse_Click);
|
||||
//
|
||||
// lblInstallPath
|
||||
//
|
||||
this.lblInstallPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblInstallPath.Location = new System.Drawing.Point(6, 11);
|
||||
this.lblInstallPath.Name = "lblInstallPath";
|
||||
this.lblInstallPath.Size = new System.Drawing.Size(739, 32);
|
||||
this.lblInstallPath.TabIndex = 0;
|
||||
this.lblInstallPath.Text = "label4";
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox4.Controls.Add(this.label2);
|
||||
this.groupBox4.Controls.Add(this.txtParameters);
|
||||
this.groupBox4.Controls.Add(this.ckbQuitOnLaunch);
|
||||
this.groupBox4.Location = new System.Drawing.Point(9, 9);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(809, 63);
|
||||
this.groupBox4.TabIndex = 14;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "Settings";
|
||||
//
|
||||
// Preferences
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 182);
|
||||
this.CancelButton = this.btnOK;
|
||||
this.ClientSize = new System.Drawing.Size(821, 449);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.btnRevalidate);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.btnTextColor);
|
||||
this.Controls.Add(this.ckbQuitOnLaunch);
|
||||
this.Controls.Add(this.txtParameters);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnColor);
|
||||
this.Controls.Add(this.btnOK);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(291, 384);
|
||||
this.Name = "Preferences";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Preferences";
|
||||
this.Load += new System.EventHandler(this.Preferences_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -172,5 +304,14 @@
|
||||
private System.Windows.Forms.Button btnTextColor;
|
||||
private System.Windows.Forms.Label label3;
|
||||
public System.Windows.Forms.Button btnRevalidate;
|
||||
private System.Windows.Forms.ListBox lbManifests;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Button btnAddManifest;
|
||||
private System.Windows.Forms.TextBox txtNewManifest;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Button btnInstallPathBrowse;
|
||||
private System.Windows.Forms.Label lblInstallPath;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,16 @@ namespace Tequila
|
||||
public Preferences()
|
||||
{
|
||||
InitializeComponent();
|
||||
lblInstallPath.Text = Settings.GamePath;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lbManifests.Text != Settings.LastManifest)
|
||||
{
|
||||
Settings.LastManifest = lbManifests.Text;
|
||||
ReValidate = true;
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -57,6 +63,18 @@ namespace Tequila
|
||||
txtParameters.Text = Settings.GameParams;
|
||||
btnColor.BackColor = Settings.BGColor;
|
||||
btnTextColor.BackColor = Settings.TextColor;
|
||||
|
||||
List<string> Manifests = Settings.Manifests;
|
||||
lbManifests.DataSource = Manifests;
|
||||
|
||||
// Attempt to re-select the last used manifest //
|
||||
try {
|
||||
for (int i = 0; i < Manifests.Count; i++) {
|
||||
if (Manifests[i] == Settings.LastManifest) {
|
||||
lbManifests.SelectedIndex = i;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
private void btnRevalidate_Click(object sender, EventArgs e)
|
||||
@@ -65,5 +83,81 @@ namespace Tequila
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnInstallPathBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
string myPath = "";
|
||||
bool PathValid = false;
|
||||
FolderBrowserDialog FileBox;
|
||||
|
||||
do
|
||||
{
|
||||
FileBox = new FolderBrowserDialog();
|
||||
|
||||
FileBox.Description = "Select a location where you would like to install Tequila; preferably under My Documents or Application Data. Do not use a folder under Program Files unless you have Windows User Account Control disabled.";
|
||||
FileBox.SelectedPath = Settings.GamePath;
|
||||
|
||||
if (FileBox.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myPath = FileBox.SelectedPath;
|
||||
PathValid = true;
|
||||
|
||||
} while (!PathValid);
|
||||
|
||||
Settings.GamePath = myPath;
|
||||
}
|
||||
|
||||
private void btnAddManifest_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<string> Manifests = (List<string>)lbManifests.DataSource;
|
||||
|
||||
// Make sure this is not a duplicate manifest //
|
||||
foreach (string manifest in Manifests) {
|
||||
if (manifest.Equals(txtNewManifest.Text.Trim(),StringComparison.CurrentCultureIgnoreCase)) {
|
||||
txtNewManifest.Text = "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Not a dup? keep going //
|
||||
Manifests.Add(txtNewManifest.Text);
|
||||
Settings.Manifests = Manifests;
|
||||
lbManifests.DataSource = Settings.Manifests;
|
||||
txtNewManifest.Text = "";
|
||||
|
||||
// Attempt to re-select the last used manifest //
|
||||
try {
|
||||
for (int i = 0; i < Manifests.Count; i++) {
|
||||
if (Manifests[i] == Settings.LastManifest) {
|
||||
lbManifests.SelectedIndex = i;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) { }
|
||||
}
|
||||
|
||||
private void DeleteSelectedManifest()
|
||||
{
|
||||
List<string> Manifests = (List<string>)lbManifests.DataSource;
|
||||
int SelectedIndex = lbManifests.SelectedIndex;
|
||||
Manifests.RemoveAt(lbManifests.SelectedIndex);
|
||||
Settings.Manifests = Manifests;
|
||||
lbManifests.DataSource = Settings.Manifests;
|
||||
try {
|
||||
lbManifests.SelectedIndex = SelectedIndex - 1;
|
||||
} catch (Exception ex){
|
||||
lbManifests.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void lbManifests_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Delete)
|
||||
{
|
||||
DeleteSelectedManifest();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.13")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.13")]
|
||||
[assembly: AssemblyVersion("1.0.0.14")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.14")]
|
||||
|
||||
57
TequilaPC/Tequila.Designer.cs
generated
57
TequilaPC/Tequila.Designer.cs
generated
@@ -41,6 +41,8 @@
|
||||
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
|
||||
this.btnScreenshots = new System.Windows.Forms.Button();
|
||||
this.btnOptions = new System.Windows.Forms.Button();
|
||||
this.cbManifest = new System.Windows.Forms.ComboBox();
|
||||
this.lblManifest = new System.Windows.Forms.Label();
|
||||
this.pnlErrors.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -51,9 +53,9 @@
|
||||
this.lblStatus.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
|
||||
this.lblStatus.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lblStatus.Location = new System.Drawing.Point(12, 423);
|
||||
this.lblStatus.Location = new System.Drawing.Point(12, 421);
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(806, 23);
|
||||
this.lblStatus.Size = new System.Drawing.Size(794, 23);
|
||||
this.lblStatus.TabIndex = 0;
|
||||
this.lblStatus.Text = "test";
|
||||
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
@@ -62,9 +64,9 @@
|
||||
//
|
||||
this.Progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Progress.Location = new System.Drawing.Point(12, 391);
|
||||
this.Progress.Location = new System.Drawing.Point(12, 395);
|
||||
this.Progress.Name = "Progress";
|
||||
this.Progress.Size = new System.Drawing.Size(806, 23);
|
||||
this.Progress.Size = new System.Drawing.Size(794, 23);
|
||||
this.Progress.TabIndex = 1;
|
||||
//
|
||||
// txtErrors
|
||||
@@ -75,7 +77,7 @@
|
||||
this.txtErrors.Location = new System.Drawing.Point(3, 35);
|
||||
this.txtErrors.Multiline = true;
|
||||
this.txtErrors.Name = "txtErrors";
|
||||
this.txtErrors.Size = new System.Drawing.Size(556, 335);
|
||||
this.txtErrors.Size = new System.Drawing.Size(547, 339);
|
||||
this.txtErrors.TabIndex = 2;
|
||||
//
|
||||
// pnlErrors
|
||||
@@ -88,7 +90,7 @@
|
||||
this.pnlErrors.Controls.Add(this.txtErrors);
|
||||
this.pnlErrors.Location = new System.Drawing.Point(256, 12);
|
||||
this.pnlErrors.Name = "pnlErrors";
|
||||
this.pnlErrors.Size = new System.Drawing.Size(562, 373);
|
||||
this.pnlErrors.Size = new System.Drawing.Size(566, 377);
|
||||
this.pnlErrors.TabIndex = 3;
|
||||
this.pnlErrors.Visible = false;
|
||||
//
|
||||
@@ -108,7 +110,7 @@
|
||||
this.btnPlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnPlay.Enabled = false;
|
||||
this.btnPlay.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
|
||||
this.btnPlay.Location = new System.Drawing.Point(12, 301);
|
||||
this.btnPlay.Location = new System.Drawing.Point(12, 305);
|
||||
this.btnPlay.Name = "btnPlay";
|
||||
this.btnPlay.Size = new System.Drawing.Size(238, 41);
|
||||
this.btnPlay.TabIndex = 4;
|
||||
@@ -128,9 +130,8 @@
|
||||
this.listBox1.ItemHeight = 25;
|
||||
this.listBox1.Location = new System.Drawing.Point(12, 15);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(238, 275);
|
||||
this.listBox1.Size = new System.Drawing.Size(238, 225);
|
||||
this.listBox1.TabIndex = 5;
|
||||
this.listBox1.DoubleClick += new System.EventHandler(this.btnPlay_Click);
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
@@ -145,12 +146,13 @@
|
||||
this.webBrowser1.Location = new System.Drawing.Point(259, 15);
|
||||
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
|
||||
this.webBrowser1.Name = "webBrowser1";
|
||||
this.webBrowser1.Size = new System.Drawing.Size(559, 370);
|
||||
this.webBrowser1.Size = new System.Drawing.Size(547, 374);
|
||||
this.webBrowser1.TabIndex = 6;
|
||||
this.webBrowser1.Url = new System.Uri("http://github.com/leandrotlz/Tequila", System.UriKind.Absolute);
|
||||
this.webBrowser1.Url = new System.Uri("", System.UriKind.Relative);
|
||||
//
|
||||
// btnScreenshots
|
||||
//
|
||||
this.btnScreenshots.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnScreenshots.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
|
||||
this.btnScreenshots.Location = new System.Drawing.Point(12, 348);
|
||||
this.btnScreenshots.Name = "btnScreenshots";
|
||||
@@ -162,6 +164,7 @@
|
||||
//
|
||||
// btnOptions
|
||||
//
|
||||
this.btnOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnOptions.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
|
||||
this.btnOptions.Location = new System.Drawing.Point(132, 348);
|
||||
this.btnOptions.Name = "btnOptions";
|
||||
@@ -171,12 +174,37 @@
|
||||
this.btnOptions.UseVisualStyleBackColor = true;
|
||||
this.btnOptions.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// cbManifest
|
||||
//
|
||||
this.cbManifest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.cbManifest.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbManifest.FormattingEnabled = true;
|
||||
this.cbManifest.Location = new System.Drawing.Point(12, 271);
|
||||
this.cbManifest.Name = "cbManifest";
|
||||
this.cbManifest.Size = new System.Drawing.Size(238, 21);
|
||||
this.cbManifest.TabIndex = 10;
|
||||
this.cbManifest.SelectedIndexChanged += new System.EventHandler(this.cbManifest_SelectedIndexChanged);
|
||||
//
|
||||
// lblManifest
|
||||
//
|
||||
this.lblManifest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblManifest.AutoSize = true;
|
||||
this.lblManifest.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.lblManifest.ForeColor = System.Drawing.Color.White;
|
||||
this.lblManifest.Location = new System.Drawing.Point(7, 243);
|
||||
this.lblManifest.Name = "lblManifest";
|
||||
this.lblManifest.Size = new System.Drawing.Size(160, 25);
|
||||
this.lblManifest.TabIndex = 11;
|
||||
this.lblManifest.Text = "Active Manifest";
|
||||
//
|
||||
// Tequila
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(94)))), ((int)(((byte)(112)))));
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ClientSize = new System.Drawing.Size(824, 455);
|
||||
this.ClientSize = new System.Drawing.Size(818, 448);
|
||||
this.Controls.Add(this.lblManifest);
|
||||
this.Controls.Add(this.cbManifest);
|
||||
this.Controls.Add(this.btnOptions);
|
||||
this.Controls.Add(this.btnScreenshots);
|
||||
this.Controls.Add(this.btnPlay);
|
||||
@@ -186,9 +214,7 @@
|
||||
this.Controls.Add(this.Progress);
|
||||
this.Controls.Add(this.lblStatus);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximumSize = new System.Drawing.Size(834, 487);
|
||||
this.MinimumSize = new System.Drawing.Size(834, 487);
|
||||
this.Name = "Tequila";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
@@ -198,6 +224,7 @@
|
||||
this.pnlErrors.ResumeLayout(false);
|
||||
this.pnlErrors.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -214,6 +241,8 @@
|
||||
private System.Windows.Forms.WebBrowser webBrowser1;
|
||||
private System.Windows.Forms.Button btnScreenshots;
|
||||
private System.Windows.Forms.Button btnOptions;
|
||||
private System.Windows.Forms.ComboBox cbManifest;
|
||||
private System.Windows.Forms.Label lblManifest;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Tequila
|
||||
private bool NoMove = false;
|
||||
private bool DevMode = false;
|
||||
|
||||
string ManifestURL = "http://dl.dropboxusercontent.com/u/37952257/Tequila/titanicon.xml";
|
||||
string ManifestURL = "";
|
||||
|
||||
public Tequila()
|
||||
{
|
||||
@@ -43,8 +43,8 @@ namespace Tequila
|
||||
do {
|
||||
FileBox = new FolderBrowserDialog();
|
||||
|
||||
FileBox.Description = "Select the game directory";
|
||||
FileBox.SelectedPath = @"C:\Program Files (x86)\CohBeta";
|
||||
FileBox.Description = "Select a location where you would like to install Tequila; preferably under My Documents or Application Data. Do not use a folder under Program Files unless you have Windows User Account Control disabled.";
|
||||
FileBox.SelectedPath = Application.StartupPath;
|
||||
|
||||
if (FileBox.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel) {
|
||||
MessageBox.Show("You must select a valid install directory to continue. \nLauncher will now quit. Relaunch the laucher once you have a valid installation path.");
|
||||
@@ -52,49 +52,21 @@ namespace Tequila
|
||||
return false;
|
||||
}
|
||||
|
||||
myPath = FileBox.SelectedPath; // FileName.Substring(0, FileBox.FileName.LastIndexOf("\\") + 1);
|
||||
myPath = FileBox.SelectedPath;
|
||||
PathValid = true;
|
||||
|
||||
if (File.Exists(Path.Combine(myPath, "icon.exe")))
|
||||
{
|
||||
PathValid = true;
|
||||
} else {
|
||||
PathValid = false;
|
||||
MessageBox.Show("The selected directory does not contain a full game installation.\r\nPlease make sure you select a directory that is not missing any files.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
} while (!PathValid);
|
||||
|
||||
if (!MyToolkit.InstallDirSafe(myPath)) {
|
||||
string warning = "The game files will be copied to AppData\\TitanIcon; click OK to continue, Cancel to relocate the folder yourself and relaunch Tequila";
|
||||
if (MessageBox.Show(warning, "test", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel) {
|
||||
Application.Exit();
|
||||
return false;
|
||||
}
|
||||
|
||||
string DestPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
DestPath = Path.Combine(DestPath, "TitanIcon");
|
||||
|
||||
myCopyObj = new DirCopy(myPath, DestPath);
|
||||
myPath = DestPath;
|
||||
myCopyDirThread = new Thread(new ThreadStart(myCopyObj.DirectoryCopy));
|
||||
myCopyDirThread.Start();
|
||||
}
|
||||
|
||||
Settings.GamePath = myPath;
|
||||
}
|
||||
|
||||
SelfRelocate();
|
||||
ConsolidateVirtualStore();
|
||||
|
||||
|
||||
Settings.MainRepo = ManifestURL;
|
||||
|
||||
return true;
|
||||
|
||||
} catch (Exception ex) {
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".Setup");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SelfRelocate() {
|
||||
@@ -167,10 +139,13 @@ namespace Tequila
|
||||
BackColor = Settings.BGColor;
|
||||
label1.ForeColor = Settings.TextColor;
|
||||
lblStatus.ForeColor = Settings.TextColor;
|
||||
lblManifest.ForeColor = Settings.TextColor;
|
||||
lblManifest.BackColor = Settings.BGColor;
|
||||
listBox1.BackColor = Settings.BGColor;
|
||||
listBox1.ForeColor = Settings.TextColor;
|
||||
}
|
||||
|
||||
|
||||
private void ScanParameters() {
|
||||
for (int i = 0; i < MyToolkit.args.Length; i++)
|
||||
{
|
||||
@@ -215,7 +190,31 @@ namespace Tequila
|
||||
}
|
||||
else
|
||||
{
|
||||
ManifestURL = MyToolkit.args[1];
|
||||
ManifestURL = MyToolkit.args[i + 1];
|
||||
|
||||
// Get a list of currently registered manifests //
|
||||
List<string> Manifests = Settings.Manifests;
|
||||
|
||||
// Find out if this manifest is already in the list //
|
||||
bool ManifestExists = false;
|
||||
foreach (string Manifest in Manifests)
|
||||
{
|
||||
if (Manifest.Equals(ManifestURL, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
ManifestExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If manifest is not in the list, add it //
|
||||
if (!ManifestExists) {
|
||||
Manifests.Add(ManifestURL);
|
||||
Settings.Manifests = Manifests;
|
||||
}
|
||||
|
||||
// Make this the default manifest //
|
||||
Settings.LastManifest = ManifestURL;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,31 +249,71 @@ namespace Tequila
|
||||
} catch (Exception ex) { }
|
||||
}
|
||||
|
||||
|
||||
protected bool loaded = false;
|
||||
private void Form_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Attempt to kill any other version of the patcher //
|
||||
// that may be running //
|
||||
ProcessKiller();
|
||||
|
||||
|
||||
|
||||
this.Text += " " + Application.ProductVersion;
|
||||
Skin();
|
||||
|
||||
ScanParameters();
|
||||
|
||||
LoadManifestList();
|
||||
|
||||
timer1.Enabled = Setup();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".Form_Load");
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void LoadManifestList() {
|
||||
loaded = false;
|
||||
// Load the list of stored manifests //
|
||||
List<string> Manifests = Settings.Manifests;
|
||||
|
||||
if (Manifests.Count == 0) {
|
||||
Manifests.Add("http://dl.dropboxusercontent.com/u/37952257/Tequila/titanicon.xml");
|
||||
Settings.Manifests = Manifests;
|
||||
}
|
||||
|
||||
cbManifest.DataSource = Manifests;
|
||||
ManifestURL = Manifests[0];
|
||||
|
||||
// Attempt to re-select the last used manifest //
|
||||
for (int i = 0; i < Manifests.Count; i++)
|
||||
{
|
||||
if (Manifests[i] == Settings.LastManifest)
|
||||
{
|
||||
cbManifest.SelectedIndex = i;
|
||||
ManifestURL = Settings.LastManifest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
private void StartUp() {
|
||||
try
|
||||
{
|
||||
string PathRoot = Settings.GamePath;
|
||||
string LocalManifest = PathRoot + @"rspatcher.xml";
|
||||
string LocalManifest = PathRoot + @"tequila.xml";
|
||||
|
||||
btnPlay.Text = "...";
|
||||
btnPlay.Enabled = false;
|
||||
cbManifest.Enabled = false;
|
||||
|
||||
myWorker = new WorkThread(ManifestURL);
|
||||
myWorker.LocalManifest = LocalManifest;
|
||||
@@ -297,13 +336,15 @@ namespace Tequila
|
||||
pnlErrors.Visible = true;
|
||||
} else {
|
||||
btnPlay.Enabled = true;
|
||||
btnPlay.Text = "Play";
|
||||
cbManifest.Enabled = true;
|
||||
btnPlay.Text = "Play";
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".Finish");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -323,8 +364,14 @@ namespace Tequila
|
||||
return;
|
||||
}
|
||||
|
||||
if (myWorker.ForumURL != "" && myWorker.ForumURL != webBrowser1.Url.AbsoluteUri && !webBrowser1.IsBusy)
|
||||
{
|
||||
webBrowser1.Navigate(myWorker.ForumURL);
|
||||
}
|
||||
|
||||
if (myWorker.Manifest != null)
|
||||
|
||||
|
||||
if (listBox1.Items.Count <= 1)
|
||||
{
|
||||
IEnumerable<XElement> Profiles = myWorker.Manifest.Descendants("launch");
|
||||
@@ -350,16 +397,7 @@ namespace Tequila
|
||||
|
||||
listBox1.DisplayMember = "Text";
|
||||
listBox1.DataSource = items;
|
||||
|
||||
try
|
||||
{
|
||||
int i = Settings.DefaultProfile;
|
||||
if (i < listBox1.Items.Count && i >= 0) listBox1.SelectedIndex = i;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
listBox1.SelectedIndex = 0;
|
||||
}
|
||||
listBox1.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
Progress.Value = MyToolkit.MinMax(myWorker.CurProgress, 0, 100);
|
||||
@@ -380,12 +418,9 @@ namespace Tequila
|
||||
startInfo.Arguments = ((LaunchProfile)listBox1.SelectedItem).Params;
|
||||
startInfo.Arguments += " " + Settings.GameParams;
|
||||
|
||||
Settings.DefaultProfile = listBox1.SelectedIndex;
|
||||
|
||||
Process.Start(startInfo);
|
||||
if (Settings.QuitOnLaunch) Application.Exit();
|
||||
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".btnPlay_Click");
|
||||
}
|
||||
@@ -420,18 +455,30 @@ namespace Tequila
|
||||
prefs.ShowDialog(this);
|
||||
Skin();
|
||||
|
||||
if (prefs.ReValidate)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(Path.Combine(Settings.GamePath, "tequilalog.xml"));
|
||||
timer1.Enabled = Setup();
|
||||
StartUp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".Form_Load");
|
||||
}
|
||||
LoadManifestList();
|
||||
|
||||
if (prefs.ReValidate) {
|
||||
ReValidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReValidate() {
|
||||
try {
|
||||
listBox1.DataSource = null;
|
||||
File.Delete(Path.Combine(Settings.GamePath, "tequilalog.xml"));
|
||||
timer1.Enabled = Setup();
|
||||
StartUp();
|
||||
} catch (Exception ex) {
|
||||
MyToolkit.ErrorReporter(ex, this.Name + ".Form_Load");
|
||||
}
|
||||
}
|
||||
|
||||
private void cbManifest_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (loaded) {
|
||||
Settings.LastManifest = cbManifest.SelectedItem.ToString();
|
||||
ManifestURL = Settings.LastManifest;
|
||||
ReValidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user