-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
484 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
VRCOSC.App/Startup/Serialisation/SerialisableStartupManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License. | ||
// See the LICENSE file in the repository root for full license text. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using VRCOSC.App.Serialisation; | ||
|
||
namespace VRCOSC.App.Startup.Serialisation; | ||
|
||
[JsonObject] | ||
public class SerialisableStartupManager : SerialisableVersion | ||
{ | ||
[JsonProperty("instances")] | ||
public List<SerialisableStartupInstance> Instances { get; set; } = []; | ||
|
||
[JsonConstructor] | ||
public SerialisableStartupManager() | ||
{ | ||
} | ||
|
||
public SerialisableStartupManager(StartupManager startupManager) | ||
{ | ||
Version = 1; | ||
|
||
Instances = startupManager.Instances.Select(startupInstance => new SerialisableStartupInstance(startupInstance)).ToList(); | ||
} | ||
} | ||
|
||
[JsonObject] | ||
public class SerialisableStartupInstance | ||
{ | ||
[JsonProperty("file_location")] | ||
public string FileLocation { get; set; } = string.Empty; | ||
|
||
[JsonProperty("arguments")] | ||
public string Arguments { get; set; } = string.Empty; | ||
|
||
[JsonConstructor] | ||
public SerialisableStartupInstance() | ||
{ | ||
} | ||
|
||
public SerialisableStartupInstance(StartupInstance startupInstance) | ||
{ | ||
FileLocation = startupInstance.FileLocation.Value; | ||
Arguments = startupInstance.Arguments.Value; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
VRCOSC.App/Startup/Serialisation/StartupManagerSerialiser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License. | ||
// See the LICENSE file in the repository root for full license text. | ||
|
||
using VRCOSC.App.Serialisation; | ||
using VRCOSC.App.Utils; | ||
|
||
namespace VRCOSC.App.Startup.Serialisation; | ||
|
||
public class StartupManagerSerialiser : Serialiser<StartupManager, SerialisableStartupManager> | ||
{ | ||
protected override string Directory => "configuration"; | ||
protected override string FileName => "startup.json"; | ||
|
||
public StartupManagerSerialiser(Storage storage, StartupManager reference) | ||
: base(storage, reference) | ||
{ | ||
} | ||
|
||
protected override bool ExecuteAfterDeserialisation(SerialisableStartupManager data) | ||
{ | ||
foreach (var serialisableStartupInstance in data.Instances) | ||
{ | ||
Reference.Instances.Add(new StartupInstance | ||
{ | ||
FileLocation = { Value = serialisableStartupInstance.FileLocation }, | ||
Arguments = { Value = serialisableStartupInstance.Arguments } | ||
}); | ||
} | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.