diff --git a/AlotAddOnGUI/AlotAddOnGUI.csproj b/AlotAddOnGUI/AlotAddOnGUI.csproj
index 2341e28f..6d99d806 100644
--- a/AlotAddOnGUI/AlotAddOnGUI.csproj
+++ b/AlotAddOnGUI/AlotAddOnGUI.csproj
@@ -160,7 +160,7 @@
PreserveNewest
- PreserveNewest
+ Always
diff --git a/AlotAddOnGUI/MainWindow.xaml.cs b/AlotAddOnGUI/MainWindow.xaml.cs
index 94f3493a..b92b13d8 100644
--- a/AlotAddOnGUI/MainWindow.xaml.cs
+++ b/AlotAddOnGUI/MainWindow.xaml.cs
@@ -62,11 +62,14 @@ public MainWindow()
private void RunUpdater()
{
-
Log.Information("Running GHUpdater.");
AddonFilesLabel.Content = "Checking for application updates";
string updaterpath = EXE_DIRECTORY + BINARY_DIRECTORY + "GHUpdater.exe";
string temppath = Path.GetTempPath() + "GHUpdater.exe";
+ var versInfo = FileVersionInfo.GetVersionInfo(updaterpath);
+ String fileVersion = versInfo.FileVersion;
+ Log.Information("GHUpdater.exe version: " + fileVersion);
+
File.Copy(updaterpath, temppath, true);
pipe = new AnonymousPipes("GHUPDATE_SERVER.", temppath, "", delegate (String msg)
{
@@ -82,7 +85,7 @@ private void RunUpdater()
//updateprogresscontroller.SetTitle("Update ready to install");
//updateprogresscontroller.SetMessage("Update will install in 5 seconds.");
await this.ShowMessageAsync("ALOT Addon Builder update ready", "The program will close and update in the background, then reopen. It should only take a few seconds.");
- string updatemessage = "EXECUTE_UPDATE \"" + System.AppDomain.CurrentDomain.FriendlyName + "\" \"" + EXE_DIRECTORY + "\"";
+ string updatemessage = "EXECUTE_UPDATE_AND_START_PROCESS \"" + System.AppDomain.CurrentDomain.FriendlyName + "\" \"" + EXE_DIRECTORY + "\"";
Log.Information("Executing update: " + updatemessage);
pipe.SendText(updatemessage);
Environment.Exit(0);
@@ -135,10 +138,21 @@ private void RunUpdater()
{
pipe.SendText("KILL_UPDATER");
pipe.Close();
- Log.Information("User declined update, shutting down updater");
+ try
+ {
+ File.Delete(temppath);
+ }
+ catch (Exception e)
+ {
+ Log.Error("Error deleting TEMP GHUpdater.exe: " + e.ToString());
+ }
+
await FetchManifest();
}
break;
+ default:
+ Log.Error("Unknown message from updater client: " + msg);
+ break;
}
});
}, delegate ()
@@ -162,6 +176,128 @@ private void RunUpdater()
pipe.SendText("START_UPDATE_CHECK Mgamerz AlotAddOnGUI " + System.Reflection.Assembly.GetEntryAssembly().GetName().Version);
}
+ private void RunMEMUpdater()
+ {
+ Log.Information("Running GHUpdater for MEM.");
+ AddonFilesLabel.Content = "Checking for Mass Effect Modder updates";
+ string updaterpath = EXE_DIRECTORY + BINARY_DIRECTORY + "GHUpdater.exe";
+ string temppath = Path.GetTempPath() + "GHUpdater-MEM.exe";
+ File.Copy(updaterpath, temppath, true);
+ pipe = new AnonymousPipes("GHUPDATE_SERVER_MEM.", temppath, "", delegate (String msg)
+ {
+ Dispatcher.Invoke((MethodInvoker)async delegate ()
+ {
+ //UI THREAD
+ string[] clientmessage = msg.Split();
+ switch (clientmessage[0])
+ {
+ case "UPDATE_DOWNLOAD_COMPLETE":
+ if (updateprogresscontroller != null)
+ {
+ //updateprogresscontroller.SetTitle("Update ready to install");
+ //updateprogresscontroller.SetMessage("Update will install in 5 seconds.");
+ //await this.ShowMessageAsync("ALOT Addon Builder update ready", "The program will close and update in the background, then reopen. It should only take a few seconds.");
+ string updatemessage = "EXECUTE_UPDATE \"" + EXE_DIRECTORY + "bin\\\"";
+ Log.Information("Executing update: " + updatemessage);
+ pipe.SendText(updatemessage);
+ //Environment.Exit(0);
+ }
+ break;
+ case "UPDATE_DOWNLOAD_PROGRESS":
+ if (clientmessage.Length != 2)
+ {
+ Log.Warning("UPDATE_DOWNLOAD_PROGRESS message was not length 2 - ignoring message");
+ return;
+ }
+ if (updateprogresscontroller != null)
+ {
+ double value = Double.Parse(clientmessage[1]);
+ updateprogresscontroller.SetProgress(value);
+ }
+ break;
+ case "UP_TO_DATE":
+ Log.Information("GHUpdater reporting MEM is up to date");
+ Thread.Sleep(250);
+ try
+ {
+ File.Delete(temppath);
+ }
+ catch (Exception e)
+ {
+ Log.Error("Error deleting TEMP GHUpdater-MEM.exe: " + e.ToString());
+ }
+ //await FetchManifest();
+ break;
+ case "ERROR_CHECKING_FOR_UPDATES":
+ AddonFilesLabel.Content = "Error occured checking for MEM updates";
+ break;
+ case "UPDATE_AVAILABLE":
+ if (clientmessage.Length != 2)
+ {
+ Log.Warning("UPDATE_AVAILABLE message was not length 2 - ignoring message");
+ return;
+ }
+ Log.Information("Github Updater reports program update: " + clientmessage[1] + " is available.");
+ //MessageDialogResult result = await this.ShowMessageAsync("Update Available", "ALOT Addon Builder " + clientmessage[1] + " is available. Install the update?", MessageDialogStyle.AffirmativeAndNegative);
+ //if (result == MessageDialogResult.Affirmative)
+ //{
+ pipe.SendText("INITIATE_DOWNLOAD");
+ updateprogresscontroller = await this.ShowProgressAsync("Installing Update", "Mass Effect Modder is updating. Please wait...", true);
+ updateprogresscontroller.SetIndeterminate();
+ //}
+ //else
+ //{
+ // pipe.SendText("KILL_UPDATER");
+ // pipe.Close();
+ // Log.Information("User declined update, shutting down updater");
+ // await FetchManifest();
+ //}
+ break;
+ case "UPDATE_COMPLETED":
+ AddonFilesLabel.Content = "MassEffectModder has been updated.";
+ if (updateprogresscontroller != null)
+ {
+ await updateprogresscontroller.CloseAsync();
+ }
+ try
+ {
+ File.Delete(temppath);
+ }
+ catch (Exception e)
+ {
+ Log.Error("Error deleting TEMP GHUpdater-MEM.exe: " + e.ToString());
+ }
+ break;
+ default:
+ Log.Error("Unknown message from updater client: " + msg);
+ break;
+ }
+ });
+ }, delegate ()
+ {
+ // We're disconnected!
+ try
+ {
+
+ Dispatcher.Invoke((MethodInvoker)delegate ()
+ {
+ //UITHREAD
+ var source = PresentationSource.FromVisual(this);
+ if (source == null || source.IsDisposed)
+ {
+ AddonFilesLabel.Content = "Lost connection to update client";
+ }
+ });
+ }
+ catch (Exception) { }
+ });
+ Thread.Sleep(2000);
+ var versInfo = FileVersionInfo.GetVersionInfo(BINARY_DIRECTORY + "MassEffectModder.exe");
+ int fileVersion = versInfo.FileMajorPart;
+ Log.Information("Local Mass Effect Modder version: " + fileVersion);
+ pipe.SendText("START_UPDATE_CHECK MassEffectModder MassEffectModder " + fileVersion);
+ }
+
private async void InstallCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Installing = false;
@@ -177,7 +313,7 @@ private async void InstallCompleted(object sender, RunWorkerCompletedEventArgs e
break;
case 2:
case 3:
- HeaderLabel.Text = "Addon Created.\nThe MEM packages for the addon have been placed into the "+MEM_OUTPUT_DISPLAY_DIR+" directory.";
+ HeaderLabel.Text = "Addon Created.\nThe MEM packages for the addon have been placed into the " + MEM_OUTPUT_DISPLAY_DIR + " directory.";
AddonFilesLabel.Content = "MEM Packages placed in the " + MEM_OUTPUT_DISPLAY_DIR + " folder";
await this.ShowMessageAsync("ALOT Addon for Mass Effect " + result + " has been built", "You can install the Addon MEM files with Mass Effect Modder after you've installed the main ALOT MEM file.");
break;
@@ -355,12 +491,15 @@ private async Task FetchManifest()
}
readManifest();
+
Log.Information("Manifest read. Switching over to user control");
Install_ProgressBar.IsIndeterminate = false;
HeaderLabel.Text = "Download the listed files, then drag and drop the files onto this window.\nOnce all items are ready, build the addon.";
AddonFilesLabel.Content = "Scanning...";
timer_Tick(null, null);
+ RunMEMUpdater();
+
}
}
}
@@ -465,7 +604,8 @@ private void OnPropertyChanged(string propertyName)
handler(this, new PropertyChangedEventArgs(propertyName));
}
- public override string ToString() {
+ public override string ToString()
+ {
return FriendlyName;
}
}
@@ -666,7 +806,7 @@ private async Task InstallPrecheck(int game)
{
oneisready = true;
}
- }
+ }
}
if (nummissing == 0)
@@ -780,13 +920,16 @@ private bool ExtractAddons(int game)
{
foreach (PackageFile pf in af.PackageFiles)
{
- Log.Information("Copying Package File: " + pf.SourceName + "->" + pf.DestinationName);
- string extractedpath = basepath + Path.GetFileNameWithoutExtension(af.Filename) + "\\" + pf.SourceName;
- string destination = stagingdirectory + pf.DestinationName;
- File.Copy(extractedpath, destination, true);
- numcompleted++;
- int progress = (int)((float)numcompleted / (float)totalfiles * 100);
- InstallWorker.ReportProgress(progress);
+ if (game == 2 && pf.ME2Only || game == 3 && pf.ME3Only || (!pf.ME3Only && !pf.ME2Only))
+ {
+ Log.Information("Copying Package File: " + pf.SourceName + "->" + pf.DestinationName);
+ string extractedpath = basepath + Path.GetFileNameWithoutExtension(af.Filename) + "\\" + pf.SourceName;
+ string destination = stagingdirectory + pf.DestinationName;
+ File.Copy(extractedpath, destination, true);
+ numcompleted++;
+ int progress = (int)((float)numcompleted / (float)totalfiles * 100);
+ InstallWorker.ReportProgress(progress);
+ }
// Thread.Sleep(1000);
}
}
@@ -885,6 +1028,11 @@ private async void File_Drop(object sender, System.Windows.DragEventArgs e)
{
// Note that you can have more than one file.
string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
+ Log.Information("Files dropped:");
+ foreach (String file in files)
+ {
+ Log.Information(" -" + file);
+ }
List filesimported = new List();
// Assuming you have one file that you care about, pass it off to whatever
// handling code you have defined.
@@ -904,6 +1052,10 @@ private async void File_Drop(object sender, System.Windows.DragEventArgs e)
timer_Tick(null, null);
break;
}
+ else
+ {
+ Log.Information("Dragged file does not match addonfile or file is already ready: " + af.Filename);
+ }
}
}
if (filesimported.Count > 0)
diff --git a/AlotAddOnGUI/Properties/AssemblyInfo.cs b/AlotAddOnGUI/Properties/AssemblyInfo.cs
index ddc94609..1d6a08bb 100644
--- a/AlotAddOnGUI/Properties/AssemblyInfo.cs
+++ b/AlotAddOnGUI/Properties/AssemblyInfo.cs
@@ -17,7 +17,7 @@
[assembly: AssemblyCulture("")]
// Version informationr(
-[assembly: AssemblyVersion("1.2.26.65")]
-[assembly: AssemblyFileVersion("1.2.26.65")]
+[assembly: AssemblyVersion("1.2.28.93")]
+[assembly: AssemblyFileVersion("1.2.28.93")]
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
diff --git a/AlotAddOnGUI/Updater/GHUpdater.exe b/AlotAddOnGUI/Updater/GHUpdater.exe
index 74d688df..18026194 100644
Binary files a/AlotAddOnGUI/Updater/GHUpdater.exe and b/AlotAddOnGUI/Updater/GHUpdater.exe differ