2014-05-21 07:36:05 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Net;
|
2015-02-08 22:51:52 +01:00
|
|
|
|
|
2014-05-21 07:36:05 +02:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
using System.Diagnostics;
|
2018-01-31 05:20:46 +01:00
|
|
|
|
using NonFormTimer = System.Threading.Timer;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using static DS4Windows.Global;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
|
2014-11-18 22:23:41 +01:00
|
|
|
|
namespace DS4Windows
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
|
|
|
|
public partial class WelcomeDialog : Form
|
|
|
|
|
{
|
2018-01-31 05:20:46 +01:00
|
|
|
|
public WelcomeDialog(bool loadConfig=false)
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-11-14 20:44:50 +01:00
|
|
|
|
Icon = Properties.Resources.DS4;
|
2018-01-31 05:20:46 +01:00
|
|
|
|
if (loadConfig)
|
|
|
|
|
{
|
|
|
|
|
Global.FindConfigLocation();
|
|
|
|
|
Global.Load();
|
|
|
|
|
Global.SetCulture(Global.UseLang);
|
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bnFinish_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void linkBluetoothSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Process.Start("control", "bthprops.cpl");
|
|
|
|
|
}
|
Version 1.4.222
Added Press/Toggle Key to Special Actions, you can hold a trigger to
hold a key or toggle a key with one set of buttons, and untoggle it by
pressing or releasing another set of buttons
Added Disconnect BT to Special Actions, PS+Options to d/c is now added
to Special actions and can be enabled for each profile. You can now set
Disconnect BT to any control(s) and how long you need to hold the
control(s) to take affect
Added Partial German Translation (Thanks Michél)
Added 95% Finished Russian Translation (Thanks overclockers.ru members:
KoNoRIMCI & Sr_psycho)
Added Partial Italian Translation (Thanks Giulio)
Updates to the translations sheets, they should now have every bit of
text in DS4Windows, minus the controls of the controller
English Spelling fixes
Main/Starting tab only shows info for connected controllers, and context
menu only shows options for connected controllers.
Mouse wheel scrolling with analog sticks/triggers/gyro, the mouse now
scrolls smoothly
Slightly reworked analog mouse movement + mouse acceleration (not as
janky anymore)
When starting DS4Windows, if no controllers are connected, DS4Windows
defaults to the profile tab
Certain log warnings (Like unable to get controller exclusively) shows
up in red
Easter egg: try pressing a few buttons in sequence while in the log tab
Fixed Start Profile with TP off being unchecked next time a profile is
opened
Other minor Bug Fixes, such as clearing the log then moving to a new tab
crashing DS4W
2015-01-17 21:16:48 +01:00
|
|
|
|
bool driverinstalling = false;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
private void bnStep1_Click(object sender, EventArgs e)
|
2014-12-02 01:07:29 +01:00
|
|
|
|
{
|
2014-05-21 07:36:05 +02:00
|
|
|
|
WebClient wb = new WebClient();
|
Version 1.4.222
Added Press/Toggle Key to Special Actions, you can hold a trigger to
hold a key or toggle a key with one set of buttons, and untoggle it by
pressing or releasing another set of buttons
Added Disconnect BT to Special Actions, PS+Options to d/c is now added
to Special actions and can be enabled for each profile. You can now set
Disconnect BT to any control(s) and how long you need to hold the
control(s) to take affect
Added Partial German Translation (Thanks Michél)
Added 95% Finished Russian Translation (Thanks overclockers.ru members:
KoNoRIMCI & Sr_psycho)
Added Partial Italian Translation (Thanks Giulio)
Updates to the translations sheets, they should now have every bit of
text in DS4Windows, minus the controls of the controller
English Spelling fixes
Main/Starting tab only shows info for connected controllers, and context
menu only shows options for connected controllers.
Mouse wheel scrolling with analog sticks/triggers/gyro, the mouse now
scrolls smoothly
Slightly reworked analog mouse movement + mouse acceleration (not as
janky anymore)
When starting DS4Windows, if no controllers are connected, DS4Windows
defaults to the profile tab
Certain log warnings (Like unable to get controller exclusively) shows
up in red
Easter egg: try pressing a few buttons in sequence while in the log tab
Fixed Start Profile with TP off being unchecked next time a profile is
opened
Other minor Bug Fixes, such as clearing the log then moving to a new tab
crashing DS4W
2015-01-17 21:16:48 +01:00
|
|
|
|
if (!driverinstalling)
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2017-03-20 00:13:09 +01:00
|
|
|
|
wb.DownloadFileAsync(new Uri("http://23.239.26.40/ds4windows/files/Virtual Bus Driver.zip"), exepath + "\\VBus.zip");
|
2014-05-21 07:36:05 +02:00
|
|
|
|
wb.DownloadProgressChanged += wb_DownloadProgressChanged;
|
Version 1.4.222
Added Press/Toggle Key to Special Actions, you can hold a trigger to
hold a key or toggle a key with one set of buttons, and untoggle it by
pressing or releasing another set of buttons
Added Disconnect BT to Special Actions, PS+Options to d/c is now added
to Special actions and can be enabled for each profile. You can now set
Disconnect BT to any control(s) and how long you need to hold the
control(s) to take affect
Added Partial German Translation (Thanks Michél)
Added 95% Finished Russian Translation (Thanks overclockers.ru members:
KoNoRIMCI & Sr_psycho)
Added Partial Italian Translation (Thanks Giulio)
Updates to the translations sheets, they should now have every bit of
text in DS4Windows, minus the controls of the controller
English Spelling fixes
Main/Starting tab only shows info for connected controllers, and context
menu only shows options for connected controllers.
Mouse wheel scrolling with analog sticks/triggers/gyro, the mouse now
scrolls smoothly
Slightly reworked analog mouse movement + mouse acceleration (not as
janky anymore)
When starting DS4Windows, if no controllers are connected, DS4Windows
defaults to the profile tab
Certain log warnings (Like unable to get controller exclusively) shows
up in red
Easter egg: try pressing a few buttons in sequence while in the log tab
Fixed Start Profile with TP off being unchecked next time a profile is
opened
Other minor Bug Fixes, such as clearing the log then moving to a new tab
crashing DS4W
2015-01-17 21:16:48 +01:00
|
|
|
|
wb.DownloadFileCompleted += wb_DownloadFileCompleted;
|
|
|
|
|
driverinstalling = true;
|
2014-12-02 01:07:29 +01:00
|
|
|
|
}
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void wb_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnStep1.Text = Properties.Resources.Downloading.Replace("*number*", e.ProgressPercentage.ToString());
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
bnStep1.Text = Properties.Resources.OpeningInstaller;
|
|
|
|
|
try
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
File.Delete(exepath + "\\ScpDriver.exe");
|
|
|
|
|
File.Delete(exepath + "\\ScpDriver.log");
|
|
|
|
|
Directory.Delete(exepath + "\\System", true);
|
|
|
|
|
Directory.Delete(exepath + "\\DIFxAPI", true);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
Directory.CreateDirectory(exepath + "\\Virtual Bus Driver");
|
|
|
|
|
try { ZipFile.ExtractToDirectory(exepath + "\\VBus.zip", exepath + "\\Virtual Bus Driver"); } //Saved so the user can uninstall later
|
|
|
|
|
catch { }
|
|
|
|
|
try { ZipFile.ExtractToDirectory(exepath + "\\VBus.zip", exepath); }
|
|
|
|
|
//Made here as starting the scpdriver.exe via process.start, the program looks for file from where it was called, not where the exe is
|
|
|
|
|
catch { }
|
|
|
|
|
if (File.Exists(exepath + "\\ScpDriver.exe"))
|
2014-05-21 07:36:05 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
Process.Start(exepath + "\\ScpDriver.exe", "si");
|
|
|
|
|
bnStep1.Text = Properties.Resources.Installing;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
2014-12-02 01:07:29 +01:00
|
|
|
|
catch { Process.Start(exepath + "\\Virtual Bus Driver"); }
|
|
|
|
|
|
|
|
|
|
Timer timer = new Timer();
|
|
|
|
|
timer.Start();
|
|
|
|
|
timer.Tick += timer_Tick;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
2015-12-05 09:55:11 +01:00
|
|
|
|
bool waitForFile;
|
|
|
|
|
DateTime waitFileCheck;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
private void timer_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Process[] processes = Process.GetProcessesByName("ScpDriver");
|
2014-12-02 01:07:29 +01:00
|
|
|
|
if (processes.Length < 1)
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2015-12-05 09:55:11 +01:00
|
|
|
|
if (!File.Exists(exepath + "\\ScpDriver.log") && !waitForFile)
|
|
|
|
|
{
|
|
|
|
|
waitForFile = true;
|
|
|
|
|
waitFileCheck = DateTime.UtcNow;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (waitForFile && waitFileCheck + TimeSpan.FromMinutes(2) < DateTime.UtcNow)
|
|
|
|
|
{
|
|
|
|
|
bnStep1.Text = Properties.Resources.InstallFailed;
|
|
|
|
|
Process.Start(exepath + "\\Virtual Bus Driver");
|
|
|
|
|
File.Delete(exepath + "\\VBus.zip");
|
|
|
|
|
((Timer)sender).Stop();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (waitForFile)
|
|
|
|
|
return;
|
2014-12-02 01:07:29 +01:00
|
|
|
|
string log = File.ReadAllText(exepath + "\\ScpDriver.log");
|
|
|
|
|
if (log.Contains("Install Succeeded"))
|
|
|
|
|
bnStep1.Text = Properties.Resources.InstallComplete;
|
|
|
|
|
else
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-12-02 01:07:29 +01:00
|
|
|
|
bnStep1.Text = Properties.Resources.InstallFailed;
|
|
|
|
|
Process.Start(exepath + "\\Virtual Bus Driver");
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
2014-12-02 01:07:29 +01:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Delete(exepath + "\\ScpDriver.exe");
|
|
|
|
|
File.Delete(exepath + "\\ScpDriver.log");
|
|
|
|
|
Directory.Delete(exepath + "\\System", true);
|
|
|
|
|
Directory.Delete(exepath + "\\DIFxAPI", true);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
File.Delete(exepath + "\\VBus.zip");
|
|
|
|
|
((Timer)sender).Stop();
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2017-03-20 00:50:01 +01:00
|
|
|
|
Process.Start("http://www.microsoft.com/accessories/en-gb/d/xbox-360-controller-for-windows");
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|