Rewrote Updater and Removed Compiler Warnings
This commit is contained in:
parent
446cb60f40
commit
1b14fe2e57
9 changed files with 103 additions and 130 deletions
|
@ -1,88 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
|
||||||
|
|
||||||
namespace Update
|
|
||||||
{
|
|
||||||
internal class Program
|
|
||||||
{
|
|
||||||
public static bool keepWindowOpen = false;
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Path: " + args[0]);
|
|
||||||
Console.WriteLine("FileName: " + args[1]);
|
|
||||||
Console.WriteLine("PID: " + args[2]);
|
|
||||||
Console.WriteLine("New File: " + args[3]);
|
|
||||||
Process p = Process.GetProcessById(Convert.ToInt32(args[2]));
|
|
||||||
p.Kill();
|
|
||||||
p.WaitForExit();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true);
|
|
||||||
}
|
|
||||||
Process.Start(args[0] + "\\" + args[1]);
|
|
||||||
if (File.Exists(args[3]))
|
|
||||||
{
|
|
||||||
File.Delete(args[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keepWindowOpen)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Window kept open to see error message, press enter to continue");
|
|
||||||
Console.ReadLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static class ZipArchiveHelper
|
|
||||||
{
|
|
||||||
public static void ExtractToDirectory(string archiveFileName, string destinationDirectoryName, bool overwrite)
|
|
||||||
{
|
|
||||||
if (!overwrite)
|
|
||||||
{
|
|
||||||
ZipFile.ExtractToDirectory(archiveFileName, destinationDirectoryName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using (var archive = ZipFile.OpenRead(archiveFileName))
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var file in archive.Entries)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var completeFileName = Path.Combine(destinationDirectoryName, file.FullName);
|
|
||||||
var directory = Path.GetDirectoryName(completeFileName);
|
|
||||||
|
|
||||||
if (!Directory.Exists(directory) && !string.IsNullOrEmpty(directory))
|
|
||||||
Directory.CreateDirectory(directory);
|
|
||||||
|
|
||||||
if (file.Name != "")
|
|
||||||
file.ExtractToFile(completeFileName, true);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
if (file.FullName == "Update.exe")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
Console.WriteLine(file.FullName + " couldnt be overwritten, an error has occured");
|
|
||||||
Program.keepWindowOpen = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Update")]
|
[assembly: AssemblyTitle("Update")]
|
||||||
|
@ -13,22 +16,39 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
//In order to begin building localizable applications, set
|
||||||
[assembly: Guid("6F2F689B-F4E3-4204-BA72-624BE46020AD")]
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{6F2F689B-F4E3-4204-BA72-624BE46020AD}</ProjectGuid>
|
<ProjectGuid>{133FF515-D605-4856-BA2E-5841BF47EC2F}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Update</RootNamespace>
|
<RootNamespace>Update</RootNamespace>
|
||||||
<AssemblyName>Update</AssemblyName>
|
<AssemblyName>Update</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
@ -39,18 +40,47 @@
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.IO.Compression.FileSystem" />
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs" />
|
<ApplicationDefinition Include="App.xaml">
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
</Project>
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</Project>
|
|
10
WeeXnes.sln
10
WeeXnes.sln
|
@ -8,7 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeeXnes_UAC", "WeeXnes_UAC\
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Release_Tool", "Release_Tool\Release_Tool.csproj", "{4C09AD12-B48E-40ED-B418-CF868889E317}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Release_Tool", "Release_Tool\Release_Tool.csproj", "{4C09AD12-B48E-40ED-B418-CF868889E317}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{6F2F689B-F4E3-4204-BA72-624BE46020AD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{133FF515-D605-4856-BA2E-5841BF47EC2F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -32,9 +32,9 @@ Global
|
||||||
{4C09AD12-B48E-40ED-B418-CF868889E317}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace WeeXnes
|
||||||
{
|
{
|
||||||
Environment.CurrentDirectory = Application.StartupPath;
|
Environment.CurrentDirectory = Application.StartupPath;
|
||||||
CheckForDebugMode();
|
CheckForDebugMode();
|
||||||
|
CheckUpdatedFiles();
|
||||||
CheckForFolder();
|
CheckForFolder();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
SaveSettingsHandler.SetupSaveEvents();
|
SaveSettingsHandler.SetupSaveEvents();
|
||||||
|
@ -28,6 +29,26 @@ namespace WeeXnes
|
||||||
CheckStartupArgs(e.Args);
|
CheckStartupArgs(e.Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckUpdatedFiles()
|
||||||
|
{
|
||||||
|
string[] files = System.IO.Directory.GetFiles(Environment.CurrentDirectory, "*.new");
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string originalFile = file.Substring(0, file
|
||||||
|
.Length - 4);
|
||||||
|
if (File.Exists(originalFile))
|
||||||
|
File.Delete(originalFile);
|
||||||
|
System.IO.File.Move(file, originalFile);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadSettings()
|
private void LoadSettings()
|
||||||
{
|
{
|
||||||
if(!File.Exists(Path.Combine(Global.AppDataPath, Global.SettingsFile)))
|
if(!File.Exists(Path.Combine(Global.AppDataPath, Global.SettingsFile)))
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
public class Information
|
public class Information
|
||||||
{
|
{
|
||||||
public const string Version = "4.0.4";
|
public const string Version = "4.0.5";
|
||||||
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
||||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace WeeXnes.Core
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
returnval = null;
|
returnval = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@ namespace WeeXnes.Core
|
||||||
returnval = rawcontent[2];
|
returnval = rawcontent[2];
|
||||||
}catch (Exception e)
|
}catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
returnval = null;
|
returnval = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
using WeeXnes.Views.DiscordRPC;
|
|
||||||
using Wpf.Ui.Mvvm.Services;
|
|
||||||
using Button = System.Windows.Controls.Button;
|
|
||||||
using ButtonBase = System.Windows.Controls.Primitives.ButtonBase;
|
using ButtonBase = System.Windows.Controls.Primitives.ButtonBase;
|
||||||
using MessageBox = System.Windows.MessageBox;
|
|
||||||
using NotifyIcon = Wpf.Ui.Controls.NotifyIcon;
|
using NotifyIcon = Wpf.Ui.Controls.NotifyIcon;
|
||||||
|
|
||||||
namespace WeeXnes
|
namespace WeeXnes
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Version>4.0.4</Version>
|
<Version>4.0.5</Version>
|
||||||
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>WeeXnes</RootNamespace>
|
<RootNamespace>WeeXnes</RootNamespace>
|
||||||
|
|
Loading…
Add table
Reference in a new issue