1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Merge branch 'development'

This commit is contained in:
Robert 2021-02-28 11:03:02 +01:00
commit b27803b8c0
5 changed files with 89 additions and 38 deletions

View File

@ -21,16 +21,20 @@ Artemis 1 is no longer supported and Artemis 2 is in active development. This en
1. Create a central folder like ```C:\Repos```
2. Clone RGB.NET's [development branch](https://github.com/DarthAffe/RGB.NET/tree/Development) into ```<central folder>\RGB.NET```
3. Clone Artemis into ```<central folder>\Artemis```
4. Clone Artemis.Plugins [master branch](https://github.com/Artemis-RGB/Artemis.Plugins/tree/master) into ```<central folder>\Artemis.Plugins```
5. Open ```<central folder>\RGB.NET\RGB.NET.sln``` and build with the default config
4. Open ```<central folder>\Artemis\src\Artemis.sln```
5. Restore Nuget packages
6. Open ```<central folder>\Artemis\src\Artemis.sln``` and build as Debug
7. Open ```<central folder>\Artemis.Plugins\src\Artemis.Plugins.sln``` and build as Debug
8. Restore Nuget packages
##### Alternatively in PowerShell
```powershell
git clone https://github.com/DarthAffe/RGB.NET -b Development RGB.NET
git clone https://github.com/Artemis-RGB/Artemis Artemis
git clone https://github.com/Artemis-RGB/Artemis.Plugins Artemis.Plugins
dotnet build .\RGB.NET\RGB.NET.sln
dotnet build .\Artemis\src\Artemis.sln
dotnet build .\Artemis.Plugins\src\Artemis.Plugins.sln
```
For an up-to-date overview of what's currently being worked on, see the [Projects](https://github.com/SpoinkyNL/Artemis/projects) page

View File

@ -213,9 +213,25 @@ namespace Artemis.Core
Expression? expression = Expression.Convert(parameter, Target.GetType());
Expression? nullCondition = null;
MethodInfo equals = typeof(object).GetMethod("Equals", BindingFlags.Static | BindingFlags.Public)!;
foreach (DataModelPathSegment segment in _segments)
{
BinaryExpression notNull = Expression.NotEqual(expression, Expression.Default(expression.Type));
BinaryExpression notNull;
try
{
notNull = Expression.NotEqual(expression, Expression.Default(expression.Type));
}
catch (InvalidOperationException)
{
notNull = Expression.NotEqual(
Expression.Call(
null,
equals,
Expression.Convert(expression, typeof(object)),
Expression.Convert(Expression.Default(expression.Type), typeof(object))),
Expression.Constant(true));
}
nullCondition = nullCondition != null ? Expression.AndAlso(nullCondition, notNull) : notNull;
expression = segment.Initialize(parameter, expression, nullCondition);
if (expression == null)

View File

@ -6,10 +6,10 @@
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Debug.Tabs"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:wpf="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:modules="clr-namespace:Artemis.Core.Modules;assembly=Artemis.Core"
xmlns:dataModel="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:DataModelDebugViewModel}">
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:DataModelDebugViewModel}">
<UserControl.Resources>
<dataModel:TypeToStringConverter x:Key="TypeToStringConverter" />
</UserControl.Resources>
@ -19,6 +19,10 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0 0 0 5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@ -29,16 +33,18 @@
</Grid.ColumnDefinitions>
<!-- Property searching (nyi) -->
<wpf:PackIcon Grid.Column="0" Kind="Search" VerticalAlignment="Center" />
<TextBox Grid.Column="1" wpf:HintAssist.Hint="Search property" VerticalAlignment="Center" Margin="5 0" IsEnabled="False" />
<TextBox Grid.Row="0" Grid.Column="1" wpf:HintAssist.Hint="Search property" VerticalAlignment="Center" Margin="5 0" IsEnabled="False" />
<!-- Module filtering -->
<TextBlock Grid.Column="3" VerticalAlignment="Center">Filter module</TextBlock>
<ToggleButton Grid.Column="4"
<TextBlock Grid.Row="0" Grid.Column="3" VerticalAlignment="Center">Filter module</TextBlock>
<ToggleButton Grid.Row="0"
Grid.Column="4"
VerticalAlignment="Center"
Margin="5 0"
Style="{StaticResource MaterialDesignSwitchToggleButton}"
IsChecked="{Binding IsModuleFilterEnabled}" />
<ComboBox Grid.Column="5"
<ComboBox Grid.Row="0"
Grid.Column="5"
VerticalAlignment="Center"
wpf:HintAssist.Hint="Select a module"
IsEditable="True"
@ -48,6 +54,17 @@
IsEnabled="{Binding IsModuleFilterEnabled}"
SelectedItem="{Binding SelectedModule}"
ItemsSource="{Binding Modules}" />
<StackPanel Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Orientation="Horizontal"
Margin="0 10 0 0"
ToolTip="Check to update values every half second instead of realtime">
<TextBlock VerticalAlignment="Center">Slow updates</TextBlock>
<ToggleButton VerticalAlignment="Center" Margin="5 0" Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding SlowUpdates}" />
</StackPanel>
</Grid>
<TreeView Grid.Row="1" ItemsSource="{Binding MainDataModel.Children}" HorizontalContentAlignment="Stretch">
<TreeView.Resources>

View File

@ -20,12 +20,13 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
private DataModelPropertiesViewModel _mainDataModel;
private string _propertySearch;
private Module _selectedModule;
private bool _slowUpdates;
public DataModelDebugViewModel(IDataModelUIService dataModelUIService, IPluginManagementService pluginManagementService)
{
_dataModelUIService = dataModelUIService;
_pluginManagementService = pluginManagementService;
_updateTimer = new Timer(500);
_updateTimer = new Timer(25);
DisplayName = "Data model";
Modules = new BindableCollection<Module>();
@ -43,6 +44,16 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
set => SetAndNotify(ref _propertySearch, value);
}
public bool SlowUpdates
{
get => _slowUpdates;
set
{
SetAndNotify(ref _slowUpdates, value);
_updateTimer.Interval = _slowUpdates ? 500 : 25;
}
}
public BindableCollection<Module> Modules { get; }
public Module SelectedModule

View File

@ -16,7 +16,6 @@ using Artemis.UI.Shared.Services;
using Flurl;
using Flurl.Http;
using MaterialDesignThemes.Wpf;
using Newtonsoft.Json.Linq;
using Serilog;
using File = System.IO.File;
@ -27,8 +26,8 @@ namespace Artemis.UI.Services
private const string ApiUrl = "https://dev.azure.com/artemis-rgb/Artemis/_apis/";
private readonly PluginSetting<bool> _autoInstallUpdates;
private readonly PluginSetting<bool> _checkForUpdates;
private readonly ILogger _logger;
private readonly IDialogService _dialogService;
private readonly ILogger _logger;
private readonly IMessageService _messageService;
private readonly IWindowService _windowService;
@ -46,6 +45,32 @@ namespace Artemis.UI.Services
_checkForUpdates.SettingChanged += CheckForUpdatesOnSettingChanged;
}
private async Task OfferUpdate(DevOpsBuild buildInfo)
{
await _dialogService.ShowDialog<UpdateDialogViewModel>(new Dictionary<string, object> {{"buildInfo", buildInfo}});
}
private async Task UpdateInstaller()
{
string downloadUrl = "https://builds.artemis-rgb.com/binaries/Artemis.Installer.exe";
string installerDirectory = Path.Combine(Constants.ApplicationFolder, "Installer");
string installerPath = Path.Combine(installerDirectory, "Artemis.Installer.exe");
_logger.Information("UpdateInstaller: Downloading installer from {downloadUrl}", downloadUrl);
using HttpClient client = new();
HttpResponseMessage httpResponseMessage = await client.GetAsync(downloadUrl);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new ArtemisUIException($"Failed to download installer, status code {httpResponseMessage.StatusCode}");
_logger.Information("UpdateInstaller: Writing installer file to {installerPath}", installerPath);
if (File.Exists(installerPath))
File.Delete(installerPath);
Core.Utilities.CreateAccessibleDirectory(installerDirectory);
await using FileStream fs = new(installerPath, FileMode.Create, FileAccess.Write, FileShare.None);
await httpResponseMessage.Content.CopyToAsync(fs);
}
public async Task<bool> AutoUpdate()
{
if (!_checkForUpdates.Value)
@ -68,7 +93,9 @@ namespace Artemis.UI.Services
return false;
if (_windowService.IsMainWindowOpen)
{
await OfferUpdate(buildInfo);
}
else if (_autoInstallUpdates.Value)
{
// Lets go
@ -92,11 +119,6 @@ namespace Artemis.UI.Services
return true;
}
private async Task OfferUpdate(DevOpsBuild buildInfo)
{
await _dialogService.ShowDialog<UpdateDialogViewModel>(new Dictionary<string, object> {{"buildInfo", buildInfo}});
}
public async Task<bool> IsUpdateAvailable()
{
DevOpsBuild buildInfo = await GetBuildInfo(1);
@ -114,7 +136,9 @@ namespace Artemis.UI.Services
// Always update installer if it is missing ^^
if (!File.Exists(installerPath))
{
await UpdateInstaller();
}
// Compare the creation date of the installer with the build date and update if needed
else
{
@ -182,27 +206,6 @@ namespace Artemis.UI.Services
.GetJsonAsync<GitHubDifference>();
}
private async Task UpdateInstaller()
{
string downloadUrl = "https://builds.artemis-rgb.com/binaries/Artemis.Installer.exe";
string installerDirectory = Path.Combine(Constants.ApplicationFolder, "Installer");
string installerPath = Path.Combine(installerDirectory, "Artemis.Installer.exe");
_logger.Information("UpdateInstaller: Downloading installer from {downloadUrl}", downloadUrl);
using HttpClient client = new();
HttpResponseMessage httpResponseMessage = await client.GetAsync(downloadUrl);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new ArtemisUIException($"Failed to download installer, status code {httpResponseMessage.StatusCode}");
_logger.Information("UpdateInstaller: Writing installer file to {installerPath}", installerPath);
if (File.Exists(installerPath))
File.Delete(installerPath);
else if (!Directory.Exists(installerDirectory))
Directory.CreateDirectory(installerDirectory);
await using FileStream fs = new(installerPath, FileMode.Create, FileAccess.Write, FileShare.None);
await httpResponseMessage.Content.CopyToAsync(fs);
}
#region Event handlers
private void CheckForUpdatesOnSettingChanged(object sender, EventArgs e)