Skip to content

Commit

Permalink
Merge pull request #1 from cho3ek89/release/1.0.0.0
Browse files Browse the repository at this point in the history
Creating the initial version of an application.
  • Loading branch information
cho3ek89 authored Jul 1, 2024
2 parents 029228e + 313b621 commit 999c65c
Show file tree
Hide file tree
Showing 73 changed files with 1,809 additions and 33 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
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/
42 changes: 10 additions & 32 deletions .gitignore
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
25 changes: 25 additions & 0 deletions MSI.Keyboard.Illuminator.sln
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
26 changes: 26 additions & 0 deletions MSI.Keyboard.Illuminator/App.axaml
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>
116 changes: 116 additions & 0 deletions MSI.Keyboard.Illuminator/App.axaml.cs
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);
}
}
}
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-down16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-down22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-down32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-up16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-up22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/arrow-up32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/checked-mark16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/checked-mark32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/color-palette16.png
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 added MSI.Keyboard.Illuminator/Assets/exit16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/exit32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/logo.ico
Binary file not shown.
Binary file added MSI.Keyboard.Illuminator/Assets/minus16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/minus22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/minus32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/palette16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/palette32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/plus16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/plus22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSI.Keyboard.Illuminator/Assets/plus32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/arrow-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/checked-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/color-palette.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/exit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/keyboard.svg
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/minus.svg
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/palette.svg
7 changes: 7 additions & 0 deletions MSI.Keyboard.Illuminator/Assets/svg/plus.svg
Loading

0 comments on commit 999c65c

Please sign in to comment.