using Knot.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace Knot.RCPatcher.Editor { [Serializable] [KnotTypeInfo("RCEdit Windows PropertyProvider")] public class KnotRcEditWindowsPropertyProvider : IKnotRcPatcherPropertyProvider { [field: SerializeField] public List Properties { get; set; } = new(); public IEnumerable> GetProperties() => Properties.Select(p => new KeyValuePair(p.Name, FormatPropertyValue(p.Value))); public virtual string FormatPropertyValue(string value) { StringBuilder sb = new StringBuilder(value); sb.Replace("", Application.version); sb.Replace("", Application.unityVersion); sb.Replace("", Application.companyName); sb.Replace("", Application.buildGUID); sb.Replace("", Application.productName); sb.Replace("", DateTime.UtcNow.Year.ToString()); return sb.ToString(); } [Serializable] public class Property { [field: SerializeField] public string Name { get; set; } [field: SerializeField] public string Value { get; set; } public Property() { } public Property(string name, string value) { Name = name; Value = value; } } } }