mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0253af3000
8 files changed
+131
-56
No files matched your search
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Threading;
|
||||
using Artemis.Core.Models.Profile.Conditions;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Ninject;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Ninject;
|
||||
@@ -37,11 +39,12 @@ namespace Artemis.UI
|
||||
|
||||
protected override void Launch()
|
||||
{
|
||||
StartupArguments = Args.ToList();
|
||||
|
||||
var logger = Kernel.Get<ILogger>();
|
||||
var viewManager = Kernel.Get<IViewManager>();
|
||||
|
||||
StartupArguments = Args.ToList();
|
||||
CreateDataDirectory(logger);
|
||||
|
||||
// Create the Artemis core
|
||||
try
|
||||
{
|
||||
@@ -113,6 +116,29 @@ namespace Artemis.UI
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void CreateDataDirectory(ILogger logger)
|
||||
{
|
||||
// Ensure the data folder exists
|
||||
if (Directory.Exists(Constants.DataFolder))
|
||||
return;
|
||||
|
||||
logger.Information("Creating data directory at {dataDirectoryFolder}", Constants.DataFolder);
|
||||
Directory.CreateDirectory(Constants.DataFolder);
|
||||
|
||||
// During creation ensure all local users can access the data folder
|
||||
// This is needed when later running Artemis as a different user or when Artemis is first run as admin
|
||||
var directoryInfo = new DirectoryInfo(Constants.DataFolder);
|
||||
var accessControl = directoryInfo.GetAccessControl();
|
||||
accessControl.AddAccessRule(new FileSystemAccessRule(
|
||||
new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null),
|
||||
FileSystemRights.FullControl,
|
||||
InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit,
|
||||
PropagationFlags.InheritOnly,
|
||||
AccessControlType.Allow)
|
||||
);
|
||||
directoryInfo.SetAccessControl(accessControl);
|
||||
}
|
||||
|
||||
private void HandleFatalException(Exception e, ILogger logger)
|
||||
{
|
||||
logger.Fatal(e, "Fatal exception during initialization, shutting down.");
|
||||
|
||||
@@ -50,9 +50,6 @@ namespace Artemis.UI.Screens.Module
|
||||
|
||||
private async Task AddTabsAsync()
|
||||
{
|
||||
// Give the screen a moment to active without freezing the UI thread
|
||||
await Task.Delay(400);
|
||||
|
||||
// Create the profile editor and module VMs
|
||||
if (Module is ProfileModule profileModule)
|
||||
{
|
||||
|
||||
@@ -270,6 +270,9 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
{
|
||||
Execute.PostToUIThread(async () =>
|
||||
{
|
||||
if (SelectedProfile == null)
|
||||
return;
|
||||
|
||||
var changeTask = _profileService.ActivateProfileAnimated(SelectedProfile);
|
||||
_profileEditorService.ChangeSelectedProfile(null);
|
||||
var profile = await changeTask;
|
||||
@@ -279,7 +282,10 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
|
||||
private void ModuleOnActiveProfileChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedProfile = Profiles.FirstOrDefault(d => d.Id == Module.ActiveProfile.EntityId);
|
||||
if (Module.ActiveProfile == null)
|
||||
SelectedProfile = null;
|
||||
else
|
||||
SelectedProfile = Profiles.FirstOrDefault(d => d.Id == Module.ActiveProfile.EntityId);
|
||||
}
|
||||
|
||||
private void LoadWorkspaceSettings()
|
||||
|
||||
Reference in new issue
Block a user