-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cho3ek89/release/1.0.0.0
Creating the initial version of an application.
- Loading branch information
Showing
73 changed files
with
1,809 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
env: | ||
version: 1.0.0.0 | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest] | ||
runtime: [win-x64, linux-x64] | ||
exclude: | ||
- os: windows-latest | ||
runtime: linux-x64 | ||
- os: ubuntu-latest | ||
runtime: win-x64 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.7 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4.0.0 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Publish 'MSI Keyboard Illuminator' | ||
run: dotnet publish 'MSI.Keyboard.Illuminator/MSI.Keyboard.Illuminator.csproj' -o 'binaries' -c 'Release' -r '${{ matrix.runtime }}' -v 'normal' -p:Version=${{ env.version }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4.3.3 | ||
with: | ||
name: MSI.Keyboard.Illuminator_${{ matrix.runtime }}_${{ env.version }} | ||
path: binaries/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,10 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
# C# | ||
*.suo | ||
*.user | ||
.vs/ | ||
/MSI.Keyboard.Illuminator/bin/ | ||
/MSI.Keyboard.Illuminator/obj/ | ||
|
||
# Additional | ||
/binaries/ | ||
*appsettings.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.10.35013.160 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSI.Keyboard.Illuminator", "MSI.Keyboard.Illuminator\MSI.Keyboard.Illuminator.csproj", "{A3D78733-DFF8-4CB0-9F97-559342929D10}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A3D78733-DFF8-4CB0-9F97-559342929D10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A3D78733-DFF8-4CB0-9F97-559342929D10}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A3D78733-DFF8-4CB0-9F97-559342929D10}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A3D78733-DFF8-4CB0-9F97-559342929D10}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {32C97D6A-0418-44A3-8579-2E9F12DC261B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:vm="using:MSI.Keyboard.Illuminator.ViewModels" | ||
x:Class="MSI.Keyboard.Illuminator.App" | ||
x:DataType="vm:TrayViewModel" | ||
RequestedThemeVariant="Default"> | ||
|
||
<Design.DataContext> | ||
<vm:TrayViewModel /> | ||
</Design.DataContext> | ||
|
||
<Application.Styles> | ||
<SimpleTheme /> | ||
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Simple/Simple.xaml" /> | ||
</Application.Styles> | ||
|
||
<TrayIcon.Icons> | ||
<TrayIcons> | ||
<TrayIcon Icon="/Assets/logo.ico" | ||
ToolTipText="Chenge MSI keyboard colors" | ||
Menu="{Binding TrayMenu}"> | ||
</TrayIcon> | ||
</TrayIcons> | ||
</TrayIcon.Icons> | ||
|
||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Markup.Xaml; | ||
|
||
using MSI.Keyboard.Illuminator.Helpers; | ||
using MSI.Keyboard.Illuminator.Providers; | ||
using MSI.Keyboard.Illuminator.Services; | ||
using MSI.Keyboard.Illuminator.ViewModels; | ||
|
||
using System; | ||
using System.CommandLine; | ||
using System.IO; | ||
|
||
namespace MSI.Keyboard.Illuminator; | ||
|
||
public partial class App : Application | ||
{ | ||
protected IAppSettingsManager appSettingsManager; | ||
|
||
protected IKeyboardService keyboardService; | ||
|
||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime application) | ||
{ | ||
application.ShutdownMode = ShutdownMode.OnExplicitShutdown; | ||
|
||
keyboardService = GetKeyboardService(); | ||
WarnIfDeviceIsNotSupported(); | ||
|
||
appSettingsManager = GetAppSettingsManager(application.Args); | ||
InitializeSettings(); | ||
application.Exit += (s, e) => FinalizeSettings(); | ||
|
||
var colorProfilesViewModel = new ColorProfilesViewModel(appSettingsManager); | ||
|
||
DataContext = new TrayViewModel( | ||
application, | ||
colorProfilesViewModel, | ||
keyboardService, | ||
appSettingsManager); | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
protected static IKeyboardService GetKeyboardService() | ||
{ | ||
var keyboardDevice = new KeyboardDevice(); | ||
|
||
return new KeyboardService(keyboardDevice); | ||
} | ||
|
||
protected void WarnIfDeviceIsNotSupported() | ||
{ | ||
if (keyboardService.IsDeviceSupported()) | ||
return; | ||
|
||
WindowHelper.ShowMessageWindow( | ||
"MSI keyboard not found!", | ||
"The supported \"MSI EPF USB\" SteelSeries keyboard has not been found!" + | ||
Environment.NewLine + | ||
"Exit an application as it is is not going to work properly anyway."); | ||
} | ||
|
||
protected static IAppSettingsManager GetAppSettingsManager(params string[] args) | ||
{ | ||
var fileOption = new Option<FileInfo>( | ||
name: "--settings", | ||
getDefaultValue: () => new FileInfo("appsettings.xml"), | ||
description: "A full path to the settings file."); | ||
|
||
var settingsFile = fileOption.Parse(args).GetValueForOption(fileOption); | ||
|
||
var appSettingsStreamer = new AppSettingsStreamer(settingsFile); | ||
|
||
return new AppSettingsManager(appSettingsStreamer); | ||
} | ||
|
||
protected void InitializeSettings() | ||
{ | ||
try | ||
{ | ||
appSettingsManager.LoadSettings(); | ||
} | ||
catch (FileNotFoundException) | ||
{ | ||
// supress and use default settings | ||
} | ||
catch (Exception ex) | ||
{ | ||
WindowHelper.ShowMessageWindow( | ||
"Loading application settings failed!", | ||
ex.Message); | ||
} | ||
} | ||
|
||
protected void FinalizeSettings() | ||
{ | ||
try | ||
{ | ||
appSettingsManager.SaveSettings(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
WindowHelper.ShowMessageWindow( | ||
"Saving application settings failed!", | ||
ex.Message); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.