Skip to content

Commit 0ed179b

Browse files
committed
Merge branch 'dev'
2 parents 3ca6891 + f9178ae commit 0ed179b

File tree

4 files changed

+0
-52
lines changed

4 files changed

+0
-52
lines changed

VRCOSC.App/Modules/Serialisation/SerialisableModule.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using Newtonsoft.Json;
7-
using VRCOSC.App.Packages;
87
using VRCOSC.App.SDK.Modules;
98
using VRCOSC.App.Serialisation;
109
using VRCOSC.App.Utils;
@@ -13,9 +12,6 @@ namespace VRCOSC.App.Modules.Serialisation;
1312

1413
public class SerialisableModule : SerialisableVersion
1514
{
16-
[JsonProperty("package_version")]
17-
public string? PackageVersion;
18-
1915
[JsonProperty("enabled")]
2016
public bool Enabled;
2117

@@ -33,7 +29,6 @@ public SerialisableModule()
3329
public SerialisableModule(Module module)
3430
{
3531
Version = 1;
36-
PackageVersion = PackageManager.GetInstance().GetInstalledVersion(module.PackageID).ToString();
3732

3833
Enabled = module.Enabled.Value;
3934
module.Settings.Where(pair => !pair.Value.InternalIsDefault()).ForEach(pair => Settings.Add(pair.Key, pair.Value.InternalSerialise()));

VRCOSC.App/Packages/PackageManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Threading.Tasks;
1010
using System.Windows;
1111
using Octokit;
12-
using Semver;
1312
using VRCOSC.App.Modules;
1413
using VRCOSC.App.Packages.Serialisation;
1514
using VRCOSC.App.Serialisation;
@@ -178,7 +177,6 @@ public async Task UninstallPackage(PackageSource packageSource)
178177

179178
public bool IsInstalled(PackageSource packageSource) => packageSource.PackageID is not null && InstalledPackages.ContainsKey(packageSource.PackageID);
180179
public string GetInstalledVersion(PackageSource packageSource) => packageSource.PackageID is not null && InstalledPackages.TryGetValue(packageSource.PackageID, out var version) ? version : string.Empty;
181-
public SemVersion GetInstalledVersion(string packageId) => packageId == "local" ? new SemVersion(0) : SemVersion.Parse(InstalledPackages[packageId], SemVersionStyles.Any);
182180

183181
private async Task loadCommunityPackages()
184182
{

VRCOSC.App/SDK/Modules/Attributes.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// See the LICENSE file in the repository root for full license text.
33

44
using System;
5-
using Semver;
65

76
// ReSharper disable ClassNeverInstantiated.Global
87

@@ -155,23 +154,6 @@ public ModuleSettingsWindowAttribute(Type windowType)
155154
}
156155
}
157156

158-
[AttributeUsage(AttributeTargets.Method)]
159-
public class ModuleMigrationAttribute : Attribute
160-
{
161-
internal SemVersion SourceVersion { get; }
162-
internal SemVersion DestinationVersion { get; }
163-
internal string SourceSetting { get; }
164-
internal string DestinationSetting { get; }
165-
166-
public ModuleMigrationAttribute(string sourceVersion, string destinationVersion, string sourceSetting, string destinationSetting = "")
167-
{
168-
SourceVersion = SemVersion.Parse(sourceVersion, SemVersionStyles.Any);
169-
DestinationVersion = SemVersion.Parse(destinationVersion, SemVersionStyles.Any);
170-
SourceSetting = sourceSetting;
171-
DestinationSetting = string.IsNullOrEmpty(destinationSetting) ? sourceSetting : destinationSetting;
172-
}
173-
}
174-
175157
public enum ModuleUpdateMode
176158
{
177159
/// <summary>

VRCOSC.App/SDK/Modules/Module.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Windows;
1212
using System.Windows.Controls;
1313
using System.Windows.Media;
14-
using Semver;
1514
using VRCOSC.App.ChatBox;
1615
using VRCOSC.App.ChatBox.Clips;
1716
using VRCOSC.App.ChatBox.Clips.Variables;
@@ -102,8 +101,6 @@ public abstract class Module
102101
public bool HasPrefabs => GetType().GetCustomAttributes<ModulePrefabAttribute>().Any();
103102
public IEnumerable<ModulePrefabAttribute> Prefabs => GetType().GetCustomAttributes<ModulePrefabAttribute>();
104103

105-
internal Dictionary<string, Dictionary<SemVersion, MethodInfo>> Migrators = [];
106-
107104
protected Module()
108105
{
109106
State.Subscribe(newState => Log(newState.ToString()));
@@ -126,7 +123,6 @@ internal void Load(string filePathOverride = "")
126123
Groups.Clear();
127124

128125
setSettingsWindow();
129-
generateMigrators();
130126

131127
OnPreLoad();
132128

@@ -172,29 +168,6 @@ private void setSettingsWindow()
172168
SettingsWindow = (IManagedWindow)window;
173169
}
174170

175-
private void generateMigrators()
176-
{
177-
Migrators.Clear();
178-
179-
GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).ForEach(info =>
180-
{
181-
var isDefined = info.IsDefined(typeof(ModuleMigrationAttribute));
182-
if (!isDefined) return;
183-
184-
var attribute = info.GetCustomAttribute<ModuleMigrationAttribute>()!;
185-
186-
var parameters = info.GetParameters();
187-
if (parameters.Length != 1) throw new Exception("Migration methods must have 1 parameter");
188-
189-
var returnParameter = info.ReturnParameter;
190-
if (returnParameter.ParameterType == typeof(void)) throw new Exception("Migration methods must have a return parameter");
191-
192-
Migrators.TryAdd(attribute.SourceSetting, new Dictionary<SemVersion, MethodInfo>());
193-
194-
Migrators[attribute.SourceSetting].Add(attribute.SourceVersion, info);
195-
});
196-
}
197-
198171
#endregion
199172

200173
#region Persistence

0 commit comments

Comments
 (0)