mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-02 10:43:31 +00:00
Compare commits
No commits in common. "90ddc3006c1645df32180e220d98c7547f795e1d" and "551921db9fdd0517e9c10eba39e1345db1a2737f" have entirely different histories.
90ddc3006c
...
551921db9f
@ -24,14 +24,6 @@ public static class LegacyMigrationService
|
|||||||
logger.Information("No legacy database found, nothing to migrate");
|
logger.Information("No legacy database found, nothing to migrate");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the legacy database has already been migrated, but the old DB failed to be deleted, we don't want to migrate again
|
|
||||||
// In a future update we'll clean up the old DB if it's still there, for now lets leave people's files alone
|
|
||||||
if (File.Exists(Path.Combine(Constants.DataFolder, "legacy.db")))
|
|
||||||
{
|
|
||||||
logger.Information("Legacy database already migrated, nothing to do");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using ArtemisDbContext dbContext = container.Resolve<ArtemisDbContext>();
|
using ArtemisDbContext dbContext = container.Resolve<ArtemisDbContext>();
|
||||||
MigrateToSqlite(logger, dbContext);
|
MigrateToSqlite(logger, dbContext);
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using System.Text;
|
|||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Modules;
|
using Artemis.Core.Modules;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
|
using Avalonia;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace Artemis.UI.Shared.DataModelVisualization.Shared;
|
namespace Artemis.UI.Shared.DataModelVisualization.Shared;
|
||||||
@ -281,8 +282,12 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa
|
|||||||
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
|
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
|
||||||
{
|
{
|
||||||
string childPath = AppendToPath(propertyInfo.Name);
|
string childPath = AppendToPath(propertyInfo.Name);
|
||||||
|
if (Children.Any(c => c.Path != null && c.Path.Equals(childPath)))
|
||||||
if (!ShouldIncludePath(childPath, propertyInfo))
|
continue;
|
||||||
|
if (propertyInfo.GetCustomAttribute<DataModelIgnoreAttribute>() != null)
|
||||||
|
continue;
|
||||||
|
MethodInfo? getMethod = propertyInfo.GetGetMethod();
|
||||||
|
if (getMethod == null || getMethod.GetParameters().Any())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DataModelVisualizationViewModel? child = CreateChild(dataModelUIService, childPath, GetChildDepth());
|
DataModelVisualizationViewModel? child = CreateChild(dataModelUIService, childPath, GetChildDepth());
|
||||||
@ -326,27 +331,6 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa
|
|||||||
Children.Remove(dataModelVisualizationViewModel);
|
Children.Remove(dataModelVisualizationViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldIncludePath(string childPath, PropertyInfo propertyInfo)
|
|
||||||
{
|
|
||||||
// Outdated plugins can cause unpredictable exceptions when resolving types
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Children.Any(c => c.Path != null && c.Path.Equals(childPath)))
|
|
||||||
return false;
|
|
||||||
if (propertyInfo.GetCustomAttribute<DataModelIgnoreAttribute>() != null)
|
|
||||||
return false;
|
|
||||||
MethodInfo? getMethod = propertyInfo.GetGetMethod();
|
|
||||||
if (getMethod == null || getMethod.GetParameters().Any())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DataModelVisualizationViewModel? CreateChild(IDataModelUIService dataModelUIService, string path, int depth)
|
private DataModelVisualizationViewModel? CreateChild(IDataModelUIService dataModelUIService, string path, int depth)
|
||||||
{
|
{
|
||||||
if (DataModel == null)
|
if (DataModel == null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user