Skip to content

Commit

Permalink
Merge pull request #28 from LipPkg/develop
Browse files Browse the repository at this point in the history
Relase v0.2.7
  • Loading branch information
LazuliKao authored Jun 27, 2023
2 parents 3733478 + 6a2c0d4 commit a75326c
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 258 deletions.
104 changes: 61 additions & 43 deletions src/LipNETWrapper/Class/LipPackage.cs
Original file line number Diff line number Diff line change
@@ -1,46 +1,64 @@
using Newtonsoft.Json;
using System;
#nullable disable
using System.Collections.Generic;
using Newtonsoft.Json;

namespace LipNETWrapper.Class
namespace LipNETWrapper.Class;

public partial class LipPackage
{
// {
// "author": "Mojang",
// "description": "Bedrock Dedicated Servers allow Minecraft players on Windows and Linux computers to set up their own server at home, or host their server using a cloud-based service.",
// "files": [],
// "homepage": "https://www.minecraft.net",
// "license": "",
// "name": "Minecraft Bedrock Dedicated Server",
// "tooth": "github.com/tooth-hub/bds",
// "version": "1.19.61",
// "versions": [
// "1.19.61",
// "1.7.0",
// "1.6.1"
// ]
//}
[Serializable]
public class LipPackageVersions
{
[JsonProperty("versions")] public string[]? Versions { get; set; }
}
[Serializable]
public class LipPackage: LipPackageVersions
{
[JsonProperty("author")] public string Author { get; set; } = string.Empty;
[JsonProperty("description")] public string Description { get; set; } = string.Empty;
[JsonProperty("files")] public LipFile[] Files { get; set; } = Array.Empty<LipFile>();
[JsonProperty("homepage")] public string Homepage { get; set; } = string.Empty;
[JsonProperty("license")] public string License { get; set; } = string.Empty;
[JsonProperty("name")] public string Name { get; set; } = string.Empty;
[JsonProperty("tooth")] public string Tooth { get; set; } = string.Empty;
[JsonProperty("version")] public string Version { get; set; } = string.Empty;
}
[Serializable]
public class LipFile//todo 这玩意长啥样
{
//[JsonProperty("name")] public string Name { get; set; }
//[JsonProperty("sha256")] public string Sha256 { get; set; }
//[JsonProperty("size")] public long Size { get; set; }
//[JsonProperty("url")] public string Url { get; set; }
}
[JsonProperty("format_version")]
public long FormatVersion { get; set; }

[JsonProperty("tooth")]
public string Tooth { get; set; }

[JsonProperty("version")]
public string Version { get; set; }

[JsonProperty("info")]
public Info Info { get; set; }

[JsonProperty("commands")]
public Commands Commands { get; set; }

[JsonProperty("dependencies")]
public Dictionary<string, string> Dependencies { get; set; }

[JsonProperty("files")]
public Files Files { get; set; }
}

public partial class Commands
{
[JsonProperty("post_install")]
public string[] PostInstall { get; set; }
}
public partial class Files
{
[JsonProperty("place")]
public Place[] Place { get; set; }

[JsonProperty("remove")]
public string[] Remove { get; set; }
}

public partial class Place
{
[JsonProperty("src")]
public string Src { get; set; }

[JsonProperty("dest")]
public string Dest { get; set; }
}

public partial class Info
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("description")]
public string Description { get; set; }

[JsonProperty("author")]
public string Author { get; set; }
}
19 changes: 19 additions & 0 deletions src/LipNETWrapper/Class/LipPackageItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
#nullable disable
namespace LipNETWrapper.Class;

public class LipPackageItem
{
[JsonProperty("available_versions")] public LipPackageVersions AvailableVersions { get; set; }
[JsonProperty("metadata")] public LipPackage Package { get; set; }
}

public class LipPackageVersions : List<string>
{

}
48 changes: 0 additions & 48 deletions src/LipNETWrapper/Class/LipPackageSimple.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/LipNETWrapper/Class/Tooth/ToothJson.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Newtonsoft.Json;

Expand Down Expand Up @@ -46,4 +46,4 @@ public class Confirmation
[JsonProperty("GOOS")] public string GOOS { get; set; } = "";

[JsonProperty("GOARCH")] public string GOARCH { get; set; } = "";
}
}
3 changes: 1 addition & 2 deletions src/LipNETWrapper/ILipWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface ILipWrapper
string ExecutablePath { get; set; }
string? WorkingPath { get; set; }
Task<string> GetLipVersion(CancellationToken tk = default);
Task<(LipPackageSimple[] packages, string message)> GetAllPackagesAsync(CancellationToken tk = default);
Task<(LipPackage[] packages, string message)> GetAllPackagesAsync(CancellationToken tk = default);
Task<(bool success, LipPackageVersions? package, string message)> GetPackageInfoAsync(string packageId,
CancellationToken tk = default, Action<string>? onOutput = null);
Task<(bool success, LipPackage? package, string message)> GetLocalPackageInfoAsync(string packageId,
Expand All @@ -19,6 +19,5 @@ Task<int> InstallPackageAsync(string packageId, bool upgrade = false, bool skipD
Task<int> UninstallPackageAsync(string packageId,
CancellationToken tk = default, Action<string>? onOutput = null);
Task<LipRegistry> GetLipRegistryAsync(string registry, CancellationToken tk = default);

Task CachePurge();
}
3 changes: 2 additions & 1 deletion src/LipNETWrapper/LipConsoleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public static LipCommand Create(string cmd, bool quiet = false)
var instance = new LipCommand();
if (quiet)
{
instance.Add("-q");
//todo ?
//instance.Add("-q");
}
return instance.Add(cmd);
}
Expand Down
Loading

0 comments on commit a75326c

Please sign in to comment.