Compare commits
No commits in common. "master" and "2.7.9" have entirely different histories.
|
@ -1,140 +0,0 @@
|
||||||
name: Dotnet Build
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: win11
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
|
|
||||||
- name: MSBuild version
|
|
||||||
run: |
|
|
||||||
msbuild -version
|
|
||||||
|
|
||||||
- name: Extract project version
|
|
||||||
run: |
|
|
||||||
$version = Select-String -Path "WeeXnes/WeeXnes.csproj" -Pattern "<Version>(.+?)</Version>" | ForEach-Object {
|
|
||||||
($_ -match "<Version>(.+?)</Version>") | Out-Null
|
|
||||||
$matches[1]
|
|
||||||
}
|
|
||||||
Write-Output "Version extracted: $version"
|
|
||||||
"PROJECT_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding ASCII -Append
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Test exported version variable
|
|
||||||
run: |
|
|
||||||
Write-Output "The extracted project version is: $env:PROJECT_VERSION"
|
|
||||||
if (-not $env:PROJECT_VERSION) {
|
|
||||||
Write-Error "PROJECT_VERSION variable is not set!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Restore Packages
|
|
||||||
run: nuget restore WeeXnes.sln
|
|
||||||
|
|
||||||
- name: Build Solution
|
|
||||||
run: |
|
|
||||||
msbuild WeeXnes.sln /p:DeleteExistingFiles=True /p:platform="Any CPU" /p:configuration="Release"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Packing Zip
|
|
||||||
run: |
|
|
||||||
$zipName = "currentRelease_$env:PROJECT_VERSION.zip"
|
|
||||||
Compress-Archive -Path `
|
|
||||||
WeeXnes\bin\Release\WeeXnes.exe, `
|
|
||||||
WeeXnes\bin\Release\System.Drawing.Common.dll, `
|
|
||||||
WeeXnes\bin\Release\Wpf.Ui.dll, `
|
|
||||||
WeeXnes_UAC\bin\Release\WeeXnes_UAC.exe, `
|
|
||||||
WeeXnes\bin\Release\DiscordRPC.dll, `
|
|
||||||
WeeXnes\bin\Release\Newtonsoft.Json.dll, `
|
|
||||||
Autostart\bin\Release\Autostart.exe, `
|
|
||||||
WXPlugin\bin\Release\WXPlugin.dll, `
|
|
||||||
Update\bin\Release\Update.exe `
|
|
||||||
-CompressionLevel Optimal `
|
|
||||||
-DestinationPath $zipName
|
|
||||||
Write-Output "Created zip: $zipName"
|
|
||||||
|
|
||||||
- name: Prepare release directory
|
|
||||||
run: |
|
|
||||||
mkdir release
|
|
||||||
move currentRelease_$env:PROJECT_VERSION.zip release\
|
|
||||||
|
|
||||||
|
|
||||||
- name: Create Git tag
|
|
||||||
run: |
|
|
||||||
git config user.name "WeeXnes"
|
|
||||||
git config user.email "weexnes@weexnes.dev"
|
|
||||||
git tag $env:PROJECT_VERSION
|
|
||||||
git push origin $env:PROJECT_VERSION
|
|
||||||
|
|
||||||
- name: Upload Release Asset to Forgejo
|
|
||||||
env:
|
|
||||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$owner = "WeeXnes"
|
|
||||||
$repo = "WeeXnesSuite"
|
|
||||||
$tag = "$env:PROJECT_VERSION"
|
|
||||||
$token = $env:RELEASE_TOKEN
|
|
||||||
$fileName = "currentRelease_$tag.zip"
|
|
||||||
$filePath = "release/$fileName"
|
|
||||||
|
|
||||||
$releaseUrl = "https://git.weexnes.dev/api/v1/repos/$owner/$repo/releases/tags/$tag"
|
|
||||||
try {
|
|
||||||
$release = Invoke-RestMethod -Uri $releaseUrl -Headers @{ Authorization = "token $token" }
|
|
||||||
Write-Host "Found existing release for tag $tag"
|
|
||||||
} catch {
|
|
||||||
Write-Host "Release for tag $tag not found, creating..."
|
|
||||||
$createReleaseUrl = "https://git.weexnes.dev/api/v1/repos/$owner/$repo/releases"
|
|
||||||
$body = @{
|
|
||||||
tag_name = $tag
|
|
||||||
name = $tag
|
|
||||||
draft = $false
|
|
||||||
prerelease = $false
|
|
||||||
} | ConvertTo-Json -Depth 3
|
|
||||||
$release = Invoke-RestMethod -Uri $createReleaseUrl -Headers @{ Authorization = "token $token"; "Content-Type" = "application/json" } -Method Post -Body $body
|
|
||||||
}
|
|
||||||
|
|
||||||
$releaseId = $release.id
|
|
||||||
Write-Host "Release ID: $releaseId"
|
|
||||||
|
|
||||||
$uploadUrl = "https://git.weexnes.dev/api/v1/repos/$owner/$repo/releases/$releaseId/assets?name=$fileName"
|
|
||||||
Write-Host "Uploading asset to $uploadUrl"
|
|
||||||
|
|
||||||
Add-Type -AssemblyName "System.Net.Http"
|
|
||||||
|
|
||||||
$fileBytes = [System.IO.File]::ReadAllBytes($filePath)
|
|
||||||
|
|
||||||
# Use static method to correctly instantiate ByteArrayContent
|
|
||||||
$byteContent = [System.Net.Http.ByteArrayContent]::new($fileBytes)
|
|
||||||
$byteContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::new("application/zip")
|
|
||||||
|
|
||||||
$form = [System.Net.Http.MultipartFormDataContent]::new()
|
|
||||||
$form.Add($byteContent, "attachment", $fileName)
|
|
||||||
|
|
||||||
$client = [System.Net.Http.HttpClient]::new()
|
|
||||||
$client.DefaultRequestHeaders.Authorization = [System.Net.Http.Headers.AuthenticationHeaderValue]::new("token", $token)
|
|
||||||
|
|
||||||
$response = $client.PostAsync($uploadUrl, $form).Result
|
|
||||||
$responseContent = $response.Content.ReadAsStringAsync().Result
|
|
||||||
|
|
||||||
if ($response.IsSuccessStatusCode) {
|
|
||||||
Write-Host "✅ Upload succeeded"
|
|
||||||
} else {
|
|
||||||
Write-Host "❌ Upload failed with status $($response.StatusCode)"
|
|
||||||
Write-Host "Response: $responseContent"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
||||||
<LangVersion>12</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Wpf.Ui.Common;
|
|
||||||
using Wpf.Ui.Controls;
|
|
||||||
using WXPlugin.PluginCore;
|
|
||||||
|
|
||||||
namespace ExamplePlugin
|
|
||||||
{
|
|
||||||
public class ExamplePlugin : IPluginBase
|
|
||||||
{
|
|
||||||
public String Name { get; set; } = "Example Plugin";
|
|
||||||
public String Description { get; set; } = "This is an example plugin.";
|
|
||||||
|
|
||||||
public Page UiPage { get; set; } = new ExampleUi();
|
|
||||||
public NavigationItem NavIcon { get; set; } = new NavigationItem
|
|
||||||
{
|
|
||||||
Content = "Plugin",
|
|
||||||
Icon = SymbolRegular.Syringe20,
|
|
||||||
PageTag = "examplePlugin",
|
|
||||||
PageType = typeof(ExampleUi),
|
|
||||||
};
|
|
||||||
|
|
||||||
public void Execute()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialize()
|
|
||||||
{
|
|
||||||
//throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<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>
|
|
||||||
<ProjectGuid>{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>ExamplePlugin</RootNamespace>
|
|
||||||
<AssemblyName>ExamplePlugin</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
<Reference Include="System"/>
|
|
||||||
<Reference Include="System.Core"/>
|
|
||||||
<Reference Include="System.Data"/>
|
|
||||||
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Drawing.Common.6.0.0\lib\net461\System.Drawing.Common.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xaml" />
|
|
||||||
<Reference Include="System.Xml"/>
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="Wpf.Ui, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\WPF-UI.2.0.3\lib\net48\Wpf.Ui.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="ExamplePlugin.cs" />
|
|
||||||
<Compile Include="ExampleUi.xaml.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\WXPlugin\WXPlugin.csproj">
|
|
||||||
<Project>{56bfe4e0-0d30-474a-b57b-cf08515ff66e}</Project>
|
|
||||||
<Name>WXPlugin</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Page Include="ExampleUi.xaml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<Page x:Class="ExampleUi"
|
|
||||||
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:ExamplePlugin"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="AddRPCView" Height="Auto" Width="Auto"
|
|
||||||
Loaded="ExampleUi_OnLoaded">
|
|
||||||
<Grid>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Foreground="White">This is a Test Ui for the Example Plugin</TextBlock>
|
|
||||||
<TextBlock Name="TestLabel" Foreground="White" Text="{Binding LabelContent}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,18 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
public partial class ExampleUi : Page
|
|
||||||
{
|
|
||||||
private int counter = 0;
|
|
||||||
public ExampleUi()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExampleUi_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
counter++;
|
|
||||||
TestLabel.Text = counter.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("ExamplePlugin")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("ExamplePlugin")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("910F0FC8-B73D-449F-ADD7-C6CA147D9F05")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="System.Drawing.Common" version="6.0.0" targetFramework="net48" />
|
|
||||||
<package id="WPF-UI" version="2.0.3" targetFramework="net48" />
|
|
||||||
</packages>
|
|
BIN
Images/home.png
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 46 KiB |
BIN
Images/rpc.png
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 88 KiB |
674
LICENSE
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
62
README.md
|
@ -1,61 +1,11 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img width="100" height="100" src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/WeeXnes/Images/wicon.png">
|
<img width="100" height="100" src="https://cdn.discordapp.com/attachments/741123537582162020/965619554426437732/wicon.png">
|
||||||
<br>
|
</div>
|
||||||
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/WeeXnes/WeeXnesSuite?color=%23702e94">
|
|
||||||
|
|
||||||
<h1 align="center">WeeXnes Suite</h1>
|
<h1 align="center">WeeXnes Suite</h1>
|
||||||
|
|
||||||
Built with:
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
Uses:
|
|
||||||
<a href="https://github.com/lepoco/wpfui">C# WPF-UI Library</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h2></h2>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 align="center">Encrypted Key Manager and Custom Discord Rich Presence that you can configure for every Process you want</h3>
|
<h3 align="center">Encrypted Key Manager and Custom Discord Rich Presence that you can configure for every Process you want</h3>
|
||||||
<h2>Overview:</h2>
|
<h2>Overview:</h2>
|
||||||
<image src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/Images/home.png" height="400">
|
<image src="https://cdn.discordapp.com/attachments/741123537582162020/965621127554678894/unknown.png" height="400">
|
||||||
<h2></h2>
|
<image src="https://cdn.discordapp.com/attachments/741123537582162020/965621177345278053/unknown.png" height="400">
|
||||||
|
|
||||||
|
|
||||||
<h3>Discord Rich Presence</h3>
|
<h3>Discord Rich Presence</h3>
|
||||||
Configurable DiscordRPC for every process you want. It detects if a process is started and starts the Rich Presence you configured for the Process (also has import/export functionality)
|
Configurable DiscordRPC for every process you want. It detects if a process is started and starts the Rich Presence you configured for the Process
|
||||||
<br>
|
<image src="https://cdn.discordapp.com/attachments/741123537582162020/965621051621015603/unknown.png" height="320">
|
||||||
<image src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/Images/rpc.png" height="400">
|
|
||||||
<h2></h2>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3>Key Manager</h3>
|
|
||||||
encrypted key manager with import/export functionality
|
|
||||||
<br>
|
|
||||||
<image src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/Images/password_manager.png" height="400">
|
|
||||||
<h2></h2>
|
|
||||||
|
|
||||||
|
|
||||||
<h3>Password Generator</h3>
|
|
||||||
Password Generator. Generated passwords can be quickly saved to the Key Manager
|
|
||||||
<br>
|
|
||||||
<image src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/Images/password_gen.png" height="400">
|
|
||||||
<h2></h2>
|
|
||||||
|
|
||||||
|
|
||||||
<h3>Settings</h3>
|
|
||||||
Settings Showcase
|
|
||||||
<br>
|
|
||||||
<image src="https://raw.githubusercontent.com/WeeXnes/WeeXnesSuite/master/Images/settings.png" height="600">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Supported by: <a href="https://www.jetbrains.com">JetBrains</a></h2>
|
|
||||||
<image src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" width="200"><br>
|
|
||||||
Special thanks to JetBrains supporting this Project with their <a href="https://jb.gg/OpenSourceSupport">Open Source License Program</a>
|
|
||||||
</div>
|
|
||||||
|
|
111
Release_Tool/Program.cs
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
|
||||||
|
namespace Release_Tool
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
static List<file> files = new List<file>();
|
||||||
|
public static string globalTimestamp = null;
|
||||||
|
public static string releaseFolder = "debug_release";
|
||||||
|
public static string releaseFileName = "currentRelease.zip";
|
||||||
|
public static string destFolder = null;
|
||||||
|
public static bool success = true;
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.Title = "WeeXnes Automated Release Tool";
|
||||||
|
SetTimestamp();
|
||||||
|
SetPaths();
|
||||||
|
Console.WriteLine("Folder -> " + globalTimestamp);
|
||||||
|
CheckDirectories();
|
||||||
|
GetFiles();
|
||||||
|
PackFiles();
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Something went wrong");
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PackIntoZip();
|
||||||
|
Console.WriteLine("Build succeeded | " + globalTimestamp);
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PackIntoZip()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(File.Exists(Path.Combine(releaseFolder, releaseFileName)))
|
||||||
|
{
|
||||||
|
File.Delete(Path.Combine(releaseFolder, "currentRelease.zip"));
|
||||||
|
ZipFile.CreateFromDirectory(destFolder, Path.Combine(releaseFolder, releaseFileName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ZipFile.CreateFromDirectory(destFolder, Path.Combine(releaseFolder, releaseFileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
Console.ReadLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetPaths()
|
||||||
|
{
|
||||||
|
destFolder = Path.Combine(releaseFolder, globalTimestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckDirectories()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(releaseFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(releaseFolder);
|
||||||
|
}
|
||||||
|
if(!Directory.Exists(destFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetTimestamp()
|
||||||
|
{
|
||||||
|
string date = DateTime.Now.ToString("dd.MM.yyyy");
|
||||||
|
string time = DateTime.Now.ToString("HH.mm.ss");
|
||||||
|
string timestamp = date + " - " + time;
|
||||||
|
globalTimestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PackFiles()
|
||||||
|
{
|
||||||
|
foreach(file fileobj in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Copy(fileobj.path, Path.Combine(destFolder, fileobj.newfilename));
|
||||||
|
Console.WriteLine("Copied " + fileobj.path);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Coudnt find " + fileobj.path + "| ->" + ex.GetType());
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GetFiles()
|
||||||
|
{
|
||||||
|
files.Add(new file(@"WeeXnes\bin\Release\WeeXnes.exe", "WeeXnes.exe"));
|
||||||
|
files.Add(new file(@"WeeXnes_UAC\bin\Release\WeeXnes_UAC.exe", "WeeXnes_UAC.exe"));
|
||||||
|
files.Add(new file(@"WeeXnes\bin\Release\DiscordRPC.dll", "DiscordRPC.dll"));
|
||||||
|
files.Add(new file(@"WeeXnes\bin\Release\Newtonsoft.Json.dll", "Newtonsoft.Json.dll"));
|
||||||
|
files.Add(new file(@"Autostart\bin\Release\Autostart.exe", "Autostart.exe"));
|
||||||
|
files.Add(new file(@"Update\bin\Release\Update.exe", "Update.exe"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,12 +4,12 @@ using System.Runtime.InteropServices;
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("WXPlugin")]
|
[assembly: AssemblyTitle("Release_Tool")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("WXPlugin")]
|
[assembly: AssemblyProduct("Release_Tool")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("56BFE4E0-0D30-474A-B57B-CF08515FF66E")]
|
[assembly: Guid("4C09AD12-B48E-40ED-B418-CF868889E317")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
|
@ -1,18 +1,18 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{56BFE4E0-0D30-474A-B57B-CF08515FF66E}</ProjectGuid>
|
<ProjectGuid>{4C09AD12-B48E-40ED-B418-CF868889E317}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>WXPlugin</RootNamespace>
|
<RootNamespace>Release_Tool</RootNamespace>
|
||||||
<AssemblyName>WXPlugin</AssemblyName>
|
<AssemblyName>Release_Tool</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<LangVersion>12</LangVersion>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@ -34,26 +34,19 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<HintPath>..\packages\System.Drawing.Common.6.0.0\lib\net461\System.Drawing.Common.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="Wpf.Ui, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\WPF-UI.2.0.3\lib\net48\Wpf.Ui.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="PluginCore\IPluginBase.cs" />
|
<Compile Include="file.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<Content Include="wicns.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
13
Release_Tool/file.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Release_Tool
|
||||||
|
{
|
||||||
|
public class file
|
||||||
|
{
|
||||||
|
public string path { get; set; }
|
||||||
|
public string newfilename { get; set; }
|
||||||
|
public file(string _path, string _newfilename)
|
||||||
|
{
|
||||||
|
this.path = _path;
|
||||||
|
this.newfilename = _newfilename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 308 KiB |
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
|
|
||||||
</startup>
|
|
||||||
</configuration>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<Application x:Class="Update.App"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="clr-namespace:Update"
|
|
||||||
StartupUri="MainWindow.xaml"
|
|
||||||
Startup="App_OnStartup">
|
|
||||||
<Application.Resources>
|
|
||||||
|
|
||||||
</Application.Resources>
|
|
||||||
</Application>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<Window x:Class="Update.MainWindow"
|
|
||||||
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:Update"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="MainWindow" Height="350" Width="525">
|
|
||||||
<Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
|
@ -1,13 +0,0 @@
|
||||||
namespace Update
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,49 +2,42 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace Update
|
namespace Update
|
||||||
{
|
{
|
||||||
/// <summary>
|
internal class Program
|
||||||
/// Interaction logic for App.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class App
|
|
||||||
{
|
{
|
||||||
private void App_OnStartup(object sender, StartupEventArgs e)
|
public static bool keepWindowOpen = false;
|
||||||
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
RunUpdater(e.Args[0],e.Args[1],e.Args[2],e.Args[3]);
|
Console.WriteLine("Path: " + args[0]);
|
||||||
}
|
Console.WriteLine("FileName: " + args[1]);
|
||||||
private void RunUpdater(string Path, string FileName, string ProcessId, string NewFile)
|
Console.WriteLine("PID: " + args[2]);
|
||||||
{
|
Console.WriteLine("New File: " + args[3]);
|
||||||
if(String.IsNullOrEmpty(Path))
|
Process p = Process.GetProcessById(Convert.ToInt32(args[2]));
|
||||||
return;
|
|
||||||
if(String.IsNullOrEmpty(FileName))
|
|
||||||
return;
|
|
||||||
if(String.IsNullOrEmpty(ProcessId))
|
|
||||||
return;
|
|
||||||
if(String.IsNullOrEmpty(NewFile))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Process p = Process.GetProcessById(Convert.ToInt32(ProcessId));
|
|
||||||
p.Kill();
|
p.Kill();
|
||||||
p.WaitForExit();
|
p.WaitForExit();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ZipArchiveHelper.ExtractToDirectory(NewFile, Path, true);
|
ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
ZipArchiveHelper.ExtractToDirectory(NewFile, Path, true);
|
ZipArchiveHelper.ExtractToDirectory(args[3], args[0], true);
|
||||||
}
|
}
|
||||||
Process.Start(Path + "\\" + FileName);
|
Process.Start(args[0] + "\\" + args[1]);
|
||||||
if (File.Exists(NewFile))
|
if (File.Exists(args[3]))
|
||||||
{
|
{
|
||||||
File.Delete(NewFile);
|
File.Delete(args[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keepWindowOpen)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Window kept open to see error message, press enter to continue");
|
||||||
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class ZipArchiveHelper
|
public static class ZipArchiveHelper
|
||||||
|
@ -75,9 +68,16 @@ namespace Update
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex);
|
if (file.FullName == "Update.exe")
|
||||||
var completeFileName = Path.Combine(destinationDirectoryName, file.FullName + ".new");
|
{
|
||||||
file.ExtractToFile(completeFileName);
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
Console.WriteLine(file.FullName + " couldnt be overwritten, an error has occured");
|
||||||
|
Program.keepWindowOpen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Resources;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
@ -21,25 +18,8 @@ using System.Windows;
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
//In order to begin building localizable applications, set
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
[assembly: Guid("6F2F689B-F4E3-4204-BA72-624BE46020AD")]
|
||||||
//inside a <PropertyGroup>. For example, if you are using US english
|
|
||||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
|
||||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
|
||||||
//the line below to match the UICulture setting in the project file.
|
|
||||||
|
|
||||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
|
||||||
|
|
||||||
|
|
||||||
[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)
|
|
||||||
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)
|
|
||||||
)]
|
|
||||||
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
|
|
69
Update/Properties/Resources.Designer.cs
generated
|
@ -1,69 +0,0 @@
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Update.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.
|
|
||||||
/// </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("Update.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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
|
@ -1,20 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{133FF515-D605-4856-BA2E-5841BF47EC2F}</ProjectGuid>
|
<ProjectGuid>{6F2F689B-F4E3-4204-BA72-624BE46020AD}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Update</RootNamespace>
|
<RootNamespace>Update</RootNamespace>
|
||||||
<AssemblyName>Update</AssemblyName>
|
<AssemblyName>Update</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<ApplicationIcon>wicns.ico</ApplicationIcon>
|
|
||||||
<LangVersion>12</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@ -42,48 +39,18 @@
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.IO.Compression.FileSystem" />
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Xaml">
|
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="App.xaml">
|
<Compile Include="Program.cs" />
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</ApplicationDefinition>
|
|
||||||
<Page Include="MainWindow.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
<Compile Include="App.xaml.cs">
|
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainWindow.xaml.cs">
|
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
<None Include="wicns.ico" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,16 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Wpf.Ui.Controls;
|
|
||||||
|
|
||||||
namespace WXPlugin.PluginCore
|
|
||||||
{
|
|
||||||
public interface IPluginBase
|
|
||||||
{
|
|
||||||
public String Name { get; set; }
|
|
||||||
public String Description { get; set; }
|
|
||||||
public Page UiPage { get; set; }
|
|
||||||
public NavigationItem NavIcon { get; set; }
|
|
||||||
public void Initialize();
|
|
||||||
public void Execute();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="System.Drawing.Common" version="6.0.0" targetFramework="net48" />
|
|
||||||
<package id="WPF-UI" version="2.0.3" targetFramework="net48" />
|
|
||||||
</packages>
|
|
26
WeeXnes.sln
|
@ -6,11 +6,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Autostart", "Autostart\Auto
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeeXnes_UAC", "WeeXnes_UAC\WeeXnes_UAC.csproj", "{2DCC0DCD-7843-4719-9FDD-1786924CF941}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeeXnes_UAC", "WeeXnes_UAC\WeeXnes_UAC.csproj", "{2DCC0DCD-7843-4719-9FDD-1786924CF941}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{133FF515-D605-4856-BA2E-5841BF47EC2F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Release_Tool", "Release_Tool\Release_Tool.csproj", "{4C09AD12-B48E-40ED-B418-CF868889E317}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WXPlugin", "WXPlugin\WXPlugin.csproj", "{56BFE4E0-0D30-474A-B57B-CF08515FF66E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{6F2F689B-F4E3-4204-BA72-624BE46020AD}"
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamplePlugin", "ExamplePlugin\ExamplePlugin.csproj", "{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -30,17 +28,13 @@ Global
|
||||||
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2DCC0DCD-7843-4719-9FDD-1786924CF941}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4C09AD12-B48E-40ED-B418-CF868889E317}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6F2F689B-F4E3-4204-BA72-624BE46020AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -2,16 +2,38 @@
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:WeeXnes"
|
xmlns:local="clr-namespace:WeeXnes"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
xmlns:viewModel="clr-namespace:WeeXnes.MVVM.ViewModel"
|
||||||
|
xmlns:view="clr-namespace:WeeXnes.MVVM.View"
|
||||||
StartupUri="MainWindow.xaml"
|
StartupUri="MainWindow.xaml"
|
||||||
Startup="App_OnStartup">
|
Startup="App_OnStartup">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ui:ThemesDictionary Theme="Dark" />
|
<ResourceDictionary Source="Theme/MenuButtonTheme.xaml"/>
|
||||||
<ui:ControlsDictionary />
|
<ResourceDictionary Source="Theme/TextBoxTheme.xaml"/>
|
||||||
|
<ResourceDictionary Source="Theme/ControlButtonTheme.xaml"/>
|
||||||
|
<ResourceDictionary Source="Theme/ModernCheckbox.xaml"/>
|
||||||
|
<ResourceDictionary Source="Theme/DiscordRpcTheme.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</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>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Nocksoft.IO.ConfigFiles;
|
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
using WeeXnes.Views.DiscordRPC;
|
using System.IO;
|
||||||
using WeeXnes.Views.KeyManager;
|
|
||||||
using WeeXnes.Views.Settings;
|
|
||||||
using Application = System.Windows.Forms.Application;
|
using Application = System.Windows.Forms.Application;
|
||||||
|
|
||||||
namespace WeeXnes
|
namespace WeeXnes
|
||||||
|
@ -20,192 +11,23 @@ namespace WeeXnes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App
|
public partial class App
|
||||||
{
|
{
|
||||||
public static bool DebugMode = false;
|
|
||||||
private void SetExceptionHandler()
|
|
||||||
{
|
|
||||||
AppDomain currentDomain = default(AppDomain);
|
|
||||||
currentDomain = AppDomain.CurrentDomain;
|
|
||||||
currentDomain.UnhandledException += GlobalUnhandledExceptionHandler;
|
|
||||||
}
|
|
||||||
private static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
|
|
||||||
{
|
|
||||||
Exception ex = (Exception)e.ExceptionObject;
|
|
||||||
DateTime currentDateTime = DateTime.Now;
|
|
||||||
string formattedDateTime = currentDateTime.ToString("dddd, dd MMMM yyyy HH:mm:ss");
|
|
||||||
using (StreamWriter writer = new StreamWriter("error_log.txt"))
|
|
||||||
{
|
|
||||||
writer.WriteLine(formattedDateTime);
|
|
||||||
writer.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
new FluentMessageBox(ex.Message).ShowDialog();
|
|
||||||
}
|
|
||||||
private void App_OnStartup(object sender, StartupEventArgs e)
|
private void App_OnStartup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
Environment.CurrentDirectory = Application.StartupPath;
|
Environment.CurrentDirectory = Application.StartupPath;
|
||||||
Console.Data.Colors.colored_output = false;
|
if (e.Args.Length > 0)
|
||||||
Console.Data.Formatting.timestamp_prefix = true;
|
|
||||||
SetExceptionHandler();
|
|
||||||
CheckForDebugMode();
|
|
||||||
CheckStartupArgs(e.Args);
|
|
||||||
CheckUpdatedFiles();
|
|
||||||
CheckForFolder();
|
|
||||||
LoadSettings();
|
|
||||||
SaveSettingsHandler.SetupSaveEvents();
|
|
||||||
LoadFiles();
|
|
||||||
LoadPluginManager();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadPluginManager()
|
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Global.Defaults.DefaultPathPlugins))
|
for (int i = 0; i != e.Args.Length; ++i)
|
||||||
Directory.CreateDirectory(Global.Defaults.DefaultPathPlugins);
|
|
||||||
|
|
||||||
Global.pluginManager.LoadPlugins();
|
|
||||||
foreach (var plugin in Global.pluginManager.CurrentPlugins)
|
|
||||||
{
|
{
|
||||||
plugin.Initialize();
|
//MessageBox.Show(e.Args[i]);
|
||||||
|
if (e.Args[i] == "-autostart")
|
||||||
|
{
|
||||||
|
//MessageBox.Show("Launched via autostart");
|
||||||
|
Globals.info_RpcAutoStart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckUpdatedFiles()
|
|
||||||
{
|
|
||||||
string[] files = System.IO.Directory.GetFiles(Environment.CurrentDirectory, "*.new");
|
|
||||||
foreach (string file in files)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string originalFile = file.Substring(0, file
|
|
||||||
.Length - 4);
|
|
||||||
if (File.Exists(originalFile))
|
|
||||||
File.Delete(originalFile);
|
|
||||||
System.IO.File.Move(file, originalFile);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
//Globals.autoStartRpc = true;
|
||||||
{
|
|
||||||
Console.Error(ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadSettings()
|
|
||||||
{
|
|
||||||
if(!File.Exists(Path.Combine(Global.AppDataPath, Global.SettingsFile)))
|
|
||||||
return;
|
|
||||||
KeyManagerView.Data.censorKeys.Value =
|
|
||||||
Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue(
|
|
||||||
SaveSettingsHandler.Data.KeyManager.Section,
|
|
||||||
SaveSettingsHandler.Data.KeyManager.CensorKeys));
|
|
||||||
|
|
||||||
KeyManagerView.Data.copyOnSelect.Value =
|
|
||||||
Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue(
|
|
||||||
SaveSettingsHandler.Data.KeyManager.Section,
|
|
||||||
SaveSettingsHandler.Data.KeyManager.CopyOnSelect));
|
|
||||||
|
|
||||||
KeyManagerView.Data.sortList.Value =
|
|
||||||
Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue(
|
|
||||||
SaveSettingsHandler.Data.KeyManager.Section,
|
|
||||||
SaveSettingsHandler.Data.KeyManager.SortList));
|
|
||||||
|
|
||||||
//Load paths
|
|
||||||
|
|
||||||
string customRpcPath = SettingsView.Data.settingsFile.GetValue(
|
|
||||||
SaveSettingsHandler.Data.General.Section,
|
|
||||||
SaveSettingsHandler.Data.General.RpcFilesPath
|
|
||||||
);
|
|
||||||
if (!String.IsNullOrEmpty(customRpcPath))
|
|
||||||
{
|
|
||||||
Global.AppDataPathRPC.Value = customRpcPath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Global.AppDataPathRPC.Value = Global.Defaults.DefaultPathRPC;
|
|
||||||
}
|
|
||||||
string customKeyPath = SettingsView.Data.settingsFile.GetValue(
|
|
||||||
SaveSettingsHandler.Data.General.Section,
|
|
||||||
SaveSettingsHandler.Data.General.KeyFilesPath
|
|
||||||
);
|
|
||||||
if (!String.IsNullOrEmpty(customKeyPath))
|
|
||||||
{
|
|
||||||
Global.AppDataPathKEY.Value = customKeyPath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Global.AppDataPathKEY.Value = Global.Defaults.DefaultPathKEY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadFiles()
|
|
||||||
{
|
|
||||||
Functions.CheckFolderAndCreate(Global.AppDataPathRPC.Value);
|
|
||||||
DirectoryInfo rpcDirectoryInfo = new DirectoryInfo(Global.AppDataPathRPC.Value);
|
|
||||||
foreach (var file in rpcDirectoryInfo.GetFiles("*.rpc"))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Game newGame = Game.Methods.GameFromIni(new INIFile(file.FullName));
|
|
||||||
DiscordRPCView.Data.Games.Add(newGame);
|
|
||||||
Console.WriteLine(file.Name + " loaded -> " + newGame.ProcessName);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.Error(file.Name + ": " + ex.Message);
|
|
||||||
new FluentMessageBox(file.Name + ": " + ex.Message).ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Functions.CheckFolderAndCreate(Global.AppDataPathKEY.Value);
|
|
||||||
DirectoryInfo keyDirectoryInfo = new DirectoryInfo(Global.AppDataPathKEY.Value);
|
|
||||||
foreach (var file in keyDirectoryInfo.GetFiles("*.wx"))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//Load KeyFiles
|
|
||||||
|
|
||||||
WXFile wxFile = new WXFile(file.FullName);
|
|
||||||
KeyItem newItem = new KeyItem(
|
|
||||||
wxFile.GetName(),
|
|
||||||
EncryptionLib.EncryptorLibary.decrypt(
|
|
||||||
Information.EncryptionHash,
|
|
||||||
wxFile.GetValue()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
newItem.Filename = file.Name;
|
|
||||||
KeyManagerView.Data.KeyItemsList.Add(newItem);
|
|
||||||
Console.WriteLine(file.Name + " loaded -> " + newItem.Name);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.Error(file.Name + ": " + ex.Message);
|
|
||||||
new FluentMessageBox(file.Name + ": " + ex.Message).ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void CheckForFolder()
|
|
||||||
{
|
|
||||||
Functions.CheckFolderAndCreate(Global.AppDataPath);
|
|
||||||
}
|
|
||||||
private void CheckStartupArgs(string[] arguments)
|
|
||||||
{
|
|
||||||
foreach (string argument in arguments)
|
|
||||||
{
|
|
||||||
switch (argument)
|
|
||||||
{
|
|
||||||
case HandleLaunchArguments.ArgumentStrings.autostart:
|
|
||||||
HandleLaunchArguments.arg_autostart();
|
|
||||||
break;
|
|
||||||
case HandleLaunchArguments.ArgumentStrings.debugMode:
|
|
||||||
HandleLaunchArguments.arg_debugMode();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckForDebugMode()
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
HandleLaunchArguments.arg_debugMode();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
30
WeeXnes/Core/ApiResponse.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
namespace WeeXnes.Core
|
||||||
|
{
|
||||||
|
public class ApiResponse
|
||||||
|
{
|
||||||
|
public string download_url { get; set; }
|
||||||
|
public string file_name { get; set; }
|
||||||
|
public string tag_name { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string description { get; set; }
|
||||||
|
public ApiResponse(string _download_url, string _file_name, string _tag_name, string _name, string _description)
|
||||||
|
{
|
||||||
|
this.download_url = _download_url;
|
||||||
|
this.file_name = _file_name;
|
||||||
|
this.tag_name = _tag_name;
|
||||||
|
this.name = _name;
|
||||||
|
this.description = _description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string returnval =
|
||||||
|
"download_url: " + this.download_url + "\n" +
|
||||||
|
"file_name: " + this.file_name + "\n" +
|
||||||
|
"tag_name: " + this.tag_name + "\n" +
|
||||||
|
"name: " + this.name + "\n" +
|
||||||
|
"description: " + this.description;
|
||||||
|
return returnval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,147 +0,0 @@
|
||||||
global using Console = WeeXnes.Core.Console;
|
|
||||||
global using VanillaConsole = System.Console;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public static class Console
|
|
||||||
{
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
public static class Colors
|
|
||||||
{
|
|
||||||
public static bool colored_output = true;
|
|
||||||
public static ConsoleColor int_color = ConsoleColor.Blue;
|
|
||||||
public static ConsoleColor double_color = ConsoleColor.Cyan;
|
|
||||||
public static ConsoleColor float_color = ConsoleColor.DarkCyan;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Formatting
|
|
||||||
{
|
|
||||||
public static bool timestamp_prefix = false;
|
|
||||||
public static string success_char = "✓";
|
|
||||||
public static string warning_char = "⌬";
|
|
||||||
public static string info_char = "◈";
|
|
||||||
public static string error_char = "☓";
|
|
||||||
public static string writeline_char = "•";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static void ConfiguredWriteline(
|
|
||||||
string text,
|
|
||||||
ConsoleColor color,
|
|
||||||
ConsoleColor foregroundColor = ConsoleColor.White)
|
|
||||||
{
|
|
||||||
if(!App.DebugMode)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
VanillaConsole.OutputEncoding = Encoding.UTF8;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
ConsoleColor prevColor = VanillaConsole.BackgroundColor;
|
|
||||||
ConsoleColor prevForeColor = VanillaConsole.ForegroundColor;
|
|
||||||
if (Data.Colors.colored_output)
|
|
||||||
{
|
|
||||||
VanillaConsole.BackgroundColor = color;
|
|
||||||
VanillaConsole.ForegroundColor = foregroundColor;
|
|
||||||
}
|
|
||||||
DateTime currentTime = DateTime.Now;
|
|
||||||
if (Data.Formatting.timestamp_prefix)
|
|
||||||
text = currentTime.ToString("[HH:mm:ss]") + text;
|
|
||||||
VanillaConsole.WriteLine(text + " ");
|
|
||||||
if (Data.Colors.colored_output)
|
|
||||||
{
|
|
||||||
|
|
||||||
VanillaConsole.BackgroundColor = prevColor;
|
|
||||||
VanillaConsole.ForegroundColor = prevForeColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void WriteLine(string text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,VanillaConsole.BackgroundColor, ConsoleColor.White);
|
|
||||||
}
|
|
||||||
public static void WriteLine(float text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,Data.Colors.float_color, ConsoleColor.White);
|
|
||||||
}
|
|
||||||
public static void WriteLine(double text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,Data.Colors.double_color, ConsoleColor.White);
|
|
||||||
}
|
|
||||||
public static void WriteLine(int text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.writeline_char + " (" + lineNumber + "|" + caller + ") " + text,Data.Colors.int_color, ConsoleColor.White);
|
|
||||||
}
|
|
||||||
public static void Success(string text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.success_char + " (" + lineNumber + "|" + caller + ") " + text, ConsoleColor.Green,
|
|
||||||
ConsoleColor.Black);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Info(string text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.info_char + " (" + lineNumber + "|" + caller + ") " + text, ConsoleColor.Blue,
|
|
||||||
ConsoleColor.Black);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Error(string text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.error_char + " (" + lineNumber + "|" + caller + ") " + text, ConsoleColor.DarkRed,
|
|
||||||
ConsoleColor.Black);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Warning(string text,
|
|
||||||
[CallerLineNumber] int lineNumber = 0,
|
|
||||||
[CallerMemberName] string caller = null)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline(" " + Data.Formatting.warning_char + " (" + lineNumber + "|" + caller + ") " + text, ConsoleColor.DarkYellow,
|
|
||||||
ConsoleColor.Black);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void WriteLine<T>(List<T> List, bool verbose = true)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline("List contains " + typeof(T) + "(" + List.Count + ")", ConsoleColor.DarkMagenta,
|
|
||||||
ConsoleColor.Black);
|
|
||||||
if (!verbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < List.Count; i++)
|
|
||||||
{
|
|
||||||
if (i % 2 == 0)
|
|
||||||
{
|
|
||||||
ConfiguredWriteline("(" + i + "): " + List[i], ConsoleColor.DarkGray);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ConfiguredWriteline("(" + i + "): " + List[i], ConsoleColor.Black);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public static class Functions
|
|
||||||
{
|
|
||||||
public static void CheckFolderAndCreate(string path)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(path))
|
|
||||||
Directory.CreateDirectory(path);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MessageBox.Show(e.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 void ThrowTestException(Exception ex = null)
|
|
||||||
{
|
|
||||||
if (ex == null)
|
|
||||||
ex = new NotImplementedException();
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public class Information
|
|
||||||
{
|
|
||||||
public const string Version = "4.7";
|
|
||||||
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
|
||||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Global
|
|
||||||
{
|
|
||||||
public static PluginManager pluginManager = new PluginManager(Path.Combine(Environment.CurrentDirectory, "plugins"));
|
|
||||||
public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes");
|
|
||||||
public static UpdateVar<string> AppDataPathRPC = new UpdateVar<string>();
|
|
||||||
public static UpdateVar<string> AppDataPathKEY = new UpdateVar<string>();
|
|
||||||
public static UpdateVar<bool> checkUpdateOnStartup = new UpdateVar<bool>();
|
|
||||||
public static string SettingsFile = "settings.ini";
|
|
||||||
public class Defaults
|
|
||||||
{
|
|
||||||
public static string DefaultPathRPC = Path.Combine(AppDataPath, "RPC");
|
|
||||||
public static string DefaultPathKEY = Path.Combine(AppDataPath, "Keys");
|
|
||||||
public static string DefaultPathPlugins = Path.Combine(Environment.CurrentDirectory, "plugins");
|
|
||||||
}
|
|
||||||
public static void ForceClose()
|
|
||||||
{
|
|
||||||
System.Windows.Forms.Application.Restart();
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
210
WeeXnes/Core/Globals.cs
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
using WeeXnes.RPC;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
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 SettingsFileName = "settings.ini";
|
||||||
|
public static string version = "2.7.9";
|
||||||
|
public static bool info_isRpcRunning = false;
|
||||||
|
public static bool info_RpcAutoStart;
|
||||||
|
public static string apiUrl = "http://www.weexnes.com:5169/";
|
||||||
|
|
||||||
|
public static UpdateVar<bool> settings_alwaysOnTop = new UpdateVar<bool>();
|
||||||
|
|
||||||
|
public static UpdateVar<bool> settings_copySelectedToClipboard = new UpdateVar<bool>();
|
||||||
|
|
||||||
|
public static string settings_KeyManagerItemsPath_Default = AppDataPath + "\\" + "Keys";
|
||||||
|
public static UpdateVar<string> settings_KeyManagerItemsPath = new UpdateVar<string>();
|
||||||
|
public static UpdateVar<bool> settings_KeyManagerItemsPath_Bool = new UpdateVar<bool>();
|
||||||
|
public static UpdateVar<bool> settings_KeyManagerCensorKeys = new UpdateVar<bool>();
|
||||||
|
|
||||||
|
public static string settings_RpcItemsPath_Default = AppDataPath + "\\" + "RPC";
|
||||||
|
public static UpdateVar<string> settings_RpcItemsPath = new UpdateVar<string>();
|
||||||
|
public static UpdateVar<bool> settings_RpcItemsPath_Bool = new UpdateVar<bool>();
|
||||||
|
|
||||||
|
public static UpdateVar<bool> settings_RpcShowElapsedTime = new UpdateVar<bool>();
|
||||||
|
public static UpdateVar<string> settings_RpcDefaultClientID = new UpdateVar<string>();
|
||||||
|
public static UpdateVar<bool> settings_RpcAutoStart = new UpdateVar<bool>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static UpdateVar<string> searchbox_content = new UpdateVar<string>();
|
||||||
|
}
|
||||||
|
public static class SettingsManager
|
||||||
|
{
|
||||||
|
public static INIFile SettingsFile = new INIFile(
|
||||||
|
Globals.AppDataPath + "\\" + Globals.SettingsFileName,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
public static void start()
|
||||||
|
{
|
||||||
|
loadSettings();
|
||||||
|
setEventListeners();
|
||||||
|
}
|
||||||
|
public static void refresh()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void loadSettings()
|
||||||
|
{
|
||||||
|
Globals.settings_alwaysOnTop.Value = Convert.ToBoolean(SettingsFile.GetValue("general", "alwaysOnTop"));
|
||||||
|
|
||||||
|
Globals.settings_copySelectedToClipboard.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copySelectedToClipboard"));
|
||||||
|
Globals.settings_KeyManagerItemsPath_Bool.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath_Bool"));
|
||||||
|
Globals.settings_KeyManagerCensorKeys.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "CensorKeys"));
|
||||||
|
if (Globals.settings_KeyManagerItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerItemsPath.Value = SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerItemsPath.Value = Globals.settings_KeyManagerItemsPath_Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Globals.settings_RpcShowElapsedTime.Value = Convert.ToBoolean(SettingsFile.GetValue("rpc", "RpcShowElapsedTime"));
|
||||||
|
Globals.settings_RpcItemsPath_Bool.Value = Convert.ToBoolean(SettingsFile.GetValue("rpc", "RpcItemsPath_Bool"));
|
||||||
|
Globals.settings_RpcAutoStart.Value = Convert.ToBoolean(SettingsFile.GetValue("rpc", "RpcAutoStart"));
|
||||||
|
if (Globals.settings_RpcItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath.Value = SettingsFile.GetValue("rpc", "RpcItemsPath");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath.Value = Globals.settings_RpcItemsPath_Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
Globals.settings_RpcDefaultClientID.Value = SettingsFile.GetValue("rpc", "RpcDefaultClientID");
|
||||||
|
if (String.IsNullOrEmpty(Globals.settings_RpcDefaultClientID.Value))
|
||||||
|
{
|
||||||
|
Globals.settings_RpcDefaultClientID.Value = "605116707035676701";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setEventListeners()
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerItemsPath_Bool.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (Globals.settings_KeyManagerItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath_Bool", "true");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath_Bool", "false");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Globals.settings_KeyManagerItemsPath.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (Globals.settings_KeyManagerItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath", Globals.settings_KeyManagerItemsPath.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath", "");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Globals.settings_KeyManagerCensorKeys.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (Globals.settings_KeyManagerCensorKeys.Value)
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "CensorKeys", "true");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager", "CensorKeys", "false");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Globals.settings_RpcItemsPath_Bool.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (Globals.settings_RpcItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcItemsPath_Bool", "true");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcItemsPath_Bool", "false");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Globals.settings_RpcItemsPath.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (Globals.settings_RpcItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcItemsPath", Globals.settings_RpcItemsPath.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcItemsPath", "");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Globals.settings_alwaysOnTop.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("general","alwaysOnTop",Convert.ToString(Globals.settings_alwaysOnTop.Value));
|
||||||
|
};
|
||||||
|
Globals.settings_copySelectedToClipboard.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("KeyManager","copySelectedToClipboard",Convert.ToString(Globals.settings_copySelectedToClipboard.Value));
|
||||||
|
};
|
||||||
|
Globals.settings_RpcDefaultClientID.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcDefaultClientID", Globals.settings_RpcDefaultClientID.Value);
|
||||||
|
};
|
||||||
|
Globals.settings_RpcShowElapsedTime.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc", "RpcShowElapsedTime", Convert.ToString(Globals.settings_RpcShowElapsedTime.Value));
|
||||||
|
};
|
||||||
|
Globals.settings_RpcAutoStart.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
SettingsFile.SetValue("rpc","RpcAutoStart", Convert.ToString(Globals.settings_RpcAutoStart.Value));
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,40 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Net;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public class HandleLaunchArguments
|
|
||||||
{
|
|
||||||
public static class ArgumentStrings
|
|
||||||
{
|
|
||||||
public const string autostart = "-autostart";
|
|
||||||
public const string debugMode = "-debugMode";
|
|
||||||
}
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
public static bool Autostart = false;
|
|
||||||
}
|
|
||||||
private const int ATTACH_PARENT_PROCESS = -1;
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
private static extern bool AttachConsole(int dwProcessId);
|
|
||||||
public static void arg_autostart()
|
|
||||||
{
|
|
||||||
Data.Autostart = true;
|
|
||||||
}
|
|
||||||
public static void arg_debugMode()
|
|
||||||
{
|
|
||||||
App.DebugMode = true;
|
|
||||||
HandleLaunchArguments.arg_enableConsole();
|
|
||||||
//Allow untrusted certs in Debug mode
|
|
||||||
ServicePointManager.ServerCertificateValidationCallback +=
|
|
||||||
(sender, cert, chain, sslPolicyErrors) => true;
|
|
||||||
}
|
|
||||||
public static void arg_enableConsole()
|
|
||||||
{
|
|
||||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,296 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright by Nocksoft
|
|
||||||
* https://www.nocksoft.de
|
|
||||||
* https://nocksoft.de/tutorials/visual-c-sharp-arbeiten-mit-ini-dateien/
|
|
||||||
* https://github.com/Nocksoft/INIFile.cs
|
|
||||||
* -----------------------------------
|
|
||||||
* Author: Rafael Nockmann @ Nocksoft
|
|
||||||
* Updated: 2022-01-09
|
|
||||||
* Version: 1.0.3
|
|
||||||
*
|
|
||||||
* Language: Visual C#
|
|
||||||
*
|
|
||||||
* License: MIT license
|
|
||||||
* License URL: https://github.com/Nocksoft/INIFile.cs/blob/master/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>
|
|
||||||
/// Call the constructor creates a new object of the INIFile class to work with INI files.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file">Name of INI file, which you want to access.</param>
|
|
||||||
/// <param name="createFile">Specifies whether the INI file should be created if it does not exist.</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 Public Methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes all comments and empty lines from a complete section and returns the sections.
|
|
||||||
/// This method is not case-sensitive.
|
|
||||||
/// The return value does not contain any spaces at the beginning or at the end of a line.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">Name of the requested section.</param>
|
|
||||||
/// <param name="includeComments">Specifies whether comments should also be returned.</param>
|
|
||||||
/// <returns>Returns the whole section.</returns>
|
|
||||||
public List<string> GetSection(string section, bool includeComments = false)
|
|
||||||
{
|
|
||||||
section = CheckSection(section);
|
|
||||||
|
|
||||||
List<string> completeSection = new List<string>();
|
|
||||||
bool sectionStart = false;
|
|
||||||
|
|
||||||
string[] fileArray = File.ReadAllLines(_File);
|
|
||||||
|
|
||||||
foreach (var item in fileArray)
|
|
||||||
{
|
|
||||||
if (item.Length <= 0) continue;
|
|
||||||
|
|
||||||
// Beginning of section.
|
|
||||||
if (item.Replace(" ", "").ToLower() == section)
|
|
||||||
{
|
|
||||||
sectionStart = true;
|
|
||||||
}
|
|
||||||
// Beginning of next section.
|
|
||||||
if (sectionStart == true && item.Replace(" ", "").ToLower() != section && item.Replace(" ", "").Substring(0, 1) == "[" && item.Replace(" ", "").Substring(item.Length - 1, 1) == "]")
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sectionStart == true)
|
|
||||||
{
|
|
||||||
// Add the entry to the List<string> completeSection, if it is not a comment or an empty entry.
|
|
||||||
if (includeComments == false
|
|
||||||
&& item.Replace(" ", "").Substring(0, 1) != ";" && !string.IsNullOrWhiteSpace(item))
|
|
||||||
{
|
|
||||||
completeSection.Add(ReplaceSpacesAtStartAndEnd(item));
|
|
||||||
}
|
|
||||||
if (includeComments == true && !string.IsNullOrWhiteSpace(item))
|
|
||||||
{
|
|
||||||
completeSection.Add(ReplaceSpacesAtStartAndEnd(item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return completeSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The method returns a value for the associated key.
|
|
||||||
/// This method is not case-sensitive.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">Name of the requested section.</param>
|
|
||||||
/// <param name="key">Name of the requested key.</param>
|
|
||||||
/// <param name="convertValueToLower">If "true" is passed, the value will be returned in lowercase letters.</param>
|
|
||||||
/// <returns>Returns the value for the specified key in the specified section, if available, otherwise null.</returns>
|
|
||||||
public string GetValue(string section, string key, bool convertValueToLower = false)
|
|
||||||
{
|
|
||||||
section = CheckSection(section);
|
|
||||||
key = key.ToLower();
|
|
||||||
|
|
||||||
List<string> completeSection = GetSection(section);
|
|
||||||
|
|
||||||
foreach (var item in completeSection)
|
|
||||||
{
|
|
||||||
// Continue if entry is no 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>
|
|
||||||
/// Set or add a value of the associated key in the specified section.
|
|
||||||
/// This method is not case-sensitive.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">Name of the section.</param>
|
|
||||||
/// <param name="key">Name of the key.</param>
|
|
||||||
/// <param name="value">Value to save.</param>
|
|
||||||
/// <param name="convertValueToLower">If "true" is passed, the value will be saved in lowercase letters.</param>
|
|
||||||
public void SetValue(string section, string key, string value, bool convertValueToLower = false)
|
|
||||||
{
|
|
||||||
section = CheckSection(section, false);
|
|
||||||
string sectionToLower = section.ToLower();
|
|
||||||
|
|
||||||
bool sectionFound = false;
|
|
||||||
|
|
||||||
List<string> iniFileContent = new List<string>();
|
|
||||||
|
|
||||||
string[] fileLines = File.ReadAllLines(_File);
|
|
||||||
|
|
||||||
// Creates a new INI file if none exists.
|
|
||||||
if (fileLines.Length <= 0)
|
|
||||||
{
|
|
||||||
iniFileContent = AddSection(iniFileContent, section, key, value, convertValueToLower);
|
|
||||||
WriteFile(iniFileContent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < fileLines.Length; i++)
|
|
||||||
{
|
|
||||||
// Possibility 1: The desired section has not (yet) been found.
|
|
||||||
if (fileLines[i].Replace(" ", "").ToLower() != sectionToLower)
|
|
||||||
{
|
|
||||||
iniFileContent.Add(fileLines[i]);
|
|
||||||
// If a section does not exist, the section will be created.
|
|
||||||
if (i == fileLines.Length - 1 && fileLines[i].Replace(" ", "").ToLower() != sectionToLower && sectionFound == false)
|
|
||||||
{
|
|
||||||
iniFileContent.Add(null);
|
|
||||||
iniFileContent = AddSection(iniFileContent, section, key, value, convertValueToLower);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Possibility 2 -> Desired section was found.
|
|
||||||
sectionFound = true;
|
|
||||||
|
|
||||||
// Get the complete section in which the target key may be.
|
|
||||||
List<string> targetSection = GetSection(sectionToLower, true);
|
|
||||||
|
|
||||||
for (int x = 0; x < targetSection.Count; x++)
|
|
||||||
{
|
|
||||||
string[] targetKey = targetSection[x].Split(new string[] { "=" }, StringSplitOptions.None);
|
|
||||||
// When the target key is found.
|
|
||||||
if (targetKey[0].ToLower() == key.ToLower())
|
|
||||||
{
|
|
||||||
if (convertValueToLower == true)
|
|
||||||
{
|
|
||||||
iniFileContent.Add(key + "=" + value.ToLower());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iniFileContent.Add(key + "=" + value);
|
|
||||||
}
|
|
||||||
i = i + x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iniFileContent.Add(targetSection[x]);
|
|
||||||
// If the target key is not found, it will be created.
|
|
||||||
if (x == targetSection.Count - 1 && targetKey[0].ToLower() != key.ToLower())
|
|
||||||
{
|
|
||||||
if (convertValueToLower == true)
|
|
||||||
{
|
|
||||||
iniFileContent.Add(key + "=" + value.ToLower());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iniFileContent.Add(key + "=" + value);
|
|
||||||
}
|
|
||||||
i = i + x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteFile(iniFileContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private Methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ensures that a section is always in the following format: [section].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">Section to be checked for correct format.</param>
|
|
||||||
/// <param name="convertToLower">Specifies whether the section should be vonverted in lower case letters.</param>
|
|
||||||
/// <returns>Returns section in this form: [section].</returns>
|
|
||||||
private string CheckSection(string section, bool convertToLower = true)
|
|
||||||
{
|
|
||||||
if (convertToLower == true)
|
|
||||||
{
|
|
||||||
section = section.ToLower();
|
|
||||||
}
|
|
||||||
if (!section.StartsWith("[") && !section.EndsWith("]"))
|
|
||||||
{
|
|
||||||
section = "[" + section + "]";
|
|
||||||
}
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes leading and trailing spaces from sections, keys and values.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">String to be trimmed.</param>
|
|
||||||
/// <returns>Returns the trimmed string.</returns>
|
|
||||||
private string ReplaceSpacesAtStartAndEnd(string item)
|
|
||||||
{
|
|
||||||
// If the string has a key and a value.
|
|
||||||
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>
|
|
||||||
/// Adds a new section with key value pair.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="iniFileContent">List iniFileContent from SetValue.</param>
|
|
||||||
/// <param name="section">Section to be created.</param>
|
|
||||||
/// <param name="key">Key to be added.</param>
|
|
||||||
/// <param name="value">Value to be added.</param>
|
|
||||||
/// <param name="convertValueToLower">Specifies whether the key and value should be saved in lower case letters.</param>
|
|
||||||
/// <returns>Returns the new created section with key value pair.</returns>
|
|
||||||
private List<string> AddSection(List<string> iniFileContent, string section, string key, string value, bool convertValueToLower)
|
|
||||||
{
|
|
||||||
if (convertValueToLower == true)
|
|
||||||
{
|
|
||||||
value = value.ToLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
iniFileContent.Add(section);
|
|
||||||
iniFileContent.Add($"{key}={value}");
|
|
||||||
return iniFileContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WriteFile(List<string> content)
|
|
||||||
{
|
|
||||||
StreamWriter writer = new StreamWriter(_File);
|
|
||||||
foreach (var item in content)
|
|
||||||
{
|
|
||||||
writer.WriteLine(item);
|
|
||||||
}
|
|
||||||
writer.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,144 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Net.Http;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using WeeXnes.Views.ProfileView;
|
|
||||||
using WeeXnes.Views.Settings;
|
|
||||||
using Wpf.Ui.Appearance;
|
|
||||||
using Wpf.Ui.Controls;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
|
|
||||||
public class Auth
|
|
||||||
{
|
|
||||||
public BackgroundWorker _loginWorker { get; set; }
|
|
||||||
public UpdateVar<dynamic> _currentUserCache { get; private set; } = new UpdateVar<dynamic>();
|
|
||||||
private string _token { get; set; }
|
|
||||||
private string _userDataUrl { get; set; }
|
|
||||||
private string _loginUrl { get; set; }
|
|
||||||
public string _email { get; set; }
|
|
||||||
public string _password { private get; set; }
|
|
||||||
public UpdateVar<Exception> ExceptionCache { get; private set; } = new UpdateVar<Exception>();
|
|
||||||
|
|
||||||
public Auth(string loginUrl, string userDataUrl)
|
|
||||||
{
|
|
||||||
this._currentUserCache.Value = null;
|
|
||||||
this._loginWorker = new BackgroundWorker();
|
|
||||||
this._loginWorker.WorkerReportsProgress = true;
|
|
||||||
this._loginWorker.WorkerSupportsCancellation = true;
|
|
||||||
this._loginWorker.DoWork += (sender, args) =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Login(this._email, this._password);
|
|
||||||
GetUserData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.Error(ex.ToString());
|
|
||||||
this.ExceptionCache.Value = ex;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this._loginWorker.RunWorkerCompleted += LoginWorkerOnRunWorkerCompleted;
|
|
||||||
this._loginUrl = loginUrl;
|
|
||||||
this._userDataUrl = userDataUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoginWorkerOnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("LoginWorker complete");
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Login(string email, string password)
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(email))
|
|
||||||
throw new NullReferenceException();
|
|
||||||
if (String.IsNullOrEmpty(password))
|
|
||||||
throw new NullReferenceException();
|
|
||||||
|
|
||||||
using (HttpClient client = new HttpClient())
|
|
||||||
{
|
|
||||||
var postData = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "email", email },
|
|
||||||
{ "password", password }
|
|
||||||
};
|
|
||||||
|
|
||||||
var content = new FormUrlEncodedContent(postData);
|
|
||||||
|
|
||||||
HttpResponseMessage response = client.PostAsync(_loginUrl, content).Result;
|
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
string responseData = response.Content.ReadAsStringAsync().Result;
|
|
||||||
dynamic jsonData = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData);
|
|
||||||
string token = jsonData.token;
|
|
||||||
_token = token;
|
|
||||||
return token;
|
|
||||||
//Console.WriteLine($"Token: {token}");
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.Error("Error: " + response.StatusCode);
|
|
||||||
LoginView.errorStringCache.Value = response.StatusCode.ToString();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public dynamic GetUserData(string token = null)
|
|
||||||
{
|
|
||||||
if(String.IsNullOrEmpty(token))
|
|
||||||
if (String.IsNullOrEmpty(_token))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
token = _token;
|
|
||||||
}
|
|
||||||
// Create an instance of HttpClient
|
|
||||||
using (HttpClient client = new HttpClient())
|
|
||||||
{
|
|
||||||
// Add the token to the request headers
|
|
||||||
client.DefaultRequestHeaders.Add("token", token);
|
|
||||||
|
|
||||||
// Send the GET request
|
|
||||||
HttpResponseMessage response = client.GetAsync(_userDataUrl).Result;
|
|
||||||
|
|
||||||
// Check if the request was successful (status code 200)
|
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
// Read the response content as a string
|
|
||||||
string responseData = response.Content.ReadAsStringAsync().Result;
|
|
||||||
//Console.WriteLine(responseData);
|
|
||||||
// Parse the JSON data into a dynamic object
|
|
||||||
dynamic user = JsonConvert.DeserializeObject(responseData);
|
|
||||||
user = user.user;
|
|
||||||
|
|
||||||
// Now you can access the user object properties dynamically
|
|
||||||
Console.WriteLine("authenticated user: " + user.name);
|
|
||||||
//Console.WriteLine($"Email: {user.email}");
|
|
||||||
// Access other properties as needed
|
|
||||||
_currentUserCache.Value = user;
|
|
||||||
LoginView.alreadyLoggedIn = true;
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Handle the error, e.g., print the status code
|
|
||||||
_currentUserCache.Value = null;
|
|
||||||
|
|
||||||
Console.Error("Error: " + response.StatusCode);
|
|
||||||
|
|
||||||
LoginView.errorStringCache.Value = response.StatusCode.ToString();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,51 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using WXPlugin.PluginCore;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core;
|
|
||||||
|
|
||||||
public class PluginManager
|
|
||||||
{
|
|
||||||
private HashSet<String> Directories = new HashSet<String>();
|
|
||||||
public HashSet<IPluginBase> CurrentPlugins { get; set; } = new HashSet<IPluginBase>();
|
|
||||||
public PluginManager(String pluginPath)
|
|
||||||
{
|
|
||||||
|
|
||||||
Console.WriteLine("Plugin Manager Initialized");
|
|
||||||
Directories.Add(pluginPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadPlugins()
|
|
||||||
{
|
|
||||||
|
|
||||||
Console.WriteLine("Plugin Manager Loading Plugins");
|
|
||||||
CurrentPlugins = new HashSet<IPluginBase>();
|
|
||||||
foreach (var dir in Directories)
|
|
||||||
{
|
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(dir);
|
|
||||||
foreach (var file in dirInfo.GetFiles("*.dll"))
|
|
||||||
{
|
|
||||||
Assembly asm = Assembly.LoadFrom(file.FullName);
|
|
||||||
foreach (Type type in asm.GetTypes())
|
|
||||||
{
|
|
||||||
if (type.IsSubclassOf(typeof(IPluginBase)) || type.GetInterfaces().Contains(typeof(IPluginBase)) && type.IsAbstract == false)
|
|
||||||
{
|
|
||||||
IPluginBase newPlugin = type.InvokeMember(
|
|
||||||
null,
|
|
||||||
BindingFlags.CreateInstance,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null)
|
|
||||||
as IPluginBase;
|
|
||||||
Console.WriteLine("Loaded: " + newPlugin.Name);
|
|
||||||
Console.WriteLine(newPlugin.UiPage.Content.ToString());
|
|
||||||
CurrentPlugins.Add(newPlugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,50 +0,0 @@
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public enum EventType
|
|
||||||
{
|
|
||||||
ProcessStartedEvent,
|
|
||||||
ProcessStoppedEvent,
|
|
||||||
RPCUpdateEvent,
|
|
||||||
RPCReadyEvent
|
|
||||||
}
|
|
||||||
public class customEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public string Content { get; set; }
|
|
||||||
public EventType Type { get; set; }
|
|
||||||
|
|
||||||
public string GradientColor1 { get; set; }
|
|
||||||
public string GradientColor2 { get; set; }
|
|
||||||
public customEvent(string content, EventType type)
|
|
||||||
{
|
|
||||||
this.Content = content;
|
|
||||||
this.Type = type;
|
|
||||||
if (this.Type == EventType.ProcessStartedEvent)
|
|
||||||
{
|
|
||||||
this.GradientColor1 = "#46db69";
|
|
||||||
this.GradientColor2 = "#33a34d";
|
|
||||||
}
|
|
||||||
else if (this.Type == EventType.ProcessStoppedEvent)
|
|
||||||
{
|
|
||||||
this.GradientColor1 = "#d1415d";
|
|
||||||
this.GradientColor2 = "#a33349";
|
|
||||||
}
|
|
||||||
else if (this.Type == EventType.RPCUpdateEvent)
|
|
||||||
{
|
|
||||||
this.GradientColor1 = "#3e65c9";
|
|
||||||
this.GradientColor2 = "#3352a3";
|
|
||||||
}
|
|
||||||
else if (this.Type == EventType.RPCReadyEvent)
|
|
||||||
{
|
|
||||||
this.GradientColor1 = "#c93eb4";
|
|
||||||
this.GradientColor2 = "#a33389";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return this.Content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Net.Mime;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Windows;
|
|
||||||
using WeeXnes.Views.KeyManager;
|
|
||||||
using WeeXnes.Views.Settings;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public static class SaveSettingsHandler
|
|
||||||
{
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
//Layout-Names for INIFiles
|
|
||||||
public static class General
|
|
||||||
{
|
|
||||||
public const string Section = "GENERAL";
|
|
||||||
public const string RpcFilesPath = "RpcFilesPath";
|
|
||||||
public const string KeyFilesPath = "KeyFilesPath";
|
|
||||||
public const string StartupUpdateCheck = "StartupUpdateCheck";
|
|
||||||
}
|
|
||||||
public static class KeyManager
|
|
||||||
{
|
|
||||||
public const string Section = "KEY_MANAGER";
|
|
||||||
public const string CensorKeys = "CensorKeys";
|
|
||||||
public const string CopyOnSelect = "CopyOnSelect";
|
|
||||||
public const string SortList = "SortList";
|
|
||||||
}
|
|
||||||
public static class DiscordRpcFiles
|
|
||||||
{
|
|
||||||
public const string Section = "CONFIG";
|
|
||||||
public const string ProcessName = "ProcessName";
|
|
||||||
public const string ClientId = "ClientID";
|
|
||||||
public const string State = "State";
|
|
||||||
public const string Details = "Details";
|
|
||||||
public const string BigImageKey = "BigImageKey";
|
|
||||||
public const string BigImageText = "BigImageText";
|
|
||||||
public const string SmallImageKey = "SmallImageKey";
|
|
||||||
public const string SmallImageText = "SmallImageText";
|
|
||||||
public const string UUID = "UUID";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void SetupSaveEvents()
|
|
||||||
{
|
|
||||||
KeyManagerView.Data.censorKeys.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.KeyManager.Section,
|
|
||||||
Data.KeyManager.CensorKeys,
|
|
||||||
KeyManagerView.Data.censorKeys.Value.ToString()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
KeyManagerView.Data.copyOnSelect.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.KeyManager.Section,
|
|
||||||
Data.KeyManager.CopyOnSelect,
|
|
||||||
KeyManagerView.Data.copyOnSelect.Value.ToString()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
KeyManagerView.Data.sortList.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.KeyManager.Section,
|
|
||||||
Data.KeyManager.SortList,
|
|
||||||
KeyManagerView.Data.sortList.Value.ToString()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Global.AppDataPathRPC.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.General.Section,
|
|
||||||
Data.General.RpcFilesPath,
|
|
||||||
Global.AppDataPathRPC.Value
|
|
||||||
);
|
|
||||||
};
|
|
||||||
Global.AppDataPathKEY.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.General.Section,
|
|
||||||
Data.General.KeyFilesPath,
|
|
||||||
Global.AppDataPathKEY.Value
|
|
||||||
);
|
|
||||||
};
|
|
||||||
Global.checkUpdateOnStartup.ValueChanged += () =>
|
|
||||||
{
|
|
||||||
SettingsView.Data.settingsFile.SetValue(
|
|
||||||
Data.General.Section,
|
|
||||||
Data.General.StartupUpdateCheck,
|
|
||||||
Global.checkUpdateOnStartup.Value.ToString()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,99 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using WeeXnes.Views.KeyManager;
|
|
||||||
|
|
||||||
namespace WeeXnes.Core
|
|
||||||
{
|
|
||||||
public class WXFile
|
|
||||||
{
|
|
||||||
private const string FileIdentifier = "##WXfile##";
|
|
||||||
public string path
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
public WXFile(string _path)
|
|
||||||
{
|
|
||||||
this.path = _path;
|
|
||||||
}
|
|
||||||
public string GetName()
|
|
||||||
{
|
|
||||||
string returnval = null;
|
|
||||||
string[] rawcontent = Methods.ReadFile(this.path);
|
|
||||||
|
|
||||||
if (Methods.Verify(rawcontent))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
returnval = rawcontent[1];
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
returnval = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnval;
|
|
||||||
}
|
|
||||||
public string GetValue()
|
|
||||||
{
|
|
||||||
string returnval = null;
|
|
||||||
string[] rawcontent = Methods.ReadFile(this.path);
|
|
||||||
|
|
||||||
if (Methods.Verify(rawcontent))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
returnval = rawcontent[2];
|
|
||||||
}catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
returnval = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnval;
|
|
||||||
}
|
|
||||||
public static class Methods
|
|
||||||
{
|
|
||||||
public static void WriteFile(KeyItem keyItem, WXFile wxFile)
|
|
||||||
{
|
|
||||||
|
|
||||||
string[] fileContent = new string[]
|
|
||||||
{
|
|
||||||
"##WXfile##",
|
|
||||||
keyItem.Name,
|
|
||||||
EncryptionLib.EncryptorLibary.encrypt(
|
|
||||||
Information.EncryptionHash,
|
|
||||||
keyItem.Value
|
|
||||||
)
|
|
||||||
};
|
|
||||||
Functions.writeFile(fileContent, wxFile.path);
|
|
||||||
}
|
|
||||||
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] == FileIdentifier)
|
|
||||||
{
|
|
||||||
integ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return integ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
BIN
WeeXnes/Fonts/Poppins-Regular.ttf
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
|
@ -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
|
@ -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>
|
317
WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
Normal file
|
@ -0,0 +1,317 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
CheckFolders();
|
||||||
|
InitializeComponent();
|
||||||
|
triggerLogupdate.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if(logContent != null)
|
||||||
|
{
|
||||||
|
writeLog(logContent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
InitializeSettings();
|
||||||
|
CheckForAutostart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckFolders()
|
||||||
|
{
|
||||||
|
if (!Globals.settings_RpcItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath.Value = Globals.settings_RpcItemsPath_Default;
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(Globals.settings_RpcItemsPath.Value))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Globals.settings_RpcItemsPath.Value);
|
||||||
|
Console.WriteLine("Created settings_RpcItemsPath");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckForAutostart()
|
||||||
|
{
|
||||||
|
if (Globals.info_RpcAutoStart)
|
||||||
|
{
|
||||||
|
Globals.info_RpcAutoStart = 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.info_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.info_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.settings_RpcDefaultClientID.Value);
|
||||||
|
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.settings_RpcItemsPath.Value + "\\" + 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.settings_RpcItemsPath.Value + "\\" + game.fileName);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Misc.Message message = new Misc.Message(e.ToString());
|
||||||
|
message.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void readRpcFileDirectory()
|
||||||
|
{
|
||||||
|
bool Empty = funcs.IsDirectoryEmpty(Globals.settings_RpcItemsPath.Value);
|
||||||
|
List<Game> readGames = new List<Game>();
|
||||||
|
if (!Empty)
|
||||||
|
{
|
||||||
|
Console.WriteLine("RpcDir is not Empty, Reading content");
|
||||||
|
string[] files = Directory.GetFiles(Globals.settings_RpcItemsPath.Value, "*.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
|
@ -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
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
80
WeeXnes/MVVM/View/KeyManagerView.xaml
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<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"
|
||||||
|
Name="monkeman"
|
||||||
|
Loaded="Monkeman_OnLoaded"/>
|
||||||
|
</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>
|
267
WeeXnes/MVVM/View/KeyManagerView.xaml.cs
Normal file
|
@ -0,0 +1,267 @@
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
CheckForFolders();
|
||||||
|
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.settings_KeyManagerItemsPath.Value + "\\" + 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();
|
||||||
|
if (!SaveInterface.IsDirectoryEmpty(Globals.settings_KeyManagerItemsPath.Value))
|
||||||
|
{
|
||||||
|
string[] files = SaveInterface.GetFilesInDir(Globals.settings_KeyManagerItemsPath.Value);
|
||||||
|
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 (!Globals.settings_KeyManagerItemsPath_Bool.Value)
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerItemsPath.Value = Globals.settings_KeyManagerItemsPath_Default;
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(Globals.AppDataPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Globals.AppDataPath);
|
||||||
|
Console.WriteLine("Created AppDataPath");
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(Globals.settings_KeyManagerItemsPath.Value))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Globals.settings_KeyManagerItemsPath.Value);
|
||||||
|
Console.WriteLine("Created settings_KeyManagerItemsPath");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.settings_copySelectedToClipboard.Value)
|
||||||
|
{
|
||||||
|
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.settings_KeyManagerItemsPath.Value);
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Monkeman_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (Globals.settings_KeyManagerCensorKeys.Value)
|
||||||
|
{
|
||||||
|
TextBlock tb = (TextBlock)sender;
|
||||||
|
int text_size = tb.Text.Length;
|
||||||
|
string censored_string = "";
|
||||||
|
for (int i = 0; i <= text_size; i++)
|
||||||
|
censored_string = censored_string + "•";
|
||||||
|
tb.Text = censored_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
217
WeeXnes/MVVM/View/SettingView.xaml
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
<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">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
<Button Name="CheckForUpdateBtn"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Check for Updates"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="CheckForUpdateBtn_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
|
||||||
|
<Button Name="createShortcut"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Create Startmenu Entry"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="CreateShortcut_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
</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 ClientID"
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
<Label Content="Placeholder" HorizontalAlignment="Center"
|
||||||
|
FontSize="8"
|
||||||
|
Foreground="White"
|
||||||
|
Name="RpcPathLabel"/>
|
||||||
|
<Button Name="SetRpcLocation"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Set Rpc Files Path"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="SetRpcLocation_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
<Button Name="SetRpcLocationDefault"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Set Default Path"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="SetRpcLocationDefault_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Column="1"
|
||||||
|
Background="#22202f"
|
||||||
|
CornerRadius="10"
|
||||||
|
Margin="10,40,10,10">
|
||||||
|
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<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>
|
||||||
|
<CheckBox VerticalAlignment="Top"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
Name="CensorKeysSwitch"
|
||||||
|
Checked="CensorKeysSwitch_OnChecked"
|
||||||
|
Unchecked="CensorKeysSwitch_OnUnchecked"
|
||||||
|
Margin="10,10,0,0">
|
||||||
|
<TextBlock
|
||||||
|
Text="Censor Keys Visually"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="15"
|
||||||
|
Foreground="White"/>
|
||||||
|
</CheckBox>
|
||||||
|
<Label Content="Placeholder" HorizontalAlignment="Center"
|
||||||
|
FontSize="8"
|
||||||
|
Foreground="White"
|
||||||
|
Name="KeyPathLabel"/>
|
||||||
|
<Button Name="SetKeyLocation"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Set Key Files Path"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="SetKeyLocation_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
<Button Name="SetKeyLocationDefault"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="Set Default Path"
|
||||||
|
Background="#353340"
|
||||||
|
Height="25"
|
||||||
|
Click="SetKeyLocationDefault_OnClick"
|
||||||
|
Margin="4,10,4,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</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>
|
330
WeeXnes/MVVM/View/SettingView.xaml.cs
Normal file
|
@ -0,0 +1,330 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Nocksoft.IO.ConfigFiles;
|
||||||
|
using WeeXnes.Core;
|
||||||
|
using WeeXnes.Misc;
|
||||||
|
using Application = System.Windows.Forms.Application;
|
||||||
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
using Path = System.IO.Path;
|
||||||
|
using UserControl = System.Windows.Controls.UserControl;
|
||||||
|
|
||||||
|
namespace WeeXnes.MVVM.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für SettingView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SettingView : UserControl
|
||||||
|
{
|
||||||
|
public SettingView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
//LoadUiFromSettingsFile();
|
||||||
|
SetFunction();
|
||||||
|
SetUiUpdateListeners();
|
||||||
|
InitializeUi();
|
||||||
|
//UpdatePathsOnUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeUi()
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(Globals.settings_RpcItemsPath.Value))
|
||||||
|
{
|
||||||
|
RpcPathLabel.Content = Globals.settings_RpcItemsPath.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RpcPathLabel.Content = Globals.settings_RpcItemsPath_Default;
|
||||||
|
}
|
||||||
|
if (!String.IsNullOrEmpty(Globals.settings_KeyManagerItemsPath.Value))
|
||||||
|
{
|
||||||
|
KeyPathLabel.Content = Globals.settings_KeyManagerItemsPath.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyPathLabel.Content = Globals.settings_KeyManagerItemsPath_Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.settings_alwaysOnTop.Value)
|
||||||
|
{
|
||||||
|
AlwaysOnTopSwitch.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.settings_RpcAutoStart.Value)
|
||||||
|
{
|
||||||
|
UnsetFunction();
|
||||||
|
EnableAutoStart.IsChecked = true;
|
||||||
|
SetFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.settings_RpcShowElapsedTime.Value)
|
||||||
|
{
|
||||||
|
ShowElapsedTimeOnRpc.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.settings_copySelectedToClipboard.Value)
|
||||||
|
{
|
||||||
|
ItemToClipboardSwitch.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.settings_KeyManagerCensorKeys.Value)
|
||||||
|
{
|
||||||
|
CensorKeysSwitch.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
tb_DefaultClientID.Text = Globals.settings_RpcDefaultClientID.Value;
|
||||||
|
}
|
||||||
|
private void SetUiUpdateListeners()
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(Globals.settings_RpcItemsPath.Value))
|
||||||
|
{
|
||||||
|
RpcPathLabel.Content = Globals.settings_RpcItemsPath.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RpcPathLabel.Content = Globals.settings_RpcItemsPath_Default;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Globals.settings_KeyManagerItemsPath.ValueChanged += () =>
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(Globals.settings_KeyManagerItemsPath.Value))
|
||||||
|
{
|
||||||
|
KeyPathLabel.Content = Globals.settings_KeyManagerItemsPath.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyPathLabel.Content = Globals.settings_KeyManagerItemsPath_Default;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
private void SetFunction()
|
||||||
|
{
|
||||||
|
EnableAutoStart.Checked += EnableAutoStart_Checked;
|
||||||
|
EnableAutoStart.Unchecked += EnableAutoStart_Unchecked;
|
||||||
|
}
|
||||||
|
private void UnsetFunction()
|
||||||
|
{
|
||||||
|
EnableAutoStart.Checked -= EnableAutoStart_Checked;
|
||||||
|
EnableAutoStart.Unchecked -= EnableAutoStart_Unchecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void AlwaysOnTopSwitch_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_alwaysOnTop.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void AlwaysOnTopSwitch_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_alwaysOnTop.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowElapsedTimeOnRpc_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcShowElapsedTime.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowElapsedTimeOnRpc_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcShowElapsedTime.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ItemToClipboardSwitch_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_copySelectedToClipboard.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ItemToClipboardSwitch_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_copySelectedToClipboard.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenAppdataFolder_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Process.Start(Globals.AppDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveDefaultID_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(tb_DefaultClientID.Text))
|
||||||
|
{
|
||||||
|
Globals.settings_RpcDefaultClientID.Value = tb_DefaultClientID.Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Misc.Message message = new Misc.Message("Dont leave ClientID empty");
|
||||||
|
message.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchAutoRpc(bool on)
|
||||||
|
{
|
||||||
|
UnsetFunction();
|
||||||
|
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcAutoStart.Value = true;
|
||||||
|
EnableAutoStart.IsChecked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals.settings_RpcAutoStart.Value = 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void SetKeyLocationDefault_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerItemsPath_Bool.Value = false;
|
||||||
|
Globals.settings_KeyManagerItemsPath.Value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetKeyLocation_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
using(var fbd = new FolderBrowserDialog())
|
||||||
|
{
|
||||||
|
DialogResult result = fbd.ShowDialog();
|
||||||
|
|
||||||
|
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||||
|
{
|
||||||
|
|
||||||
|
Globals.settings_KeyManagerItemsPath_Bool.Value = true;
|
||||||
|
Globals.settings_KeyManagerItemsPath.Value = fbd.SelectedPath;
|
||||||
|
//MessageBox.Show("valid path: " + fbd.SelectedPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetRpcLocationDefault_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath_Bool.Value = false;
|
||||||
|
Globals.settings_RpcItemsPath.Value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetRpcLocation_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
using(var fbd = new FolderBrowserDialog())
|
||||||
|
{
|
||||||
|
DialogResult result = fbd.ShowDialog();
|
||||||
|
|
||||||
|
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||||
|
{
|
||||||
|
Globals.settings_RpcItemsPath_Bool.Value = true;
|
||||||
|
Globals.settings_RpcItemsPath.Value = fbd.SelectedPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckForUpdateBtn_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WebClient client = new WebClient();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string downloadString = client.DownloadString(Globals.apiUrl);
|
||||||
|
ApiResponse GitHub = JsonConvert.DeserializeObject<ApiResponse>(downloadString);
|
||||||
|
if (GitHub.tag_name != Globals.version)
|
||||||
|
{
|
||||||
|
Misc.UpdateMessage updateMessage = new UpdateMessage(
|
||||||
|
GitHub,
|
||||||
|
"Update Found");
|
||||||
|
updateMessage.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Misc.Message msg = new Misc.Message("No Updates found");
|
||||||
|
msg.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Misc.Message error = new Misc.Message(ex.ToString());
|
||||||
|
error.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateShortcut_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process p = Process.Start("WeeXnes_UAC.exe", "-CreateStartMenuShortcut");
|
||||||
|
p.WaitForExit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Misc.Message message = new Misc.Message(ex.ToString());
|
||||||
|
message.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CensorKeysSwitch_OnChecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerCensorKeys.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CensorKeysSwitch_OnUnchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Globals.settings_KeyManagerCensorKeys.Value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,130 +1,130 @@
|
||||||
<ui:UiWindow x:Class="WeeXnes.MainWindow"
|
<Window x:Class="WeeXnes.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
xmlns:local="clr-namespace:WeeXnes"
|
||||||
xmlns:home="clr-namespace:WeeXnes.Views.Home"
|
xmlns:viewModel="clr-namespace:WeeXnes.MVVM.ViewModel"
|
||||||
xmlns:keymanager="clr-namespace:WeeXnes.Views.KeyManager"
|
|
||||||
xmlns:settings="clr-namespace:WeeXnes.Views.Settings"
|
|
||||||
xmlns:discordrpc="clr-namespace:WeeXnes.Views.DiscordRPC"
|
|
||||||
xmlns:passwordGenerator="clr-namespace:WeeXnes.Views.PasswordGenerator"
|
|
||||||
xmlns:profile="clr-namespace:WeeXnes.Views.ProfileView"
|
|
||||||
xmlns:EncryptedTextEditor="clr-namespace:WeeXnes.Views.EncryptedTextEditor"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Height="540"
|
Height="600"
|
||||||
Width="500"
|
Width="920"
|
||||||
|
WindowStyle="None"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
Background="Transparent"
|
||||||
|
AllowsTransparency="True"
|
||||||
Title="WeeXnes"
|
Title="WeeXnes"
|
||||||
Background="{DynamicResource ApplicationBackgroundBrush}"
|
|
||||||
ExtendsContentIntoTitleBar="True"
|
|
||||||
WindowBackdropType="Mica"
|
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Loaded="MainWindow_OnLoaded">
|
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>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="200"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="75"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ui:TitleBar
|
|
||||||
Grid.Row="0"
|
|
||||||
Title="WeeXnes Suite"
|
|
||||||
ForceShutdown="False"
|
|
||||||
MinimizeToTray="True"
|
|
||||||
ShowHelp="False"
|
|
||||||
ShowClose="True"
|
|
||||||
ShowMaximize="True"
|
|
||||||
ShowMinimize="True"
|
|
||||||
UseSnapLayout="True"
|
|
||||||
Name="TitleBar2">
|
|
||||||
<ui:TitleBar.Tray>
|
|
||||||
|
|
||||||
<ui:NotifyIcon Icon="/Images/wicon.png"
|
<TextBlock Text="WeeXnes"
|
||||||
LeftClick="NotifyIcon_OnLeftClick">
|
VerticalAlignment="Center"
|
||||||
<ui:NotifyIcon.Menu>
|
HorizontalAlignment="Left"
|
||||||
<ContextMenu>
|
Foreground="White"
|
||||||
<MenuItem
|
FontSize="22"
|
||||||
Header="Start RPC"
|
Margin="20,0,0,0"
|
||||||
Click="ContextStartRpc_OnClick"/>
|
FontFamily="/Fonts/#Poppins"/>
|
||||||
<MenuItem
|
|
||||||
Header="Stop RPC"
|
|
||||||
Click="ContextStopRpc_OnClick"/>
|
|
||||||
<MenuItem
|
|
||||||
Header="Exit"
|
|
||||||
Click="ContextExit_OnClick"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</ui:NotifyIcon.Menu>
|
|
||||||
</ui:NotifyIcon>
|
|
||||||
</ui:TitleBar.Tray>
|
|
||||||
|
|
||||||
</ui:TitleBar>
|
<StackPanel Grid.Row="1">
|
||||||
|
<RadioButton Content="Home"
|
||||||
|
Height="50"
|
||||||
|
Foreground="White"
|
||||||
|
FontSize="14"
|
||||||
|
Style="{StaticResource MenuButtonRoundTheme}"
|
||||||
|
IsChecked="True"
|
||||||
|
Command="{Binding HomeViewCommand}"
|
||||||
|
Name="HomeMenuButton"/>
|
||||||
|
|
||||||
<Grid Margin="8" Grid.Row="1">
|
<RadioButton Content="Key Manager"
|
||||||
<Grid.ColumnDefinitions>
|
Height="50"
|
||||||
<ColumnDefinition Width="Auto" />
|
Foreground="White"
|
||||||
<ColumnDefinition Width="*" />
|
FontSize="14"
|
||||||
</Grid.ColumnDefinitions>
|
Style="{StaticResource MenuButtonRoundTheme}"
|
||||||
<ui:NavigationStore
|
Command="{Binding KeyManagerViewCommand}"
|
||||||
Name="NavBar"
|
Name="KMMenuButton"/>
|
||||||
Grid.Column="0"
|
|
||||||
Frame="{Binding ElementName=MainFrame}"
|
<RadioButton Content="DiscordRPC"
|
||||||
SelectedPageIndex="0">
|
Height="50"
|
||||||
<ui:NavigationStore.Items>
|
Foreground="White"
|
||||||
<ui:NavigationItem
|
FontSize="14"
|
||||||
Content="Home"
|
Style="{StaticResource MenuButtonRoundTheme}"
|
||||||
Icon="Home24"
|
Command="{Binding DiscordRpcViewCommand}"
|
||||||
PageTag="home"
|
Name="RpcMenuButton"/>
|
||||||
Name="ButtonHome"
|
|
||||||
PageType="{x:Type home:HomeView}"/>
|
<RadioButton Content="Settings"
|
||||||
<ui:NavigationItem
|
Height="50"
|
||||||
Content="RPC"
|
Foreground="White"
|
||||||
Icon="XboxController24"
|
FontSize="14"
|
||||||
Name="ButtonRpc"
|
Style="{StaticResource MenuButtonRoundTheme}"
|
||||||
PageTag="RPC"
|
Command="{Binding SettingsViewCommand}"
|
||||||
PageType="{x:Type discordrpc:DiscordRPCView}"
|
Name="SettingsMenuButton"/>
|
||||||
Loaded="RPCBtn_OnLoaded"/>
|
|
||||||
<ui:NavigationItem
|
|
||||||
Content="Keys"
|
|
||||||
Icon="Key24"
|
|
||||||
PageTag="Keys"
|
</StackPanel>
|
||||||
PageType="{x:Type keymanager:KeyManagerView}"/>
|
|
||||||
<ui:NavigationItem
|
|
||||||
Content="Gen."
|
<TextBox Grid.Column="1"
|
||||||
Icon="Password24"
|
Width="250"
|
||||||
Name="ButtonPwGen"
|
Height="40"
|
||||||
PageTag="Gen"
|
VerticalAlignment="Center"
|
||||||
PageType="{x:Type passwordGenerator:PasswordGenView}"/>
|
HorizontalAlignment="Left"
|
||||||
<ui:NavigationItem
|
Margin="5"
|
||||||
Content="Editor"
|
Style="{StaticResource ModernTextbox}"
|
||||||
Icon="DocumentOnePage24"
|
TextChanged="Searchbox_TextChanged"
|
||||||
Name="ButtonEncryptedFileEditor"
|
Name="Searchbox"
|
||||||
PageTag="Editor"
|
|
||||||
PageType="{x:Type EncryptedTextEditor:TextEditorView}"/>
|
|
||||||
<ui:NavigationItem
|
|
||||||
Content="Profile"
|
|
||||||
Icon="InprivateAccount24"
|
|
||||||
Name="ButtonProfile"
|
|
||||||
PageTag="Profile"
|
|
||||||
PageType="{x:Type profile:LoginView}"
|
|
||||||
Visibility="Collapsed"/>
|
|
||||||
</ui:NavigationStore.Items>
|
|
||||||
<ui:NavigationStore.Footer>
|
|
||||||
<ui:NavigationItem
|
|
||||||
Content="Settings"
|
|
||||||
Icon="Settings24"
|
|
||||||
PageTag="Settings"
|
|
||||||
PageType="{x:Type settings:SettingsView}"/>
|
|
||||||
</ui:NavigationStore.Footer>
|
|
||||||
</ui:NavigationStore>
|
|
||||||
<Frame
|
|
||||||
x:Name="MainFrame"
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="8,0,0,0"
|
|
||||||
/>
|
/>
|
||||||
</Grid>
|
<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>
|
</Grid>
|
||||||
|
|
||||||
</ui:UiWindow>
|
</Border>
|
||||||
|
</Window>
|
||||||
|
|
||||||
|
|
|
@ -1,74 +1,173 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
using ButtonBase = System.Windows.Controls.Primitives.ButtonBase;
|
using WeeXnes.MVVM.View;
|
||||||
using NotifyIcon = Wpf.Ui.Controls.NotifyIcon;
|
|
||||||
|
|
||||||
namespace WeeXnes
|
namespace WeeXnes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaktionslogik für MainWindow.xaml
|
/// Interaktionslogik für MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
System.Windows.Forms.NotifyIcon trayIcon = new System.Windows.Forms.NotifyIcon();
|
||||||
|
private ContextMenuStrip trayIconMenu = new ContextMenuStrip();
|
||||||
public MainWindow()
|
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();
|
InitializeComponent();
|
||||||
Wpf.Ui.Appearance.Accent.ApplySystemAccent();
|
|
||||||
EnableDebugOptions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnableDebugOptions()
|
private void buildTrayMenu()
|
||||||
{
|
{
|
||||||
if(!App.DebugMode)
|
trayIconMenu.Items.Add("Show Window",null, (sender, args) =>
|
||||||
return;
|
|
||||||
//Code to be enabled in Debug mode
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void RPCBtn_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
{
|
||||||
if (HandleLaunchArguments.Data.Autostart)
|
|
||||||
{
|
|
||||||
ButtonRpc.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
|
|
||||||
MainFrame.Source = new Uri("/Views/DiscordRPC/RunRPCView.xaml",UriKind.Relative);
|
|
||||||
this.Visibility = Visibility.Collapsed;
|
|
||||||
this.ShowInTaskbar = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ContextStartRpc_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
ButtonRpc.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
|
|
||||||
MainFrame.Source = new Uri("/Views/DiscordRPC/RunRPCView.xaml",UriKind.Relative);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ContextStopRpc_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
ButtonHome.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyIcon_OnLeftClick(NotifyIcon sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
this.ShowInTaskbar = true;
|
|
||||||
this.Show();
|
this.Show();
|
||||||
}
|
this.WindowState = WindowState.Normal;
|
||||||
private void ContextExit_OnClick(object sender, RoutedEventArgs e)
|
trayIcon.Visible = false;
|
||||||
{
|
});
|
||||||
Environment.Exit(0);
|
//RPC MENU//////////////////////////////////////////////////////////////////////////////////////
|
||||||
}
|
//monke
|
||||||
|
|
||||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
ToolStripMenuItem DiscordMenu = new ToolStripMenuItem("DiscordRPC");
|
||||||
|
|
||||||
|
|
||||||
|
DiscordMenu.DropDownItems.Add("Stop DiscordRPC",null, (sender, args) =>
|
||||||
{
|
{
|
||||||
foreach (var plugin in Global.pluginManager.CurrentPlugins)
|
controllRpcFromTray(false);
|
||||||
|
});
|
||||||
|
DiscordMenu.DropDownItems.Add("Start DiscordRPC",null, (sender, args) =>
|
||||||
{
|
{
|
||||||
NavBar.Items.Add(plugin.NavIcon);
|
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.info_RpcAutoStart = 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();
|
||||||
|
SettingsManager.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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.info_RpcAutoStart)
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Deactivated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Window window = (Window)sender;
|
||||||
|
if (Globals.settings_alwaysOnTop.Value)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -47,7 +47,25 @@ namespace EncryptionLib
|
||||||
}
|
}
|
||||||
return returnval;
|
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)
|
public static string[] encryptArray(string hash, string[] arrayToEncrypt)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < arrayToEncrypt.Length; i++)
|
for (int i = 0; i < arrayToEncrypt.Length; i++)
|
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
|
@ -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>
|
34
WeeXnes/Misc/Message.xaml.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
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, string _title = "Message")
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
MessageLabel.Content = _message;
|
||||||
|
this.Title = _title;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
WeeXnes/Misc/UpdateMessage.xaml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<Window x:Class="WeeXnes.Misc.UpdateMessage"
|
||||||
|
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"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<Button Grid.Row="1"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="OK"
|
||||||
|
Width="140"
|
||||||
|
Height="40"
|
||||||
|
Background="#353340"
|
||||||
|
Name="okButton"
|
||||||
|
Click="OkButton_OnClick"/>
|
||||||
|
<Button Grid.Row="1"
|
||||||
|
Style="{StaticResource UniversalMaterialButton}"
|
||||||
|
Content="CANCEL"
|
||||||
|
Width="140"
|
||||||
|
Height="40"
|
||||||
|
Background="#353340"
|
||||||
|
Name="cancelButton"
|
||||||
|
Click="CancelButton_OnClick"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
61
WeeXnes/Misc/UpdateMessage.xaml.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Windows;
|
||||||
|
using WeeXnes.Core;
|
||||||
|
using Application = System.Windows.Forms.Application;
|
||||||
|
|
||||||
|
namespace WeeXnes.Misc
|
||||||
|
{
|
||||||
|
public partial class UpdateMessage : Window
|
||||||
|
{
|
||||||
|
public static ApiResponse GitHub;
|
||||||
|
public UpdateMessage(ApiResponse _GitHub, string _title = "Message")
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
string content = "Your Version: " + Globals.version + "\n" +
|
||||||
|
"Current Version: " + _GitHub.tag_name;
|
||||||
|
MessageLabel.Content = content;
|
||||||
|
this.Title = _title;
|
||||||
|
GitHub = _GitHub;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void downloadAssets()
|
||||||
|
{
|
||||||
|
checkForFile();
|
||||||
|
WebClient client = new WebClient();
|
||||||
|
client.DownloadFile(GitHub.download_url, GitHub.file_name);
|
||||||
|
}
|
||||||
|
private static void checkForFile()
|
||||||
|
{
|
||||||
|
if (File.Exists(GitHub.file_name))
|
||||||
|
{
|
||||||
|
File.Delete(GitHub.file_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OkButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
downloadAssets();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string path = Application.StartupPath;
|
||||||
|
string fileName = Path.GetFileName(Application.ExecutablePath);
|
||||||
|
string pid = Process.GetCurrentProcess().Id.ToString();
|
||||||
|
Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + GitHub.file_name + "\"");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Misc.Message message = new Misc.Message(ex.ToString());
|
||||||
|
message.Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
152
WeeXnes/RPC/Game.cs
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (Globals.settings_RpcShowElapsedTime.Value)
|
||||||
|
{
|
||||||
|
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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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,50 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.DiscordRPC.AddRPCView"
|
|
||||||
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.Views.DiscordRPC"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="AddRPCView" Height="Auto" Width="Auto">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition Height="45"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="0">
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<ui:TextBox Name="TextboxProcessname" PlaceholderText="Process name" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxClientid" PlaceholderText="Client ID" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxDetails" PlaceholderText="Details" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxState" PlaceholderText="State" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxBigimgkey" PlaceholderText="Big image key" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxBigimgtxt" PlaceholderText="Big image text" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxSmallimgkey" PlaceholderText="Small image key" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxSmallimgtxt" PlaceholderText="Small image text" Margin="0,4"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ui:Button
|
|
||||||
Padding="24,6"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Content="Cancel"
|
|
||||||
Icon="CaretLeft24"
|
|
||||||
Name="ButtonCancelDialog"
|
|
||||||
Click="ButtonCancelDialog_OnClick"/>
|
|
||||||
<ui:Button Grid.Column="1"
|
|
||||||
Padding="24,6"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Content="Add"
|
|
||||||
Icon="AddCircle32"
|
|
||||||
Name="ButtonSaveDialog"
|
|
||||||
Click="ButtonSaveDialog_OnClick"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,56 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Net.Mime;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.DiscordRPC
|
|
||||||
{
|
|
||||||
public partial class AddRPCView : Page
|
|
||||||
{
|
|
||||||
public AddRPCView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseDialog()
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/DiscordRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSaveDialog_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if(String.IsNullOrEmpty(TextboxProcessname.Text))
|
|
||||||
return;
|
|
||||||
if(String.IsNullOrEmpty(TextboxClientid.Text))
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//Add new item
|
|
||||||
Game newGame = new Game(
|
|
||||||
TextboxProcessname.Text,
|
|
||||||
TextboxClientid.Text,
|
|
||||||
TextboxDetails.Text,
|
|
||||||
TextboxState.Text,
|
|
||||||
TextboxBigimgkey.Text,
|
|
||||||
TextboxBigimgtxt.Text,
|
|
||||||
TextboxSmallimgkey.Text,
|
|
||||||
TextboxSmallimgtxt.Text
|
|
||||||
);
|
|
||||||
DiscordRPCView.Data.Games.Add(newGame);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
CloseDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancelDialog_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
CloseDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.DiscordRPC.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.Views.DiscordRPC"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Tag="RPCView"
|
|
||||||
Title="DiscordRPCView" Height="Auto" Width="Auto">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="74"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ListBox Grid.Column="0" Name="ItemboxRpc" Margin="0,0,0,5"
|
|
||||||
SelectionChanged="ItemboxRpc_OnSelectionChanged">
|
|
||||||
<ListBox.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Header="Edit"
|
|
||||||
Name="ButtonContextEdit"
|
|
||||||
Click="ContextMenu_Edit"/>
|
|
||||||
<MenuItem Header="Export"
|
|
||||||
Name="ButtonContextExport"
|
|
||||||
Click="ContextMenu_Export"/>
|
|
||||||
<MenuItem Header="Import"
|
|
||||||
Name="ButtonContextImport"
|
|
||||||
Click="ContextMenu_Import"/>
|
|
||||||
<Separator />
|
|
||||||
<MenuItem Header="Remove"
|
|
||||||
Name="ButtonContextRemove"
|
|
||||||
Click="ContextMenu_Remove"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</ListBox.ContextMenu>
|
|
||||||
</ListBox>
|
|
||||||
<StackPanel Grid.Column="1">
|
|
||||||
<ui:CardAction Icon="Play28" Grid.Row="1"
|
|
||||||
Name="ButtonStartRPC"
|
|
||||||
Margin="5,0,0,0"
|
|
||||||
Click="ButtonStartRPC_OnClick">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock
|
|
||||||
Margin="0,0,0,4"
|
|
||||||
FontWeight="Medium"
|
|
||||||
Text="Run RPC"
|
|
||||||
/>
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardAction>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<ui:CardAction Icon="AddCircle32" Grid.Row="1"
|
|
||||||
Name="ButtonAddProcess"
|
|
||||||
Click="ButtonAddProcess_OnClick">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock
|
|
||||||
Margin="0,0,0,4"
|
|
||||||
FontWeight="Medium"
|
|
||||||
Text="Add Process" />
|
|
||||||
<TextBlock
|
|
||||||
FontSize="11"
|
|
||||||
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
|
|
||||||
Text="add process to configure corresponding RPC" />
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardAction>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,121 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using Nocksoft.IO.ConfigFiles;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.DiscordRPC
|
|
||||||
{
|
|
||||||
public partial class DiscordRPCView : Page
|
|
||||||
{
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
public static BindingList<Game> Games = new BindingList<Game>();
|
|
||||||
public static Game SelectedItem = null;
|
|
||||||
}
|
|
||||||
public DiscordRPCView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
ItemboxRpc.ItemsSource = Data.Games;
|
|
||||||
Data.Games.ListChanged += GamesOnListChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GamesOnListChanged(object sender, ListChangedEventArgs e)
|
|
||||||
{
|
|
||||||
foreach (Game game in Data.Games)
|
|
||||||
{
|
|
||||||
//Save Item to disk
|
|
||||||
game.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAddProcess_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/AddRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ItemboxRpc_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
ListBox listBox = (ListBox)sender;
|
|
||||||
Data.SelectedItem = (Game)listBox.SelectedItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ContextMenu_Edit(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if(Data.SelectedItem == null)
|
|
||||||
return;
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/EditRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
private void ContextMenu_Export(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Game selectedCache = Data.SelectedItem;
|
|
||||||
if(selectedCache == null)
|
|
||||||
return;
|
|
||||||
string filepath = Global.AppDataPathRPC.Value + "\\" + selectedCache.UUID + ".rpc";
|
|
||||||
|
|
||||||
SaveFileDialog dialog = new SaveFileDialog()
|
|
||||||
{
|
|
||||||
FileName = selectedCache.UUID,
|
|
||||||
Filter = "RPC File (*.rpc)|*.rpc",
|
|
||||||
Title = "Export RPC File"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == true)
|
|
||||||
{
|
|
||||||
File.Copy(filepath, dialog.FileName, true);
|
|
||||||
Console.WriteLine("Exported to: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void ContextMenu_Import(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Game selectedCache = Data.SelectedItem;
|
|
||||||
if(selectedCache == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
OpenFileDialog dialog = new OpenFileDialog()
|
|
||||||
{
|
|
||||||
Filter = "RPC File (*.rpc)|*.rpc",
|
|
||||||
Title = "Import RPC File"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == true)
|
|
||||||
{
|
|
||||||
|
|
||||||
Game newGame = Game.Methods.GameFromIni(new INIFile(dialog.FileName));
|
|
||||||
|
|
||||||
if (!File.Exists(Global.AppDataPathRPC.Value + "\\" + newGame.UUID + ".rpc"))
|
|
||||||
{
|
|
||||||
File.Copy(dialog.FileName, Global.AppDataPathRPC.Value + "\\" + newGame.UUID + ".rpc", true);
|
|
||||||
DiscordRPCView.Data.Games.Add(newGame);
|
|
||||||
Console.WriteLine("Imported: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.Error("not imported: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ContextMenu_Remove(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Game selectedCache = Data.SelectedItem;
|
|
||||||
if(selectedCache == null)
|
|
||||||
return;
|
|
||||||
Data.Games.Remove(selectedCache);
|
|
||||||
File.Delete(Global.AppDataPathRPC.Value + "\\" + selectedCache.UUID + ".rpc");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonStartRPC_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/RunRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.DiscordRPC.EditRPCView"
|
|
||||||
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.Views.DiscordRPC"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="EditRPCView" Height="Auto" Width="Auto"
|
|
||||||
Loaded="EditRPCView_OnLoaded">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition Height="45"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="0">
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<ui:TextBox Name="TextboxProcessname" PlaceholderText="Process name" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxClientid" PlaceholderText="Client ID" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxState" PlaceholderText="State" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxDetails" PlaceholderText="Details" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxBigimgkey" PlaceholderText="Big image key" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxBigimgtxt" PlaceholderText="Big image text" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxSmallimgkey" PlaceholderText="Small image key" Margin="0,4"/>
|
|
||||||
<ui:TextBox Name="TextboxSmallimgtxt" PlaceholderText="Small image text" Margin="0,4"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ui:Button
|
|
||||||
Padding="24,6"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Content="Cancel"
|
|
||||||
Icon="CaretLeft24"
|
|
||||||
Name="ButtonCancelDialog"
|
|
||||||
Click="ButtonCancelDialog_OnClick"/>
|
|
||||||
<ui:Button Grid.Column="1"
|
|
||||||
Padding="24,6"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Content="Edit"
|
|
||||||
Icon="AddCircle32"
|
|
||||||
Name="ButtonSaveDialog"
|
|
||||||
Click="ButtonSaveDialog_OnClick"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,55 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.DiscordRPC
|
|
||||||
{
|
|
||||||
public partial class EditRPCView : Page
|
|
||||||
{
|
|
||||||
private Game editItem = null;
|
|
||||||
public EditRPCView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void CloseDialog()
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/DiscordRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSaveDialog_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Game editedItem = new Game(
|
|
||||||
TextboxProcessname.Text,
|
|
||||||
TextboxClientid.Text,
|
|
||||||
TextboxDetails.Text,
|
|
||||||
TextboxState.Text,
|
|
||||||
TextboxBigimgkey.Text,
|
|
||||||
TextboxBigimgtxt.Text,
|
|
||||||
TextboxSmallimgkey.Text,
|
|
||||||
TextboxSmallimgtxt.Text
|
|
||||||
);
|
|
||||||
editedItem.UUID = editItem.UUID;
|
|
||||||
int listIndex = DiscordRPCView.Data.Games.IndexOf(editItem);
|
|
||||||
DiscordRPCView.Data.Games[listIndex] = editedItem;
|
|
||||||
CloseDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EditRPCView_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
editItem = DiscordRPCView.Data.SelectedItem;
|
|
||||||
TextboxProcessname.Text = editItem.ProcessName;
|
|
||||||
TextboxClientid.Text = editItem.PresenceClient.ApplicationID;
|
|
||||||
TextboxState.Text = editItem.State;
|
|
||||||
TextboxDetails.Text = editItem.Details;
|
|
||||||
TextboxBigimgkey.Text = editItem.BigImageKey;
|
|
||||||
TextboxBigimgtxt.Text = editItem.BigImageText;
|
|
||||||
TextboxSmallimgkey.Text = editItem.SmallImageKey;
|
|
||||||
TextboxSmallimgtxt.Text = editItem.SmallImageText;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancelDialog_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
CloseDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,208 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using DiscordRPC;
|
|
||||||
using DiscordRPC.Message;
|
|
||||||
using Nocksoft.IO.ConfigFiles;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
using WeeXnes.Views.Settings;
|
|
||||||
using EventType = WeeXnes.Core.EventType;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.DiscordRPC
|
|
||||||
{
|
|
||||||
public class Game
|
|
||||||
{
|
|
||||||
public static class Methods
|
|
||||||
{
|
|
||||||
public static Game GameFromIni(INIFile inifile)
|
|
||||||
{
|
|
||||||
Game returnval = new Game(
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.ProcessName),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.ClientId),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Details),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.State),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.BigImageKey),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.BigImageText),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.SmallImageKey),
|
|
||||||
|
|
||||||
inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.SmallImageText)
|
|
||||||
);
|
|
||||||
returnval.UUID = inifile.GetValue(SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.UUID);
|
|
||||||
return returnval;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string ProcessName { get; set; }
|
|
||||||
public bool IsRunning { get; set; }
|
|
||||||
public DiscordRpcClient PresenceClient { get; set; }
|
|
||||||
public string Details { get; set; }
|
|
||||||
public string State { get; set; }
|
|
||||||
|
|
||||||
public string BigImageKey { get; set; }
|
|
||||||
public string BigImageText { get; set; }
|
|
||||||
public string SmallImageKey { get; set; }
|
|
||||||
public string SmallImageText { get; set; }
|
|
||||||
public string UUID { get; set; }
|
|
||||||
private string generateUUID()
|
|
||||||
{
|
|
||||||
return Guid.NewGuid().ToString();
|
|
||||||
}
|
|
||||||
public Game(
|
|
||||||
string processName,
|
|
||||||
string clientId,
|
|
||||||
string details,
|
|
||||||
string state,
|
|
||||||
string bigImageKey,
|
|
||||||
string bigImageText,
|
|
||||||
string smallImageKey,
|
|
||||||
string smallImageText
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this.ProcessName = processName;
|
|
||||||
this.IsRunning = false;
|
|
||||||
this.PresenceClient = new DiscordRpcClient(clientId);
|
|
||||||
this.Details = details;
|
|
||||||
this.State = state;
|
|
||||||
this.BigImageKey = bigImageKey;
|
|
||||||
this.BigImageText = bigImageText;
|
|
||||||
this.SmallImageKey = smallImageKey;
|
|
||||||
this.SmallImageText = smallImageText;
|
|
||||||
this.UUID = generateUUID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
this.IsRunning = true;
|
|
||||||
//Console.WriteLine("Process started");
|
|
||||||
RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ is running", EventType.ProcessStartedEvent);
|
|
||||||
|
|
||||||
if (!this.PresenceClient.IsInitialized)
|
|
||||||
{
|
|
||||||
this.PresenceClient.Initialize();
|
|
||||||
}
|
|
||||||
this.PresenceClient.OnReady += PresenceClientOnOnReady;
|
|
||||||
this.PresenceClient.OnPresenceUpdate += PresenceClientOnOnPresenceUpdate;
|
|
||||||
this.PresenceClient.SetPresence(new RichPresence()
|
|
||||||
{
|
|
||||||
Details = this.Details,
|
|
||||||
State = this.State,
|
|
||||||
Assets = new Assets()
|
|
||||||
{
|
|
||||||
LargeImageKey = this.BigImageKey,
|
|
||||||
LargeImageText = this.BigImageText,
|
|
||||||
SmallImageKey = this.SmallImageKey,
|
|
||||||
SmallImageText = this.SmallImageText
|
|
||||||
}
|
|
||||||
});
|
|
||||||
PresenceClient.UpdateStartTime();
|
|
||||||
}
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
this.IsRunning = false;
|
|
||||||
//Console.WriteLine("Process stopped");
|
|
||||||
RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ stopped running", EventType.ProcessStoppedEvent);
|
|
||||||
if (this.PresenceClient.IsInitialized)
|
|
||||||
{
|
|
||||||
this.PresenceClient.ClearPresence();
|
|
||||||
this.PresenceClient.OnReady -= PresenceClientOnOnReady;
|
|
||||||
this.PresenceClient.OnPresenceUpdate -= PresenceClientOnOnPresenceUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void PresenceClientOnOnPresenceUpdate(object sender, PresenceMessage args)
|
|
||||||
{
|
|
||||||
//Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name);
|
|
||||||
RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name, EventType.RPCUpdateEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PresenceClientOnOnReady(object sender, ReadyMessage args)
|
|
||||||
{
|
|
||||||
//Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username);
|
|
||||||
RunRPCView.Data.LogCache.Value =
|
|
||||||
new customEvent("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username, EventType.RPCReadyEvent);
|
|
||||||
}
|
|
||||||
public void CheckState(Process[] processes)
|
|
||||||
{
|
|
||||||
if(String.IsNullOrEmpty(this.ProcessName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool processFound = false;
|
|
||||||
|
|
||||||
foreach (Process process in processes)
|
|
||||||
{
|
|
||||||
if (process.ProcessName == this.ProcessName)
|
|
||||||
processFound = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.IsRunning)
|
|
||||||
if (processFound)
|
|
||||||
Start();
|
|
||||||
|
|
||||||
if(this.IsRunning)
|
|
||||||
if(!processFound)
|
|
||||||
Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
INIFile rpcFile = new INIFile(Global.AppDataPathRPC.Value + "\\" + this.UUID + ".rpc", true);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.ProcessName,
|
|
||||||
this.ProcessName);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.ClientId,
|
|
||||||
this.PresenceClient.ApplicationID);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.State,
|
|
||||||
this.State);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Details,
|
|
||||||
this.Details);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.BigImageKey,
|
|
||||||
this.BigImageKey);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.BigImageText,
|
|
||||||
this.BigImageText);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.SmallImageKey,
|
|
||||||
this.SmallImageKey);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.SmallImageText,
|
|
||||||
this.SmallImageText);
|
|
||||||
rpcFile.SetValue(
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.Section,
|
|
||||||
SaveSettingsHandler.Data.DiscordRpcFiles.UUID,
|
|
||||||
this.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return this.ProcessName + ".exe";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.DiscordRPC.RunRPCView"
|
|
||||||
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.Views.DiscordRPC"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="RunRPCView" Height="Auto" Width="Auto"
|
|
||||||
Unloaded="RunRPCView_OnUnloaded">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="70px"/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<ui:CardAction Grid.Column="1" Icon="CaretLeft24"
|
|
||||||
Name="ButtonRPCStop"
|
|
||||||
Click="ButtonRPCStop_OnClick">
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock
|
|
||||||
Margin="0,0,0,4"
|
|
||||||
FontWeight="Medium"
|
|
||||||
Text="Stop RPC"
|
|
||||||
/>
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardAction>
|
|
||||||
<ScrollViewer Grid.Row="1" Name="LogViewer">
|
|
||||||
<ItemsControl Grid.Row="1" Name="RpcLogView" Loaded="RpcLogView_OnLoaded" Margin="0,0,0,0">
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
|
|
||||||
<Border Height="30" CornerRadius="4" Margin="0,3,0,0" Name="ParentBorder"
|
|
||||||
Opacity="0">
|
|
||||||
<Border.Triggers>
|
|
||||||
|
|
||||||
<!-- Animate the button's Width property. -->
|
|
||||||
<EventTrigger RoutedEvent="Border.Loaded">
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation
|
|
||||||
Storyboard.TargetName="ParentBorder"
|
|
||||||
Storyboard.TargetProperty="(Border.Opacity)"
|
|
||||||
To="1" Duration="0:0:00.5" AutoReverse="False"
|
|
||||||
/>
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</EventTrigger>
|
|
||||||
|
|
||||||
</Border.Triggers>
|
|
||||||
<Border.Background>
|
|
||||||
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
|
|
||||||
<LinearGradientBrush.GradientStops>
|
|
||||||
<GradientStop Offset="0" Color="{Binding GradientColor1}" />
|
|
||||||
<GradientStop Offset="1" Color="{Binding GradientColor2}" />
|
|
||||||
</LinearGradientBrush.GradientStops>
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</Border.Background>
|
|
||||||
<TextBlock Margin="5 0" Text="{Binding Content}" FontSize="12"
|
|
||||||
Foreground="White"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Padding="10,0,0,0">
|
|
||||||
|
|
||||||
<TextBlock.Effect>
|
|
||||||
<DropShadowEffect ShadowDepth="1"/>
|
|
||||||
|
|
||||||
</TextBlock.Effect>
|
|
||||||
</TextBlock>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</ScrollViewer>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,122 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.DiscordRPC
|
|
||||||
{
|
|
||||||
public partial class RunRPCView : Page
|
|
||||||
{
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
public static UpdateVar<customEvent> LogCache = new UpdateVar<customEvent>();
|
|
||||||
}
|
|
||||||
BackgroundWorker backgroundWorker = new BackgroundWorker();
|
|
||||||
public RunRPCView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
SetupLogListener();
|
|
||||||
SetupBackgroundWorker();
|
|
||||||
}
|
|
||||||
public void SetupLogListener()
|
|
||||||
{
|
|
||||||
Data.LogCache.ValueChanged += LogChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveListener()
|
|
||||||
{
|
|
||||||
Data.LogCache.ValueChanged -= LogChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LogChanged()
|
|
||||||
{
|
|
||||||
VanillaConsole.WriteLine("Log Write Data: " + Data.LogCache.Value);
|
|
||||||
this.Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
RpcLogView.Items.Add(Data.LogCache.Value);
|
|
||||||
LogViewer.ScrollToEnd();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetupBackgroundWorker()
|
|
||||||
{
|
|
||||||
backgroundWorker.WorkerReportsProgress = true;
|
|
||||||
backgroundWorker.WorkerSupportsCancellation = true;
|
|
||||||
backgroundWorker.RunWorkerCompleted += BackgroundWorkerOnRunWorkerCompleted;
|
|
||||||
backgroundWorker.DoWork += BackgroundWorkerOnDoWork;
|
|
||||||
RunBackgroundWorker();
|
|
||||||
}
|
|
||||||
public void RunBackgroundWorker()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(!backgroundWorker.IsBusy)
|
|
||||||
backgroundWorker.RunWorkerAsync();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
VanillaConsole.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void StopBackgroundWorker()
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(backgroundWorker.IsBusy)
|
|
||||||
backgroundWorker.CancelAsync();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
VanillaConsole.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
//Stop RPC
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BackgroundWorkerOnDoWork(object sender, DoWorkEventArgs e)
|
|
||||||
{
|
|
||||||
Data.LogCache.Value = new customEvent("[INFO] RPC Thread is running", EventType.ProcessStartedEvent);
|
|
||||||
bool runWorker = true;
|
|
||||||
while (runWorker)
|
|
||||||
{
|
|
||||||
Process[] processes = Process.GetProcesses();
|
|
||||||
if (backgroundWorker.CancellationPending)
|
|
||||||
runWorker = false;
|
|
||||||
|
|
||||||
foreach (Game game in DiscordRPCView.Data.Games)
|
|
||||||
{
|
|
||||||
game.CheckState(processes);
|
|
||||||
}
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BackgroundWorkerOnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
||||||
{
|
|
||||||
foreach (Game game in DiscordRPCView.Data.Games)
|
|
||||||
game.Stop();
|
|
||||||
VanillaConsole.WriteLine("Thread Stopped");
|
|
||||||
Data.LogCache.Value = new customEvent("[INFO] RPC Thread has stopped", EventType.ProcessStoppedEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunRPCView_OnUnloaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
StopBackgroundWorker();
|
|
||||||
RemoveListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRPCStop_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/DiscordRPC/DiscordRPCView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void RpcLogView_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.EncryptedTextEditor.TextEditorView"
|
|
||||||
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.Views.EncryptedTextEditor"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="TextEditorView" Height="Auto" Width="Auto">
|
|
||||||
<Grid>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="40px"/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid Grid.Row="0">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Button Name="btn_openFile" Click="Btn_openFile_OnClick" Grid.Column="0" Content="Open File" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5"/>
|
|
||||||
<Button Name="btn_saveFile" Click="Btn_saveFile_OnClick" Grid.Column="1" Content="Save" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5"/>
|
|
||||||
<Button Name="btn_saveFileAs" Click="Btn_saveFileAs_OnClick" Grid.Column="2" Content="Save As" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5"/>
|
|
||||||
</Grid>
|
|
||||||
<RichTextBox Name="rtb_FileEditor" Grid.Row="1">
|
|
||||||
<RichTextBox.Resources>
|
|
||||||
<Style TargetType="{x:Type Paragraph}">
|
|
||||||
<Setter Property="Margin" Value="0"/>
|
|
||||||
</Style>
|
|
||||||
</RichTextBox.Resources>
|
|
||||||
</RichTextBox>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,97 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using EncryptionLib;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.EncryptedTextEditor;
|
|
||||||
|
|
||||||
public partial class TextEditorView : Page
|
|
||||||
{
|
|
||||||
public string currentFilePath { get; set; } = null;
|
|
||||||
public TextEditorView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void RaiseClickEvent(System.Windows.Controls.Button button)
|
|
||||||
{
|
|
||||||
var clickEventArgs = new RoutedEventArgs(System.Windows.Controls.Button.ClickEvent);
|
|
||||||
button.RaiseEvent(clickEventArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Btn_openFile_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var fileContent = string.Empty;
|
|
||||||
var filePath = string.Empty;
|
|
||||||
|
|
||||||
Console.WriteLine("Calling OpenFileDialog");
|
|
||||||
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
|
||||||
{
|
|
||||||
//openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
|
||||||
openFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
|
||||||
openFileDialog.RestoreDirectory = true;
|
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Opening file " + openFileDialog.FileName);
|
|
||||||
this.currentFilePath = openFileDialog.FileName;
|
|
||||||
string[] FileContent = File.ReadAllLines(openFileDialog.FileName);
|
|
||||||
string[] decryptedContent = EncryptorLibary.decryptArray(Information.EncryptionHash, FileContent);
|
|
||||||
rtb_FileEditor.Document.Blocks.Clear();
|
|
||||||
foreach (string line in decryptedContent)
|
|
||||||
{
|
|
||||||
rtb_FileEditor.Document.Blocks.Add(new Paragraph(new Run(line)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void Btn_saveFile_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (this.currentFilePath == null)
|
|
||||||
{
|
|
||||||
RaiseClickEvent(btn_saveFileAs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Saving file " + currentFilePath);
|
|
||||||
TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd);
|
|
||||||
string plainText = textRange.Text;
|
|
||||||
string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
|
||||||
string[] encryptedContent =
|
|
||||||
EncryptionLib.EncryptorLibary.encryptArray(Information.EncryptionHash, lines);
|
|
||||||
File.WriteAllLines(this.currentFilePath, encryptedContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Btn_saveFileAs_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Calling SaveFileDialog");
|
|
||||||
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
|
|
||||||
{
|
|
||||||
//saveFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
|
||||||
saveFileDialog.Filter = "WXN Text Files (*.wtf)|*.wtf";
|
|
||||||
saveFileDialog.RestoreDirectory = true;
|
|
||||||
|
|
||||||
if(saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Saving file " + saveFileDialog.FileName);
|
|
||||||
this.currentFilePath = saveFileDialog.FileName;
|
|
||||||
TextRange textRange = new TextRange(rtb_FileEditor.Document.ContentStart, rtb_FileEditor.Document.ContentEnd);
|
|
||||||
string plainText = textRange.Text;
|
|
||||||
string[] lines = plainText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
|
||||||
string[] encryptedContent =
|
|
||||||
EncryptionLib.EncryptorLibary.encryptArray(Information.EncryptionHash, lines);
|
|
||||||
File.WriteAllLines(saveFileDialog.FileName, encryptedContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.Home.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.Views.Home"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="HomeView" Height="Auto" Width="Auto">
|
|
||||||
<Grid>
|
|
||||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
|
||||||
<Image RenderOptions.BitmapScalingMode="HighQuality"
|
|
||||||
Source="/Images/wicon.png" Grid.Row="0"
|
|
||||||
HorizontalAlignment="Center" Width="200"/>
|
|
||||||
<TextBlock Text="WeeXnes Hub"
|
|
||||||
Foreground="White"
|
|
||||||
FontSize="28"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Name="VersionInfo"
|
|
||||||
Loaded="VersionInfo_OnLoaded"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.Home
|
|
||||||
{
|
|
||||||
public partial class HomeView : Page
|
|
||||||
{
|
|
||||||
public HomeView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void VersionInfo_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
VersionInfo.Text = "WeeXnes Hub v" + Information.Version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using Wpf.Ui.Controls;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using Path = System.Windows.Shapes.Path;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.KeyManager
|
|
||||||
{
|
|
||||||
public class KeyItem
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Value { get; set; }
|
|
||||||
public string Filename { get; set; }
|
|
||||||
public KeyItem(string name, string value)
|
|
||||||
{
|
|
||||||
this.Name = name;
|
|
||||||
this.Value = value;
|
|
||||||
this.Filename = Guid.NewGuid().ToString() + ".wx";
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return this.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Export()
|
|
||||||
{
|
|
||||||
string filePath = Global.AppDataPathKEY.Value + "\\" + this.Filename;
|
|
||||||
Console.WriteLine(filePath);
|
|
||||||
|
|
||||||
SaveFileDialog dialog = new SaveFileDialog()
|
|
||||||
{
|
|
||||||
FileName = this.Filename,
|
|
||||||
Filter = "WXFiles (*.wx)|*.wx",
|
|
||||||
Title = "Export KeyFile"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == true)
|
|
||||||
{
|
|
||||||
File.Copy(filePath, dialog.FileName, true);
|
|
||||||
Console.WriteLine("Exported to: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Import()
|
|
||||||
{
|
|
||||||
OpenFileDialog dialog = new OpenFileDialog()
|
|
||||||
{
|
|
||||||
Filter = "WXFiles (*.wx)|*.wx",
|
|
||||||
Title = "Import KeyFile"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == true)
|
|
||||||
{
|
|
||||||
string filename = System.IO.Path.GetFileName(dialog.FileName);
|
|
||||||
WXFile wxFile = new WXFile(dialog.FileName);
|
|
||||||
KeyItem newItem = new KeyItem(
|
|
||||||
wxFile.GetName(),
|
|
||||||
EncryptionLib.EncryptorLibary.decrypt(
|
|
||||||
Information.EncryptionHash,
|
|
||||||
wxFile.GetValue()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
newItem.Filename = filename;
|
|
||||||
if (!File.Exists(Global.AppDataPathKEY.Value + "\\" + filename))
|
|
||||||
{
|
|
||||||
File.Copy(dialog.FileName, Global.AppDataPathKEY.Value + "\\" + filename, true);
|
|
||||||
KeyManagerView.Data.KeyItemsList.Add(newItem);
|
|
||||||
Console.WriteLine("Imported: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.Error("Not Imported, already exists: " + dialog.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.KeyManager.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.Views.KeyManager"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="KeyManagerView" Height="Auto" Width="Auto"
|
|
||||||
Loaded="KeyManagerView_OnLoaded">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="50px"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<ListView Name="ListviewKeys"
|
|
||||||
Background="Transparent"
|
|
||||||
Foreground="White"
|
|
||||||
BorderThickness="0"
|
|
||||||
SelectionChanged="ListviewKeys_OnSelectionChanged"
|
|
||||||
IsTextSearchEnabled="True"
|
|
||||||
>
|
|
||||||
<ListView.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Header="Export"
|
|
||||||
Name="btn_context_export"
|
|
||||||
Click="ContextMenu_Export"/>
|
|
||||||
<MenuItem Header="Import"
|
|
||||||
Name="btn_context_import"
|
|
||||||
Click="ContextMenu_Import"/>
|
|
||||||
<Separator />
|
|
||||||
<MenuItem Header="Remove"
|
|
||||||
Name="btn_context_remove"
|
|
||||||
Click="ContextMenu_Remove"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</ListView.ContextMenu>
|
|
||||||
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<TextBlock Text="{Binding Name}"
|
|
||||||
Grid.Column="0"/>
|
|
||||||
<TextBlock Text="{Binding Value}"
|
|
||||||
Grid.Column="1"
|
|
||||||
Name="KeyValue"
|
|
||||||
Loaded="KeyValue_OnLoaded"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
|
|
||||||
</ListView>
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="2*"/>
|
|
||||||
<ColumnDefinition Width="2*"/>
|
|
||||||
<ColumnDefinition Width="100px"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ui:TextBox
|
|
||||||
Grid.Column="0"
|
|
||||||
Margin="0,0,5,0"
|
|
||||||
Name="tb_keyname" PlaceholderText="Name"/>
|
|
||||||
<ui:TextBox
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="5,0,0,0"
|
|
||||||
Name="tb_keyvalue" PlaceholderText="Key"/>
|
|
||||||
<Button Grid.Column="2"
|
|
||||||
Content="Add"
|
|
||||||
Height="35px"
|
|
||||||
Width="80px"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Name="btn_add"
|
|
||||||
Click="Btn_add_OnClick"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,133 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.KeyManager
|
|
||||||
{
|
|
||||||
public partial class KeyManagerView : Page
|
|
||||||
{
|
|
||||||
public static class Data
|
|
||||||
{
|
|
||||||
public static BindingList<KeyItem> KeyItemsList = new BindingList<KeyItem>();
|
|
||||||
public static UpdateVar<bool> censorKeys = new UpdateVar<bool>();
|
|
||||||
public static UpdateVar<bool> copyOnSelect = new UpdateVar<bool>();
|
|
||||||
public static UpdateVar<bool> sortList = new UpdateVar<bool>();
|
|
||||||
}
|
|
||||||
public KeyManagerView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
ListviewKeys.ItemsSource = Data.KeyItemsList;
|
|
||||||
//((INotifyCollectionChanged)listview_keys.Items).CollectionChanged += OnCollectionChanged;
|
|
||||||
}
|
|
||||||
private void KeyManagerView_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if(Data.sortList.Value)
|
|
||||||
resortList();
|
|
||||||
|
|
||||||
ListviewKeys.Items.Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Btn_add_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if(String.IsNullOrEmpty(tb_keyname.Text))
|
|
||||||
return;
|
|
||||||
if(String.IsNullOrEmpty(tb_keyvalue.Text))
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
KeyItem newKey = new KeyItem(
|
|
||||||
tb_keyname.Text,
|
|
||||||
tb_keyvalue.Text
|
|
||||||
);
|
|
||||||
WXFile wxFile = new WXFile(
|
|
||||||
Global.AppDataPathKEY.Value + "\\" + newKey.Filename);
|
|
||||||
WXFile.Methods.WriteFile(newKey, wxFile);
|
|
||||||
KeyManagerView.Data.KeyItemsList.Add(newKey);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClearInputs();
|
|
||||||
|
|
||||||
if(Data.sortList.Value)
|
|
||||||
resortList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resortList()
|
|
||||||
{
|
|
||||||
BindingList<KeyItem> newList = new BindingList<KeyItem>(Data.KeyItemsList.OrderBy(x => x.Name).ToList());
|
|
||||||
Data.KeyItemsList = newList;
|
|
||||||
ListviewKeys.ItemsSource = Data.KeyItemsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClearInputs()
|
|
||||||
{
|
|
||||||
tb_keyname.Text = "";
|
|
||||||
tb_keyvalue.Text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteItem(KeyItem removeItem)
|
|
||||||
{
|
|
||||||
if(removeItem == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Data.KeyItemsList.Remove(removeItem);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File.Delete(Global.AppDataPathKEY.Value + "\\" + removeItem.Filename);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void ContextMenu_Remove(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
DeleteItem((KeyItem)ListviewKeys.SelectedItem);
|
|
||||||
}
|
|
||||||
private void ContextMenu_Import(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
KeyItem.Import();
|
|
||||||
}
|
|
||||||
private void ContextMenu_Export(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var item = (KeyItem)ListviewKeys.SelectedItem;
|
|
||||||
item.Export();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void KeyValue_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (!Data.censorKeys.Value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TextBlock tb = (TextBlock)sender;
|
|
||||||
string censoredString = "";
|
|
||||||
for (int i = 0; i <= tb.Text.Length; i++)
|
|
||||||
censoredString = censoredString + "•";
|
|
||||||
tb.Text = censoredString;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ListviewKeys_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
KeyItem selectedItem = (KeyItem)ListviewKeys.SelectedItem;
|
|
||||||
if(selectedItem == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!Data.copyOnSelect.Value)
|
|
||||||
return;
|
|
||||||
Clipboard.SetText(selectedItem.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.PasswordGenerator.PasswordGenView"
|
|
||||||
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.Views.PasswordGenerator"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="PasswordGenView" Height="Auto" Width="Auto">
|
|
||||||
<Grid>
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<Label Foreground="White" Content="Password Generator" HorizontalAlignment="Center"/>
|
|
||||||
<Label Content="Lenght: " Foreground="White"/>
|
|
||||||
<ui:NumberBox Name="numbox_pwCount" Margin="0,5" DecimalPlaces="0" Min="1" Value="15"/>
|
|
||||||
<ui:ToggleSwitch Name="toggle_alpha" Margin="0,5" Content="a-z" IsChecked="True"/>
|
|
||||||
<ui:ToggleSwitch Name="toggle_numeric" Margin="0,5" Content="0-9" IsChecked="True"/>
|
|
||||||
<ui:ToggleSwitch Name="toggle_caps" Margin="0,5" Content="Capitalization" IsChecked="True"/>
|
|
||||||
<ui:ToggleSwitch Name="toggle_special" Margin="0,5" Content="Special characters"/>
|
|
||||||
<ui:Button Content="Generate Password" HorizontalAlignment="Stretch" Click="ButtonBase_OnClick"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,68 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using WeeXnes.Core;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.PasswordGenerator
|
|
||||||
{
|
|
||||||
public partial class PasswordGenView : Page
|
|
||||||
{
|
|
||||||
public static Random random = new Random();
|
|
||||||
private class PasswordBuilderStrings
|
|
||||||
{
|
|
||||||
public static string alphabetical_lc = "abcdefghijklmnopqrstuvwxyz";
|
|
||||||
public static string alphabetical_caps = "ABCDEFGHIJKLMNOPQRSTUVQXYZ";
|
|
||||||
public static string numerical = "1234567890";
|
|
||||||
public static string special = "!#$%&()*+,-<>=?";
|
|
||||||
}
|
|
||||||
public PasswordGenView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GeneratePasword()
|
|
||||||
{
|
|
||||||
if(toggle_alpha.IsChecked == false)
|
|
||||||
if(toggle_numeric.IsChecked == false)
|
|
||||||
if(toggle_special.IsChecked == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
string CustomPasswordBuilderString = "";
|
|
||||||
|
|
||||||
if (toggle_alpha.IsChecked == true)
|
|
||||||
CustomPasswordBuilderString += PasswordBuilderStrings.alphabetical_lc;
|
|
||||||
|
|
||||||
if (toggle_caps.IsChecked == true)
|
|
||||||
CustomPasswordBuilderString += PasswordBuilderStrings.alphabetical_caps;
|
|
||||||
|
|
||||||
if (toggle_numeric.IsChecked == true)
|
|
||||||
CustomPasswordBuilderString += PasswordBuilderStrings.numerical;
|
|
||||||
|
|
||||||
if (toggle_special.IsChecked == true)
|
|
||||||
CustomPasswordBuilderString += PasswordBuilderStrings.special;
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("Generating Password from: " + CustomPasswordBuilderString);
|
|
||||||
//MessageBox.Show(CustomPasswordBuilderString);
|
|
||||||
|
|
||||||
string generatedPassword = "";
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < numbox_pwCount.Value; i++)
|
|
||||||
{
|
|
||||||
int randomNr = random.Next(0, CustomPasswordBuilderString.Length);
|
|
||||||
generatedPassword = generatedPassword + CustomPasswordBuilderString[randomNr];
|
|
||||||
}
|
|
||||||
|
|
||||||
SavePasswordView.GeneratedPassword = generatedPassword;
|
|
||||||
SavePasswordView._prevPage = this;
|
|
||||||
NavigationService.Navigate(new Uri("/Views/PasswordGenerator/SavePasswordView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
GeneratePasword();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
<Page x:Class="WeeXnes.Views.PasswordGenerator.SavePasswordView"
|
|
||||||
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.Views.PasswordGenerator"
|
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="SavePasswordView" Height="Auto" Width="Auto"
|
|
||||||
Loaded="SavePasswordView_OnLoaded">
|
|
||||||
<Grid>
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<Label Content="Password Generated: " Foreground="White" FontSize="20"/>
|
|
||||||
<Label Name="displayPassword" Foreground="White" FontSize="15" Margin="0,0,0,5"/>
|
|
||||||
<ui:Button Content="Copy to clipboard" HorizontalAlignment="Stretch" Click="CopyToClipboard" Margin="0,3"/>
|
|
||||||
<ui:Button Content="Save to KeyManager" HorizontalAlignment="Stretch" Click="SaveToKeyManager" Margin="0,3"/>
|
|
||||||
<ui:Button Content="Back" HorizontalAlignment="Stretch" Click="CloseDialog" Margin="0,3"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,35 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace WeeXnes.Views.PasswordGenerator
|
|
||||||
{
|
|
||||||
public partial class SavePasswordView : Page
|
|
||||||
{
|
|
||||||
public static string GeneratedPassword = "";
|
|
||||||
public static PasswordGenView _prevPage = null;
|
|
||||||
public SavePasswordView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SavePasswordView_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
displayPassword.Content = GeneratedPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseDialog(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if(_prevPage != null)
|
|
||||||
NavigationService.Navigate(_prevPage);
|
|
||||||
}
|
|
||||||
private void CopyToClipboard(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Clipboard.SetText(GeneratedPassword);
|
|
||||||
}
|
|
||||||
private void SaveToKeyManager(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NavigationService.Navigate(new Uri("/Views/PasswordGenerator/SaveToKeyManagerView.xaml",UriKind.Relative));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|