2014-05-21 07:36:05 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using DS4Control;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Security.Principal;
|
|
|
|
|
using System.Security.Permissions;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace ScpServer
|
|
|
|
|
{
|
|
|
|
|
public partial class WelcomeDialog : Form
|
|
|
|
|
{
|
|
|
|
|
public WelcomeDialog()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.Icon = Properties.Resources.DS4;
|
2014-06-12 20:46:00 +02:00
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bnStep1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
WebClient wb = new WebClient();
|
2014-08-17 00:09:15 +02:00
|
|
|
|
if (bnStep1.Text == Properties.Resources.Step1)
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-10-13 23:56:04 +02:00
|
|
|
|
wb.DownloadFileAsync(new Uri("http://ds4windows.com/Files/Virtual Bus Driver.zip"), Global.appdatapath + "\\VBus.zip");
|
2014-05-21 07:36:05 +02:00
|
|
|
|
wb.DownloadProgressChanged += wb_DownloadProgressChanged;
|
|
|
|
|
wb.DownloadFileCompleted += wb_DownloadFileCompleted;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
|
|
|
|
private void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
|
|
|
|
{
|
2014-06-12 20:46:00 +02:00
|
|
|
|
if (!Global.AdminNeeded())
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnStep1.Text = Properties.Resources.OpeningInstaller;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Delete(exepath + "\\ScpDriver.exe");
|
|
|
|
|
File.Delete(exepath + "\\ScpDriver.log");
|
|
|
|
|
Directory.Delete(exepath + "\\System", true);
|
|
|
|
|
Directory.Delete(exepath + "\\DIFxAPI", true);
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver");
|
|
|
|
|
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); } //Saved so the user can uninstall later
|
|
|
|
|
catch { }
|
|
|
|
|
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\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 { }
|
2014-06-09 01:41:36 +02:00
|
|
|
|
if (File.Exists(exepath + "\\ScpDriver.exe"))
|
|
|
|
|
try { Process.Start(exepath + "\\ScpDriver.exe"); }
|
|
|
|
|
catch { Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); }
|
2014-05-21 07:36:05 +02:00
|
|
|
|
Timer timer = new Timer();
|
|
|
|
|
timer.Start();
|
|
|
|
|
timer.Tick += timer_Tick;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnStep1.Text = Properties.Resources.OpenScpDriver;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver");
|
|
|
|
|
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); }
|
|
|
|
|
catch { }
|
|
|
|
|
Process.Start(Global.appdatapath + "\\Virtual Bus Driver");
|
|
|
|
|
Timer timer = new Timer();
|
|
|
|
|
timer.Start();
|
|
|
|
|
timer.Tick += timer_Tick;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool running = false;
|
|
|
|
|
private void timer_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Process[] processes = Process.GetProcessesByName("ScpDriver");
|
2014-06-12 20:46:00 +02:00
|
|
|
|
if (!Global.AdminNeeded())
|
2014-05-21 07:36:05 +02:00
|
|
|
|
{
|
|
|
|
|
if (processes.Length < 1)
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnStep1.Text = Properties.Resources.InstallComplete;
|
2014-05-21 07:36:05 +02: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(Global.appdatapath + "\\VBus.zip");
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
((Timer)sender).Stop();
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (processes.Length > 0)
|
|
|
|
|
running = true;
|
|
|
|
|
if (running)
|
|
|
|
|
if (processes.Length < 1)
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnStep1.Text = Properties.Resources.InstallComplete;
|
2014-05-21 07:36:05 +02:00
|
|
|
|
File.Delete(Global.appdatapath + "\\VBus.zip");
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
((Timer)sender).Stop();
|
2014-05-21 07:36:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Process.Start("http://www.microsoft.com/hardware/en-us/d/xbox-360-controller-for-windows");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|