mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-25 10:46:51 +01:00
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DS4WinWPF
|
|
{
|
|
public class ProfileEntity
|
|
{
|
|
private string name;
|
|
public string Name
|
|
{
|
|
get => name;
|
|
set
|
|
{
|
|
if (name == value) return;
|
|
name = value;
|
|
NameChanged?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public event EventHandler NameChanged;
|
|
public event EventHandler ProfileSaved;
|
|
public event EventHandler ProfileDeleted;
|
|
|
|
public void DeleteFile()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(name))
|
|
{
|
|
string filepath = DS4Windows.Global.appdatapath + @"\Profiles\" + name + ".xml";
|
|
if (File.Exists(filepath))
|
|
{
|
|
File.Delete(filepath);
|
|
ProfileDeleted?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SaveProfile(int deviceNum)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(name))
|
|
{
|
|
DS4Windows.Global.SaveProfile(deviceNum, name);
|
|
DS4Windows.Global.CacheExtraProfileInfo(deviceNum);
|
|
}
|
|
}
|
|
|
|
public void FireSaved()
|
|
{
|
|
ProfileSaved?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|