2017-08-20 01:48:06 +02:00
|
|
|
|
using System;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.IO;
|
2015-02-08 22:51:52 +01:00
|
|
|
|
|
2014-05-28 21:47:25 +02:00
|
|
|
|
using System.Xml;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
using System.Runtime.InteropServices;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
|
2014-11-18 22:23:41 +01:00
|
|
|
|
namespace DS4Windows
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
|
|
|
|
public partial class WinProgs : Form
|
|
|
|
|
{
|
|
|
|
|
ToolTip tp = new ToolTip();
|
2014-05-30 22:39:39 +02:00
|
|
|
|
ComboBox[] cbs;
|
2014-11-18 22:23:41 +01:00
|
|
|
|
public DS4Form form;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
//C:\ProgramData\Microsoft\Windows\Start Menu\Programs
|
|
|
|
|
string steamgamesdir, origingamesdir;
|
|
|
|
|
protected String m_Profile = Global.appdatapath + "\\Auto Profiles.xml";
|
2014-06-06 22:38:52 +02:00
|
|
|
|
protected XmlDocument m_Xdoc = new XmlDocument();
|
|
|
|
|
List<string> programpaths = new List<string>();
|
|
|
|
|
List<string> lodsf = new List<string>();
|
|
|
|
|
bool appsloaded = false;
|
|
|
|
|
|
2014-11-14 20:44:50 +01:00
|
|
|
|
public WinProgs(string[] oc, DS4Form main)
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2015-11-28 06:47:26 +01:00
|
|
|
|
openProgram.Filter = Properties.Resources.Programs+"|*.exe|" + Properties.Resources.Shortcuts + "|*.lnk";
|
2014-06-06 22:38:52 +02:00
|
|
|
|
form = main;
|
|
|
|
|
cbs = new ComboBox[4] { cBProfile1, cBProfile2, cBProfile3, cBProfile4 };
|
2014-05-30 22:39:39 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
cbs[i].Items.AddRange(oc);
|
2014-08-17 00:09:15 +02:00
|
|
|
|
cbs[i].Items.Add(Properties.Resources.noneProfile);
|
2014-06-06 22:38:52 +02:00
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-05-28 21:47:25 +02:00
|
|
|
|
if (!File.Exists(Global.appdatapath + @"\Auto Profiles.xml"))
|
|
|
|
|
Create();
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
LoadP();
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
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
|
|
|
|
if (Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common"))
|
|
|
|
|
steamgamesdir = @"C:\Program Files (x86)\Steam\steamapps\common";
|
|
|
|
|
else if (Directory.Exists(@"C:\Program Files\Steam\steamapps\common"))
|
|
|
|
|
steamgamesdir = @"C:\Program Files\Steam\steamapps\common";
|
2014-06-09 01:41:36 +02:00
|
|
|
|
else
|
|
|
|
|
cMSPrograms.Items.Remove(addSteamGamesToolStripMenuItem);
|
|
|
|
|
|
|
|
|
|
if (Directory.Exists(@"C:\Program Files (x86)\Origin Games"))
|
|
|
|
|
origingamesdir = @"C:\Program Files (x86)\Origin Games";
|
|
|
|
|
else if (Directory.Exists(@"C:\Program Files\Origin Games"))
|
|
|
|
|
origingamesdir = @"C:\Program Files\Origin Games";
|
|
|
|
|
else
|
|
|
|
|
cMSPrograms.Items.Remove(addOriginGamesToolStripMenuItem);
|
|
|
|
|
}
|
2014-05-28 21:47:25 +02:00
|
|
|
|
|
|
|
|
|
public bool Create()
|
|
|
|
|
{
|
2017-08-20 01:48:06 +02:00
|
|
|
|
bool Saved = true;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
XmlNode Node;
|
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateComment(String.Format(" Auto-Profile Configuration Data. {0} ", DateTime.Now));
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateWhitespace("\r\n");
|
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "Programs", "");
|
2014-05-28 21:47:25 +02:00
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
m_Xdoc.Save(m_Profile);
|
|
|
|
|
}
|
|
|
|
|
catch { Saved = false; }
|
|
|
|
|
|
|
|
|
|
return Saved;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
2014-11-18 22:23:41 +01:00
|
|
|
|
public void ShowMainWindow()
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
2014-11-18 23:07:27 +01:00
|
|
|
|
form.WindowState = FormWindowState.Normal;
|
|
|
|
|
form.Focus();
|
2014-11-18 22:23:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
public void LoadP()
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
programpaths.Clear();
|
|
|
|
|
if (!File.Exists(Global.appdatapath + "\\Auto Profiles.xml"))
|
|
|
|
|
return;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
doc.Load(Global.appdatapath + "\\Auto Profiles.xml");
|
|
|
|
|
XmlNodeList programslist = doc.SelectNodes("Programs/Program");
|
|
|
|
|
foreach (XmlNode x in programslist)
|
|
|
|
|
programpaths.Add(x.Attributes["path"].Value);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
foreach (string st in programpaths)
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (File.Exists(st))
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
int index = programpaths.IndexOf(st);
|
|
|
|
|
if (string.Empty != st)
|
|
|
|
|
{
|
|
|
|
|
iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st));
|
|
|
|
|
ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index);
|
|
|
|
|
lvi.SubItems.Add(st);
|
|
|
|
|
lvi.Checked = true;
|
|
|
|
|
lvi.ToolTipText = st;
|
|
|
|
|
lVPrograms.Items.Add(lvi);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RemoveP(st, false, false);
|
2014-05-28 21:47:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
2014-05-28 21:47:25 +02:00
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
private void GetApps(string path)
|
2014-06-06 22:38:52 +02:00
|
|
|
|
{
|
2014-06-09 01:41:36 +02:00
|
|
|
|
lodsf.Clear();
|
2015-06-01 21:04:22 +02:00
|
|
|
|
lodsf.AddRange(Directory.GetFiles(path, "*.exe", SearchOption.TopDirectoryOnly));
|
|
|
|
|
foreach (string s in Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
lodsf.AddRange(Directory.GetFiles(s, "*.exe", SearchOption.TopDirectoryOnly));
|
|
|
|
|
lodsf.AddRange(GetAppsR(s));
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
appsloaded = true;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-01 21:04:22 +02:00
|
|
|
|
private List<string> GetAppsR(string path)
|
|
|
|
|
{
|
|
|
|
|
List<string> lods = new List<string>();
|
|
|
|
|
foreach (string s in Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
lods.AddRange(Directory.GetFiles(s, "*.exe", SearchOption.TopDirectoryOnly));
|
|
|
|
|
lods.AddRange(GetAppsR(s));
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2015-06-01 21:04:22 +02:00
|
|
|
|
return lods;
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
private void GetShortcuts(string path)
|
|
|
|
|
{
|
|
|
|
|
lodsf.Clear();
|
|
|
|
|
lodsf.AddRange(Directory.GetFiles(path, "*.lnk", SearchOption.AllDirectories));
|
|
|
|
|
lodsf.AddRange(Directory.GetFiles(@"C:\ProgramData\Microsoft\Windows\Start Menu\Programs", "*.lnk", SearchOption.AllDirectories));
|
|
|
|
|
for (int i = 0; i < lodsf.Count; i++)
|
|
|
|
|
lodsf[i] = GetTargetPath(lodsf[i]);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
appsloaded = true;
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
void appstimer_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (appsloaded)
|
|
|
|
|
{
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.AddingToList;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int i = lodsf.Count - 1; i >= 0; i--)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (lodsf[i].Contains("etup") || lodsf[i].Contains("dotnet") || lodsf[i].Contains("SETUP")
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|| lodsf[i].Contains("edist") || lodsf[i].Contains("nstall") || String.IsNullOrEmpty(lodsf[i]))
|
2014-06-06 22:38:52 +02:00
|
|
|
|
lodsf.RemoveAt(i);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int i = lodsf.Count - 1; i >= 0; i--)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int j = programpaths.Count - 1; j >= 0; j--)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
2014-06-13 21:52:25 +02:00
|
|
|
|
if (lodsf[i].ToLower().Replace('/', '\\') == programpaths[j].ToLower().Replace('/', '\\'))
|
2014-06-06 22:38:52 +02:00
|
|
|
|
lodsf.RemoveAt(i);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
foreach (string st in lodsf)
|
|
|
|
|
{
|
2014-06-09 01:41:36 +02:00
|
|
|
|
if (File.Exists(st))
|
|
|
|
|
{
|
|
|
|
|
int index = programpaths.IndexOf(st);
|
|
|
|
|
iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st));
|
|
|
|
|
ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), iLIcons.Images.Count + index);
|
|
|
|
|
lvi.SubItems.Add(st);
|
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
|
|
|
|
lvi.ToolTipText = st;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
lVPrograms.Items.Add(lvi);
|
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.AddPrograms;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
bnAddPrograms.Enabled = true;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
appsloaded = false;
|
|
|
|
|
((Timer)sender).Stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save(string name)
|
|
|
|
|
{
|
|
|
|
|
m_Xdoc.Load(m_Profile);
|
|
|
|
|
XmlNode Node;
|
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.CreateComment(String.Format(" Auto-Profile Configuration Data. {0} ", DateTime.Now));
|
|
|
|
|
foreach (XmlNode node in m_Xdoc.SelectNodes("//comment()"))
|
|
|
|
|
node.ParentNode.ReplaceChild(Node, node);
|
|
|
|
|
|
|
|
|
|
Node = m_Xdoc.SelectSingleNode("Programs");
|
|
|
|
|
string programname;
|
|
|
|
|
programname = Path.GetFileNameWithoutExtension(name);
|
|
|
|
|
XmlElement el = m_Xdoc.CreateElement("Program");
|
|
|
|
|
el.SetAttribute("path", name);
|
|
|
|
|
el.AppendChild(m_Xdoc.CreateElement("Controller1")).InnerText = cBProfile1.Text;
|
|
|
|
|
el.AppendChild(m_Xdoc.CreateElement("Controller2")).InnerText = cBProfile2.Text;
|
|
|
|
|
el.AppendChild(m_Xdoc.CreateElement("Controller3")).InnerText = cBProfile3.Text;
|
|
|
|
|
el.AppendChild(m_Xdoc.CreateElement("Controller4")).InnerText = cBProfile4.Text;
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
el.AppendChild(m_Xdoc.CreateElement("TurnOff")).InnerText = cBTurnOffDS4W.Checked.ToString();
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
XmlNode oldxmlprocess = m_Xdoc.SelectSingleNode("/Programs/Program[@path=\"" + lBProgramPath.Text + "\"]");
|
|
|
|
|
Node.ReplaceChild(el, oldxmlprocess);
|
|
|
|
|
}
|
|
|
|
|
catch { Node.AppendChild(el); }
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
m_Xdoc.AppendChild(Node);
|
|
|
|
|
m_Xdoc.Save(m_Profile);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (lVPrograms.SelectedItems.Count > 0)
|
|
|
|
|
lVPrograms.SelectedItems[0].Checked = true;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
form.LoadP();
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
public void LoadP(string name)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
doc.Load(m_Profile);
|
|
|
|
|
XmlNodeList programs = doc.SelectNodes("Programs/Program");
|
|
|
|
|
XmlNode Item = doc.SelectSingleNode("/Programs/Program[@path=\"" + name + "\"]");
|
|
|
|
|
if (Item != null)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
2014-05-30 22:39:39 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
Item = doc.SelectSingleNode("/Programs/Program[@path=\"" + name + "\"]" + "/Controller" + (i + 1));
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
if (Item != null)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
for (int j = 0; j < cbs[i].Items.Count; j++)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
if (cbs[i].Items[j].ToString() == Item.InnerText)
|
|
|
|
|
{
|
|
|
|
|
cbs[i].SelectedIndex = j;
|
|
|
|
|
bnSave.Enabled = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
else
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
Item = doc.SelectSingleNode("/Programs/Program[@path=\"" + name + "\"]" + "/TurnOff");
|
|
|
|
|
bool turnOff;
|
|
|
|
|
if (Item != null && bool.TryParse(Item.InnerText, out turnOff))
|
|
|
|
|
{
|
|
|
|
|
cBTurnOffDS4W.Checked = turnOff;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
else
|
|
|
|
|
cBTurnOffDS4W.Checked = false;
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
cBTurnOffDS4W.Checked = false;
|
2014-06-06 22:38:52 +02:00
|
|
|
|
bnSave.Enabled = false;
|
|
|
|
|
}
|
2014-05-30 22:39:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
public void RemoveP(string name, bool uncheck, bool reload = true)
|
2014-05-28 21:47:25 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
|
|
doc.Load(m_Profile);
|
|
|
|
|
XmlNode Node = doc.SelectSingleNode("Programs");
|
|
|
|
|
XmlNode Item = doc.SelectSingleNode("/Programs/Program[@path=\"" + name + "\"]");
|
|
|
|
|
if (Item != null)
|
|
|
|
|
Node.RemoveChild(Item);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
doc.AppendChild(Node);
|
2014-06-09 01:41:36 +02:00
|
|
|
|
doc.Save(m_Profile);
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (lVPrograms.SelectedItems.Count > 0 && uncheck)
|
|
|
|
|
lVPrograms.SelectedItems[0].Checked = false;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
bnSave.Enabled = false;
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (reload)
|
2017-08-20 01:48:06 +02:00
|
|
|
|
form.LoadP();
|
2014-06-09 01:41:36 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
private void CBProfile_IndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int last = cbs[0].Items.Count - 1;
|
|
|
|
|
if (lBProgramPath.Text != string.Empty)
|
|
|
|
|
bnSave.Enabled = true;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (cbs[0].SelectedIndex == last && cbs[1].SelectedIndex == last &&
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
cbs[2].SelectedIndex == last && cbs[3].SelectedIndex == last && !cBTurnOffDS4W.Checked)
|
2014-06-06 22:38:52 +02:00
|
|
|
|
bnSave.Enabled = false;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
if (lBProgramPath.Text != "")
|
2014-06-09 01:41:36 +02:00
|
|
|
|
Save(lBProgramPath.Text);
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-06 22:38:52 +02:00
|
|
|
|
bnSave.Enabled = false;
|
2014-05-28 21:47:25 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
|
|
|
|
|
private void bnAddPrograms_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-09 01:41:36 +02:00
|
|
|
|
cMSPrograms.Show(bnAddPrograms, new Point(0, bnAddPrograms.Height));
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lBProgramPath_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lBProgramPath.Text != "")
|
|
|
|
|
LoadP(lBProgramPath.Text);
|
|
|
|
|
else
|
2017-08-20 01:48:06 +02:00
|
|
|
|
{
|
2014-06-06 22:38:52 +02:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
|
2017-08-20 01:48:06 +02:00
|
|
|
|
}
|
2014-06-06 22:38:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RemoveP(lBProgramPath.Text, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lBProgramPath_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lVPrograms.SelectedItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (lVPrograms.SelectedIndices[0] > -1)
|
|
|
|
|
lBProgramPath.Text = lVPrograms.SelectedItems[0].SubItems[1].Text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
lBProgramPath.Text = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void listView1_ItemCheck(object sender, ItemCheckEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (lVPrograms.Items[e.Index].Checked)
|
|
|
|
|
RemoveP(lVPrograms.Items[e.Index].SubItems[1].Text, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bnHideUnchecked_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
form.RefreshAutoProfilesPage();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
private void addSteamGamesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var AppCollectionThread = new System.Threading.Thread(() => GetApps(steamgamesdir));
|
|
|
|
|
AppCollectionThread.IsBackground = true;
|
|
|
|
|
AppCollectionThread.Start();
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.Loading;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
bnAddPrograms.Enabled = false;
|
|
|
|
|
cMSPrograms.Items.Remove(addSteamGamesToolStripMenuItem);
|
|
|
|
|
Timer appstimer = new Timer();
|
|
|
|
|
appstimer.Start();
|
|
|
|
|
appstimer.Tick += appstimer_Tick;
|
|
|
|
|
}
|
2015-06-01 21:04:22 +02:00
|
|
|
|
|
|
|
|
|
private void addDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-07-31 05:51:16 +02:00
|
|
|
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
|
|
|
|
if (fbd.ShowDialog() == DialogResult.OK)
|
2015-06-01 21:04:22 +02:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var AppCollectionThread = new System.Threading.Thread(() => GetApps(fbd.SelectedPath));
|
|
|
|
|
AppCollectionThread.IsBackground = true;
|
|
|
|
|
AppCollectionThread.Start();
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2015-06-01 21:04:22 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.Loading;
|
|
|
|
|
bnAddPrograms.Enabled = false;
|
|
|
|
|
Timer appstimer = new Timer();
|
|
|
|
|
appstimer.Start();
|
|
|
|
|
appstimer.Tick += appstimer_Tick;
|
2015-07-31 05:51:16 +02:00
|
|
|
|
}
|
2015-06-01 21:04:22 +02:00
|
|
|
|
}
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
|
|
|
|
private void browseForOtherProgramsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-07-31 05:51:16 +02:00
|
|
|
|
if (openProgram.ShowDialog() == DialogResult.OK)
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
string file = openProgram.FileName;
|
|
|
|
|
if (file.EndsWith(".lnk"))
|
|
|
|
|
{
|
|
|
|
|
file = GetTargetPath(file);
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-06-09 01:41:36 +02:00
|
|
|
|
lBProgramPath.Text = file;
|
|
|
|
|
iLIcons.Images.Add(Icon.ExtractAssociatedIcon(file));
|
|
|
|
|
ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(file), lVPrograms.Items.Count);
|
|
|
|
|
lvi.SubItems.Add(file);
|
|
|
|
|
lVPrograms.Items.Insert(0, lvi);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addOriginGamesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var AppCollectionThread = new System.Threading.Thread(() => GetApps(origingamesdir));
|
|
|
|
|
AppCollectionThread.IsBackground = true;
|
|
|
|
|
AppCollectionThread.Start();
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.Loading;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
bnAddPrograms.Enabled = false;
|
|
|
|
|
cMSPrograms.Items.Remove(addOriginGamesToolStripMenuItem);
|
|
|
|
|
Timer appstimer = new Timer();
|
|
|
|
|
appstimer.Start();
|
|
|
|
|
appstimer.Tick += appstimer_Tick;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void addProgramsFromStartMenuToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var AppCollectionThread = new System.Threading.Thread(() => GetShortcuts(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Programs"));
|
|
|
|
|
AppCollectionThread.IsBackground = true;
|
|
|
|
|
AppCollectionThread.Start();
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2014-08-17 00:09:15 +02:00
|
|
|
|
bnAddPrograms.Text = Properties.Resources.Loading;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
bnAddPrograms.Enabled = false;
|
|
|
|
|
cMSPrograms.Items.Remove(addProgramsFromStartMenuToolStripMenuItem);
|
|
|
|
|
Timer appstimer = new Timer();
|
|
|
|
|
appstimer.Start();
|
|
|
|
|
appstimer.Tick += appstimer_Tick;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetTargetPath(string filePath)
|
|
|
|
|
{
|
|
|
|
|
string targetPath = ResolveMsiShortcut(filePath);
|
|
|
|
|
if (targetPath == null)
|
|
|
|
|
{
|
|
|
|
|
targetPath = ResolveShortcut(filePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return targetPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetInternetShortcut(string filePath)
|
|
|
|
|
{
|
|
|
|
|
string url = "";
|
|
|
|
|
|
|
|
|
|
using (TextReader reader = new StreamReader(filePath))
|
|
|
|
|
{
|
|
|
|
|
string line = "";
|
|
|
|
|
while ((line = reader.ReadLine()) != null)
|
|
|
|
|
{
|
|
|
|
|
if (line.StartsWith("URL="))
|
|
|
|
|
{
|
|
|
|
|
string[] splitLine = line.Split('=');
|
|
|
|
|
if (splitLine.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
url = splitLine[1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-13 21:12:03 +01:00
|
|
|
|
public static string ResolveShortcut(string filePath)
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
// IWshRuntimeLibrary is in the COM library "Windows Script Host Object Model"
|
|
|
|
|
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
|
|
|
|
|
return shortcut.TargetPath;
|
|
|
|
|
}
|
|
|
|
|
catch (COMException)
|
|
|
|
|
{
|
|
|
|
|
// A COMException is thrown if the file is not a valid shortcut (.lnk) file
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-13 21:12:03 +01:00
|
|
|
|
public static string ResolveShortcutAndArgument(string filePath)
|
|
|
|
|
{
|
|
|
|
|
// IWshRuntimeLibrary is in the COM library "Windows Script Host Object Model"
|
|
|
|
|
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
|
|
|
|
|
return shortcut.TargetPath + " " + shortcut.Arguments;
|
|
|
|
|
}
|
|
|
|
|
catch (COMException)
|
|
|
|
|
{
|
|
|
|
|
// A COMException is thrown if the file is not a valid shortcut (.lnk) file
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Version 1.4.5
Added support for the New DS4 USB Adapater (Thanks to boganhobo and
Chamilsaan)
Implemented teokp's amazing fix for hide ds4 not working on the
anniversary update of Windows 10: when a controller fails to enter
exclusive mode, DS4Windows will ask for admin privilages to fix the
issue.
Now (near)unlimited Special Actions can be made from the previous limit
of 50
Special Action Xbox Game DVR is now no longer limited to Windows 10,
renamed multi action button: Assign a macro to single tap, double tap,
and holding down a button
Added option for White DS4Windows Icon in the notification tray (While
not merged from, thanks to tehmantra)
Added option to temporarily turn off DS4Windows when using a certain
program (togglable in the Auto Profiles Tab) (Same case as above but
thanks to dedChar to bring to light)
Fixed Options crashes in certain locales where decimal points are
repesented with commas, such as German (Thanks to kiliansch)
Added/Updated translations for many languauges, now including Japanese,
Slovenian, Hungarian, Greek, Finnish, Czech, Indonesian, and Ukrainian
2016-09-22 03:38:38 +02:00
|
|
|
|
private void cBTurnOffDS4W_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CBProfile_IndexChanged(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-13 21:12:03 +01:00
|
|
|
|
public static string ResolveMsiShortcut(string file)
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
2015-02-08 22:51:52 +01:00
|
|
|
|
StringBuilder product = new StringBuilder(NativeMethods2.MaxGuidLength + 1);
|
|
|
|
|
StringBuilder feature = new StringBuilder(NativeMethods2.MaxFeatureLength + 1);
|
|
|
|
|
StringBuilder component = new StringBuilder(NativeMethods2.MaxGuidLength + 1);
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
2015-02-08 22:51:52 +01:00
|
|
|
|
NativeMethods2.MsiGetShortcutTarget(file, product, feature, component);
|
2014-06-09 01:41:36 +02:00
|
|
|
|
|
2015-02-08 22:51:52 +01:00
|
|
|
|
int pathLength = NativeMethods2.MaxPathLength;
|
2014-06-09 01:41:36 +02:00
|
|
|
|
StringBuilder path = new StringBuilder(pathLength);
|
|
|
|
|
|
2015-02-08 22:51:52 +01:00
|
|
|
|
NativeMethods2.InstallState installState = NativeMethods2.MsiGetComponentPath(product.ToString(), component.ToString(), path, ref pathLength);
|
|
|
|
|
if (installState == NativeMethods2.InstallState.Local)
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
return path.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-08-20 01:48:06 +02:00
|
|
|
|
|
2015-02-08 22:51:52 +01:00
|
|
|
|
class NativeMethods2
|
2014-06-09 01:41:36 +02:00
|
|
|
|
{
|
|
|
|
|
[DllImport("msi.dll", CharSet = CharSet.Auto)]
|
|
|
|
|
public static extern uint MsiGetShortcutTarget(string targetFile, StringBuilder productCode, StringBuilder featureID, StringBuilder componentCode);
|
|
|
|
|
|
|
|
|
|
[DllImport("msi.dll", CharSet = CharSet.Auto)]
|
|
|
|
|
public static extern InstallState MsiGetComponentPath(string productCode, string componentCode, StringBuilder componentPath, ref int componentPathBufferSize);
|
|
|
|
|
|
|
|
|
|
public const int MaxFeatureLength = 38;
|
|
|
|
|
public const int MaxGuidLength = 38;
|
|
|
|
|
public const int MaxPathLength = 1024;
|
|
|
|
|
|
|
|
|
|
public enum InstallState
|
|
|
|
|
{
|
|
|
|
|
NotUsed = -7,
|
|
|
|
|
BadConfig = -6,
|
|
|
|
|
Incomplete = -5,
|
|
|
|
|
SourceAbsent = -4,
|
|
|
|
|
MoreData = -3,
|
|
|
|
|
InvalidArg = -2,
|
|
|
|
|
Unknown = -1,
|
|
|
|
|
Broken = 0,
|
|
|
|
|
Advertised = 1,
|
|
|
|
|
Removed = 1,
|
|
|
|
|
Absent = 2,
|
|
|
|
|
Local = 3,
|
|
|
|
|
Source = 4,
|
|
|
|
|
Default = 5
|
|
|
|
|
}
|
2014-05-28 21:47:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|