initial release
This commit is contained in:
parent
abdf533fc8
commit
f02aa48972
40 changed files with 3573 additions and 91 deletions
|
@ -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">
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Theme/MenuButtonTheme.xaml"/>
|
||||
<ResourceDictionary Source="Theme/TextBoxTheme.xaml"/>
|
||||
<ResourceDictionary Source="Theme/ControlButtonTheme.xaml"/>
|
||||
<ResourceDictionary Source="Theme/ModernCheckbox.xaml"/>
|
||||
<ResourceDictionary Source="Theme/DiscordRpcTheme.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewModel:HomeViewModel}">
|
||||
<view:HomeView/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewModel:KeyManagerViewModel}">
|
||||
<view:KeyManagerView/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewModel:DiscordRpcViewModel}">
|
||||
<view:DiscordRpcView/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewModel:SettingsViewModel}">
|
||||
<view:SettingView/>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
@ -1,9 +1,29 @@
|
|||
namespace WeeXnes
|
||||
using System.Windows;
|
||||
using WeeXnes.Core;
|
||||
|
||||
namespace WeeXnes
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
56
WeeXnes/Core/Globals.cs
Normal file
56
WeeXnes/Core/Globals.cs
Normal file
|
@ -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<string> searchbox_content = new UpdateVar<string>();
|
||||
}
|
||||
public static class funcs
|
||||
{
|
||||
public static bool IsDirectoryEmpty(string path)
|
||||
{
|
||||
return !Directory.EnumerateFileSystemEntries(path).Any();
|
||||
}
|
||||
}
|
||||
public class UpdateVar<T>
|
||||
{
|
||||
private T _value;
|
||||
|
||||
public Action ValueChanged;
|
||||
|
||||
public T Value
|
||||
{
|
||||
get => _value;
|
||||
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnValueChanged() => ValueChanged?.Invoke();
|
||||
}
|
||||
}
|
19
WeeXnes/Core/ObservableObject.cs
Normal file
19
WeeXnes/Core/ObservableObject.cs
Normal file
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
30
WeeXnes/Core/RelayCommand.cs
Normal file
30
WeeXnes/Core/RelayCommand.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace WeeXnes.Core
|
||||
{
|
||||
internal class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> _execute;
|
||||
private Func<object, bool> _canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value;}
|
||||
}
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return _canExecute == null || _canExecute(parameter);
|
||||
}
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
BIN
WeeXnes/Fonts/Poppins-Regular.ttf
Normal file
BIN
WeeXnes/Fonts/Poppins-Regular.ttf
Normal file
Binary file not shown.
BIN
WeeXnes/Images/wicon.png
Normal file
BIN
WeeXnes/Images/wicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 KiB |
19
WeeXnes/Keys/KeyItem.cs
Normal file
19
WeeXnes/Keys/KeyItem.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
13
WeeXnes/Keys/KeyManagerLib.cs
Normal file
13
WeeXnes/Keys/KeyManagerLib.cs
Normal file
|
@ -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<KeyItem> KeyList = new List<KeyItem>();
|
||||
}
|
||||
}
|
184
WeeXnes/MVVM/View/DiscordRpcView.xaml
Normal file
184
WeeXnes/MVVM/View/DiscordRpcView.xaml
Normal file
|
@ -0,0 +1,184 @@
|
|||
<UserControl x:Class="WeeXnes.MVVM.View.DiscordRpcView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeeXnes.MVVM.View"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Unloaded="UserControl_Unloaded">
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="340"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="220"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="#22202f"
|
||||
CornerRadius="10"
|
||||
Height="300"
|
||||
VerticalAlignment="Top">
|
||||
<ListBox Height="300"
|
||||
VerticalAlignment="Top"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Name="RpcItemList"
|
||||
Foreground="White"
|
||||
SelectionChanged="RpcItemList_SelectionChanged"
|
||||
MouseDoubleClick="RpcItemList_MouseDoubleClick"/>
|
||||
</Border>
|
||||
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormName}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,20,0,0"
|
||||
Name="tb_FormName"/>
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormPName}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,60,0,0"
|
||||
Name="tb_FormPName"/>
|
||||
<Label Content=".exe"
|
||||
Foreground="White"
|
||||
FontSize="20" Grid.Column="1"
|
||||
Margin="240,56,0,0"/>
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormClient}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,100,0,0"
|
||||
Name="tb_FormClient"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormState}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,180,0,0"
|
||||
Name="tb_FormState"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormDetails}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,140,0,0"
|
||||
Name="tb_FormDetails"/>
|
||||
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormLargeImgKey}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,220,0,0"
|
||||
Name="tb_FormLargeImgKey"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormLargeImgTXT}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="250,220,0,0"
|
||||
Name="tb_FormLargeImgTxt"/>
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormSmallImgKey}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,260,0,0"
|
||||
Name="tb_FormSmallImgKey"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Style="{StaticResource RpcFormSmallImgTXT}"
|
||||
Height="33"
|
||||
Width="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="250,260,0,0"
|
||||
Name="tb_FormSmallImgTxt"/>
|
||||
<Button Height="30"
|
||||
Width="65"
|
||||
Style="{StaticResource DiscordRpcSaveButton}"
|
||||
Name="DiscordRpcSave"
|
||||
Click="DiscordRpcSave_Click"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Column="1"
|
||||
Margin="20,0,0,5"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Button Height="30"
|
||||
Width="65"
|
||||
Style="{StaticResource DiscordRpcStopButton}"
|
||||
Name="DiscordRpcStop"
|
||||
Click="DiscordRpcStop_Click"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="70,0,0,5"/>
|
||||
<Button Height="30"
|
||||
Width="65"
|
||||
Style="{StaticResource DiscordRpcStartButton}"
|
||||
Name="DiscordRpcStart"
|
||||
Click="DiscordRpcStart_Click"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,5"/>
|
||||
<Button Height="30"
|
||||
Width="65"
|
||||
Style="{StaticResource DiscordRpcNewButton}"
|
||||
Name="DiscordRpcNew"
|
||||
Click="DiscordRpcNew_Click"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="140,0,0,5"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Background="#22202f"
|
||||
CornerRadius="10">
|
||||
<RichTextBox Grid.Row="1"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="White"
|
||||
IsReadOnly="True"
|
||||
IsHitTestVisible="False"
|
||||
Name="RpcLog">
|
||||
<RichTextBox.Resources>
|
||||
<Style TargetType="{x:Type Paragraph}">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
</RichTextBox.Resources>
|
||||
</RichTextBox>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
304
WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
Normal file
304
WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
Normal file
|
@ -0,0 +1,304 @@
|
|||
using Nocksoft.IO.ConfigFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using WeeXnes.Core;
|
||||
using WeeXnes.RPC;
|
||||
using WeeXnes.Core;
|
||||
|
||||
namespace WeeXnes.MVVM.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für DiscordRpcView.xaml
|
||||
/// </summary>
|
||||
public partial class DiscordRpcView : UserControl
|
||||
{
|
||||
//static bool shouldBeRunning = false;
|
||||
BackgroundWorker backgroundWorker = new BackgroundWorker();
|
||||
List<Game> Games = new List<Game>();
|
||||
Game lastSelectedGame = null;
|
||||
public static string logContent = null;
|
||||
public static UpdateVar<string> triggerLogupdate = new UpdateVar<string>();
|
||||
public DiscordRpcView()
|
||||
{
|
||||
InitializeComponent();
|
||||
triggerLogupdate.ValueChanged += () =>
|
||||
{
|
||||
if(logContent != null)
|
||||
{
|
||||
writeLog(logContent);
|
||||
}
|
||||
};
|
||||
InitializeSettings();
|
||||
CheckForAutostart();
|
||||
}
|
||||
|
||||
private void CheckForAutostart()
|
||||
{
|
||||
if (Globals.autoStartRpc)
|
||||
{
|
||||
Globals.autoStartRpc = false;
|
||||
runBackgroundWorker();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeSettings()
|
||||
{
|
||||
backgroundWorker.WorkerReportsProgress = true;
|
||||
backgroundWorker.WorkerSupportsCancellation = true;
|
||||
backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
|
||||
backgroundWorker.DoWork += BackgroundWorker_DoWork;
|
||||
Refresh();
|
||||
}
|
||||
public void writeLog(string _content, bool _timestamp = true)
|
||||
{
|
||||
string timestamp = DateTime.Now.ToString("HH:mm:ss");
|
||||
if (_timestamp)
|
||||
{
|
||||
_content = "[" + timestamp + "] " + _content;
|
||||
}
|
||||
Console.WriteLine(_content);
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
RpcLog.AppendText(_content + "\n");
|
||||
RpcLog.ScrollToEnd();
|
||||
});
|
||||
}
|
||||
|
||||
private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
Globals.isRpcRunning = true;
|
||||
writeLog("Thread Started");
|
||||
bool runWorker = true;
|
||||
int delay = 2000;
|
||||
while (runWorker)
|
||||
{
|
||||
if (backgroundWorker.CancellationPending)
|
||||
{
|
||||
runWorker = false;
|
||||
delay = 0;
|
||||
|
||||
foreach (Game game in Games)
|
||||
{
|
||||
game.stop();
|
||||
}
|
||||
}
|
||||
Process[] processes = Process.GetProcesses();
|
||||
foreach (Game game in Games)
|
||||
{
|
||||
game.checkState(processes);
|
||||
}
|
||||
Thread.Sleep(delay);
|
||||
}
|
||||
}
|
||||
|
||||
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
Globals.isRpcRunning = false;
|
||||
foreach(Game game in Games)
|
||||
{
|
||||
game.isRunning = false;
|
||||
}
|
||||
writeLog("Thread Closed");
|
||||
}
|
||||
public void runBackgroundWorker()
|
||||
{
|
||||
try
|
||||
{
|
||||
backgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Misc.Message message = new Misc.Message(e.ToString());
|
||||
message.Show();
|
||||
}
|
||||
}
|
||||
public void stopBackgroundWorker()
|
||||
{
|
||||
try
|
||||
{
|
||||
backgroundWorker.CancelAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Misc.Message message = new Misc.Message(e.ToString());
|
||||
message.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
readRpcFileDirectory();
|
||||
LoadGamesIntoListBox();
|
||||
}
|
||||
public void generateNewGame()
|
||||
{
|
||||
string filename = Guid.NewGuid().ToString() + ".rpc";
|
||||
Game newGame = new Game(filename, generateIncrementalName(), null, Globals.defaultRpcClient);
|
||||
saveGameToFile(newGame);
|
||||
}
|
||||
public string generateIncrementalName()
|
||||
{
|
||||
Random random = new Random();
|
||||
int randomInt = random.Next(1000);
|
||||
return "New Game " + randomInt;
|
||||
}
|
||||
public void saveGameToFile(Game game)
|
||||
{
|
||||
INIFile rpcFile = new INIFile(Globals.RpcListPath + "\\" + game.fileName, true);
|
||||
rpcFile.SetValue("config", "name", game.Name);
|
||||
rpcFile.SetValue("config", "pname", game.ProcessName);
|
||||
rpcFile.SetValue("config", "id", game.id);
|
||||
rpcFile.SetValue("config", "state", game.state);
|
||||
rpcFile.SetValue("config", "details", game.details);
|
||||
rpcFile.SetValue("config", "BigImgKey", game.bigimgkey);
|
||||
rpcFile.SetValue("config", "SmallImgKey", game.smallimgkey);
|
||||
rpcFile.SetValue("config", "BigImgText", game.bigimgtext);
|
||||
rpcFile.SetValue("config", "SmallImgText", game.smallimgtext);
|
||||
rpcFile.SetValue("config", "FileName", game.fileName);
|
||||
}
|
||||
public void deleteGameFile(Game game)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(Globals.RpcListPath + "\\" + game.fileName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Misc.Message message = new Misc.Message(e.ToString());
|
||||
message.Show();
|
||||
}
|
||||
}
|
||||
public void readRpcFileDirectory()
|
||||
{
|
||||
bool Empty = funcs.IsDirectoryEmpty(Globals.RpcListPath);
|
||||
List<Game> readGames = new List<Game>();
|
||||
if (!Empty)
|
||||
{
|
||||
Console.WriteLine("RpcDir is not Empty, Reading content");
|
||||
string[] files = Directory.GetFiles(Globals.RpcListPath, "*.rpc", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
{
|
||||
INIFile rpcFile = new INIFile(file);
|
||||
string Name = rpcFile.GetValue("config", "name");
|
||||
string ProcessName = rpcFile.GetValue("config", "pname");
|
||||
string id = rpcFile.GetValue("config", "id");
|
||||
string state = rpcFile.GetValue("config", "state");
|
||||
string details = rpcFile.GetValue("config", "details");
|
||||
string bigimgkey = rpcFile.GetValue("config", "BigImgKey");
|
||||
string smallimgkey = rpcFile.GetValue("config", "SmallImgKey");
|
||||
string bigimgtxt = rpcFile.GetValue("config", "BigImgText");
|
||||
string smallimgtxt = rpcFile.GetValue("config", "SmallImgText");
|
||||
string FileName = rpcFile.GetValue("config", "FileName");
|
||||
Game newGame = new Game(FileName, Name, ProcessName, id, state, details, bigimgkey, smallimgkey, bigimgtxt, smallimgtxt);
|
||||
readGames.Add(newGame);
|
||||
}
|
||||
Games.Clear();
|
||||
foreach (Game game in readGames)
|
||||
{
|
||||
//Console.WriteLine("Added " + game + " from file");
|
||||
Games.Add(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void LoadGamesIntoListBox()
|
||||
{
|
||||
RpcItemList.Items.Clear();
|
||||
foreach (Game game in Games)
|
||||
{
|
||||
RpcItemList.Items.Add(game);
|
||||
}
|
||||
}
|
||||
|
||||
private void RpcItemList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (RpcItemList.SelectedItem != null)
|
||||
{
|
||||
Game selectedGame = RpcItemList.SelectedItem as Game;
|
||||
lastSelectedGame = selectedGame;
|
||||
|
||||
|
||||
tb_FormPName.Text = selectedGame.ProcessName;
|
||||
tb_FormClient.Text = selectedGame.id;
|
||||
tb_FormName.Text = selectedGame.Name;
|
||||
tb_FormState.Text = selectedGame.state;
|
||||
tb_FormDetails.Text = selectedGame.details;
|
||||
tb_FormLargeImgKey.Text = selectedGame.bigimgkey;
|
||||
tb_FormLargeImgTxt.Text = selectedGame.bigimgtext;
|
||||
tb_FormSmallImgKey.Text = selectedGame.smallimgkey;
|
||||
tb_FormSmallImgTxt.Text = selectedGame.smallimgtext;
|
||||
}
|
||||
}
|
||||
|
||||
private void RpcItemList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (RpcItemList.SelectedItem != null)
|
||||
{
|
||||
deleteGameFile((Game)RpcItemList.SelectedItem);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void DiscordRpcSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Game selectedItem = lastSelectedGame;
|
||||
if (selectedItem != null)
|
||||
{
|
||||
Game editedGame = new Game(
|
||||
selectedItem.fileName,
|
||||
tb_FormName.Text,
|
||||
tb_FormPName.Text,
|
||||
tb_FormClient.Text,
|
||||
tb_FormState.Text,
|
||||
tb_FormDetails.Text,
|
||||
tb_FormLargeImgKey.Text,
|
||||
tb_FormSmallImgKey.Text,
|
||||
tb_FormLargeImgTxt.Text,
|
||||
tb_FormSmallImgTxt.Text
|
||||
);
|
||||
saveGameToFile(editedGame);
|
||||
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void DiscordRpcStop_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
stopBackgroundWorker();
|
||||
}
|
||||
|
||||
private void DiscordRpcStart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
runBackgroundWorker();
|
||||
}
|
||||
|
||||
private void DiscordRpcNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
generateNewGame();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
stopBackgroundWorker();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
35
WeeXnes/MVVM/View/HomeView.xaml
Normal file
35
WeeXnes/MVVM/View/HomeView.xaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
<UserControl x:Class="WeeXnes.MVVM.View.HomeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeeXnes.MVVM.View"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Welcome to WeeXnes Hub"
|
||||
Foreground="White"
|
||||
FontSize="28"
|
||||
Margin="0,0,0,20"
|
||||
Name="WelcomeMSG"
|
||||
HorizontalAlignment="Center"/>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="300"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="/Images/wicon.png" Grid.Row="0"
|
||||
HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" />
|
||||
<TextBlock Text="WeeXnes Hub" Grid.Row="1"
|
||||
Foreground="White"
|
||||
FontFamily="/Fonts/#Poppins"
|
||||
FontSize="28"
|
||||
HorizontalAlignment="Center"
|
||||
Name="VersionInfo"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</UserControl>
|
41
WeeXnes/MVVM/View/HomeView.xaml.cs
Normal file
41
WeeXnes/MVVM/View/HomeView.xaml.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using WeeXnes.Core;
|
||||
|
||||
namespace WeeXnes.MVVM.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für HomeView.xaml
|
||||
/// </summary>
|
||||
public partial class HomeView : UserControl
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetWelcomeMSG();
|
||||
SetVersionInfo();
|
||||
}
|
||||
|
||||
private void SetVersionInfo()
|
||||
{
|
||||
VersionInfo.Text = VersionInfo.Text + " v" + Globals.version;
|
||||
}
|
||||
|
||||
private void SetWelcomeMSG()
|
||||
{
|
||||
WelcomeMSG.Text = "Welcome, " + Environment.UserName;
|
||||
}
|
||||
}
|
||||
}
|
78
WeeXnes/MVVM/View/KeyManagerView.xaml
Normal file
78
WeeXnes/MVVM/View/KeyManagerView.xaml
Normal file
|
@ -0,0 +1,78 @@
|
|||
<UserControl x:Class="WeeXnes.MVVM.View.KeyManagerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeeXnes.MVVM.View"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="430"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Loaded="StackPanel_Loaded"
|
||||
Grid.Row="0">
|
||||
<TextBlock Text="Key Manager"
|
||||
Foreground="White"
|
||||
FontSize="25"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,0,0,20"/>
|
||||
|
||||
|
||||
<Grid>
|
||||
<Border Background="#22202f"
|
||||
CornerRadius="10"
|
||||
Height="375">
|
||||
<ListView Name="KeyListView"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="KeyListView_SelectionChanged" MouseDoubleClick="KeyListView_MouseDoubleClick"
|
||||
>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding name}"
|
||||
Grid.Column="0"/>
|
||||
<TextBlock Text="{Binding value}"
|
||||
Grid.Column="1"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
|
||||
|
||||
</ListView>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBox Name="Textbox_Name"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Width="250"
|
||||
Style="{StaticResource KeyNameTextbox}"/>
|
||||
<TextBox Name="Textbox_Value"
|
||||
Height="30"
|
||||
HorizontalAlignment="Right"
|
||||
Width="250"
|
||||
Margin="15,0,0,0"
|
||||
Style="{StaticResource KeyValTextbox}"/>
|
||||
<Button Width="90"
|
||||
Height="30"
|
||||
Name="AddButton"
|
||||
Margin="15,0,0,0"
|
||||
Click="AddButton_Click"
|
||||
Content="Add"
|
||||
Style="{StaticResource ModernAddButton}"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
250
WeeXnes/MVVM/View/KeyManagerView.xaml.cs
Normal file
250
WeeXnes/MVVM/View/KeyManagerView.xaml.cs
Normal file
|
@ -0,0 +1,250 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using WeeXnes.Keys;
|
||||
using WeeXnes.Core;
|
||||
using wx;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace WeeXnes.MVVM.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für KeyManagerView.xaml
|
||||
/// </summary>
|
||||
public partial class KeyManagerView : UserControl
|
||||
{
|
||||
|
||||
|
||||
|
||||
public KeyManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
Globals.searchbox_content.ValueChanged += () => { SearchboxChanged(); };
|
||||
}
|
||||
|
||||
public void SearchboxChanged()
|
||||
{
|
||||
Console.WriteLine("Searchbox: " + Globals.searchbox_content.Value);
|
||||
KeyListView.Items.Clear();
|
||||
List<KeyItem> items = new List<KeyItem>();
|
||||
foreach(KeyItem item in KeyManagerLib.KeyList)
|
||||
{
|
||||
if(Contains(item.name, Globals.searchbox_content.Value, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
if(items.Count > 0)
|
||||
{
|
||||
foreach(KeyItem item in items)
|
||||
{
|
||||
KeyListView.Items.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyListView.Items.Clear();
|
||||
}
|
||||
}
|
||||
public bool Contains(string source, string toCheck, StringComparison comp)
|
||||
{
|
||||
return source?.IndexOf(toCheck, comp) >= 0;
|
||||
}
|
||||
|
||||
#region ListControls
|
||||
|
||||
|
||||
public void FillList()
|
||||
{
|
||||
Console.WriteLine("->Filling Listview");
|
||||
KeyListView.Items.Clear();
|
||||
foreach (KeyItem key in KeyManagerLib.KeyList)
|
||||
{
|
||||
KeyListView.Items.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItemFromUI()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Textbox_Name.Text))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Textbox_Value.Text))
|
||||
{
|
||||
KeyItem newkey = new KeyItem(Textbox_Name.Text, Textbox_Value.Text);
|
||||
KeyManagerLib.KeyList.Add(newkey);
|
||||
string filename = Globals.KeyListPath + "\\" + Guid.NewGuid().ToString() + ".wx";
|
||||
string[] filecontent = new string[] { "##WXfile##", newkey.name, EncryptionLib.EncryptorLibary.encrypt(Globals.encryptionKey, newkey.value) };
|
||||
/*
|
||||
INIFile newini = new INIFile(filename, true);
|
||||
newini.SetValue("key", "name", newkey.name);
|
||||
newini.SetValue("key", "value", newkey.value);
|
||||
*/
|
||||
EncryptionLib.EncryptorLibary.writeFile(filecontent, filename);
|
||||
Console.WriteLine("Added: <" + newkey.name + "> Value: " + newkey.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AddItem(string _name, string _value)
|
||||
{
|
||||
KeyItem newkey = new KeyItem(_name, _value);
|
||||
KeyManagerLib.KeyList.Add(newkey);
|
||||
}
|
||||
|
||||
public void PrintList()
|
||||
{
|
||||
Console.WriteLine("-------------------------------");
|
||||
foreach (KeyItem item in KeyManagerLib.KeyList)
|
||||
{
|
||||
Console.WriteLine(item.name + ": " + item.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private void StackPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
KeyManagerLib.KeyList.Clear();
|
||||
CheckForFolders();
|
||||
if (!SaveInterface.IsDirectoryEmpty(Globals.KeyListPath))
|
||||
{
|
||||
string[] files = SaveInterface.GetFilesInDir(Globals.KeyListPath);
|
||||
foreach (string file in files)
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
try
|
||||
{
|
||||
wxfile inifile = new wxfile(file);
|
||||
string name = inifile.GetName();
|
||||
string value = inifile.GetValue();
|
||||
value = EncryptionLib.EncryptorLibary.decrypt(Globals.encryptionKey, value);
|
||||
if (name != null && value != null)
|
||||
{
|
||||
KeyItem newitem = new KeyItem(name, value);
|
||||
KeyManagerLib.KeyList.Add(newitem);
|
||||
Console.WriteLine("Added Item: <" + newitem.name + ">");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
FillList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckForFolders()
|
||||
{
|
||||
if (!Directory.Exists(Globals.AppDataPath))
|
||||
{
|
||||
Directory.CreateDirectory(Globals.AppDataPath);
|
||||
Console.WriteLine("Created AppDataPath");
|
||||
}
|
||||
if (!Directory.Exists(Globals.KeyListPath))
|
||||
{
|
||||
Directory.CreateDirectory(Globals.KeyListPath);
|
||||
Console.WriteLine("Created KeyListPath");
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddItemFromUI();
|
||||
FillList();
|
||||
ClearInputs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void DebugBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PrintList();
|
||||
}
|
||||
|
||||
private void RefreshBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FillList();
|
||||
}
|
||||
|
||||
private void KeyListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
KeyItem selectedItem = (KeyItem)KeyListView.SelectedItem;
|
||||
if(selectedItem != null)
|
||||
{
|
||||
Console.WriteLine(selectedItem.name + ": " + selectedItem.value);
|
||||
if (Globals.copySelectedToClipboard)
|
||||
{
|
||||
Clipboard.SetText(selectedItem.value);
|
||||
}
|
||||
Console.WriteLine("Copied: " + selectedItem.value + " to Clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
private void KeyListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
KeyItem selectedItem = (KeyItem)KeyListView.SelectedItem;
|
||||
Console.WriteLine("Doubleclicked " + selectedItem.name);
|
||||
KeyManagerLib.KeyList.Remove(selectedItem);
|
||||
string[] files = SaveInterface.GetFilesInDir(Globals.KeyListPath);
|
||||
foreach (string file in files)
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
try
|
||||
{
|
||||
wxfile inifile = new wxfile(file);
|
||||
string name = inifile.GetName();
|
||||
string value = inifile.GetValue();
|
||||
if(name == selectedItem.name)
|
||||
{
|
||||
File.Delete(file);
|
||||
Console.WriteLine("Removed File: " + file);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
FillList();
|
||||
}
|
||||
private void ClearInputs()
|
||||
{
|
||||
Textbox_Name.Clear();
|
||||
Textbox_Value.Clear();
|
||||
}
|
||||
|
||||
private void addNameClip_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
Console.WriteLine("fnmgikegnmek");
|
||||
}
|
||||
|
||||
}
|
||||
public static class SaveInterface
|
||||
{
|
||||
public static bool IsDirectoryEmpty(string path)
|
||||
{
|
||||
return !Directory.EnumerateFileSystemEntries(path).Any();
|
||||
}
|
||||
public static string[] GetFilesInDir(string path)
|
||||
{
|
||||
return Directory.GetFiles(path, "*.wx");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
141
WeeXnes/MVVM/View/SettingView.xaml
Normal file
141
WeeXnes/MVVM/View/SettingView.xaml
Normal file
|
@ -0,0 +1,141 @@
|
|||
<UserControl x:Class="WeeXnes.MVVM.View.SettingView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeeXnes.MVVM.View"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="440"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="General"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="23"
|
||||
Grid.Column="0"/>
|
||||
<Label Content="RPC"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="23"
|
||||
Grid.Column="2"/>
|
||||
<Label Content="Key Manager"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="23"
|
||||
Grid.Column="1"/>
|
||||
<Border Grid.Column="0"
|
||||
Background="#22202f"
|
||||
CornerRadius="10"
|
||||
Margin="10,40,10,10">
|
||||
|
||||
<CheckBox VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Name="AlwaysOnTopSwitch"
|
||||
Checked="AlwaysOnTopSwitch_Checked"
|
||||
Unchecked="AlwaysOnTopSwitch_Unchecked"
|
||||
Margin="10,10,0,0">
|
||||
<TextBlock
|
||||
Text="Always On Top"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="15"
|
||||
Foreground="White"/>
|
||||
</CheckBox>
|
||||
|
||||
|
||||
</Border>
|
||||
<Border Grid.Column="2"
|
||||
Background="#22202f"
|
||||
CornerRadius="10"
|
||||
Margin="10,40,10,10">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<CheckBox VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Name="ShowElapsedTimeOnRpc"
|
||||
Checked="ShowElapsedTimeOnRpc_Checked"
|
||||
Unchecked="ShowElapsedTimeOnRpc_Unchecked"
|
||||
Margin="10,10,0,0">
|
||||
<TextBlock
|
||||
Text="Show Elapsed Time"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="15"
|
||||
Foreground="White"/>
|
||||
|
||||
</CheckBox>
|
||||
|
||||
<Label Content="Default RPC ClientID:"
|
||||
Margin="0,0,0,0"
|
||||
FontSize="13"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBox Style="{StaticResource RpcSettingDefault}"
|
||||
Margin="4,0,4,0"
|
||||
Name="tb_DefaultClientID"/>
|
||||
<Button Name="SaveDefaultID"
|
||||
Style="{StaticResource UniversalMaterialButton}"
|
||||
Content="Set Default"
|
||||
Background="#353340"
|
||||
Height="25"
|
||||
Click="SaveDefaultID_Click"
|
||||
Margin="4,10,4,0"/>
|
||||
<CheckBox VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Name="EnableAutoStart"
|
||||
|
||||
|
||||
Margin="10,10,0,0">
|
||||
<TextBlock
|
||||
Text="Enable RPC autostart"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="15"
|
||||
Foreground="White"/>
|
||||
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
</Border>
|
||||
<Border Grid.Column="1"
|
||||
Background="#22202f"
|
||||
CornerRadius="10"
|
||||
Margin="10,40,10,10">
|
||||
|
||||
|
||||
|
||||
<CheckBox VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Name="ItemToClipboardSwitch"
|
||||
Checked="ItemToClipboardSwitch_Checked"
|
||||
Unchecked="ItemToClipboardSwitch_Unchecked"
|
||||
Margin="10,10,0,0">
|
||||
<TextBlock
|
||||
Text="Selected Item to Clipboard"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="15"
|
||||
Foreground="White"/>
|
||||
</CheckBox>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Button Name="OpenAppdataFolder" Grid.Row="1"
|
||||
Style="{StaticResource UniversalMaterialButton}"
|
||||
Content="Open AppData Folder"
|
||||
Background="#353340"
|
||||
Height="30"
|
||||
Width="130"
|
||||
Click="OpenAppdataFolder_Click"/>
|
||||
</Grid>
|
||||
</UserControl>
|
228
WeeXnes/MVVM/View/SettingView.xaml.cs
Normal file
228
WeeXnes/MVVM/View/SettingView.xaml.cs
Normal file
|
@ -0,0 +1,228 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Nocksoft.IO.ConfigFiles;
|
||||
using WeeXnes.Core;
|
||||
|
||||
namespace WeeXnes.MVVM.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für SettingView.xaml
|
||||
/// </summary>
|
||||
public partial class SettingView : UserControl
|
||||
{
|
||||
public SettingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadUiFromSettingsFile();
|
||||
SetFunction();
|
||||
}
|
||||
|
||||
private void SetFunction()
|
||||
{
|
||||
EnableAutoStart.Checked += EnableAutoStart_Checked;
|
||||
EnableAutoStart.Unchecked += EnableAutoStart_Unchecked;
|
||||
}
|
||||
private void UnsetFunction()
|
||||
{
|
||||
EnableAutoStart.Checked -= EnableAutoStart_Checked;
|
||||
EnableAutoStart.Unchecked -= EnableAutoStart_Unchecked;
|
||||
}
|
||||
|
||||
private void LoadUiFromSettingsFile()
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
if (Globals.alwaysOnTop)
|
||||
{
|
||||
AlwaysOnTopSwitch.IsChecked = true;
|
||||
}
|
||||
if (Globals.showElapsedTime)
|
||||
{
|
||||
ShowElapsedTimeOnRpc.IsChecked = true;
|
||||
}
|
||||
|
||||
if (Globals.copySelectedToClipboard)
|
||||
{
|
||||
ItemToClipboardSwitch.IsChecked = true;
|
||||
}
|
||||
bool autoStartRpc = Convert.ToBoolean(SettingsFile.GetValue("RPC", "autoStartRpc"));
|
||||
if (autoStartRpc)
|
||||
{
|
||||
EnableAutoStart.IsChecked = true;
|
||||
}
|
||||
|
||||
|
||||
tb_DefaultClientID.Text = Globals.defaultRpcClient;
|
||||
}
|
||||
public static void CheckSetting()
|
||||
{
|
||||
|
||||
|
||||
if(!File.Exists(Globals.AppDataPath + "\\" + Globals.SettingsFileName))
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("General", "AlwaysOnTop", "false");
|
||||
SettingsFile.SetValue("RPC", "showElapsedTime", "true");
|
||||
SettingsFile.SetValue("KeyManager", "copyToClipboard", "false");
|
||||
SettingsFile.SetValue("RPC", "defaultID", "605116707035676701");
|
||||
CheckSetting();
|
||||
}
|
||||
else
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName);
|
||||
|
||||
Globals.alwaysOnTop = Convert.ToBoolean(SettingsFile.GetValue("General", "AlwaysOnTop"));
|
||||
Console.WriteLine(Globals.alwaysOnTop);
|
||||
Globals.showElapsedTime = Convert.ToBoolean(SettingsFile.GetValue("RPC", "showElapsedTime"));
|
||||
Console.WriteLine(Globals.showElapsedTime);
|
||||
Globals.copySelectedToClipboard = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copyToClipboard"));
|
||||
Console.WriteLine(Globals.copySelectedToClipboard);
|
||||
|
||||
|
||||
Globals.defaultRpcClient = SettingsFile.GetValue("RPC", "defaultID");
|
||||
Console.WriteLine(Globals.defaultRpcClient);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SettingsFile.SetValue("settings", "alwaysOnTop", "false");
|
||||
Globals.alwaysOnTop = false;
|
||||
SettingsFile.SetValue("RPC", "elapsedTime", "true");
|
||||
Globals.showElapsedTime = true;
|
||||
*/
|
||||
}
|
||||
private void AlwaysOnTopSwitch_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("General", "AlwaysOnTop", "true");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
|
||||
private void AlwaysOnTopSwitch_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("General", "AlwaysOnTop", "false");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
private void ShowElapsedTimeOnRpc_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("RPC", "showElapsedTime", "true");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
private void ShowElapsedTimeOnRpc_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("RPC", "showElapsedTime", "false");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
private void ItemToClipboardSwitch_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("KeyManager", "copyToClipboard", "true");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
private void ItemToClipboardSwitch_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
SettingsFile.SetValue("KeyManager", "copyToClipboard", "false");
|
||||
CheckSetting();
|
||||
}
|
||||
|
||||
private void OpenAppdataFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start(Globals.AppDataPath);
|
||||
}
|
||||
|
||||
private void SaveDefaultID_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
if (!String.IsNullOrEmpty(tb_DefaultClientID.Text))
|
||||
{
|
||||
SettingsFile.SetValue("RPC", "defaultID", tb_DefaultClientID.Text);
|
||||
CheckSetting();
|
||||
}
|
||||
else
|
||||
{
|
||||
Misc.Message message = new Misc.Message("Dont leave ClientID empty");
|
||||
message.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public void switchAutoRpc(bool on)
|
||||
{
|
||||
UnsetFunction();
|
||||
|
||||
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
|
||||
if (on)
|
||||
{
|
||||
SettingsFile.SetValue("RPC", "autoStartRpc", "true");
|
||||
EnableAutoStart.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsFile.SetValue("RPC", "autoStartRpc", "false");
|
||||
EnableAutoStart.IsChecked = false;
|
||||
}
|
||||
SetFunction();
|
||||
}
|
||||
private void EnableAutoStart_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool proc_suc;
|
||||
try
|
||||
{
|
||||
Process uacpromp = Process.Start("WeeXnes_UAC.exe", "-EnableAutostart");
|
||||
uacpromp.WaitForExit();
|
||||
proc_suc = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Misc.Message message = new Misc.Message(ex.ToString());
|
||||
message.Show();
|
||||
proc_suc = false;
|
||||
}
|
||||
|
||||
switchAutoRpc(proc_suc);
|
||||
}
|
||||
|
||||
private void EnableAutoStart_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
bool proc_suc;
|
||||
try
|
||||
{
|
||||
Process uacpromp = Process.Start("WeeXnes_UAC.exe", "-DisableAutostart");
|
||||
uacpromp.WaitForExit();
|
||||
proc_suc = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Misc.Message message = new Misc.Message(ex.ToString());
|
||||
message.Show();
|
||||
proc_suc = true;
|
||||
|
||||
}
|
||||
|
||||
switchAutoRpc(proc_suc);
|
||||
}
|
||||
}
|
||||
}
|
12
WeeXnes/MVVM/ViewModel/DiscordRpcViewModel.cs
Normal file
12
WeeXnes/MVVM/ViewModel/DiscordRpcViewModel.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WeeXnes.MVVM.ViewModel
|
||||
{
|
||||
internal class DiscordRpcViewModel
|
||||
{
|
||||
}
|
||||
}
|
12
WeeXnes/MVVM/ViewModel/HomeViewModel.cs
Normal file
12
WeeXnes/MVVM/ViewModel/HomeViewModel.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WeeXnes.MVVM.ViewModel
|
||||
{
|
||||
internal class HomeViewModel
|
||||
{
|
||||
}
|
||||
}
|
12
WeeXnes/MVVM/ViewModel/KeyManagerViewModel.cs
Normal file
12
WeeXnes/MVVM/ViewModel/KeyManagerViewModel.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WeeXnes.MVVM.ViewModel
|
||||
{
|
||||
internal class KeyManagerViewModel
|
||||
{
|
||||
}
|
||||
}
|
62
WeeXnes/MVVM/ViewModel/MainViewModel.cs
Normal file
62
WeeXnes/MVVM/ViewModel/MainViewModel.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WeeXnes.Core;
|
||||
|
||||
namespace WeeXnes.MVVM.ViewModel
|
||||
{
|
||||
internal class MainViewModel : ObservableObject
|
||||
{
|
||||
public RelayCommand HomeViewCommand { get; set; }
|
||||
public RelayCommand KeyManagerViewCommand { get; set; }
|
||||
public RelayCommand DiscordRpcViewCommand { get; set; }
|
||||
public RelayCommand SettingsViewCommand { get; set; }
|
||||
|
||||
|
||||
|
||||
public HomeViewModel HomeVM { get; set; }
|
||||
public KeyManagerViewModel KeyManagerVM { get; set; }
|
||||
public DiscordRpcViewModel DiscordRpcVM { get; set; }
|
||||
public SettingsViewModel SettingsVM { get; set; }
|
||||
|
||||
private object _currentView;
|
||||
|
||||
public object CurrentView
|
||||
{
|
||||
get { return _currentView; }
|
||||
set
|
||||
{
|
||||
_currentView = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
HomeVM = new HomeViewModel();
|
||||
KeyManagerVM = new KeyManagerViewModel();
|
||||
DiscordRpcVM = new DiscordRpcViewModel();
|
||||
SettingsVM = new SettingsViewModel();
|
||||
CurrentView = HomeVM;
|
||||
|
||||
HomeViewCommand = new RelayCommand(o =>
|
||||
{
|
||||
CurrentView = HomeVM;
|
||||
});
|
||||
KeyManagerViewCommand = new RelayCommand(o =>
|
||||
{
|
||||
CurrentView = KeyManagerVM;
|
||||
});
|
||||
DiscordRpcViewCommand = new RelayCommand(o =>
|
||||
{
|
||||
CurrentView = DiscordRpcVM;
|
||||
});
|
||||
SettingsViewCommand = new RelayCommand(o =>
|
||||
{
|
||||
CurrentView = SettingsVM;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
12
WeeXnes/MVVM/ViewModel/SettingsViewModel.cs
Normal file
12
WeeXnes/MVVM/ViewModel/SettingsViewModel.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WeeXnes.MVVM.ViewModel
|
||||
{
|
||||
internal class SettingsViewModel
|
||||
{
|
||||
}
|
||||
}
|
|
@ -4,9 +4,127 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WeeXnes"
|
||||
xmlns:viewModel="clr-namespace:WeeXnes.MVVM.ViewModel"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="350" Width="525">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
Height="600"
|
||||
Width="920"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
Background="Transparent"
|
||||
AllowsTransparency="True"
|
||||
Title="WeeXnes"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Loaded="Window_Loaded"
|
||||
Deactivated="Window_Deactivated"
|
||||
StateChanged="Window_StateChanged"
|
||||
Closing="Window_Closing">
|
||||
|
||||
<Window.DataContext>
|
||||
<viewModel:MainViewModel/>
|
||||
</Window.DataContext>
|
||||
|
||||
<Border Background="#272537"
|
||||
CornerRadius="10"
|
||||
MouseDown="Border_MouseDown">
|
||||
<Grid>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="75"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="WeeXnes"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="White"
|
||||
FontSize="22"
|
||||
Margin="20,0,0,0"
|
||||
FontFamily="/Fonts/#Poppins"/>
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<RadioButton Content="Home"
|
||||
Height="50"
|
||||
Foreground="White"
|
||||
FontSize="14"
|
||||
Style="{StaticResource MenuButtonRoundTheme}"
|
||||
IsChecked="True"
|
||||
Command="{Binding HomeViewCommand}"
|
||||
Name="HomeMenuButton"/>
|
||||
|
||||
<RadioButton Content="Key Manager"
|
||||
Height="50"
|
||||
Foreground="White"
|
||||
FontSize="14"
|
||||
Style="{StaticResource MenuButtonRoundTheme}"
|
||||
Command="{Binding KeyManagerViewCommand}"
|
||||
Name="KMMenuButton"/>
|
||||
|
||||
<RadioButton Content="DiscordRPC"
|
||||
Height="50"
|
||||
Foreground="White"
|
||||
FontSize="14"
|
||||
Style="{StaticResource MenuButtonRoundTheme}"
|
||||
Command="{Binding DiscordRpcViewCommand}"
|
||||
Name="RpcMenuButton"/>
|
||||
|
||||
<RadioButton Content="Settings"
|
||||
Height="50"
|
||||
Foreground="White"
|
||||
FontSize="14"
|
||||
Style="{StaticResource MenuButtonRoundTheme}"
|
||||
Command="{Binding SettingsViewCommand}"
|
||||
Name="SettingsMenuButton"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<TextBox Grid.Column="1"
|
||||
Width="250"
|
||||
Height="40"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="5"
|
||||
Style="{StaticResource ModernTextbox}"
|
||||
TextChanged="Searchbox_TextChanged"
|
||||
Name="Searchbox"
|
||||
/>
|
||||
<Button Width="50"
|
||||
Height="23"
|
||||
Name="MinimizeBtn"
|
||||
Click="MinimizeBtn_Click"
|
||||
Content="―"
|
||||
FontSize="11"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,0,50,0"
|
||||
Style="{StaticResource ModernMinimizeButton}"
|
||||
Grid.Column="1"/>
|
||||
<Button Width="50"
|
||||
Height="23"
|
||||
Name="CloseBtn"
|
||||
Click="CloseBtn_Click"
|
||||
Content="╳"
|
||||
FontSize="11"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource ModernCloseButton}"
|
||||
Grid.Column="1"/>
|
||||
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="10"
|
||||
Content="{Binding CurrentView}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</Window>
|
||||
|
|
|
@ -1,13 +1,176 @@
|
|||
namespace WeeXnes
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using WeeXnes.Core;
|
||||
using WeeXnes.MVVM.View;
|
||||
|
||||
namespace WeeXnes
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
public MainWindow()
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
System.Windows.Forms.NotifyIcon trayIcon = new System.Windows.Forms.NotifyIcon();
|
||||
private ContextMenuStrip trayIconMenu = new ContextMenuStrip();
|
||||
public MainWindow()
|
||||
{
|
||||
buildTrayMenu();
|
||||
trayIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name);
|
||||
trayIcon.Visible = false;
|
||||
trayIcon.DoubleClick += TrayIcon_DoubleClick;
|
||||
trayIcon.ContextMenuStrip = trayIconMenu;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buildTrayMenu()
|
||||
{
|
||||
trayIconMenu.Items.Add("Show Window",null, (sender, args) =>
|
||||
{
|
||||
this.Show();
|
||||
this.WindowState = WindowState.Normal;
|
||||
trayIcon.Visible = false;
|
||||
});
|
||||
//RPC MENU//////////////////////////////////////////////////////////////////////////////////////
|
||||
//monke
|
||||
|
||||
ToolStripMenuItem DiscordMenu = new ToolStripMenuItem("DiscordRPC");
|
||||
|
||||
|
||||
DiscordMenu.DropDownItems.Add("Stop DiscordRPC",null, (sender, args) =>
|
||||
{
|
||||
controllRpcFromTray(false);
|
||||
});
|
||||
DiscordMenu.DropDownItems.Add("Start DiscordRPC",null, (sender, args) =>
|
||||
{
|
||||
controllRpcFromTray(true);
|
||||
});
|
||||
|
||||
trayIconMenu.Items.Add(DiscordMenu);
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
trayIconMenu.Items.Add("Exit",null, (sender, args) =>
|
||||
{
|
||||
this.Close();
|
||||
});
|
||||
trayIconMenu.Opening += (sender, args) =>
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void controllRpcFromTray(bool start)
|
||||
{
|
||||
|
||||
//set tray controlls.
|
||||
if (start)
|
||||
{
|
||||
HomeMenuButton.Command.Execute(null);
|
||||
HomeMenuButton.IsChecked = true;
|
||||
Globals.autoStartRpc = true;
|
||||
RpcMenuButton.Command.Execute(null);
|
||||
RpcMenuButton.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
HomeMenuButton.Command.Execute(null);
|
||||
HomeMenuButton.IsChecked = true;
|
||||
}
|
||||
}
|
||||
private void TrayIcon_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
this.Show();
|
||||
this.WindowState = WindowState.Normal;
|
||||
trayIcon.Visible = false;
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckForFolders();
|
||||
CheckForSettingsFile();
|
||||
CheckForAutoStartup();
|
||||
}
|
||||
|
||||
private void CheckForSettingsFile()
|
||||
{
|
||||
SettingView.CheckSetting();
|
||||
}
|
||||
|
||||
private void Border_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
this.DragMove();
|
||||
}
|
||||
|
||||
private void Searchbox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
Globals.searchbox_content.Value = Searchbox.Text;
|
||||
}
|
||||
|
||||
private void CloseBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void MinimizeBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void CheckForAutoStartup()
|
||||
{
|
||||
if (Globals.autoStartRpc)
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
RpcMenuButton.Command.Execute(null);
|
||||
RpcMenuButton.IsChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckForFolders()
|
||||
{
|
||||
if (!Directory.Exists(Globals.AppDataPath))
|
||||
{
|
||||
Directory.CreateDirectory(Globals.AppDataPath);
|
||||
Console.WriteLine("Created AppDataPath");
|
||||
}
|
||||
if (!Directory.Exists(Globals.RpcListPath))
|
||||
{
|
||||
Directory.CreateDirectory(Globals.RpcListPath);
|
||||
Console.WriteLine("Created RpcListPath");
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
Window window = (Window)sender;
|
||||
if (Globals.alwaysOnTop)
|
||||
{
|
||||
window.Topmost = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Topmost = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_StateChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == System.Windows.WindowState.Minimized)
|
||||
{
|
||||
this.Hide();
|
||||
trayIcon.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
trayIcon.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
87
WeeXnes/Misc/EncryptorLibary.cs
Normal file
87
WeeXnes/Misc/EncryptorLibary.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.IO;
|
||||
|
||||
namespace EncryptionLib
|
||||
{
|
||||
public static class EncryptorLibary
|
||||
{
|
||||
public static string encrypt(string hash, string texttenc)
|
||||
{
|
||||
string returnval = "";
|
||||
byte[] data = UTF8Encoding.UTF8.GetBytes(texttenc);
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
|
||||
using (TripleDESCryptoServiceProvider tripDes = new TripleDESCryptoServiceProvider() { Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
|
||||
{
|
||||
ICryptoTransform transform = tripDes.CreateEncryptor();
|
||||
byte[] result = transform.TransformFinalBlock(data, 0, data.Length);
|
||||
returnval = Convert.ToBase64String(result, 0, result.Length);
|
||||
}
|
||||
}
|
||||
return returnval;
|
||||
}
|
||||
public static string decrypt(string hash, string texttenc)
|
||||
{
|
||||
string returnval = "";
|
||||
byte[] data = Convert.FromBase64String(texttenc);
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
|
||||
using (TripleDESCryptoServiceProvider tripDes = new TripleDESCryptoServiceProvider() { Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
|
||||
{
|
||||
ICryptoTransform transform = tripDes.CreateDecryptor();
|
||||
try
|
||||
{
|
||||
byte[] result = transform.TransformFinalBlock(data, 0, data.Length);
|
||||
returnval = UTF8Encoding.UTF8.GetString(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
returnval = "Wrong Hash";
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnval;
|
||||
}
|
||||
public static string[] readFile(string filepath)
|
||||
{
|
||||
string[] lines = System.IO.File.ReadAllLines(filepath);
|
||||
var listOfStrings = new List<string>();
|
||||
foreach (string line in lines)
|
||||
{
|
||||
listOfStrings.Add(line);
|
||||
}
|
||||
string[] arrayOfStrings = listOfStrings.ToArray();
|
||||
return arrayOfStrings;
|
||||
}
|
||||
public static void writeFile(string[] stringArray, string filepath)
|
||||
{
|
||||
for (int i = 0; i < stringArray.Length; i++)
|
||||
{
|
||||
Console.WriteLine(stringArray[i]);
|
||||
}
|
||||
File.WriteAllLines(filepath, stringArray, Encoding.UTF8);
|
||||
}
|
||||
public static string[] encryptArray(string hash, string[] arrayToEncrypt)
|
||||
{
|
||||
for (int i = 0; i < arrayToEncrypt.Length; i++)
|
||||
{
|
||||
arrayToEncrypt[i] = EncryptorLibary.encrypt(hash, arrayToEncrypt[i]);
|
||||
}
|
||||
return arrayToEncrypt;
|
||||
}
|
||||
public static string[] decryptArray(string hash, string[] arrayToDecrypt)
|
||||
{
|
||||
for (int i = 0; i < arrayToDecrypt.Length; i++)
|
||||
{
|
||||
arrayToDecrypt[i] = EncryptorLibary.decrypt(hash, arrayToDecrypt[i]);
|
||||
}
|
||||
return arrayToDecrypt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
305
WeeXnes/Misc/INIFile.cs
Normal file
305
WeeXnes/Misc/INIFile.cs
Normal file
|
@ -0,0 +1,305 @@
|
|||
/**
|
||||
* Copyright by Nocksoft
|
||||
* https://www.nocksoft.de
|
||||
* https://nocksoft.de/tutorials/visual-c-sharp-arbeiten-mit-ini-dateien/
|
||||
* https://github.com/Nocksoft/INIFile
|
||||
* -----------------------------------
|
||||
* Author: Rafael Nockmann @ Nocksoft
|
||||
* Updated: 2017-08-23
|
||||
* Version: 1.0.3
|
||||
*
|
||||
* Language: Visual C#
|
||||
*
|
||||
* License: MIT license
|
||||
*
|
||||
* Description:
|
||||
* Provides basic functions for working with INI files.
|
||||
*
|
||||
* ##############################################################################################
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace Nocksoft.IO.ConfigFiles
|
||||
{
|
||||
public class INIFile
|
||||
{
|
||||
private string _File;
|
||||
|
||||
/// <summary>
|
||||
/// Aufruf des Konstruktors initialisiert ein Objekt der Klasse INIFile.
|
||||
/// </summary>
|
||||
/// <param name="file">INI-Datei, auf der zugegriffen werden soll.</param>
|
||||
/// <param name="createFile">Gibt an, ob die Datei erstellt werden soll, wenn diese nicht vorhanden ist.</param>
|
||||
public INIFile(string file, bool createFile = false)
|
||||
{
|
||||
if (createFile == true && File.Exists(file) == false)
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(file);
|
||||
FileStream fileStream = fileInfo.Create();
|
||||
fileStream.Close();
|
||||
}
|
||||
_File = file;
|
||||
}
|
||||
|
||||
#region Öffentliche Methoden
|
||||
|
||||
/// <summary>
|
||||
/// Entfernt alle Kommentare und leeren Zeilen aus einer kompletten Section und gibt diese zurück.
|
||||
/// Die Methode ist nicht Case-sensitivity und ignoriert daher Groß- und Kleinschreibung.
|
||||
/// Der Rückgabewert enthält keine Leerzeichen.
|
||||
/// </summary>
|
||||
/// <param name="section">Name der angeforderten Section.</param>
|
||||
/// <param name="getComments">Gibt an, ob Kommentare berücksichtigt werden sollen.</param>
|
||||
/// <returns>Gibt die komplette Section zurück.</returns>
|
||||
public List<string> GetSection(string section, bool getComments = false)
|
||||
{
|
||||
// Stellt sicher, dass eine Section immer im folgenden Format vorliegt: [section]
|
||||
section = CheckSection(section);
|
||||
|
||||
List<string> completeSection = new List<string>();
|
||||
bool sectionStart = false;
|
||||
|
||||
// Liest die Zieldatei ein
|
||||
string[] fileArray = File.ReadAllLines(_File);
|
||||
|
||||
foreach (var item in fileArray)
|
||||
{
|
||||
if (item.Length <= 0) continue;
|
||||
|
||||
// Wenn die gewünschte Section erreicht ist
|
||||
if (item.Replace(" ", "").ToLower() == section)
|
||||
{
|
||||
sectionStart = true;
|
||||
}
|
||||
// Wenn auf eine neue Section getroffen wird, wird die Schleife beendet
|
||||
if (sectionStart == true && item.Replace(" ", "").ToLower() != section && item.Replace(" ", "").Substring(0, 1) == "[" && item.Replace(" ", "").Substring(item.Length - 1, 1) == "]")
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (sectionStart == true)
|
||||
{
|
||||
// Wenn der Eintrag kein Kommentar und kein leerer Eintrag ist, wird er der List<string> completeSection hinzugefügt
|
||||
if (getComments == false
|
||||
&& item.Replace(" ", "").Substring(0, 1) != ";" && !string.IsNullOrWhiteSpace(item))
|
||||
{
|
||||
completeSection.Add(ReplaceScpacesAtStartAndEnd(item));
|
||||
}
|
||||
if (getComments == true && !string.IsNullOrWhiteSpace(item))
|
||||
{
|
||||
completeSection.Add(ReplaceScpacesAtStartAndEnd(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
return completeSection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Die Methode gibt einen Wert zum dazugehörigen Key zurück.
|
||||
/// Die Methode ist nicht Case-sensitivity und ignoriert daher Groß- und Kleinschreibung.
|
||||
/// </summary>
|
||||
/// <param name="section">Name der angeforderten Section.</param>
|
||||
/// <param name="key">Name des angeforderten Keys.</param>
|
||||
/// <param name="convertKeyToLower">Wenn "true" übergeben wird, wird der Rückgabewert in Kleinbuchstaben zurückgegeben.</param>
|
||||
/// <returns>Gibt, wenn vorhanden, den Wert zu dem angegebenen Key in der angegeben Section zurück.</returns>
|
||||
public string GetValue(string section, string key, bool convertValueToLower = false)
|
||||
{
|
||||
// Stellt sicher, dass eine Section immer im folgenden Format vorliegt: [section]
|
||||
section = CheckSection(section);
|
||||
key = key.ToLower();
|
||||
|
||||
List<string> completeSection = GetSection(section);
|
||||
|
||||
foreach (var item in completeSection)
|
||||
{
|
||||
// In Schleife fortfahren, wenn kein Key
|
||||
if (!item.Contains("=") && item.Contains("[") && item.Contains("]")) continue;
|
||||
|
||||
string[] keyAndValue = item.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (keyAndValue[0].ToLower() == key && keyAndValue.Count() > 1)
|
||||
{
|
||||
if (convertValueToLower == true)
|
||||
{
|
||||
keyAndValue[1] = keyAndValue[1].ToLower();
|
||||
}
|
||||
return keyAndValue[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert einen Wert des dazugehörigen Schlüssels in der angegebenen Section.
|
||||
/// </summary>
|
||||
/// <param name="section">Name der Section, in dem sich der Schlüssel befindet.</param>
|
||||
/// <param name="key">Name des Schlüssels, dessen Wert geändert werden soll.</param>
|
||||
/// <param name="value">Neuer Wert.</param>
|
||||
/// <param name="convertValueToLower">Wenn "true" übergeben wird, wird der Wert in Kleinbuchstaben gespeichert.</param>
|
||||
public void SetValue(string section, string key, string value, bool convertValueToLower = false)
|
||||
{
|
||||
// Stellt sicher, dass eine Section immer im folgenden Format vorliegt: [section]
|
||||
section = CheckSection(section);
|
||||
string keyToLower = key.ToLower();
|
||||
|
||||
// Prüft, ob die gesuchte Section gefunden wurde
|
||||
bool sectionFound = false;
|
||||
|
||||
List<string> newFileContent = new List<string>();
|
||||
|
||||
// Liest die Zieldatei ein
|
||||
string[] fileLines = File.ReadAllLines(_File);
|
||||
|
||||
// Wenn die Zieldatei leer ist...
|
||||
if (fileLines.Length <= 0)
|
||||
{
|
||||
newFileContent = CreateSection(newFileContent, section, value, key, convertValueToLower);
|
||||
WriteFile(newFileContent);
|
||||
return;
|
||||
}
|
||||
|
||||
// ...sonst wird jede Zeile durchsucht
|
||||
for (int i = 0; i < fileLines.Length; i++)
|
||||
{
|
||||
// Option 1 -> Gewünschte Section wurde (noch) nicht gefunden
|
||||
if (fileLines[i].Replace(" ", "").ToLower() != section)
|
||||
{
|
||||
newFileContent.Add(fileLines[i]);
|
||||
// Wenn Section nicht vorhanden ist, wird diese erzeugt
|
||||
if (i == fileLines.Length - 1 && fileLines[i].Replace(" ", "").ToLower() != section && sectionFound == false)
|
||||
{
|
||||
newFileContent.Add(null);
|
||||
newFileContent = CreateSection(newFileContent, section, value, key, convertValueToLower);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Option 2 -> Gewünschte Section wurde gefunden
|
||||
sectionFound = true;
|
||||
|
||||
// Enthält die komplette Section, in der sich der Zielschlüssel befindet
|
||||
List<string> targetSection = GetSection(section, true);
|
||||
|
||||
// Jeden Eintrag in der Section, in der sich der Zielschlüssel befindet, durchgehen
|
||||
for (int x = 0; x < targetSection.Count; x++)
|
||||
{
|
||||
string[] targetKey = targetSection[x].Split(new string[] { "=" }, StringSplitOptions.None);
|
||||
// Wenn der Zielschlüssel gefunden ist
|
||||
if (targetKey[0].ToLower() == keyToLower)
|
||||
{
|
||||
// Prüft, in welcher Schreibweise die Werte abgespeichert werden sollen
|
||||
if (convertValueToLower == true)
|
||||
{
|
||||
newFileContent.Add(keyToLower + "=" + value.ToLower());
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileContent.Add(key + "=" + value);
|
||||
}
|
||||
i = i + x;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileContent.Add(targetSection[x]);
|
||||
// Wenn Key nicht vorhanden ist, wird dieser erzeugt
|
||||
if (x == targetSection.Count - 1 && targetKey[0].ToLower() != keyToLower)
|
||||
{
|
||||
// Prüft, in welcher Schreibweise die Werte abgespeichert werden sollen
|
||||
if (convertValueToLower == true)
|
||||
{
|
||||
newFileContent.Add(keyToLower + "=" + value.ToLower());
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileContent.Add(key + "=" + value);
|
||||
}
|
||||
i = i + x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WriteFile(newFileContent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methoden
|
||||
|
||||
/// <summary>
|
||||
/// Stellt sicher, dass eine Section immer im folgenden Format vorliegt: [section]
|
||||
/// </summary>
|
||||
/// <param name="section">Section, die auf korrektes Format geprüft werden soll.</param>
|
||||
/// <returns>Gibt Section in dieser Form zurück: [section]</returns>
|
||||
private string CheckSection(string section)
|
||||
{
|
||||
section = section.ToLower();
|
||||
if (section.Substring(0, 1) != "[" && section.Substring(section.Length - 1, 1) != "]")
|
||||
{
|
||||
section = "[" + section + "]";
|
||||
}
|
||||
return section;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entfernt voranstehende und hintenstehende Leerzeichen bei Sections, Keys und Values.
|
||||
/// </summary>
|
||||
/// <param name="item">String, der gekürzt werden soll.</param>
|
||||
/// <returns>Gibt einen gekürzten String zurück.</returns>
|
||||
private string ReplaceScpacesAtStartAndEnd(string item)
|
||||
{
|
||||
// Wenn der Eintrag einen Schlüssel und einen Wert hat
|
||||
if (item.Contains("=") && !item.Contains("[") && !item.Contains("]"))
|
||||
{
|
||||
string[] keyAndValue = item.Split(new string[] { "=" }, StringSplitOptions.None);
|
||||
return keyAndValue[0].Trim() + "=" + keyAndValue[1].Trim();
|
||||
}
|
||||
|
||||
return item.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legt eine neue Section an.
|
||||
/// </summary>
|
||||
/// <param name="newSettings">Liste newSettings aus SetValue.</param>
|
||||
/// <param name="section">section die angelegt werden soll.</param>
|
||||
/// <param name="value">Wert der hinzugefügt werden soll.</param>
|
||||
/// <param name="key">Schlüssel der hinzugefügt werden soll.</param>
|
||||
/// <param name="convertValueToLower">Gibt an, ob Schlüssel und Wert in Kleinbuchstaben abgespeichert werden sollen.</param>
|
||||
/// <returns></returns>
|
||||
private List<string> CreateSection(List<string> newSettings, string section, string value, string key, bool convertValueToLower)
|
||||
{
|
||||
string keyToLower = key.ToLower();
|
||||
|
||||
newSettings.Add(section);
|
||||
// Prüft, in welcher Schreibweise die Werte abgespeichert werden sollen
|
||||
if (convertValueToLower == true)
|
||||
{
|
||||
newSettings.Add(keyToLower + "=" + value.ToLower());
|
||||
}
|
||||
else
|
||||
{
|
||||
newSettings.Add(key + "=" + value);
|
||||
}
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
private void WriteFile(List<string> content)
|
||||
{
|
||||
StreamWriter writer = new StreamWriter(_File);
|
||||
foreach (var item in content)
|
||||
{
|
||||
writer.WriteLine(item);
|
||||
}
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
34
WeeXnes/Misc/Message.xaml
Normal file
34
WeeXnes/Misc/Message.xaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<Window x:Class="WeeXnes.Misc.Message"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WeeXnes.Misc"
|
||||
mc:Ignorable="d"
|
||||
Title="Message" Height="150" Width="300"
|
||||
ResizeMode="NoResize"
|
||||
Background="#272537"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
SizeToContent="WidthAndHeight">
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Placeholder"
|
||||
Name="MessageLabel"
|
||||
Foreground="White"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"/>
|
||||
<Button Grid.Row="1"
|
||||
Style="{StaticResource UniversalMaterialButton}"
|
||||
Content="OK"
|
||||
Width="140"
|
||||
Height="40"
|
||||
Background="#353340"
|
||||
Name="okButton"
|
||||
Click="okButton_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
33
WeeXnes/Misc/Message.xaml.cs
Normal file
33
WeeXnes/Misc/Message.xaml.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace WeeXnes.Misc
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Message.xaml
|
||||
/// </summary>
|
||||
public partial class Message : Window
|
||||
{
|
||||
public Message(string _message)
|
||||
{
|
||||
InitializeComponent();
|
||||
MessageLabel.Content = _message;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
82
WeeXnes/Misc/wxfile.cs
Normal file
82
WeeXnes/Misc/wxfile.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
#pragma warning disable CS0168
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace wx
|
||||
{
|
||||
public class wxfile
|
||||
{
|
||||
public string path { get; set; }
|
||||
public wxfile(string _path)
|
||||
{
|
||||
this.path = _path;
|
||||
}
|
||||
public string GetName()
|
||||
{
|
||||
string returnval = null;
|
||||
string[] rawcontent = wxfilefuncs.readFile(this.path);
|
||||
|
||||
if (wxfilefuncs.verify(rawcontent))
|
||||
{
|
||||
try
|
||||
{
|
||||
returnval = rawcontent[1];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
returnval = null;
|
||||
}
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
public string GetValue()
|
||||
{
|
||||
string returnval = null;
|
||||
string[] rawcontent = wxfilefuncs.readFile(this.path);
|
||||
|
||||
if (wxfilefuncs.verify(rawcontent))
|
||||
{
|
||||
try
|
||||
{
|
||||
returnval = rawcontent[2];
|
||||
}catch (Exception e)
|
||||
{
|
||||
returnval = null;
|
||||
}
|
||||
}
|
||||
|
||||
return returnval;
|
||||
}
|
||||
}
|
||||
public class wxfilefuncs
|
||||
{
|
||||
|
||||
public static string[] readFile(string filepath)
|
||||
{
|
||||
string[] lines = System.IO.File.ReadAllLines(filepath);
|
||||
var listOfStrings = new List<string>();
|
||||
foreach (string line in lines)
|
||||
{
|
||||
listOfStrings.Add(line);
|
||||
}
|
||||
string[] arrayOfStrings = listOfStrings.ToArray();
|
||||
return arrayOfStrings;
|
||||
}
|
||||
public static bool verify(string[] content)
|
||||
{
|
||||
bool integ = false;
|
||||
if(content != null)
|
||||
{
|
||||
if(content[0] == "##WXfile##")
|
||||
{
|
||||
integ = true;
|
||||
}
|
||||
}
|
||||
return integ;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,11 +33,11 @@ using System.Windows;
|
|||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
|
@ -52,4 +52,4 @@ using System.Windows;
|
|||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
102
WeeXnes/Properties/Resources.Designer.cs
generated
102
WeeXnes/Properties/Resources.Designer.cs
generated
|
@ -10,62 +10,60 @@
|
|||
|
||||
namespace WeeXnes.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder",
|
||||
"4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance",
|
||||
"CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WeeXnes.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
|
||||
.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp =
|
||||
new global::System.Resources.ResourceManager("WeeXnes.Properties.Resources",
|
||||
typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
|
||||
.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get { return resourceCulture; }
|
||||
set { resourceCulture = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
149
WeeXnes/RPC/Game.cs
Normal file
149
WeeXnes/RPC/Game.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WeeXnes.Core;
|
||||
using WeeXnes.MVVM.View;
|
||||
using DiscordRPC;
|
||||
|
||||
namespace WeeXnes.RPC
|
||||
{
|
||||
public class Game
|
||||
{
|
||||
public DiscordRpcClient client { get; set; }
|
||||
public string id { get; set; }
|
||||
public string state { get; set; }
|
||||
public string details { get; set; }
|
||||
public string ProcessName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string bigimgkey { get; set; }
|
||||
public string smallimgkey { get; set; }
|
||||
public string bigimgtext { get; set; }
|
||||
public string smallimgtext { get; set; }
|
||||
public bool isRunning { get; set; }
|
||||
public string fileName { get; set; }
|
||||
public Game(string _fileName, string _name, string _pname = null, string _id = null, string _state = null, string _details = null, string _bigimgkey = null, string _smallimgkey = null, string _bigimgtext = null, string _smallimgtext = null)
|
||||
{
|
||||
this.fileName = _fileName;
|
||||
this.id = _id;
|
||||
this.state = _state;
|
||||
this.details = _details;
|
||||
this.Name = _name;
|
||||
this.ProcessName = _pname;
|
||||
this.bigimgkey = _bigimgkey;
|
||||
this.smallimgkey = _smallimgkey;
|
||||
this.bigimgtext = _bigimgtext;
|
||||
this.smallimgtext = _smallimgtext;
|
||||
this.client = new DiscordRpcClient(id);
|
||||
}
|
||||
public void start()
|
||||
{
|
||||
if (!client.IsInitialized)
|
||||
{
|
||||
client.Initialize();
|
||||
}
|
||||
client.OnReady += (sender, e) =>
|
||||
{
|
||||
/*
|
||||
Globals.logContent.Value = "[" + this.ProcessName + ".exe] -> Received Ready from user " + e.User.Username;
|
||||
Globals.logUpdateTrigger.Value = "mgjnoeimgje";
|
||||
*/
|
||||
DiscordRpcView.logContent = "[" + this.ProcessName + ".exe] -> Received Ready from user " + e.User.Username;
|
||||
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
|
||||
};
|
||||
client.OnPresenceUpdate += (sender, e) =>
|
||||
{
|
||||
/*
|
||||
Globals.logContent.Value = "[" + this.ProcessName + ".exe] ->Received Update!";
|
||||
Globals.logUpdateTrigger.Value = "mgjnoeimgje";
|
||||
*/
|
||||
DiscordRpcView.logContent = "[" + this.ProcessName + ".exe] -> Received Update on RPC";
|
||||
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
|
||||
|
||||
};
|
||||
client.SetPresence(new RichPresence()
|
||||
{
|
||||
Details = this.details,
|
||||
State = this.state,
|
||||
Assets = new Assets()
|
||||
{
|
||||
LargeImageKey = this.bigimgkey,
|
||||
LargeImageText = this.bigimgtext,
|
||||
SmallImageKey = this.smallimgkey,
|
||||
SmallImageText = this.smallimgtext
|
||||
}
|
||||
});
|
||||
client.UpdateStartTime();
|
||||
}
|
||||
public void stop()
|
||||
{
|
||||
if (this.client.IsInitialized)
|
||||
{
|
||||
client.ClearPresence();
|
||||
}
|
||||
}
|
||||
public void checkState(Process[] processes)
|
||||
{
|
||||
if(!String.IsNullOrEmpty(this.ProcessName))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(this.id))
|
||||
{
|
||||
bool foundProcess = false;
|
||||
foreach (Process process in processes)
|
||||
{
|
||||
if (process.ProcessName == this.ProcessName)
|
||||
{
|
||||
foundProcess = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.isRunning)
|
||||
{
|
||||
if (foundProcess)
|
||||
{
|
||||
//Do when Process is launched
|
||||
//message.running(this.ProcessName);
|
||||
start();
|
||||
|
||||
string output = this.Name + " [" + this.ProcessName + ".exe] started";
|
||||
/*
|
||||
Globals.logContent.Value = output;
|
||||
Globals.logUpdateTrigger.Value = "mjfgoklemkgoeg";
|
||||
*/
|
||||
DiscordRpcView.logContent = output;
|
||||
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
|
||||
this.isRunning = true;
|
||||
}
|
||||
}
|
||||
if (this.isRunning)
|
||||
{
|
||||
if (!foundProcess)
|
||||
{
|
||||
//Do when Process is closed
|
||||
//message.closed(this.ProcessName);
|
||||
stop();
|
||||
string output = this.Name + " [" + this.ProcessName + ".exe] closed";
|
||||
/*
|
||||
Globals.logContent.Value = output;
|
||||
Globals.logUpdateTrigger.Value = "mjfgoklemkgoeg";
|
||||
*/
|
||||
DiscordRpcView.logContent = output;
|
||||
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
|
||||
|
||||
this.isRunning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
}
|
||||
}
|
103
WeeXnes/Theme/ControlButtonTheme.xaml
Normal file
103
WeeXnes/Theme/ControlButtonTheme.xaml
Normal file
|
@ -0,0 +1,103 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="ModernAddButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="Add"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="ModernCloseButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="0"
|
||||
Background="#b82727">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="{TemplateBinding Property=Content}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"
|
||||
Margin="0,0,0,5"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="ModernMinimizeButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="0"
|
||||
Background="#22202f">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="{TemplateBinding Property=Content}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="UniversalMaterialButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="{TemplateBinding Background}">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="{TemplateBinding Property=Content}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
559
WeeXnes/Theme/DiscordRpcTheme.xaml
Normal file
559
WeeXnes/Theme/DiscordRpcTheme.xaml
Normal file
|
@ -0,0 +1,559 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="DiscordRpcStartButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="Start"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="DiscordRpcNewButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="New"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="DiscordRpcSaveButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="Save"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}"
|
||||
x:Key="DiscordRpcStopButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBlock Text="Stop"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormName">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Name (for List)"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormPName">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Process Name"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormClient">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Client ID"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormDetails">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Details"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormState">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="State"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormLargeImgKey">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Large Image Key"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormLargeImgTXT">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Large Image Text"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormSmallImgKey">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Small Image Key"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcFormSmallImgTXT">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Small Image Text"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="RpcSettingDefault">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Default ClientID"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
64
WeeXnes/Theme/MenuButtonTheme.xaml
Normal file
64
WeeXnes/Theme/MenuButtonTheme.xaml
Normal file
|
@ -0,0 +1,64 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style BasedOn="{StaticResource {x:Type ToggleButton}}"
|
||||
TargetType="{x:Type RadioButton}"
|
||||
x:Key="MenuButtonTheme">
|
||||
<Style.Setters>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
|
||||
<Grid VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}">
|
||||
|
||||
<TextBlock Text="{TemplateBinding Property=Content}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="50,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="#22202f"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource {x:Type ToggleButton}}"
|
||||
TargetType="{x:Type RadioButton}"
|
||||
x:Key="MenuButtonRoundTheme">
|
||||
<Style.Setters>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
|
||||
<Grid VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="10">
|
||||
<TextBlock Text="{TemplateBinding Property=Content}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="50,0,0,0"/>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="#22202f"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
35
WeeXnes/Theme/ModernCheckbox.xaml
Normal file
35
WeeXnes/Theme/ModernCheckbox.xaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style BasedOn="{StaticResource {x:Type ToggleButton}}"
|
||||
TargetType="{x:Type CheckBox}"
|
||||
x:Key="ModernChecbox">
|
||||
<Style.Setters>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="CheckBox">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<CheckBox Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="DarkGray"
|
||||
Background="#353340"
|
||||
Margin="5,0,0,0"
|
||||
BorderThickness="0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="#22202f"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
143
WeeXnes/Theme/TextBoxTheme.xaml
Normal file
143
WeeXnes/Theme/TextBoxTheme.xaml
Normal file
|
@ -0,0 +1,143 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="ModernTextbox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Search..."
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="KeyNameTextbox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Key Name..."
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
|
||||
<Style TargetType="{x:Type TextBox}"
|
||||
x:Key="KeyValTextbox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Border CornerRadius="10"
|
||||
Background="#353340">
|
||||
<Grid>
|
||||
<Rectangle StrokeThickness="1"/>
|
||||
<TextBox Margin="1"
|
||||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, UpdateSourceTrigger=PropertyChanged}"
|
||||
BorderThickness="0"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Center"
|
||||
Padding="5"
|
||||
Foreground="#cfcfcf"
|
||||
x:Name="SearchBox"/>
|
||||
<TextBlock IsHitTestVisible="False"
|
||||
Text="Key Value"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="DarkGray"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Hidden"/>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
||||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
|
@ -14,6 +13,7 @@
|
|||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -35,22 +35,31 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Data"/>
|
||||
<Reference Include="System.Xml"/>
|
||||
<Reference Include="DiscordRPC, Version=1.0.175.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DiscordRichPresence.1.0.175\lib\net35\DiscordRPC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase"/>
|
||||
<Reference Include="PresentationCore"/>
|
||||
<Reference Include="PresentationFramework"/>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="RPC\Game.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -59,12 +68,40 @@
|
|||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Globals.cs" />
|
||||
<Compile Include="Core\ObservableObject.cs" />
|
||||
<Compile Include="Core\RelayCommand.cs" />
|
||||
<Compile Include="Keys\KeyItem.cs" />
|
||||
<Compile Include="Keys\KeyManagerLib.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Misc\Message.xaml" />
|
||||
<Page Include="MVVM\View\DiscordRpcView.xaml" />
|
||||
<Page Include="MVVM\View\HomeView.xaml" />
|
||||
<Page Include="MVVM\View\KeyManagerView.xaml" />
|
||||
<Page Include="MVVM\View\SettingView.xaml" />
|
||||
<Page Include="Theme\ControlButtonTheme.xaml" />
|
||||
<Page Include="Theme\DiscordRpcTheme.xaml" />
|
||||
<Page Include="Theme\MenuButtonTheme.xaml" />
|
||||
<Page Include="Theme\ModernCheckbox.xaml" />
|
||||
<Page Include="Theme\TextBoxTheme.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Misc\EncryptorLibary.cs" />
|
||||
<Compile Include="Misc\INIFile.cs" />
|
||||
<Compile Include="Misc\Message.xaml.cs" />
|
||||
<Compile Include="Misc\wxfile.cs" />
|
||||
<Compile Include="MVVM\ViewModel\DiscordRpcViewModel.cs" />
|
||||
<Compile Include="MVVM\ViewModel\HomeViewModel.cs" />
|
||||
<Compile Include="MVVM\ViewModel\KeyManagerViewModel.cs" />
|
||||
<Compile Include="MVVM\ViewModel\MainViewModel.cs" />
|
||||
<Compile Include="MVVM\ViewModel\SettingsViewModel.cs" />
|
||||
<Compile Include="MVVM\View\DiscordRpcView.xaml.cs" />
|
||||
<Compile Include="MVVM\View\HomeView.xaml.cs" />
|
||||
<Compile Include="MVVM\View\KeyManagerView.xaml.cs" />
|
||||
<Compile Include="MVVM\View\SettingView.xaml.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -79,7 +116,16 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config"/>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
<ItemGroup>
|
||||
<Folder Include="MVVM\Model" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Fonts\Poppins-Regular.ttf" />
|
||||
<Content Include="wicns.ico" />
|
||||
<Resource Include="Images\wicon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
5
WeeXnes/packages.config
Normal file
5
WeeXnes/packages.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DiscordRichPresence" version="1.0.175" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net48" />
|
||||
</packages>
|
BIN
WeeXnes/wicns.ico
Normal file
BIN
WeeXnes/wicns.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 308 KiB |
Loading…
Add table
Reference in a new issue