cemu-DS4Windows/DS4Tool/SaveWhere.cs
jays2kings b4a6249fa3 Version 1.4.156
Significant CPU usage decrease by reworking how single instances work,
on a mobile i7 for example with a single controller connected usage went
from 4-6% to .5-1.5%. With no controllers connected the usage went from
2.5-4.5% to 0%!
As mentioned before, single instances has been reworked, so trying to
relaunch DS4W more reliably opens the previous instance
Fixed Shift modifier not working if main controls were not modified
Fixed Tilt Left for Shift modifier
Fixed default text of shift controls
Remove touchpad movement notification when swipe for controls is enabled
Can test the rumble motors separately via Heavy and Light
Truly implemented Flush HID (I think)
Slight change in profiles, when loading profiles in for the first time
in this new version, there may be a slight delay
Updated French Translations
Removed mouse moving as an option for touch swipes controls, as they
weren't implemented nor have a purpose to be
2014-11-18 16:23:41 -05:00

103 lines
3.5 KiB
C#

using DS4Control;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
namespace DS4Windows
{
public partial class SaveWhere : Form
{
private bool multisaves;
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public SaveWhere(bool multisavespots)
{
InitializeComponent();
Icon = Properties.Resources.DS4W;
multisaves = multisavespots;
lbMultiSaves.Visible = multisaves;
cBDeleteOther.Visible = multisaves;
if (multisaves)
lbPickWhere.Text += ", other location files will be deleted";
if (Global.AdminNeeded())
bnPrgmFolder.Enabled = false;
}
private void bnPrgmFolder_Click(object sender, EventArgs e)
{
Global.SaveWhere(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName);
if (multisaves && !cBDeleteOther.Checked)
{
try { Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool", true); }
catch { }
}
else if (!multisaves)
Save(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml");
Close();
}
private void bnAppdataFolder_Click(object sender, EventArgs e)
{
if (multisaves && !cBDeleteOther.Checked)
try
{
Directory.Delete(exepath + "\\Profiles", true);
File.Delete(exepath + "\\Profiles.xml");
File.Delete(exepath + "\\Auto Profiles.xml");
}
catch (UnauthorizedAccessException) { MessageBox.Show("Cannot Delete old settings, please manaully delete", "DS4Windows"); }
else if (!multisaves)
Save(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml");
Global.SaveWhere(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool");
Close();
}
public bool Save(String path)
{
Boolean Saved = true;
XmlDocument m_Xdoc = new XmlDocument();
try
{
XmlNode Node;
m_Xdoc.RemoveAll();
Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
m_Xdoc.AppendChild(Node);
Node = m_Xdoc.CreateComment(String.Format(" Profile Configuration Data. {0} ", DateTime.Now));
m_Xdoc.AppendChild(Node);
Node = m_Xdoc.CreateWhitespace("\r\n");
m_Xdoc.AppendChild(Node);
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "Profile", null);
m_Xdoc.AppendChild(Node);
m_Xdoc.Save(path);
}
catch { Saved = false; }
return Saved;
}
private void SaveWhere_FormClosing(object sender, FormClosingEventArgs e)
{
if (String.IsNullOrEmpty(Global.appdatapath))
if (MessageBox.Show("Close DS4Windows?\nA location must be picked to continue", "DS4Windows",
MessageBoxButtons.YesNo) == DialogResult.No)
e.Cancel = true;
}
}
}