diff --git a/WeeXnes/App.xaml b/WeeXnes/App.xaml index f2ab930..ba8bfd3 100644 --- a/WeeXnes/App.xaml +++ b/WeeXnes/App.xaml @@ -2,8 +2,38 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WeeXnes" - StartupUri="MainWindow.xaml"> + xmlns:viewModel="clr-namespace:WeeXnes.MVVM.ViewModel" + xmlns:view="clr-namespace:WeeXnes.MVVM.View" + StartupUri="MainWindow.xaml" + Startup="App_OnStartup"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WeeXnes/App.xaml.cs b/WeeXnes/App.xaml.cs index a1351fe..8ca5544 100644 --- a/WeeXnes/App.xaml.cs +++ b/WeeXnes/App.xaml.cs @@ -1,9 +1,29 @@ -namespace WeeXnes +using System.Windows; +using WeeXnes.Core; + +namespace WeeXnes { - /// - /// Interaction logic for App.xaml - /// - public partial class App - { - } -} + /// + /// Interaction logic for App.xaml + /// + public partial class App + { + private void App_OnStartup(object sender, StartupEventArgs e) + { + if (e.Args.Length > 0) + { + for (int i = 0; i != e.Args.Length; ++i) + { + //MessageBox.Show(e.Args[i]); + if (e.Args[i] == "-autostart") + { + //MessageBox.Show("Launched via autostart"); + Globals.autoStartRpc = true; + } + } + + } + //Globals.autoStartRpc = true; + } + } +} \ No newline at end of file diff --git a/WeeXnes/Core/Globals.cs b/WeeXnes/Core/Globals.cs new file mode 100644 index 0000000..9f59b3f --- /dev/null +++ b/WeeXnes/Core/Globals.cs @@ -0,0 +1,56 @@ +using WeeXnes.RPC; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Nocksoft.IO.ConfigFiles; + +namespace WeeXnes.Core +{ + internal class Globals + { + public static string encryptionKey = "8zf5#RdyQ]$4x4_"; + public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes"); + public static string KeyListPath = AppDataPath + "\\" + "Keys"; + public static string RpcListPath = AppDataPath + "\\" + "RPC"; + public static string SettingsFileName = "settings.ini"; + public static string version = "2.3"; + public static bool isRpcRunning = false; + public static string defaultRpcClient; + public static bool alwaysOnTop; + public static bool showElapsedTime; + public static bool copySelectedToClipboard; + public static bool autoStartRpc; + + + public static UpdateVar searchbox_content = new UpdateVar(); + } + public static class funcs + { + public static bool IsDirectoryEmpty(string path) + { + return !Directory.EnumerateFileSystemEntries(path).Any(); + } + } + public class UpdateVar + { + private T _value; + + public Action ValueChanged; + + public T Value + { + get => _value; + + set + { + _value = value; + OnValueChanged(); + } + } + + protected virtual void OnValueChanged() => ValueChanged?.Invoke(); + } +} diff --git a/WeeXnes/Core/ObservableObject.cs b/WeeXnes/Core/ObservableObject.cs new file mode 100644 index 0000000..bac94be --- /dev/null +++ b/WeeXnes/Core/ObservableObject.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace WeeXnes.Core +{ + internal class ObservableObject : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + protected void OnPropertyChanged([CallerMemberName] string name = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + } +} diff --git a/WeeXnes/Core/RelayCommand.cs b/WeeXnes/Core/RelayCommand.cs new file mode 100644 index 0000000..91b2324 --- /dev/null +++ b/WeeXnes/Core/RelayCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Windows.Input; + +namespace WeeXnes.Core +{ + internal class RelayCommand : ICommand + { + private Action _execute; + private Func _canExecute; + + public event EventHandler CanExecuteChanged + { + add { CommandManager.RequerySuggested += value; } + remove { CommandManager.RequerySuggested -= value;} + } + public RelayCommand(Action execute, Func canExecute = null) + { + _execute = execute; + _canExecute = canExecute; + } + public bool CanExecute(object parameter) + { + return _canExecute == null || _canExecute(parameter); + } + public void Execute(object parameter) + { + _execute(parameter); + } + } +} diff --git a/WeeXnes/Fonts/Poppins-Regular.ttf b/WeeXnes/Fonts/Poppins-Regular.ttf new file mode 100644 index 0000000..be06e7f Binary files /dev/null and b/WeeXnes/Fonts/Poppins-Regular.ttf differ diff --git a/WeeXnes/Images/wicon.png b/WeeXnes/Images/wicon.png new file mode 100644 index 0000000..e7bb1ae Binary files /dev/null and b/WeeXnes/Images/wicon.png differ diff --git a/WeeXnes/Keys/KeyItem.cs b/WeeXnes/Keys/KeyItem.cs new file mode 100644 index 0000000..543c0fe --- /dev/null +++ b/WeeXnes/Keys/KeyItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WeeXnes.Keys +{ + public class KeyItem + { + public string name { get; set; } + public string value { get; set; } + public KeyItem(string _name, string _value) + { + this.name = _name; + this.value = _value; + } + } +} diff --git a/WeeXnes/Keys/KeyManagerLib.cs b/WeeXnes/Keys/KeyManagerLib.cs new file mode 100644 index 0000000..76bde9a --- /dev/null +++ b/WeeXnes/Keys/KeyManagerLib.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WeeXnes.Keys +{ + public class KeyManagerLib + { + public static List KeyList = new List(); + } +} diff --git a/WeeXnes/MVVM/View/DiscordRpcView.xaml b/WeeXnes/MVVM/View/DiscordRpcView.xaml new file mode 100644 index 0000000..e3ae5eb --- /dev/null +++ b/WeeXnes/MVVM/View/DiscordRpcView.xaml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + +