Ignore AIClient/Library and AIClient/HybridCLRData permanently; include HybridCLR/YooAsset project setup and UI tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace AOT.Patch
|
|
{
|
|
[Serializable]
|
|
public class VersionInfo
|
|
{
|
|
public string appVersionMin = "1.0.0";
|
|
public string appVersionMax = "1.0.0";
|
|
public string resVersion = "0";
|
|
public string cdnRoot = "https://www.xworld.ren/wechat/1.0.0";
|
|
public string[] packages = { "DefaultPackage" };
|
|
public bool forceUpdate;
|
|
public string notice = "";
|
|
|
|
public static VersionInfo FromJson(string json)
|
|
{
|
|
if (string.IsNullOrEmpty(json))
|
|
return null;
|
|
try
|
|
{
|
|
return JsonUtility.FromJson<VersionInfo>(json);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Debug.LogError($"[VersionInfo] parse failed: {e.Message}");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static int CompareVersion(string a, string b)
|
|
{
|
|
if (string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b)) return 0;
|
|
if (string.IsNullOrEmpty(a)) return -1;
|
|
if (string.IsNullOrEmpty(b)) return 1;
|
|
|
|
var pa = a.Split('.');
|
|
var pb = b.Split('.');
|
|
int n = Mathf.Max(pa.Length, pb.Length);
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
int va = i < pa.Length && int.TryParse(pa[i], out var xa) ? xa : 0;
|
|
int vb = i < pb.Length && int.TryParse(pb[i], out var xb) ? xb : 0;
|
|
if (va != vb) return va.CompareTo(vb);
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
}
|