[Save/Sync] In-Progress ModConfigXml loading rewrite.
+ Fixed async operations lock for Dispose() pattern in working files. + Rewrote StorageService.cs: --- Now uses ContentPath instead of raw strings where possible. --- Now throws exceptions for developer errors and critical program states. + Rewrote ModConfigService.cs: --- All functions are now completely async. + Removed ConfigProfilesResources completely as they exist in common Config xml files. + Somewhat simplified package data and processes.
This commit is contained in:
@@ -20,7 +20,6 @@ public record ModConfigInfo : IModConfigInfo
|
||||
public ImmutableArray<IAssemblyResourceInfo> Assemblies { get; init; }
|
||||
public ImmutableArray<ILuaScriptResourceInfo> LuaScripts { get; init; }
|
||||
public ImmutableArray<IConfigResourceInfo> Configs { get; init; }
|
||||
public ImmutableArray<IConfigProfileResourceInfo> ConfigProfiles { get; init; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -30,7 +29,6 @@ public record ModConfigInfo : IModConfigInfo
|
||||
public record AssemblyResourcesInfo(ImmutableArray<IAssemblyResourceInfo> Assemblies) : IAssembliesResourcesInfo;
|
||||
public record LuaScriptsResourcesInfo(ImmutableArray<ILuaScriptResourceInfo> LuaScripts) : ILuaScriptsResourcesInfo;
|
||||
public record ConfigResourcesInfo(ImmutableArray<IConfigResourceInfo> Configs) : IConfigsResourcesInfo;
|
||||
public record ConfigProfilesResourcesInfo(ImmutableArray<IConfigProfileResourceInfo> ConfigProfiles) : IConfigProfilesResourcesInfo;
|
||||
|
||||
public record BaseResourceInfo : IBaseResourceInfo
|
||||
{
|
||||
@@ -51,10 +49,11 @@ public record AssemblyResourceInfo : BaseResourceInfo, IAssemblyResourceInfo
|
||||
public bool IsScript { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Note: Config settings and settings-profiles are stored in the same files.
|
||||
/// </summary>
|
||||
public record ConfigResourceInfo : BaseResourceInfo, IConfigResourceInfo {}
|
||||
|
||||
public record ConfigProfileResourceInfo : BaseResourceInfo, IConfigProfileResourceInfo {}
|
||||
|
||||
public record LuaScriptsResourceInfo : BaseResourceInfo, ILuaScriptResourceInfo
|
||||
{
|
||||
public bool IsAutorun { get; init; }
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public partial interface IModConfigInfo : IAssembliesResourcesInfo,
|
||||
ILuaScriptsResourcesInfo, IConfigsResourcesInfo,
|
||||
IConfigProfilesResourcesInfo
|
||||
ILuaScriptsResourcesInfo, IConfigsResourcesInfo
|
||||
{
|
||||
// package info
|
||||
ContentPackage Package { get; }
|
||||
}
|
||||
|
||||
public record ResourceParserInfo(
|
||||
ContentPackage Owner,
|
||||
XElement Element,
|
||||
[NotNull] ContentPackage Owner,
|
||||
[NotNull] XElement Element,
|
||||
ImmutableArray<Identifier> Required,
|
||||
ImmutableArray<Identifier> Incompatible);
|
||||
|
||||
@@ -9,8 +9,6 @@ public interface IBaseResourceInfo : IResourceInfo, IDataInfo, IDependencyInfo {
|
||||
|
||||
public interface IConfigResourceInfo : IBaseResourceInfo {}
|
||||
|
||||
public interface IConfigProfileResourceInfo :IBaseResourceInfo {}
|
||||
|
||||
/// <summary>
|
||||
/// Represents loadable Lua files.
|
||||
/// </summary>
|
||||
@@ -53,9 +51,4 @@ public interface IConfigsResourcesInfo
|
||||
ImmutableArray<IConfigResourceInfo> Configs { get; }
|
||||
}
|
||||
|
||||
public interface IConfigProfilesResourcesInfo
|
||||
{
|
||||
ImmutableArray<IConfigProfileResourceInfo> ConfigProfiles { get; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -112,7 +112,7 @@ public record StorageServiceConfig : IStorageServiceConfig, IStorageServiceConfi
|
||||
|
||||
public string LocalDataSavePath => Path.Combine(ExecutionLocation, "/Data/Mods/");
|
||||
|
||||
public string LocalDataPathRegex => "<PACKAGENAME>";
|
||||
public string LocalDataPathRegex => "%ModDir%";
|
||||
|
||||
public string RunLocation => ExecutionLocation;
|
||||
public bool GlobalSafeIOEnabled => false;
|
||||
|
||||
Reference in New Issue
Block a user