Permalink
Browse files

Version 1.1.27

Updates are now downloaded from Github
UI fixes, with clearer errors and "Open DS4" changed to say "Open DS4W"
If you choose to open DS4W after an update, DS4Windows will update the
updater, so you won't see the command prompt window if you choose this
route.
  • Loading branch information...
1 parent 4cf5b3d commit 048c266d20a72dfb7c5625e18c52ff08e3220641 @Jays2Kings committed Aug 13, 2015
Binary file not shown.
View
Binary file not shown.
@@ -18,6 +18,7 @@ namespace Updater2
public partial class App : Application
{
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
+ public static bool openingDS4W;
private void Application_Startup(object sender, StartupEventArgs e)
{
MainWindow mwd = new MainWindow();
@@ -35,9 +36,11 @@ public App()
this.Exit += (s, e) =>
{
string version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
- if (System.IO.File.Exists(exepath + "\\DS4Updater NEW.exe")
- && FileVersionInfo.GetVersionInfo(exepath + "\\DS4Updater NEW.exe").FileVersion.CompareTo(version) == 1)
+ if (!openingDS4W && System.IO.File.Exists(exepath + "\\Update Files\\DS4Updater.exe")
+ && FileVersionInfo.GetVersionInfo(exepath + "\\Update Files\\DS4Updater.exe").FileVersion.CompareTo(version) == 1)
{
+ File.Move(exepath + "\\Update Files\\DS4Updater.exe", exepath + "\\DS4Updater NEW.exe");
+ Directory.Delete(exepath + "\\Update Files");
StreamWriter w = new StreamWriter(exepath + "\\UpdateReplacer.bat");
w.WriteLine("@echo off"); // Turn off echo
w.WriteLine("@echo Attempting to replace updater, please wait...");
@@ -1,13 +1,13 @@
<Window x:Name="DS4_Updater" x:Class="Updater2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="DS4 Updater" Height="110" Width="391.566" ResizeMode="CanMinimize">
+ Title="DS4 Updater" Height="110" Width="408.566" ResizeMode="CanMinimize">
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressValue="0" ProgressState="Normal"/>
</Window.TaskbarItemInfo>
<Grid>
- <Button x:Name="btnOpenDS4" Content="Open DS4" HorizontalAlignment="Left" Margin="290,41,0,0" VerticalAlignment="Top" Width="75" IsEnabled="False" Click="btnOpenDS4_Click"/>
+ <Button x:Name="btnOpenDS4" Content="Open DS4W" HorizontalAlignment="Left" Margin="290,41,0,0" VerticalAlignment="Top" Width="86" IsEnabled="False" Click="btnOpenDS4_Click" Background="#FFF0F0F0"/>
<Button x:Name="btnChangelog" Content="View Changelog" HorizontalAlignment="Left" Margin="186,41,0,0" VerticalAlignment="Top" Width="99" Click="btnChangelog_Click"/>
<ProgressBar x:Name="UpdaterBar" HorizontalAlignment="Left" Height="20" Margin="10,41,0,0" VerticalAlignment="Top" Width="171" Maximum="106"/>
<Label x:Name="label1" Content="Fetching Download" HorizontalAlignment="Left" Margin="5,10,0,0" VerticalAlignment="Top"/>
@@ -62,8 +62,13 @@ public MainWindow()
label1.Content = "Please re-run with admin rights";
else
{
- try { File.Delete(exepath + "\\Update.zip"); }
- catch { label1.Content = "Cannot access Update.zip at this time"; return; }
+ try
+ {
+ File.Delete(exepath + "\\Update.zip");
+ if (Directory.Exists(exepath + "\\Update Files"))
+ Directory.Delete(exepath + "\\Update Files", true);
+ }
+ catch (IOException) { label1.Content = "Cannot save download at this time"; return; }
if (File.Exists(exepath + "\\Profiles.xml"))
path = exepath;
if (File.Exists(path + "\\version.txt"))
@@ -82,8 +87,8 @@ public MainWindow()
}
if (!downloading && version.Replace(',', '.').CompareTo(newversion) == -1)
{
- Uri url = new Uri("http://ds4windows.com/Files/Builds/DS4Windows%20-%20J2K%20(v" + newversion + ").zip");
- //Sorry other devs, gonna have to find your own server
+ Uri url = new Uri($"http://github.com/Jays2Kings/DS4Windows/releases/download/v{newversion}/DS4Windows.zip");
+ //Uri url = new Uri("http://ds4windows.com/Files/Builds/DS4Windows%20-%20J2K%20(v" + newversion + ").zip");
sw.Start();
try { wc.DownloadFileAsync(url, exepath + "\\Update.zip"); }
catch (Exception e) { label1.Content = e.Message; }
@@ -92,7 +97,7 @@ public MainWindow()
}
else if (!downloading)
{
- label1.Content = "DS4Tool is up to date";
+ label1.Content = "DS4Windows is up to date";
try
{
File.Delete(path + "\\version.txt");
@@ -110,8 +115,8 @@ void subwc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
File.Delete(exepath + "\\version.txt");
if (version.Replace(',', '.').CompareTo(newversion) == -1)
{
- Uri url = new Uri("http://ds4windows.com/Files/Builds/DS4Windows%20-%20J2K%20(v" + newversion + ").zip");
- //Sorry other devs, gonna have to find your own server
+ Uri url = new Uri($"http://github.com/Jays2Kings/DS4Windows/releases/download/v{newversion}/DS4Windows.zip");
+ //Uri url = new Uri("http://ds4windows.com/Files/Builds/DS4Windows%20-%20J2K%20(v" + newversion + ").zip");
sw.Start();
try { wc.DownloadFileAsync(url, exepath + "\\Update.zip"); }
catch (Exception ec) { label1.Content = ec.Message; }
@@ -120,7 +125,7 @@ void subwc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
}
else
{
- label1.Content = "DS4Tool is up to date";
+ label1.Content = "DS4Windows is up to date";
try
{
File.Delete(path + "\\version.txt");
@@ -240,6 +245,7 @@ private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
File.Delete(exepath + "\\DS4Control.dll");
File.Delete(exepath + "\\DS4Library.dll");
File.Delete(exepath + "\\HidLibrary.dll");
+ Directory.Delete(exepath + "\\Update Files");
string[] updatefiles = Directory.GetFiles(exepath);
for (int i = 0; i < updatefiles.Length; i++)
if (System.IO.Path.GetExtension(updatefiles[i]) == ".ds4w")
@@ -249,30 +255,41 @@ private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
label1.Content = "Installing new files";
UpdaterBar.Value = 104;
TaskbarItemInfo.ProgressValue = UpdaterBar.Value / 106d;
- try { ZipFile.ExtractToDirectory(exepath + "\\Update.zip", exepath); }
+ try
+ {
+ Directory.CreateDirectory(exepath + "\\Update Files");
+ ZipFile.ExtractToDirectory(exepath + "\\Update.zip", exepath + "\\Update Files");
+ }
catch (IOException) { }
try
{
File.Delete(exepath + "\\version.txt");
File.Delete(path + "\\version.txt");
}
catch { }
-
+ if (File.Exists(exepath + "\\Update Files\\DS4Updater NEW.exe"))
+ File.Move(exepath + "\\Update Files\\DS4Updater NEW.exe", exepath + "\\Update Files\\DS4Updater.exe");
+ string[] files = Directory.GetFiles(exepath + "\\Update Files");
+ for (int i = files.Length -1; i >= 0; i--)
+ if (System.IO.Path.GetFileNameWithoutExtension(files[i]) != "DS4Updater")
+ File.Move(files[i], $"{exepath}\\{System.IO.Path.GetFileName(files[i])}");
string version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
- if (System.IO.File.Exists(exepath + "\\DS4Updater NEW.exe")
- && FileVersionInfo.GetVersionInfo(exepath + "\\DS4Updater NEW.exe").FileVersion.CompareTo(version) != 1)
- System.IO.File.Delete(exepath + "\\DS4Updater NEW.exe");
-
+ /*if (File.Exists(exepath + "\\Update Files\\DS4Updater.exe")
+ && FileVersionInfo.GetVersionInfo(exepath + "\\Update Files\\DS4Updater.exe").FileVersion.CompareTo(version) != 1)
+ {
+ File.Delete(exepath + "\\Update Files\\DS4Updater.exe");
+ Directory.Delete(exepath + "\\Update Files");
+ }*/
if ((File.Exists(exepath + "\\DS4Windows.exe") || File.Exists(exepath + "\\DS4Tool.exe")) &&
FileVersionInfo.GetVersionInfo(exepath + "\\DS4Windows.exe").FileVersion == newversion)
{
File.Delete(exepath + "\\Update.zip");
File.Delete(exepath + "\\" + lang + ".zip");
- label1.Content = "DS4Windows has been updated to v" + newversion;
+ label1.Content = $"DS4Windows has been updated to v{newversion}";
}
else if (File.Exists(exepath + "\\DS4Windows.exe") || File.Exists(exepath + "\\DS4Tool.exe"))
{
- label1.Content = "Could replace DS4Windows, please manually unzip";
+ label1.Content = "Could not replace DS4Windows, please manually unzip";
}
else
label1.Content = "Could not unpack zip, please manually unzip";
@@ -304,6 +321,7 @@ private void btnOpenDS4_Click(object sender, RoutedEventArgs e)
Process.Start(exepath + "\\DS4Windows.exe");
else
Process.Start(exepath);
+ App.openingDS4W = true;
this.Close();
}
}
@@ -51,5 +51,5 @@
// 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.1.23")]
-[assembly: AssemblyFileVersion("1.1.23")]
+[assembly: AssemblyVersion("1.1.27")]
+[assembly: AssemblyFileVersion("1.1.27")]
@@ -1 +0,0 @@
-hi there :)
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.0
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.0
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,8 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2D15C395934087719D9F57EF6BE31B46"
+#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C569175C04EC9D17363F92E9D856EA35"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.0
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -1,8 +1,8 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2D15C395934087719D9F57EF6BE31B46"
+#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C569175C04EC9D17363F92E9D856EA35"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.0
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

0 comments on commit 048c266

Please sign in to comment.