-
Notifications
You must be signed in to change notification settings - Fork 1
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
10 changed files
with
100 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
- **优化**增加主窗体初始尺寸 | ||
- **新增**更新整合包到指定版本(#20) | ||
- **新增**支持Prism(mmc-pack)整合包导入 | ||
|
||
## v0.4.4 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using DotNext; | ||
using Newtonsoft.Json; | ||
using Polymerium.Abstractions.Importers; | ||
using Polymerium.Abstractions.Meta; | ||
using Polymerium.Core.Models.Prism; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Polymerium.Core.Importers | ||
{ | ||
public class PrismImporter : ImporterBase | ||
{ | ||
public override Task<Result<ModpackContent, GameImportError>> ExtractMetadataAsync(string fileName, string indexContent, IEnumerable<string> rawFileList, Uri? source, bool forceOffline) | ||
{ | ||
var model = JsonConvert.DeserializeObject<PrismModpackIndex>(indexContent); | ||
var metadata = new GameMetadata(); | ||
foreach (var component in model.Components) | ||
{ | ||
metadata.Components.Add(new Component() | ||
{ | ||
Identity = component.Uid, | ||
Version = component.Version | ||
}); | ||
} | ||
var list = new List<PackedSolidFile>(); | ||
foreach (var raw in rawFileList.Where(x => x.StartsWith("minecraft"))) | ||
{ | ||
var packed = new PackedSolidFile() | ||
{ | ||
FileName = raw, | ||
Path = Path.GetRelativePath("minecraft", raw) | ||
}; | ||
list.Add(packed); | ||
} | ||
foreach (var raw in rawFileList.Where(x => x.StartsWith(".minecraft"))) | ||
{ | ||
var packed = new PackedSolidFile() | ||
{ | ||
FileName = raw, | ||
Path = Path.GetRelativePath(".minecraft", raw) | ||
}; | ||
list.Add(packed); | ||
} | ||
var name = Path.GetFileNameWithoutExtension(fileName); | ||
var version = Path.GetFileName(fileName); | ||
return Task.FromResult(Finished(name, version, string.Empty, null, null, metadata, list)); | ||
} | ||
} | ||
} |
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,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Polymerium.Core.Models.Prism | ||
{ | ||
public struct PrismModpackComponent | ||
{ | ||
public bool? Important { get; set; } | ||
public string Uid { get; set; } | ||
public string Version { 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,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Polymerium.Core.Models.Prism | ||
{ | ||
public struct PrismModpackIndex | ||
{ | ||
public IEnumerable<PrismModpackComponent> Components { get; set; } | ||
public uint FormatVersion { 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