Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .run/LinuxPublish.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="LinuxPublish" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" include_all_content_for_self_extract="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-x64" self_contained="true" target_folder="$PROJECT_DIR$/PCL.Neo/bin/Release/net9.0/linux-x64/publish" target_framework="net9.0" trim_unused_assemblies="true" uuid_high="-7633829966872318734" uuid_low="5995717239141094893" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions .run/MacOSPublish.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="MacOSPublish" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" include_all_content_for_self_extract="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="osx-x64" self_contained="true" target_folder="$PROJECT_DIR$/PCL.Neo/bin/Release/net9.0/osx-x64/publish" target_framework="net9.0" trim_unused_assemblies="true" uuid_high="-7633829966872318734" uuid_low="5995717239141094893" />
<method v="2" />
</configuration>
</component>
6 changes: 6 additions & 0 deletions .run/WinPublish.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="WinPublish" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" include_all_content_for_self_extract="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="osx-x64" self_contained="true" target_folder="$PROJECT_DIR$/PCL2.Neo/bin/Release/net9.0/osx-x64/publish" target_framework="net9.0" trim_unused_assemblies="true" uuid_high="-7633829966872318734" uuid_low="5995717239141094893" />
<method v="2" />
</configuration>
</component>
62 changes: 62 additions & 0 deletions PCL.Neo.Core/Const.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Runtime.InteropServices;

namespace PCL.Neo.Core;

public static class Const
{
/// <summary>
/// 系统是否为64位。
/// </summary>
public static readonly bool Is64Os = Environment.Is64BitOperatingSystem;
public enum RunningOs
{
Windows,
Linux,
MacOs,
Unknown
}

public static readonly RunningOs Os = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? RunningOs.Windows
: RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
? RunningOs.Linux
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
? RunningOs.MacOs
: RunningOs.Unknown;

public static readonly Architecture Architecture = RuntimeInformation.ProcessArchitecture;

/// <summary>
/// 根据 MOJANG API 命名
/// </summary>
public static string Platform
{
get
{
return Os switch
{
RunningOs.Windows => Architecture switch
{
Architecture.X64 => "windows-x64",
Architecture.X86 => "windows-x86",
Architecture.Arm64 => "windows-arm64",
_ => "unknown"
},
RunningOs.Linux => Architecture switch
{
Architecture.X64 => "linux",
Architecture.X86 => "linux-i386",
_ => "unknown"
},
RunningOs.MacOs => Architecture switch
{
Architecture.X64 => "mac-os",
Architecture.Arm64 => "mac-os-arm64",
_ => "unknown"
},
RunningOs.Unknown => "unknown",
_ => "unknown"
};
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
using Avalonia.Platform.Storage;
using CommunityToolkit.Mvvm.DependencyInjection;
using PCL.Neo.Services;
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;

namespace PCL.Neo.Helpers;
namespace PCL.Neo.Core.Helpers;

/// <summary>
/// 一些文件操作和下载请求之类的
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Audio
namespace PCL.Neo.Core.Models.Audio
{
public enum FileType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace PCL.Neo.Models.Audio
namespace PCL.Neo.Core.Models.Audio
{
public class AudioFileSearcher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

namespace PCL.Neo.Models.Minecraft;
namespace PCL.Neo.Core.Models.Minecraft;

public class AssetIndexFile
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static PCL.Neo.Models.Minecraft.MetadataFile.Rule;
using static PCL.Neo.Core.Models.Minecraft.MetadataFile.Rule;

namespace PCL.Neo.Models.Minecraft.Game.Data
namespace PCL.Neo.Core.Models.Minecraft.Game.Data
{
public partial class Arguments
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics;
using System.IO;

namespace PCL.Neo.Models.Minecraft.Game.Data;
namespace PCL.Neo.Core.Models.Minecraft.Game.Data;

public record GameEntityInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Game.Data
namespace PCL.Neo.Core.Models.Minecraft.Game.Data
{
public enum Icons : byte
{
Expand Down
6 changes: 6 additions & 0 deletions PCL.Neo.Core/Models/Minecraft/Game/Log.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace PCL.Neo.Core.Models.Minecraft.Game
{
internal class Log
{
}
}
6 changes: 6 additions & 0 deletions PCL.Neo.Core/Models/Minecraft/Game/Versions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace PCL.Neo.Core.Models.Minecraft.Game
{
internal class Versions
{
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Java;
namespace PCL.Neo.Core.Models.Minecraft.Java;

public interface IJavaManager
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using PCL.Neo.Utils;
using System;
using PCL.Neo.Core.Utils;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Java;
namespace PCL.Neo.Core.Models.Minecraft.Java;

/// <summary>
/// 每一个 Java 实体的信息类
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using PCL.Neo.Helpers;
using System;
using System.Collections.Generic;
using PCL.Neo.Core.Helpers;
using System.Diagnostics;
using System.IO;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Java;
namespace PCL.Neo.Core.Models.Minecraft.Java;

public sealed partial class JavaManager
{
Expand Down Expand Up @@ -111,7 +106,7 @@ public sealed record MojangJavaVersion(string Value)
}

string localFilePath = Path.Combine(destinationFolder,
filePath.Replace("/", Const.Sep.ToString()));
filePath.Replace("/", Path.DirectorySeparatorChar.ToString()));
if (isExecutable) executableFiles.Add(localFilePath);
Directory.CreateDirectory(Path.GetDirectoryName(localFilePath)!);
// 有的文件有LZMA压缩但是有的 tm 没有,尼玛搞了个解压缩发现文件少了几个
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
using PCL.Neo.Helpers;
using PCL.Neo.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Diagnostics;
using PCL.Neo.Core.Utils;

namespace PCL.Neo.Models.Minecraft.Java;
namespace PCL.Neo.Core.Models.Minecraft.Java;

/// <summary>
/// 测试
Expand Down Expand Up @@ -146,8 +136,8 @@ public void TestOutput()
{
Console.WriteLine("--------------------");
Console.WriteLine("路径: " + javaEntity.DirectoryPath);
Console.WriteLine("是否兼容: " + javaEntity.Compability);
Console.WriteLine("架构:" + javaEntity.Architecture);
Console.WriteLine((string?)("是否兼容: " + javaEntity.Compability));
Console.WriteLine((string?)("架构:" + javaEntity.Architecture));
Console.WriteLine("发行商:" + javaEntity.Implementor);
Console.WriteLine("版本:" + javaEntity.Version);
Console.WriteLine("数字版本:" + javaEntity.SlugVersion);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using PCL.Neo.Utils;
using System;
using System.Collections.Generic;
using PCL.Neo.Core.Utils;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Java
namespace PCL.Neo.Core.Models.Minecraft.Java
{
/// <summary>
/// 处理Unix系统下的java搜索
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using PCL.Neo.Utils;
using System;
using System.Collections.Generic;
using PCL.Neo.Core.Utils;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace PCL.Neo.Models.Minecraft.Java;
namespace PCL.Neo.Core.Models.Minecraft.Java;

/// <summary>
/// Fetches Java installations on Windows.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

namespace PCL.Neo.Models.Minecraft;
namespace PCL.Neo.Core.Models.Minecraft;

public class MetadataFile
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.IO;
using System.IO.Compression;

namespace PCL.Neo.Models.Minecraft.Mod;
namespace PCL.Neo.Core.Models.Minecraft.Mod;

public class ModPack
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace PCL.Neo.Models.Minecraft;
namespace PCL.Neo.Core.Models.Minecraft;

[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ReleaseTypeEnum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

namespace PCL.Neo.Models.Minecraft;
namespace PCL.Neo.Core.Models.Minecraft;

public class VersionManifestFile
{
Expand Down
13 changes: 13 additions & 0 deletions PCL.Neo.Core/PCL.Neo.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SevenZip" Version="19.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using PCL.Neo.Models.Minecraft.Java;
using System;
using System.IO;
using System.Runtime.InteropServices;

namespace PCL.Neo.Utils;
namespace PCL.Neo.Core.Utils;

/// <summary>
/// 描述某个 Java 环境与当前系统是否兼容
Expand Down
1 change: 0 additions & 1 deletion PCL.Neo.Tests/GlobalUsings.cs

This file was deleted.

Loading
Loading