Ionite
1 year ago
100 changed files with 236 additions and 257 deletions
@ -1,9 +1,8 @@
|
||||
using System; |
||||
using System.Text.Json; |
||||
using System.Text.Json; |
||||
using System.Text.Json.Serialization; |
||||
using StabilityMatrix.Extensions; |
||||
using StabilityMatrix.Core.Extensions; |
||||
|
||||
namespace StabilityMatrix.Converters.Json; |
||||
namespace StabilityMatrix.Core.Converters.Json; |
||||
|
||||
public class DefaultUnknownEnumConverter<T> : JsonConverter<T> where T : Enum |
||||
{ |
@ -1,8 +1,7 @@
|
||||
using System; |
||||
using System.Text.Json; |
||||
using System.Text.Json; |
||||
using System.Text.Json.Serialization; |
||||
|
||||
namespace StabilityMatrix.Converters.Json; |
||||
namespace StabilityMatrix.Core.Converters.Json; |
||||
|
||||
public class LaunchOptionValueJsonConverter : JsonConverter<object?> |
||||
{ |
@ -1,6 +1,4 @@
|
||||
using System; |
||||
|
||||
namespace StabilityMatrix.Extensions; |
||||
namespace StabilityMatrix.Core.Extensions; |
||||
|
||||
public static class EnumAttributeExtensions |
||||
{ |
@ -1,6 +1,4 @@
|
||||
using System; |
||||
|
||||
namespace StabilityMatrix.Extensions; |
||||
namespace StabilityMatrix.Core.Extensions; |
||||
|
||||
public static class EnumConversionExtensions |
||||
{ |
@ -1,7 +1,4 @@
|
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
namespace StabilityMatrix.Extensions; |
||||
namespace StabilityMatrix.Core.Extensions; |
||||
|
||||
public static class EnumerableExtensions |
||||
{ |
@ -1,12 +1,9 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Linq.Expressions; |
||||
using System.Linq.Expressions; |
||||
using System.Reflection; |
||||
using LiteDB; |
||||
using LiteDB.Async; |
||||
|
||||
namespace StabilityMatrix.Extensions; |
||||
namespace StabilityMatrix.Core.Extensions; |
||||
|
||||
// ReSharper disable once InconsistentNaming |
||||
public static class LiteDBExtensions |
@ -1,11 +1,7 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using Microsoft.Extensions.Caching.Memory; |
||||
using Microsoft.Extensions.Caching.Memory; |
||||
using Octokit; |
||||
|
||||
namespace StabilityMatrix.Helper.Cache; |
||||
namespace StabilityMatrix.Core.Helper.Cache; |
||||
|
||||
public class GithubApiCache : IGithubApiCache |
||||
{ |
@ -1,10 +1,7 @@
|
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using Octokit; |
||||
using Octokit; |
||||
using Refit; |
||||
|
||||
namespace StabilityMatrix.Helper.Cache; |
||||
namespace StabilityMatrix.Core.Helper.Cache; |
||||
|
||||
public interface IGithubApiCache |
||||
{ |
@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic; |
||||
using System.Runtime.CompilerServices; |
||||
using System.Runtime.CompilerServices; |
||||
|
||||
namespace StabilityMatrix.Helper.Cache; |
||||
namespace StabilityMatrix.Core.Helper.Cache; |
||||
|
||||
// ReSharper disable once InconsistentNaming |
||||
public class LRUCache<TK,TV> where TK : notnull |
@ -1,8 +1,7 @@
|
||||
using System; |
||||
using System.Linq.Expressions; |
||||
using System.Linq.Expressions; |
||||
using System.Reflection; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public static class Expressions |
||||
{ |
@ -1,12 +1,9 @@
|
||||
using System; |
||||
using System.Buffers; |
||||
using System.IO; |
||||
using System.Buffers; |
||||
using System.Security.Cryptography; |
||||
using System.Threading.Tasks; |
||||
using Blake3; |
||||
using StabilityMatrix.Core.Models.Progress; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public static class FileHash |
||||
{ |
@ -1,12 +1,7 @@
|
||||
using System; |
||||
using System.Buffers; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using System.Buffers; |
||||
using StabilityMatrix.Core.Models.Progress; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public static class FileTransfers |
||||
{ |
@ -1,8 +1,6 @@
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.Threading.Tasks; |
||||
using System.Diagnostics; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
/// <summary> |
||||
/// Enforces a minimum delay if the function returns too quickly. |
@ -1,8 +1,7 @@
|
||||
using System; |
||||
using System.Text; |
||||
using System.Text; |
||||
using System.Text.Json; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public class ObjectHash |
||||
{ |
@ -1,14 +1,9 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.Linq; |
||||
using System.Diagnostics; |
||||
using System.Text; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
using NLog; |
||||
using StabilityMatrix.Core.Exceptions; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public static class ProcessRunner |
||||
{ |
@ -0,0 +1,22 @@
|
||||
using System.Diagnostics.CodeAnalysis; |
||||
|
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] |
||||
public static class Size |
||||
{ |
||||
public const ulong KiB = 1024; |
||||
public const ulong MiB = KiB * 1024; |
||||
public const ulong GiB = MiB * 1024; |
||||
|
||||
public static string FormatBytes(ulong bytes) |
||||
{ |
||||
return bytes switch |
||||
{ |
||||
< KiB => $"{bytes} B", |
||||
< MiB => $"{bytes / (double) KiB:0.0} KiB", |
||||
< GiB => $"{bytes / (double) MiB:0.0} MiB", |
||||
_ => $"{bytes / (double) GiB:0.0} GiB" |
||||
}; |
||||
} |
||||
} |
@ -1,8 +1,8 @@
|
||||
using System.Runtime.InteropServices; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
internal static class SystemInfo |
||||
public static class SystemInfo |
||||
{ |
||||
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")] |
||||
public static extern bool ShouldUseDarkMode(); |
@ -1,8 +1,6 @@
|
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
using System.Reflection; |
||||
|
||||
namespace StabilityMatrix.Helper; |
||||
namespace StabilityMatrix.Core.Helper; |
||||
|
||||
public static class Utilities |
||||
{ |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.Models.Configs; |
||||
namespace StabilityMatrix.Core.Models.Configs; |
||||
|
||||
public class DebugOptions |
||||
{ |
@ -1,8 +1,4 @@
|
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
|
||||
namespace StabilityMatrix.Models.FileInterfaces; |
||||
namespace StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
public class DirectoryPath : FileSystemPath, IPathObject |
||||
{ |
@ -1,9 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.IO; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
|
||||
namespace StabilityMatrix.Models.FileInterfaces; |
||||
namespace StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] |
||||
public class FilePath : FileSystemPath, IPathObject |
@ -1,7 +1,4 @@
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace StabilityMatrix.Models.FileInterfaces; |
||||
namespace StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
public class FileSystemPath : IEquatable<FileSystemPath>, IEquatable<string> |
||||
{ |
@ -1,6 +1,4 @@
|
||||
using System.Threading.Tasks; |
||||
|
||||
namespace StabilityMatrix.Models.FileInterfaces; |
||||
namespace StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
public interface IPathObject |
||||
{ |
@ -1,6 +1,6 @@
|
||||
using System.Globalization; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public class FileSizeType |
||||
{ |
@ -1,7 +1,6 @@
|
||||
using System; |
||||
using StabilityMatrix.Models.FileInterfaces; |
||||
using StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public static class GlobalConfig |
||||
{ |
@ -1,11 +1,7 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Text.Json.Serialization; |
||||
using System.Threading.Tasks; |
||||
using StabilityMatrix.Helper; |
||||
using System.Text.Json.Serialization; |
||||
using StabilityMatrix.Core.Helper; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
/// <summary> |
||||
/// Profile information for a user-installed package. |
@ -1,9 +1,8 @@
|
||||
using System; |
||||
using System.Text.Json.Serialization; |
||||
using StabilityMatrix.Converters.Json; |
||||
using StabilityMatrix.Helper; |
||||
using System.Text.Json.Serialization; |
||||
using StabilityMatrix.Core.Converters.Json; |
||||
using StabilityMatrix.Core.Helper; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public class LaunchOption |
||||
{ |
@ -1,6 +1,6 @@
|
||||
using System.Collections.ObjectModel; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public class LaunchOptionCard |
||||
{ |
@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic; |
||||
using System.Text.Json.Serialization; |
||||
using System.Text.Json.Serialization; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
/// <summary> |
||||
/// Defines a launch option for a BasePackage. |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public enum LaunchOptionType |
||||
{ |
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public class LicenseInfo |
||||
{ |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public enum LoadState |
||||
{ |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public class PackageVersion |
||||
{ |
@ -1,7 +1,6 @@
|
||||
using System; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")] |
||||
[SuppressMessage("ReSharper", "IdentifierTypo")] |
@ -1,7 +1,6 @@
|
||||
using System; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
namespace StabilityMatrix.Core.Models; |
||||
|
||||
public readonly record struct TaskResult<T> |
||||
{ |
@ -1,11 +1,8 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
||||
using NLog; |
||||
using NLog; |
||||
using Python.Runtime; |
||||
using StabilityMatrix.Models; |
||||
using StabilityMatrix.Core.Models; |
||||
|
||||
namespace StabilityMatrix.Python; |
||||
namespace StabilityMatrix.Core.Python; |
||||
|
||||
/// <summary> |
||||
/// Extracts command arguments from Python source file. |
@ -1,9 +1,4 @@
|
||||
using System; |
||||
using System.IO; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
|
||||
namespace StabilityMatrix.Python; |
||||
namespace StabilityMatrix.Core.Python; |
||||
|
||||
public interface IPyRunner |
||||
{ |
@ -1,10 +1,7 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.IO; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.Text; |
||||
|
||||
namespace StabilityMatrix.Python.Interop; |
||||
namespace StabilityMatrix.Core.Python.Interop; |
||||
|
||||
/// <summary> |
||||
/// Implement the interface of the sys.stdout redirection |
@ -1,13 +1,9 @@
|
||||
using System; |
||||
using System.IO; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
using NLog; |
||||
using NLog; |
||||
using Python.Runtime; |
||||
using StabilityMatrix.Helper; |
||||
using StabilityMatrix.Python.Interop; |
||||
using StabilityMatrix.Core.Helper; |
||||
using StabilityMatrix.Core.Python.Interop; |
||||
|
||||
namespace StabilityMatrix.Python; |
||||
namespace StabilityMatrix.Core.Python; |
||||
|
||||
public record struct PyVersionInfo(int Major, int Minor, int Micro, string ReleaseLevel, int Serial); |
||||
|
@ -1,15 +1,10 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using System.Diagnostics; |
||||
using NLog; |
||||
using Salaros.Configuration; |
||||
using StabilityMatrix.Helper; |
||||
using StabilityMatrix.Models.FileInterfaces; |
||||
using StabilityMatrix.Core.Helper; |
||||
using StabilityMatrix.Core.Models.FileInterfaces; |
||||
|
||||
namespace StabilityMatrix.Python; |
||||
namespace StabilityMatrix.Core.Python; |
||||
|
||||
/// <summary> |
||||
/// Python runner using a subprocess, mainly for venv support. |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
internal enum DeviceIoControlCode : uint |
||||
{ |
@ -1,13 +1,11 @@
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.Diagnostics; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.IO; |
||||
using System.Runtime.InteropServices; |
||||
using System.Runtime.Versioning; |
||||
using System.Text; |
||||
using Microsoft.Win32.SafeHandles; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
[SupportedOSPlatform("windows")] |
||||
public static class Junction |
@ -1,6 +1,6 @@
|
||||
using System.Runtime.InteropServices; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
/// <summary> |
||||
/// Because the tag we're using is IO_REPARSE_TAG_MOUNT_POINT, |
@ -1,4 +1,4 @@
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
internal enum Win32CreationDisposition : uint |
||||
{ |
@ -1,36 +1,34 @@
|
||||
using StabilityMatrix.Extensions; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
internal enum Win32ErrorCode |
||||
{ |
||||
/// <summary> |
||||
/// The file or directory is not a reparse point. |
||||
/// ERROR_NOT_A_REPARSE_POINT |
||||
/// </summary> |
||||
[StringValue("ERROR_NOT_A_REPARSE_POINT")] |
||||
NotAReparsePoint = 4390, |
||||
|
||||
/// <summary> |
||||
/// The reparse point attribute cannot be set because it conflicts with an existing attribute. |
||||
/// ERROR_REPARSE_ATTRIBUTE_CONFLICT |
||||
/// </summary> |
||||
[StringValue("ERROR_REPARSE_ATTRIBUTE_CONFLICT")] |
||||
ReparseAttributeConflict = 4391, |
||||
|
||||
/// <summary> |
||||
/// The data present in the reparse point buffer is invalid. |
||||
/// ERROR_INVALID_REPARSE_DATA |
||||
/// </summary> |
||||
[StringValue("ERROR_INVALID_REPARSE_DATA")] |
||||
InvalidReparseData = 4392, |
||||
|
||||
/// <summary> |
||||
/// The tag present in the reparse point buffer is invalid. |
||||
/// ERROR_REPARSE_TAG_INVALID |
||||
/// </summary> |
||||
[StringValue("ERROR_REPARSE_TAG_INVALID")] |
||||
ReparseTagInvalid = 4393, |
||||
|
||||
/// <summary> |
||||
/// There is a mismatch between the tag specified in the request and the tag present in the reparse point. |
||||
/// ERROR_REPARSE_TAG_MISMATCH |
||||
/// </summary> |
||||
[StringValue("ERROR_REPARSE_TAG_MISMATCH")] |
||||
ReparseTagMismatch = 4394, |
||||
} |
@ -1,6 +1,4 @@
|
||||
using System; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
[Flags] |
||||
internal enum Win32FileAccess : uint |
@ -1,7 +1,6 @@
|
||||
using System; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
using System.Diagnostics.CodeAnalysis; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
[Flags] |
||||
[SuppressMessage("ReSharper", "InconsistentNaming")] |
@ -1,6 +1,4 @@
|
||||
using System; |
||||
|
||||
namespace StabilityMatrix.ReparsePoints; |
||||
namespace StabilityMatrix.Core.ReparsePoints; |
||||
|
||||
[Flags] |
||||
internal enum Win32FileShare : uint |
Loading…
Reference in new issue