This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 98f6204
Showing
52 changed files
with
1,469 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Express 2013 for Windows Desktop | ||
VisualStudioVersion = 12.0.21005.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater2", "Updater2\Updater2.csproj", "{03DBF06C-F9FA-423D-9D2C-E032669DFBE2}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{03DBF06C-F9FA-423D-9D2C-E032669DFBE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{03DBF06C-F9FA-423D-9D2C-E032669DFBE2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{03DBF06C-F9FA-423D-9D2C-E032669DFBE2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{03DBF06C-F9FA-423D-9D2C-E032669DFBE2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application x:Class="Updater2.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace Updater2 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<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"> | ||
|
||
<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="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="Fecthing Download" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/> | ||
<Label x:Name="label2" Content="time left" HorizontalAlignment="Left" Margin="265,10,0,0" VerticalAlignment="Top" Width="100" HorizontalContentAlignment="Right" Opacity="0"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using System.Windows.Shell; | ||
|
||
namespace Updater2 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
WebClient wc = new WebClient(); | ||
protected string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool"; | ||
Process[] processes = Process.GetProcessesByName("DS4Tool"); | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
double newversion; | ||
try | ||
{ | ||
if (double.TryParse(File.ReadAllText(path + "\\version.txt"), out newversion)) | ||
{ | ||
|
||
Uri url = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/DS4Tool%20-%20J2K%20%28v" + newversion.ToString() + "%29.zip");//Sorry other devs, gonna have to find your own server | ||
sw.Start(); | ||
if (!Directory.Exists(path)) | ||
Directory.CreateDirectory(path); | ||
try { wc.DownloadFileAsync(url, path + "\\Update.zip"); } | ||
catch (Exception e) { label1.Content = e.Message; } | ||
wc.DownloadFileCompleted += wc_DownloadFileCompleted; | ||
wc.DownloadProgressChanged +=wc_DownloadProgressChanged; | ||
} | ||
} | ||
catch | ||
{ | ||
label1.Content = "version.txt not found, please re-run DS4Tool"; | ||
} | ||
|
||
|
||
if (processes.Length > 0) | ||
{ | ||
if (MessageBox.Show("It must be closed to update.", "DS4Tool is still running", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation) == MessageBoxResult.OK) | ||
for (int i = processes.Length - 1; i >= 0; i--) | ||
processes[i].CloseMainWindow(); | ||
else | ||
this.Close(); | ||
} | ||
} | ||
Stopwatch sw = new Stopwatch(); | ||
private void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) | ||
{ | ||
label2.Opacity = 1; | ||
double speed = e.BytesReceived / sw.Elapsed.TotalSeconds; | ||
double timeleft = (e.TotalBytesToReceive - e.BytesReceived) / speed; | ||
if (timeleft > 3660) | ||
label2.Content = (int)timeleft / 3600 + "h left"; | ||
else if (timeleft > 90) | ||
label2.Content = (int)timeleft / 60 + "m left"; | ||
else | ||
label2.Content = (int)timeleft + "s left"; | ||
UpdaterBar.Value = e.ProgressPercentage; | ||
TaskbarItemInfo.ProgressValue = UpdaterBar.Value / 106d; | ||
string convertedrev, convertedtotal; | ||
if (e.BytesReceived > 1024 * 1024 * 5) convertedrev = (int)(e.BytesReceived / 1024d / 1024d) + "MB"; | ||
else convertedrev = (int)(e.BytesReceived / 1024d) + "kB"; | ||
if (e.TotalBytesToReceive > 1024 * 1024 * 5) convertedtotal = (int)(e.TotalBytesToReceive / 1024d / 1024d) + "MB"; | ||
else convertedtotal = (int)(e.TotalBytesToReceive / 1024d) + "kB"; | ||
label1.Content = "Downloading update: " + convertedrev + " / " + convertedtotal; | ||
|
||
} | ||
|
||
private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) | ||
{ | ||
sw.Reset(); | ||
label2.Opacity = 0; | ||
label1.Content = "Deleting old files"; | ||
UpdaterBar.Value = 102; | ||
TaskbarItemInfo.ProgressValue = UpdaterBar.Value / 106d; | ||
File.Delete("DS4Tool.exe"); | ||
File.Delete("DS4Control.dll"); | ||
File.Delete("DS4Library.dll"); | ||
File.Delete("HidLibrary.dll"); | ||
label1.Content = "Installing new files"; | ||
UpdaterBar.Value = 104; | ||
TaskbarItemInfo.ProgressValue = UpdaterBar.Value / 106d; | ||
try { ZipFile.ExtractToDirectory(path + "\\Update.zip", Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName); } | ||
catch (IOException) { } //Since profiles may be in the zip ignore them if already exists | ||
File.Delete(path + "\\version.txt"); | ||
File.Delete(path + "\\Update.zip"); | ||
if (File.Exists("Updater NEW.exe")) | ||
label1.Content = "New Updater in program folder, replace to finish update"; | ||
else | ||
label1.Content = "Update complete"; | ||
UpdaterBar.Value = 106; | ||
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; | ||
btnOpenDS4.IsEnabled = true; | ||
} | ||
|
||
|
||
private void btnChangelog_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start("https://docs.google.com/document/d/1l4xcgVQkGUskc5CQ0p069yW22Cd5WAH_yE3Fz2hXo0E/edit?usp=sharing"); | ||
} | ||
|
||
private void btnOpenDS4_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start("DS4Tool.exe"); | ||
this.Close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Updater2")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Updater2")] | ||
[assembly: AssemblyCopyright("Copyright © 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 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 | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
//In order to begin building localizable applications, set | ||
//<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: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// 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.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.