-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate mod presets to deferred settings system
- Loading branch information
1 parent
de82349
commit 53f77f9
Showing
33 changed files
with
546 additions
and
313 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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Bloxstrap.Models.Attributes | ||
{ | ||
class EnumSortAttribute : Attribute | ||
{ | ||
public int Order { get; set; } | ||
} | ||
} |
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,40 @@ | ||
using System.Security.Cryptography; | ||
using System.Windows.Markup; | ||
|
||
namespace Bloxstrap.Models | ||
{ | ||
public class ModPresetFileData | ||
{ | ||
public string FilePath { get; private set; } | ||
|
||
public string FullFilePath => Path.Combine(Paths.Modifications, FilePath); | ||
|
||
public FileStream FileStream => File.OpenRead(FullFilePath); | ||
|
||
public string ResourceIdentifier { get; private set; } | ||
|
||
public Stream ResourceStream => Resource.GetStream(ResourceIdentifier); | ||
|
||
public byte[] ResourceHash { get; private set; } | ||
|
||
public ModPresetFileData(string contentPath, string resource) | ||
{ | ||
FilePath = contentPath; | ||
ResourceIdentifier = resource; | ||
|
||
using var stream = ResourceStream; | ||
ResourceHash = App.MD5Provider.ComputeHash(stream); | ||
} | ||
|
||
public bool HashMatches() | ||
{ | ||
if (!File.Exists(FullFilePath)) | ||
return false; | ||
|
||
using var fileStream = FileStream; | ||
var fileHash = App.MD5Provider.ComputeHash(fileStream); | ||
|
||
return fileHash.SequenceEqual(ResourceHash); | ||
} | ||
} | ||
} |
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,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Bloxstrap.Models.SettingTasks.Base | ||
{ | ||
public abstract class BaseTask | ||
{ | ||
public string Name { get; private set; } | ||
|
||
public abstract bool Changed { get; } | ||
|
||
public BaseTask(string prefix, string name) => Name = $"{prefix}.{name}"; | ||
|
||
public override string ToString() => Name; | ||
|
||
public abstract void Execute(); | ||
} | ||
} |
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
Oops, something went wrong.