更新最新框架
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36408.4 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBConfigBuilder", "NBConfigBuilder\NBConfigBuilder.csproj", "{A6264F0E-870D-401D-B1BF-698695AC674C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A6264F0E-870D-401D-B1BF-698695AC674C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A6264F0E-870D-401D-B1BF-698695AC674C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A6264F0E-870D-401D-B1BF-698695AC674C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A6264F0E-870D-401D-B1BF-698695AC674C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F223241C-FF74-4903-8F47-8A5A5A0FAC99}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,6 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExcelWorkbook_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F26685bcb566c4c14b12da150da20d45842b010_003F40_003Ff5039b99_003FExcelWorkbook_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonConvert_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F00b3a5efdbc34c2f9c398fe4911d40e8b09a8_003F2e_003Fa774a145_003FJsonConvert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALogManager_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc5462be99aec4b8dbd0143c73a99d4d1e0000_003F10_003Fa592ee39_003FLogManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeWindow_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F257c19112c5249f9bf699efc998471b6cef910_003F44_003Fcc810871_003FNativeWindow_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANativeWindow_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fde7e5d9f3eff8e93316bbae6f9743ff9f72884862e5d612aaaba84bf9aa3a8_003FNativeWindow_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
// 添加配置类
|
||||
public class AppConfig
|
||||
{
|
||||
public string ExcelPath { get; set; }
|
||||
public string ClientPath { get; set; }
|
||||
public string ClientJsonPath { get; set; }
|
||||
public string ServerPath { get; set; }
|
||||
public string ServerJsonPath { get; set; }
|
||||
public bool GenClient { get; set; }
|
||||
public bool GenServer { get; set; }
|
||||
|
||||
|
||||
public string ExcelVersionPath => Path.Combine(ExcelPath, "Version.txt");
|
||||
}
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static AppConfig Config;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 实现了这个接口代表支持对象池
|
||||
/// </summary>
|
||||
public interface IPool
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否从池里创建的
|
||||
/// </summary>
|
||||
bool IsPool();
|
||||
/// <summary>
|
||||
/// 设置是否从池里创建的
|
||||
/// </summary>
|
||||
/// <param name="isPool"></param>
|
||||
void SetIsPool(bool isPool);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
public partial class IntDictionaryConfig
|
||||
{
|
||||
public Dictionary<int, int> Dic;
|
||||
public int this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out int value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : 0;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System.Buffers;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
public enum MemoryStreamBufferSource
|
||||
{
|
||||
None = 0,
|
||||
Pack = 1,
|
||||
UnPack = 2,
|
||||
}
|
||||
|
||||
public sealed class MemoryStreamBuffer : MemoryStream, IBufferWriter<byte>
|
||||
{
|
||||
public MemoryStreamBufferSource MemoryStreamBufferSource;
|
||||
|
||||
public MemoryStreamBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
public MemoryStreamBuffer(MemoryStreamBufferSource memoryStreamBufferSource, int capacity) : base(capacity)
|
||||
{
|
||||
MemoryStreamBufferSource = memoryStreamBufferSource;
|
||||
}
|
||||
|
||||
public MemoryStreamBuffer(byte[] buffer) : base(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
public void Advance(int count)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(count), count, "The value of 'count' cannot be negative.");
|
||||
}
|
||||
|
||||
var newLength = Position + count;
|
||||
|
||||
if (newLength != Length)
|
||||
{
|
||||
SetLength(newLength);
|
||||
}
|
||||
|
||||
Position = newLength;
|
||||
}
|
||||
|
||||
public Memory<byte> GetMemory(int sizeHint = 0)
|
||||
{
|
||||
if (sizeHint < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(sizeHint), sizeHint,
|
||||
"The value of 'count' cannot be negative.");
|
||||
}
|
||||
|
||||
if (Length - Position <= sizeHint)
|
||||
{
|
||||
SetLength(Position + sizeHint);
|
||||
}
|
||||
|
||||
return new Memory<byte>(GetBuffer(), (int)Position, (int)(Length - Position));
|
||||
}
|
||||
|
||||
public Span<byte> GetSpan(int sizeHint = 0)
|
||||
{
|
||||
if (sizeHint < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(sizeHint), sizeHint,
|
||||
"The value of 'count' cannot be negative.");
|
||||
}
|
||||
|
||||
if (Length - Position <= sizeHint)
|
||||
{
|
||||
SetLength(Position + sizeHint);
|
||||
}
|
||||
|
||||
return new Span<byte>(GetBuffer(), (int)Position, (int)(Length - Position));
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 可回收的、一对多关系的列表池。
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">键的类型。</typeparam>
|
||||
/// <typeparam name="TValue">值的类型。</typeparam>
|
||||
public class OneToManyListPool<TKey, TValue> : OneToManyList<TKey, TValue>, IDisposable, IPool where TKey : notnull
|
||||
{
|
||||
private bool _isPool;
|
||||
private bool _isDispose;
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个 <see cref="OneToManyListPool{TKey, TValue}"/> 一对多关系的列表池的实例。
|
||||
/// </summary>
|
||||
/// <returns>创建的实例。</returns>
|
||||
public static OneToManyListPool<TKey, TValue> Create()
|
||||
{
|
||||
var list = Pool<OneToManyListPool<TKey, TValue>>.Rent();
|
||||
list._isDispose = false;
|
||||
list._isPool = true;
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 释放当前对象所占用的资源,并将对象回收到对象池中。
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDispose)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isDispose = true;
|
||||
Clear();
|
||||
Pool<OneToManyListPool<TKey, TValue>>.Return(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个值,该值指示当前实例是否为对象池中的实例。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsPool()
|
||||
{
|
||||
return _isPool;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置一个值,该值指示当前实例是否为对象池中的实例。
|
||||
/// </summary>
|
||||
/// <param name="isPool"></param>
|
||||
public void SetIsPool(bool isPool)
|
||||
{
|
||||
_isPool = isPool;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 一对多关系的列表字典。
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">键的类型。</typeparam>
|
||||
/// <typeparam name="TValue">值的类型。</typeparam>
|
||||
public class OneToManyList<TKey, TValue> : Dictionary<TKey, List<TValue>> where TKey : notnull
|
||||
{
|
||||
private readonly int _recyclingLimit = 120;
|
||||
private static readonly List<TValue> Empty = new List<TValue>();
|
||||
private readonly Queue<List<TValue>> _queue = new Queue<List<TValue>>();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个新的 <see cref="OneToManyList{TKey, TValue}"/> 实例。
|
||||
/// </summary>
|
||||
public OneToManyList()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置最大缓存数量
|
||||
/// </summary>
|
||||
/// <param name="recyclingLimit">
|
||||
/// 1:防止数据量过大、所以超过recyclingLimit的数据还是走GC.
|
||||
/// 2:设置成0不控制数量,全部缓存
|
||||
/// </param>
|
||||
public OneToManyList(int recyclingLimit)
|
||||
{
|
||||
_recyclingLimit = recyclingLimit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断给定的键和值是否存在于列表中。
|
||||
/// </summary>
|
||||
/// <param name="key">要搜索的键。</param>
|
||||
/// <param name="value">要搜索的值。</param>
|
||||
/// <returns>如果存在则为 <see langword="true"/>,否则为 <see langword="false"/>。</returns>
|
||||
public bool Contains(TKey key, TValue value)
|
||||
{
|
||||
TryGetValue(key, out var list);
|
||||
|
||||
return list != null && list.Contains(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向列表中添加指定键和值。
|
||||
/// </summary>
|
||||
/// <param name="key">要添加值的键。</param>
|
||||
/// <param name="value">要添加的值。</param>
|
||||
public void Add(TKey key, TValue value)
|
||||
{
|
||||
if (!TryGetValue(key, out var list))
|
||||
{
|
||||
list = Fetch();
|
||||
list.Add(value);
|
||||
Add(key, list);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
list.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定键对应的列表中的第一个值。
|
||||
/// </summary>
|
||||
/// <param name="key">要获取值的键。</param>
|
||||
/// <returns>键对应的列表中的第一个值。</returns>
|
||||
public TValue First(TKey key)
|
||||
{
|
||||
return !TryGetValue(key, out var list) ? default : list.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从列表中移除指定键和值。
|
||||
/// </summary>
|
||||
/// <param name="key">要移除值的键。</param>
|
||||
/// <param name="value">要移除的值。</param>
|
||||
/// <returns>如果成功移除则为 <see langword="true"/>,否则为 <see langword="false"/>。</returns>
|
||||
public bool RemoveValue(TKey key, TValue value)
|
||||
{
|
||||
if (!TryGetValue(key, out var list))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var isRemove = list.Remove(value);
|
||||
|
||||
if (list.Count == 0)
|
||||
{
|
||||
isRemove = RemoveByKey(key);
|
||||
}
|
||||
|
||||
return isRemove;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从列表中移除指定键及其关联的所有值。
|
||||
/// </summary>
|
||||
/// <param name="key">要移除的键。</param>
|
||||
/// <returns>如果成功移除则为 <see langword="true"/>,否则为 <see langword="false"/>。</returns>
|
||||
public bool RemoveByKey(TKey key)
|
||||
{
|
||||
if (!TryGetValue(key, out var list))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Remove(key);
|
||||
Recycle(list);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定键关联的所有值的列表。
|
||||
/// </summary>
|
||||
/// <param name="key">要获取值的键。</param>
|
||||
/// <returns>键关联的所有值的列表。</returns>
|
||||
public List<TValue> GetValues(TKey key)
|
||||
{
|
||||
if (TryGetValue(key, out List<TValue> list))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除字典中的所有键值对,并回收相关的值集合。
|
||||
/// </summary>
|
||||
public new void Clear()
|
||||
{
|
||||
foreach (var keyValuePair in this) Recycle(keyValuePair.Value);
|
||||
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从空闲值集合队列中获取一个值集合,如果队列为空则创建一个新的值集合。
|
||||
/// </summary>
|
||||
/// <returns>从队列中获取的值集合。</returns>
|
||||
private List<TValue> Fetch()
|
||||
{
|
||||
return _queue.Count <= 0 ? new List<TValue>() : _queue.Dequeue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回收一个不再使用的值集合到空闲值集合队列中。
|
||||
/// </summary>
|
||||
/// <param name="list">要回收的值集合。</param>
|
||||
private void Recycle(List<TValue> list)
|
||||
{
|
||||
list.Clear();
|
||||
|
||||
if (_recyclingLimit != 0 && _queue.Count > _recyclingLimit) return;
|
||||
|
||||
_queue.Enqueue(list);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 静态的对象池系统,不支持多线程。
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static class Pool<T> where T : IPool, new()
|
||||
{
|
||||
private static readonly Queue<T> PoolQueue = new Queue<T>();
|
||||
|
||||
/// <summary>
|
||||
/// 池子里可用的数量
|
||||
/// </summary>
|
||||
public static int Count => PoolQueue.Count;
|
||||
|
||||
/// <summary>
|
||||
/// 租借
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static T Rent()
|
||||
{
|
||||
return PoolQueue.Count == 0 ? new T() : PoolQueue.Dequeue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 租借
|
||||
/// </summary>
|
||||
/// <param name="generator">如果池子里没有,会先执行这个委托。</param>
|
||||
/// <returns></returns>
|
||||
public static T Rent(Func<T> generator)
|
||||
{
|
||||
return PoolQueue.Count == 0 ? generator() : PoolQueue.Dequeue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返还
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
public static void Return(T t)
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PoolQueue.Enqueue(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返还
|
||||
/// </summary>
|
||||
/// <param name="t">返还的东西</param>
|
||||
/// <param name="reset">返还后执行的委托</param>
|
||||
public static void Return(T t, Action<T> reset)
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reset(t);
|
||||
PoolQueue.Enqueue(t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空池子
|
||||
/// </summary>
|
||||
public static void Clear()
|
||||
{
|
||||
PoolQueue.Clear();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Fantasy.Serialize;
|
||||
|
||||
public abstract class ASerialize : ISupportInitialize, IDisposable
|
||||
{
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void BeginInit()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void EndInit()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void AfterDeserialization() => EndInit();
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
public sealed partial class StringDictionaryConfig
|
||||
{
|
||||
public Dictionary<int, string> Dic;
|
||||
public string this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out string value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private string GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : null;
|
||||
}
|
||||
}
|
||||
@@ -1,750 +0,0 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml;
|
||||
using static System.String;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
using TableDictionary = SortedDictionary<string, List<int>>;
|
||||
|
||||
/// <summary>
|
||||
/// Excel 数据导出器,用于从 Excel 文件导出数据到二进制格式和生成 C# 类文件。
|
||||
/// </summary>
|
||||
public sealed class ExcelExporter
|
||||
{
|
||||
public ExportType ExportType;
|
||||
private readonly string _excelProgramPath;
|
||||
private readonly string _versionFilePath;
|
||||
|
||||
// public VersionInfo VersionInfo; // 存储 Excel 文件的版本信息。
|
||||
private readonly Regex _regexName = new Regex("^[a-zA-Z][a-zA-Z0-9_]*$"); // 用于验证 Excel 表名的正则表达式。
|
||||
private readonly HashSet<string> _loadFiles = [".xlsx", ".xlsm", ".csv"]; // 加载的支持文件扩展名。
|
||||
|
||||
private readonly ConcurrentDictionary<string, ExcelTable> _excelTables =
|
||||
new ConcurrentDictionary<string, ExcelTable>(); // 存储解析后的 Excel 表。
|
||||
|
||||
/// <summary>
|
||||
/// 导表支持的数据类型集合。
|
||||
/// </summary>
|
||||
public static readonly HashSet<string> ColTypeSet =
|
||||
[
|
||||
"", "0", "bool", "byte", "short", "ushort", "int", "uint", "long", "ulong", "float", "string",
|
||||
"IntDictionaryConfig", "StringDictionaryConfig",
|
||||
"short[]", "int[]", "long[]", "float[]", "string[]", "uint[]"
|
||||
];
|
||||
|
||||
// 进度报告回调
|
||||
private Action<string> _progressCallback;
|
||||
|
||||
static ExcelExporter()
|
||||
{
|
||||
ExcelPackage.License.SetNonCommercialOrganization("Fantasy");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据指定的 exportType 初始化 ExcelExporter 类的新实例。
|
||||
/// </summary>
|
||||
/// <param name="exportType">要执行的导出类型(AllExcel 或 AllExcelIncrement)。</param>
|
||||
public ExcelExporter(ExportType exportType)
|
||||
{
|
||||
ExportType = exportType;
|
||||
|
||||
if (App.Config.ExcelVersionPath == null || App.Config.ExcelVersionPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelVersionFile Can not be empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (App.Config.ExcelPath == null || App.Config.ExcelPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelProgramPath Can not be empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
_excelProgramPath = FileHelper.GetFullPath(App.Config.ExcelPath);
|
||||
_versionFilePath = FileHelper.GetFullPath(App.Config.ExcelVersionPath);
|
||||
|
||||
if (App.Config.GenClient)
|
||||
{
|
||||
if (App.Config.ClientJsonPath == null ||
|
||||
App.Config.ClientJsonPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelClientJsonDirectory Can not be empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (App.Config.ClientPath == null ||
|
||||
App.Config.ClientPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelServerFileDirectory Can not be empty!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (App.Config.GenServer)
|
||||
{
|
||||
if (App.Config.ServerPath == null ||
|
||||
App.Config.ServerPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelServerFileDirectory Can not be empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (App.Config.ServerJsonPath == null ||
|
||||
App.Config.ServerJsonPath.Trim() == "")
|
||||
{
|
||||
Log.Info($"ExcelServerJsonDirectory Can not be empty!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (ExportType)
|
||||
{
|
||||
case ExportType.AllExcelIncrement:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ExportType.AllExcel:
|
||||
{
|
||||
if (File.Exists(_versionFilePath))
|
||||
{
|
||||
File.Delete(_versionFilePath);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置进度报告回调
|
||||
/// </summary>
|
||||
/// <param name="callback">进度报告回调函数</param>
|
||||
public void SetProgressCallback(Action<string> callback)
|
||||
{
|
||||
_progressCallback = callback;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
ReportProgress("正在查找配置文件...");
|
||||
Find();
|
||||
ReportProgress("正在解析配置表...");
|
||||
Parsing();
|
||||
ReportProgress("正在导出JSON数据...");
|
||||
ExportToJson();
|
||||
ReportProgress("导出完成");
|
||||
}
|
||||
|
||||
private void ReportProgress(string message)
|
||||
{
|
||||
_progressCallback?.Invoke(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找配置文件
|
||||
/// </summary>
|
||||
private void Find()
|
||||
{
|
||||
var dir = new DirectoryInfo(_excelProgramPath);
|
||||
var excelFiles = dir.GetFiles("*", SearchOption.AllDirectories);
|
||||
|
||||
if (excelFiles.Length <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var tables = new List<FileInfo>();
|
||||
|
||||
// var tables = new OneToManyList<string, ExportInfo>();
|
||||
foreach (var excelFile in excelFiles)
|
||||
{
|
||||
// 过滤掉非指定后缀的文件
|
||||
|
||||
if (!_loadFiles.Contains(excelFile.Extension))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var lastIndexOf = excelFile.Name.LastIndexOf(".", StringComparison.Ordinal);
|
||||
|
||||
if (lastIndexOf < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var fullName = excelFile.FullName;
|
||||
var excelName = excelFile.Name.Substring(0, lastIndexOf);
|
||||
var path = fullName.Substring(0, fullName.Length - excelFile.Name.Length);
|
||||
|
||||
// 过滤~开头文件
|
||||
|
||||
if (excelName.StartsWith("~", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果文件名以#开头,那么这个文件夹下的所有文件都不导出
|
||||
if (excelName.StartsWith("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果文件夹名包含#,那么这个文件夹下的所有文件都不导出
|
||||
if (path.Contains("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_regexName.IsMatch(excelName))
|
||||
{
|
||||
Log.Info($"{excelName} 配置文件名非法");
|
||||
continue;
|
||||
}
|
||||
|
||||
tables.Add(excelFile);
|
||||
}
|
||||
|
||||
|
||||
var generateTasks = new List<Task>();
|
||||
|
||||
foreach (var table in tables)
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
var worksheets = LoadExcel(table.FullName);
|
||||
foreach (var worksheet in worksheets)
|
||||
{
|
||||
var tableName = worksheet.Name;
|
||||
if (tableName.Contains("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ReportProgress($"正在解析配置表: {table.Name} Sheet:{tableName}");
|
||||
var excelTable = new ExcelTable(worksheet);
|
||||
try
|
||||
{
|
||||
var serverColInfoList = new List<int>();
|
||||
var clientColInfoList = new List<int>();
|
||||
|
||||
for (var col = 3; col <= worksheet.Columns.EndColumn; col++)
|
||||
{
|
||||
// 列名字第一个字符是#不参与导出
|
||||
|
||||
var colName = worksheet.GetCellValue(5, col);
|
||||
if (colName.StartsWith("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 数值列不参与导出
|
||||
|
||||
var numericalCol = worksheet.GetCellValue(3, col);
|
||||
if (numericalCol != "" && numericalCol != "0")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var serverType = worksheet.GetCellValue(1, col);
|
||||
var clientType = worksheet.GetCellValue(2, col);
|
||||
var isExportServer = !IsNullOrEmpty(serverType) && serverType != "0";
|
||||
var isExportClient = !IsNullOrEmpty(clientType) && clientType != "0";
|
||||
|
||||
if (!isExportServer && !isExportClient)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isExportServer && isExportClient & serverType != clientType)
|
||||
{
|
||||
Log.Info(
|
||||
$"配置表 {tableName} {col} 列 [{colName}] 客户端类型 {clientType} 和 服务端类型 {serverType} 不一致");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ColTypeSet.Contains(serverType) || !ColTypeSet.Contains(clientType))
|
||||
{
|
||||
Log.Info(
|
||||
$"配置表 {tableName} {col} 列 [{colName}] 客户端类型 {clientType}, 服务端类型 {serverType} 不合法");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_regexName.IsMatch(colName))
|
||||
{
|
||||
Log.Info($"配置表 {tableName} {col} 列 [{colName}] 列名非法");
|
||||
continue;
|
||||
}
|
||||
|
||||
serverColInfoList.Add(col);
|
||||
|
||||
if (isExportClient)
|
||||
{
|
||||
clientColInfoList.Add(col);
|
||||
}
|
||||
}
|
||||
|
||||
if (clientColInfoList.Count > 0)
|
||||
{
|
||||
excelTable.ClientColInfos.Add(tableName, clientColInfoList);
|
||||
}
|
||||
|
||||
if (serverColInfoList.Count > 0)
|
||||
{
|
||||
excelTable.ServerColInfos.Add(tableName, serverColInfoList);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error($"Config : {tableName}, Name : {tableName}, Error : {e}");
|
||||
}
|
||||
|
||||
_excelTables.TryAdd(tableName, excelTable);
|
||||
}
|
||||
});
|
||||
|
||||
generateTasks.Add(task);
|
||||
}
|
||||
|
||||
Task.WaitAll(generateTasks.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成配置文件
|
||||
/// </summary>
|
||||
private void Parsing()
|
||||
{
|
||||
var generateTasks = new List<Task>();
|
||||
|
||||
foreach ((var tableName, ExcelTable excelTable) in _excelTables)
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
// 生成cs文件
|
||||
var writeToClassTask = new List<Task>();
|
||||
|
||||
var table = excelTable;
|
||||
if (App.Config.GenServer)
|
||||
{
|
||||
writeToClassTask.Add(Task.Run(() =>
|
||||
{
|
||||
ReportProgress($"正在生成服务端CS文件: {tableName}");
|
||||
WriteToClass(table, true);
|
||||
}));
|
||||
}
|
||||
|
||||
if (App.Config.GenClient)
|
||||
{
|
||||
writeToClassTask.Add(Task.Run(() =>
|
||||
{
|
||||
ReportProgress($"正在生成客户端CS文件: {tableName}");
|
||||
WriteToClass(table, false);
|
||||
}));
|
||||
}
|
||||
|
||||
Task.WaitAll(writeToClassTask.ToArray());
|
||||
});
|
||||
|
||||
generateTasks.Add(task);
|
||||
}
|
||||
|
||||
Task.WaitAll(generateTasks.ToArray());
|
||||
Console.WriteLine("build cs success===");
|
||||
}
|
||||
|
||||
#region json
|
||||
|
||||
private Dictionary<string, List<Dictionary<string, object>>> _clientTableJsonDictionary =
|
||||
new Dictionary<string, List<Dictionary<string, object>>>();
|
||||
|
||||
private Dictionary<string, List<Dictionary<string, object>>> _serverTableJsonDictionary =
|
||||
new Dictionary<string, List<Dictionary<string, object>>>();
|
||||
|
||||
/// <summary>
|
||||
/// 把数据生成json
|
||||
/// </summary>
|
||||
private void ExportToJson()
|
||||
{
|
||||
_clientTableJsonDictionary.Clear();
|
||||
_serverTableJsonDictionary.Clear();
|
||||
foreach (var (tableName, excelTable) in _excelTables)
|
||||
{
|
||||
// 示例:客户端JSON导出
|
||||
if (App.Config.GenClient && excelTable.ClientColInfos.Count > 0)
|
||||
{
|
||||
ReportProgress($"正在生成客户端JSON文件: {tableName}");
|
||||
ExportTableToJson(excelTable, excelTable.ClientColInfos, _clientTableJsonDictionary);
|
||||
}
|
||||
|
||||
// 示例:服务端JSON导出
|
||||
if (App.Config.GenServer && excelTable.ServerColInfos.Count > 0)
|
||||
{
|
||||
ReportProgress($"正在生成服务端JSON文件: {tableName}");
|
||||
ExportTableToJson(excelTable, excelTable.ServerColInfos, _serverTableJsonDictionary);
|
||||
}
|
||||
}
|
||||
|
||||
if (_clientTableJsonDictionary.Count > 0)
|
||||
{
|
||||
ReportProgress("正在写入客户端JSON文件: configs.json");
|
||||
var json = JsonConvert.SerializeObject(_clientTableJsonDictionary, Formatting.Indented);
|
||||
File.WriteAllText(Path.Combine(App.Config.ClientJsonPath, $"configs.json"), json);
|
||||
}
|
||||
|
||||
if (_serverTableJsonDictionary.Count > 0)
|
||||
{
|
||||
ReportProgress("正在写入服务端JSON文件: configs.json");
|
||||
var json = JsonConvert.SerializeObject(_serverTableJsonDictionary, Formatting.Indented);
|
||||
File.WriteAllText(Path.Combine(App.Config.ServerJsonPath, $"configs.json"), json);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportTableToJson(ExcelTable table, TableDictionary colInfos,
|
||||
Dictionary<string, List<Dictionary<string, object>>> dictionary)
|
||||
{
|
||||
var result = new List<Dictionary<string, object>>();
|
||||
|
||||
var worksheet = table.Sheet;
|
||||
foreach (var (fileName, columns) in colInfos)
|
||||
{
|
||||
// 从第7行开始读取数据(前6行为表头)
|
||||
for (int row = 7; row <= worksheet.Rows.EndRow; row++)
|
||||
{
|
||||
// 检查是否为空行
|
||||
bool isEmptyRow = true;
|
||||
foreach (var col in columns)
|
||||
{
|
||||
var cellValue = worksheet.GetCellValue(row, col);
|
||||
if (!IsNullOrEmpty(cellValue))
|
||||
{
|
||||
isEmptyRow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果整行都为空,则停止处理
|
||||
if (isEmptyRow)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var rowData = new Dictionary<string, object>();
|
||||
|
||||
foreach (var col in columns)
|
||||
{
|
||||
var columnName = worksheet.GetCellValue(5, col);
|
||||
var cellValue = worksheet.GetCellValue(row, col);
|
||||
// 可在此处做类型转换
|
||||
var columnType = GetColumnType(worksheet, col); // 需要实现获取列类型的方法
|
||||
rowData[columnName] = ConvertCellValue(cellValue, columnType);
|
||||
}
|
||||
|
||||
result.Add(rowData);
|
||||
}
|
||||
}
|
||||
|
||||
dictionary[table.Name] = result;
|
||||
}
|
||||
|
||||
private string GetColumnType(ExcelWorksheet worksheet, int column)
|
||||
{
|
||||
var serverType = worksheet.GetCellValue(1, column);
|
||||
var clientType = worksheet.GetCellValue(2, column);
|
||||
|
||||
// 根据实际情况确定使用哪个类型,这里简化处理
|
||||
return !string.IsNullOrEmpty(serverType) && serverType != "0" ? serverType : clientType;
|
||||
}
|
||||
|
||||
private object ConvertCellValue(string cellValue, string targetType)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cellValue))
|
||||
{
|
||||
// 返回默认值
|
||||
if (targetType.EndsWith("[]"))
|
||||
{
|
||||
var elementType = targetType.Substring(0, targetType.Length - 2);
|
||||
return Array.CreateInstance(Type.GetType(elementType) ?? typeof(object), 0);
|
||||
}
|
||||
|
||||
return GetDefaultValue(targetType);
|
||||
}
|
||||
|
||||
// 处理数组类型
|
||||
if (targetType.EndsWith("[]"))
|
||||
{
|
||||
var elementType = targetType.Substring(0, targetType.Length - 2);
|
||||
var values = cellValue.Split(',');
|
||||
|
||||
switch (elementType)
|
||||
{
|
||||
case "short":
|
||||
return values.Select(v =>
|
||||
{
|
||||
short result;
|
||||
return short.TryParse(v, out result) ? result : (short)0;
|
||||
}).ToArray();
|
||||
|
||||
case "ushort":
|
||||
return values.Select(v =>
|
||||
{
|
||||
ushort result;
|
||||
return ushort.TryParse(v, out result) ? result : (ushort)0;
|
||||
}).ToArray();
|
||||
|
||||
case "int":
|
||||
return values.Select(v =>
|
||||
{
|
||||
int result;
|
||||
return int.TryParse(v, out result) ? result : 0;
|
||||
}).ToArray();
|
||||
|
||||
case "uint":
|
||||
return values.Select(v =>
|
||||
{
|
||||
uint result;
|
||||
return uint.TryParse(v, out result) ? result : 0u;
|
||||
}).ToArray();
|
||||
|
||||
case "long":
|
||||
return values.Select(v =>
|
||||
{
|
||||
long result;
|
||||
return long.TryParse(v, out result) ? result : 0L;
|
||||
}).ToArray();
|
||||
|
||||
case "ulong":
|
||||
return values.Select(v =>
|
||||
{
|
||||
ulong result;
|
||||
return ulong.TryParse(v, out result) ? result : 0UL;
|
||||
}).ToArray();
|
||||
|
||||
case "bool":
|
||||
return values.Select(v =>
|
||||
{
|
||||
bool result;
|
||||
return bool.TryParse(v, out result) ? result : false;
|
||||
}).ToArray();
|
||||
|
||||
case "string":
|
||||
return values.Select(v => v.Trim()).ToArray();
|
||||
|
||||
default:
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理单个值
|
||||
switch (targetType)
|
||||
{
|
||||
case "short":
|
||||
short shortResult;
|
||||
return short.TryParse(cellValue, out shortResult) ? shortResult : (short)0;
|
||||
|
||||
case "ushort":
|
||||
ushort ushortResult;
|
||||
return ushort.TryParse(cellValue, out ushortResult) ? ushortResult : (ushort)0;
|
||||
|
||||
case "int":
|
||||
int intResult;
|
||||
return int.TryParse(cellValue, out intResult) ? intResult : 0;
|
||||
|
||||
case "uint":
|
||||
uint uintResult;
|
||||
return uint.TryParse(cellValue, out uintResult) ? uintResult : 0u;
|
||||
|
||||
case "long":
|
||||
long longResult;
|
||||
return long.TryParse(cellValue, out longResult) ? longResult : 0L;
|
||||
|
||||
case "ulong":
|
||||
ulong ulongResult;
|
||||
return ulong.TryParse(cellValue, out ulongResult) ? ulongResult : 0UL;
|
||||
|
||||
case "bool":
|
||||
bool boolResult;
|
||||
if (bool.TryParse(cellValue, out boolResult))
|
||||
{
|
||||
return boolResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
int numericBool;
|
||||
return int.TryParse(cellValue, out numericBool) ? numericBool != 0 : false;
|
||||
}
|
||||
|
||||
case "string":
|
||||
return cellValue;
|
||||
|
||||
default:
|
||||
return cellValue;
|
||||
}
|
||||
}
|
||||
|
||||
private object GetDefaultValue(string type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "short": return (short)0;
|
||||
case "ushort": return (ushort)0;
|
||||
case "int": return 0;
|
||||
case "uint": return 0u;
|
||||
case "long": return 0L;
|
||||
case "ulong": return 0UL;
|
||||
case "bool": return false;
|
||||
case "string": return "";
|
||||
case "short[]": return new short[0];
|
||||
case "ushort[]": return new ushort[0];
|
||||
case "int[]": return new int[0];
|
||||
case "uint[]": return new uint[0];
|
||||
case "long[]": return new long[0];
|
||||
case "ulong[]": return new ulong[0];
|
||||
case "bool[]": return new bool[0];
|
||||
case "string[]": return new string[0];
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 从 Excel 文件加载工作表并返回 ExcelWorksheet 对象。
|
||||
/// </summary>
|
||||
/// <param name="name">工作表的名称或文件路径。</param>
|
||||
/// <returns>表示 Excel 工作表的 ExcelWorksheet 对象。</returns>
|
||||
public List<ExcelWorksheet> LoadExcel(string name)
|
||||
{
|
||||
var workbookWorksheets = ExcelHelper.LoadExcel(name).Workbook.Worksheets;
|
||||
return workbookWorksheets.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入到cs
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="isServer"></param>
|
||||
private void WriteToClass(ExcelTable table, bool isServer)
|
||||
{
|
||||
var colInfos = isServer ? table.ServerColInfos : table.ClientColInfos;
|
||||
var exportPath = isServer ? App.Config.ServerPath : App.Config.ClientPath;
|
||||
|
||||
if (colInfos.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var excelWorksheet = table.Sheet;
|
||||
|
||||
var index = 0;
|
||||
var fileBuilder = new StringBuilder();
|
||||
var colNameSet = new HashSet<string>();
|
||||
|
||||
if (colInfos.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var csName = Path.GetFileNameWithoutExtension(colInfos.First().Key)?.Split('_')[0];
|
||||
|
||||
foreach (var (tableName, cols) in colInfos)
|
||||
{
|
||||
if (cols == null || cols.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
foreach (var colIndex in cols)
|
||||
{
|
||||
var colName = excelWorksheet.GetCellValue(5, colIndex);
|
||||
|
||||
if (!colNameSet.Add(colName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string colType;
|
||||
|
||||
if (isServer)
|
||||
{
|
||||
colType = excelWorksheet.GetCellValue(1, colIndex);
|
||||
|
||||
if (IsNullOrEmpty(colType) || colType == "0")
|
||||
{
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
|
||||
var remarks = excelWorksheet.GetCellValue(4, colIndex);
|
||||
|
||||
// 解决不同平台换行符不一致的问题
|
||||
|
||||
switch (Environment.OSVersion.Platform)
|
||||
{
|
||||
case PlatformID.Win32NT:
|
||||
case PlatformID.Win32S:
|
||||
case PlatformID.Win32Windows:
|
||||
case PlatformID.WinCE:
|
||||
{
|
||||
fileBuilder.Append($"\r\n\t\t[ProtoMember({++index})]\r\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
fileBuilder.Append($"\n\t\t[ProtoMember({++index})]\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fileBuilder.Append(
|
||||
IsArray(colType, out var t)
|
||||
? $"\t\tpublic {colType} {colName} {{ get; set; }} = Array.Empty<{t}>(); // {remarks}"
|
||||
: $"\t\tpublic {colType} {colName} {{ get; set; }} // {remarks}");
|
||||
}
|
||||
}
|
||||
|
||||
var template = GetTemplate(isServer);
|
||||
|
||||
if (fileBuilder.Length > 0)
|
||||
{
|
||||
if (!Directory.Exists(exportPath))
|
||||
{
|
||||
FileHelper.CreateDirectory(exportPath);
|
||||
}
|
||||
|
||||
var content = template.Replace("(ConfigName)", csName)
|
||||
.Replace("(Fields)", fileBuilder.ToString());
|
||||
File.WriteAllText(Path.Combine(exportPath, $"{csName}.cs"), content);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsArray(string type, out string t)
|
||||
{
|
||||
t = null;
|
||||
var index = type.IndexOf("[]", StringComparison.Ordinal);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
t = type.Remove(index, 2);
|
||||
}
|
||||
|
||||
return index >= 0;
|
||||
}
|
||||
|
||||
private string GetTemplate(bool isServer)
|
||||
{
|
||||
var fileName = isServer ? "TemplateServer.txt" : "TemplateClient.txt";
|
||||
return File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName));
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 提供操作 Excel 文件的辅助方法。
|
||||
/// </summary>
|
||||
public static class ExcelHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载 Excel 文件并返回 ExcelPackage 实例。
|
||||
/// </summary>
|
||||
/// <param name="name">Excel 文件的路径。</param>
|
||||
/// <returns>ExcelPackage 实例。</returns>
|
||||
public static ExcelPackage LoadExcel(string name)
|
||||
{
|
||||
return new ExcelPackage(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定工作表中指定行列位置的单元格值。
|
||||
/// </summary>
|
||||
/// <param name="sheet">Excel 工作表。</param>
|
||||
/// <param name="row">行索引。</param>
|
||||
/// <param name="column">列索引。</param>
|
||||
/// <returns>单元格值。</returns>
|
||||
public static string GetCellValue(this ExcelWorksheet sheet, int row, int column)
|
||||
{
|
||||
ExcelRange cell = sheet.Cells[row, column];
|
||||
|
||||
try
|
||||
{
|
||||
if (cell.Value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string s = cell.GetValue<string>();
|
||||
|
||||
return s.Trim();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception($"Rows {row} Columns {column} Content {cell.Text} {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// Excel表格类,用于存储表格的名称和列信息。
|
||||
/// </summary>
|
||||
public sealed class ExcelTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 表格的名称。
|
||||
/// </summary>
|
||||
public readonly string Name;
|
||||
|
||||
/// <summary>
|
||||
/// 客户端列信息,使用排序字典存储列名和列索引列表。
|
||||
/// </summary>
|
||||
public readonly SortedDictionary<string, List<int>> ClientColInfos = new();
|
||||
|
||||
/// <summary>
|
||||
/// 服务器端列信息,使用排序字典存储列名和列索引列表。
|
||||
/// </summary>
|
||||
public readonly SortedDictionary<string, List<int>> ServerColInfos = new();
|
||||
|
||||
/// <summary>
|
||||
/// 表数据
|
||||
/// </summary>
|
||||
public readonly ExcelWorksheet Sheet;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数,初始化Excel表格对象并设置表格名称。
|
||||
/// </summary>
|
||||
/// <param name="sheet">表格。</param>
|
||||
public ExcelTable(ExcelWorksheet sheet)
|
||||
{
|
||||
Name = sheet.Name;
|
||||
Sheet = sheet;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// using OfficeOpenXml;
|
||||
//
|
||||
// namespace NBConfigBuilder;
|
||||
//
|
||||
// public sealed class ExcelWorksheets(ExcelExporter excelExporter)
|
||||
// {
|
||||
// public bool TryGetValue(string worksheetName, out ExcelWorksheet excelWorksheet)
|
||||
// {
|
||||
// if (excelExporter.Worksheets.TryGetValue(worksheetName, out excelWorksheet))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// var computeHash64 = HashCodeHelper.ComputeHash64(worksheetName);
|
||||
// if (!excelExporter.VersionInfo.WorksheetNames.Contains(computeHash64))
|
||||
// {
|
||||
// Log.Info($"{worksheetName} is not exist!");
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 导出类型枚举,用于标识不同类型的导出操作。
|
||||
/// </summary>
|
||||
public enum ExportType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无导出类型。
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// 所有数据的增量导出Excel类型。
|
||||
/// </summary>
|
||||
AllExcelIncrement = 1,
|
||||
/// <summary>
|
||||
/// 所有数据的全量导出Excel类型。
|
||||
/// </summary>
|
||||
AllExcel = 2,
|
||||
/// <summary>
|
||||
/// 导出类型枚举的最大值,一定要放在最后。
|
||||
/// </summary>
|
||||
Max,
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
public class VersionInfo
|
||||
{
|
||||
public SortedSet<long> WorksheetNames = [];
|
||||
public SortedDictionary<long, long> Tables = new();
|
||||
}
|
||||
266
Tools/ConfigBuilder/NBConfigBuilder/Form1.Designer.cs
generated
266
Tools/ConfigBuilder/NBConfigBuilder/Form1.Designer.cs
generated
@@ -1,266 +0,0 @@
|
||||
namespace NBConfigBuilder
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
textBoxExcelPath = new TextBox();
|
||||
buttonSelectExcelPath = new Button();
|
||||
label1 = new Label();
|
||||
textBoxClientGenPath = new TextBox();
|
||||
buttonSelectClientPath = new Button();
|
||||
checkBoxGenClient = new CheckBox();
|
||||
label2 = new Label();
|
||||
textBoxServerGenPath = new TextBox();
|
||||
label3 = new Label();
|
||||
checkBoxGenServer = new CheckBox();
|
||||
buttonSelectServerPath = new Button();
|
||||
buttonRun = new Button();
|
||||
textBoxClientGenJsonPath = new TextBox();
|
||||
label4 = new Label();
|
||||
buttonSelectClientJsonPath = new Button();
|
||||
textBoxServerGenJsonPath = new TextBox();
|
||||
label5 = new Label();
|
||||
buttonSelectServerJsonPath = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBoxExcelPath
|
||||
//
|
||||
textBoxExcelPath.Location = new Point(81, 13);
|
||||
textBoxExcelPath.Name = "textBoxExcelPath";
|
||||
textBoxExcelPath.Size = new Size(325, 23);
|
||||
textBoxExcelPath.TabIndex = 0;
|
||||
//
|
||||
// buttonSelectExcelPath
|
||||
//
|
||||
buttonSelectExcelPath.Location = new Point(412, 13);
|
||||
buttonSelectExcelPath.Name = "buttonSelectExcelPath";
|
||||
buttonSelectExcelPath.Size = new Size(84, 23);
|
||||
buttonSelectExcelPath.TabIndex = 1;
|
||||
buttonSelectExcelPath.Text = "选择";
|
||||
buttonSelectExcelPath.UseVisualStyleBackColor = true;
|
||||
buttonSelectExcelPath.Click += buttonSelectExcelPath_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(7, 17);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(68, 17);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "配置表路径";
|
||||
//
|
||||
// textBoxClientGenPath
|
||||
//
|
||||
textBoxClientGenPath.Location = new Point(81, 42);
|
||||
textBoxClientGenPath.Name = "textBoxClientGenPath";
|
||||
textBoxClientGenPath.Size = new Size(325, 23);
|
||||
textBoxClientGenPath.TabIndex = 3;
|
||||
//
|
||||
// buttonSelectClientPath
|
||||
//
|
||||
buttonSelectClientPath.Location = new Point(412, 42);
|
||||
buttonSelectClientPath.Name = "buttonSelectClientPath";
|
||||
buttonSelectClientPath.Size = new Size(84, 23);
|
||||
buttonSelectClientPath.TabIndex = 4;
|
||||
buttonSelectClientPath.Text = "选择";
|
||||
buttonSelectClientPath.UseVisualStyleBackColor = true;
|
||||
buttonSelectClientPath.Click += buttonSelectClientPath_Click;
|
||||
//
|
||||
// checkBoxGenClient
|
||||
//
|
||||
checkBoxGenClient.AutoSize = true;
|
||||
checkBoxGenClient.Checked = true;
|
||||
checkBoxGenClient.CheckState = CheckState.Checked;
|
||||
checkBoxGenClient.Location = new Point(504, 13);
|
||||
checkBoxGenClient.Name = "checkBoxGenClient";
|
||||
checkBoxGenClient.Size = new Size(87, 21);
|
||||
checkBoxGenClient.TabIndex = 5;
|
||||
checkBoxGenClient.Text = "生成客户端";
|
||||
checkBoxGenClient.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(7, 47);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(68, 17);
|
||||
label2.TabIndex = 6;
|
||||
label2.Text = "客户端代码";
|
||||
//
|
||||
// textBoxServerGenPath
|
||||
//
|
||||
textBoxServerGenPath.Location = new Point(81, 100);
|
||||
textBoxServerGenPath.Name = "textBoxServerGenPath";
|
||||
textBoxServerGenPath.Size = new Size(325, 23);
|
||||
textBoxServerGenPath.TabIndex = 7;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(7, 103);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(68, 17);
|
||||
label3.TabIndex = 8;
|
||||
label3.Text = "服务端代码";
|
||||
//
|
||||
// checkBoxGenServer
|
||||
//
|
||||
checkBoxGenServer.AutoSize = true;
|
||||
checkBoxGenServer.Checked = true;
|
||||
checkBoxGenServer.CheckState = CheckState.Checked;
|
||||
checkBoxGenServer.Location = new Point(504, 42);
|
||||
checkBoxGenServer.Name = "checkBoxGenServer";
|
||||
checkBoxGenServer.Size = new Size(87, 21);
|
||||
checkBoxGenServer.TabIndex = 9;
|
||||
checkBoxGenServer.Text = "生成服务端";
|
||||
checkBoxGenServer.UseVisualStyleBackColor = true;
|
||||
checkBoxGenServer.CheckedChanged += checkBoxGenServer_CheckedChanged;
|
||||
//
|
||||
// buttonSelectServerPath
|
||||
//
|
||||
buttonSelectServerPath.Location = new Point(412, 100);
|
||||
buttonSelectServerPath.Name = "buttonSelectServerPath";
|
||||
buttonSelectServerPath.Size = new Size(84, 23);
|
||||
buttonSelectServerPath.TabIndex = 10;
|
||||
buttonSelectServerPath.Text = "选择";
|
||||
buttonSelectServerPath.UseVisualStyleBackColor = true;
|
||||
buttonSelectServerPath.Click += buttonSelectServerPath_Click;
|
||||
//
|
||||
// buttonRun
|
||||
//
|
||||
buttonRun.Location = new Point(504, 77);
|
||||
buttonRun.Name = "buttonRun";
|
||||
buttonRun.Size = new Size(87, 77);
|
||||
buttonRun.TabIndex = 12;
|
||||
buttonRun.Text = "执行";
|
||||
buttonRun.UseVisualStyleBackColor = true;
|
||||
buttonRun.Click += buttonRun_Click;
|
||||
//
|
||||
// textBoxClientGenJsonPath
|
||||
//
|
||||
textBoxClientGenJsonPath.Location = new Point(81, 71);
|
||||
textBoxClientGenJsonPath.Name = "textBoxClientGenJsonPath";
|
||||
textBoxClientGenJsonPath.Size = new Size(325, 23);
|
||||
textBoxClientGenJsonPath.TabIndex = 13;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(7, 77);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(68, 17);
|
||||
label4.TabIndex = 14;
|
||||
label4.Text = "客户端配置";
|
||||
//
|
||||
// buttonSelectClientJsonPath
|
||||
//
|
||||
buttonSelectClientJsonPath.Location = new Point(412, 71);
|
||||
buttonSelectClientJsonPath.Name = "buttonSelectClientJsonPath";
|
||||
buttonSelectClientJsonPath.Size = new Size(84, 23);
|
||||
buttonSelectClientJsonPath.TabIndex = 15;
|
||||
buttonSelectClientJsonPath.Text = "选择";
|
||||
buttonSelectClientJsonPath.UseVisualStyleBackColor = true;
|
||||
buttonSelectClientJsonPath.Click += buttonSelectClientJsonPath_Click;
|
||||
//
|
||||
// textBoxServerGenJsonPath
|
||||
//
|
||||
textBoxServerGenJsonPath.Location = new Point(81, 131);
|
||||
textBoxServerGenJsonPath.Name = "textBoxServerGenJsonPath";
|
||||
textBoxServerGenJsonPath.Size = new Size(325, 23);
|
||||
textBoxServerGenJsonPath.TabIndex = 16;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(7, 132);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(68, 17);
|
||||
label5.TabIndex = 17;
|
||||
label5.Text = "服务端配置";
|
||||
//
|
||||
// buttonSelectServerJsonPath
|
||||
//
|
||||
buttonSelectServerJsonPath.Location = new Point(412, 129);
|
||||
buttonSelectServerJsonPath.Name = "buttonSelectServerJsonPath";
|
||||
buttonSelectServerJsonPath.Size = new Size(84, 23);
|
||||
buttonSelectServerJsonPath.TabIndex = 18;
|
||||
buttonSelectServerJsonPath.Text = "选择";
|
||||
buttonSelectServerJsonPath.UseVisualStyleBackColor = true;
|
||||
buttonSelectServerJsonPath.Click += buttonSelectServerJsonPath_Click;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(599, 165);
|
||||
Controls.Add(buttonSelectServerJsonPath);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(textBoxServerGenJsonPath);
|
||||
Controls.Add(buttonSelectClientJsonPath);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(textBoxClientGenJsonPath);
|
||||
Controls.Add(buttonRun);
|
||||
Controls.Add(buttonSelectServerPath);
|
||||
Controls.Add(checkBoxGenServer);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(textBoxServerGenPath);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(checkBoxGenClient);
|
||||
Controls.Add(buttonSelectClientPath);
|
||||
Controls.Add(textBoxClientGenPath);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonSelectExcelPath);
|
||||
Controls.Add(textBoxExcelPath);
|
||||
Name = "Form1";
|
||||
Text = "配置生成导出";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox textBoxExcelPath;
|
||||
private Button buttonSelectExcelPath;
|
||||
private Label label1;
|
||||
private TextBox textBoxClientGenPath;
|
||||
private Button buttonSelectClientPath;
|
||||
private CheckBox checkBoxGenClient;
|
||||
private Label label2;
|
||||
private TextBox textBoxServerGenPath;
|
||||
private Label label3;
|
||||
private CheckBox checkBoxGenServer;
|
||||
private Button buttonSelectServerPath;
|
||||
private Button buttonRun;
|
||||
private TextBox textBoxClientGenJsonPath;
|
||||
private Label label4;
|
||||
private Button buttonSelectClientJsonPath;
|
||||
private TextBox textBoxServerGenJsonPath;
|
||||
private Label label5;
|
||||
private Button buttonSelectServerJsonPath;
|
||||
}
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NBConfigBuilder
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
// 配置文件路径
|
||||
private readonly string configPath =
|
||||
Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? string.Empty, "config.json");
|
||||
|
||||
// 保存原始标题
|
||||
private string _originalTitle;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 设置窗口大小不可变
|
||||
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
|
||||
// 保存原始标题
|
||||
_originalTitle = this.Text;
|
||||
|
||||
// 加载保存的配置
|
||||
LoadConfig();
|
||||
}
|
||||
|
||||
private async void buttonRun_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 禁用按钮防止重复点击
|
||||
buttonRun.Enabled = false;
|
||||
buttonRun.Text = "执行中...";
|
||||
|
||||
try
|
||||
{
|
||||
// 保存当前配置
|
||||
SaveConfig();
|
||||
|
||||
// 创建导出器并设置进度回调
|
||||
var exporter = new ExcelExporter(ExportType.AllExcel);
|
||||
exporter.SetProgressCallback(UpdateProgress);
|
||||
|
||||
// 运行导出器
|
||||
await Task.Run(() => exporter.Run());
|
||||
|
||||
// 显示成功消息
|
||||
MessageBox.Show("配置导出完成!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 显示错误消息
|
||||
MessageBox.Show($"导出过程中发生错误:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 恢复按钮状态和标题
|
||||
buttonRun.Enabled = true;
|
||||
buttonRun.Text = "执行";
|
||||
this.Text = _originalTitle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新进度显示
|
||||
/// </summary>
|
||||
/// <param name="message">进度消息</param>
|
||||
private void UpdateProgress(string message)
|
||||
{
|
||||
// 确保在UI线程上更新界面
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action<string>(UpdateProgress), message);
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新标题栏显示进度
|
||||
this.Text = $"{_originalTitle} - {message}";
|
||||
}
|
||||
|
||||
private void buttonSelectExcelPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog())
|
||||
{
|
||||
folderDlg.Description = "请选择配置表路径";
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBoxExcelPath.Text = folderDlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSelectClientJsonPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog())
|
||||
{
|
||||
folderDlg.Description = @"选择客户端json保存目录";
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBoxClientGenJsonPath.Text = folderDlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSelectServerJsonPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog())
|
||||
{
|
||||
folderDlg.Description = @"选择服务端json保存目录";
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBoxServerGenJsonPath.Text = folderDlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSelectClientPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog())
|
||||
{
|
||||
folderDlg.Description = @"选择客户端代码保存目录";
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBoxClientGenPath.Text = folderDlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSelectServerPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog())
|
||||
{
|
||||
folderDlg.Description = @"选择服务端代码保存目录";
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
textBoxServerGenPath.Text = folderDlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加保存和加载配置的方法
|
||||
private void SaveConfig()
|
||||
{
|
||||
var config = new AppConfig
|
||||
{
|
||||
ExcelPath = textBoxExcelPath.Text,
|
||||
ClientPath = textBoxClientGenPath.Text,
|
||||
ClientJsonPath = textBoxClientGenJsonPath.Text,
|
||||
ServerPath = textBoxServerGenPath.Text,
|
||||
ServerJsonPath = textBoxServerGenJsonPath.Text,
|
||||
GenClient = checkBoxGenClient.Checked,
|
||||
GenServer = checkBoxGenServer.Checked
|
||||
};
|
||||
App.Config = config;
|
||||
try
|
||||
{
|
||||
string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(configPath, json);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"保存配置失败: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadConfig()
|
||||
{
|
||||
if (!File.Exists(configPath)) return;
|
||||
|
||||
try
|
||||
{
|
||||
string json = File.ReadAllText(configPath);
|
||||
var config = JsonSerializer.Deserialize<AppConfig>(json);
|
||||
|
||||
if (config != null)
|
||||
{
|
||||
App.Config = config;
|
||||
textBoxExcelPath.Text = config.ExcelPath ?? "";
|
||||
textBoxClientGenPath.Text = config.ClientPath ?? "";
|
||||
textBoxServerGenPath.Text = config.ServerPath ?? "";
|
||||
checkBoxGenClient.Checked = config.GenClient;
|
||||
checkBoxGenServer.Checked = config.GenServer;
|
||||
textBoxClientGenJsonPath.Text = config.ClientJsonPath ?? "";
|
||||
textBoxServerGenJsonPath.Text = config.ServerJsonPath ?? "";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"加载配置失败: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBoxGenServer_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,97 +0,0 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace NBConfigBuilder
|
||||
{
|
||||
public static class Log
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
static Log()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录信息级别的日志消息。
|
||||
/// </summary>
|
||||
/// <param name="msg">日志消息。</param>
|
||||
public static void Info(string msg)
|
||||
{
|
||||
logger.Info(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录错误级别的日志消息,并附带调用栈信息。
|
||||
/// </summary>
|
||||
/// <param name="msg">日志消息。</param>
|
||||
public static void Error(string msg)
|
||||
{
|
||||
var st = new StackTrace(1, true);
|
||||
logger.Error($"{msg}\n{st}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录异常的错误级别的日志消息,并附带调用栈信息。
|
||||
/// </summary>
|
||||
/// <param name="e">异常对象。</param>
|
||||
public static void Error(Exception e)
|
||||
{
|
||||
if (e.Data.Contains("StackTrace"))
|
||||
{
|
||||
logger.Error($"{e.Data["StackTrace"]}\n{e}");
|
||||
return;
|
||||
}
|
||||
|
||||
var str = e.ToString();
|
||||
logger.Error(str);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录信息级别的格式化日志消息。
|
||||
/// </summary>
|
||||
/// <param name="message">日志消息模板。</param>
|
||||
/// <param name="args">格式化参数。</param>
|
||||
public static void Info(string message, params object[] args)
|
||||
{
|
||||
logger.Info(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录调试级别的日志消息。
|
||||
/// </summary>
|
||||
/// <param name="msg">日志消息。</param>
|
||||
public static void Debug(string msg)
|
||||
{
|
||||
logger.Debug(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录警告级别的日志消息。
|
||||
/// </summary>
|
||||
/// <param name="msg">日志消息。</param>
|
||||
public static void Warn(string msg)
|
||||
{
|
||||
logger.Warn(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录严重错误级别的日志消息。
|
||||
/// </summary>
|
||||
/// <param name="msg">日志消息。</param>
|
||||
public static void Fatal(string msg)
|
||||
{
|
||||
logger.Fatal(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录异常的错误级别的日志消息。
|
||||
/// </summary>
|
||||
/// <param name="e">异常对象。</param>
|
||||
/// <param name="message">附加消息。</param>
|
||||
public static void Error(Exception e, string message)
|
||||
{
|
||||
logger.Error(e, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EPPlus" Version="8.2.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="NLog" Version="6.0.4" />
|
||||
<PackageReference Include="protobuf-net" Version="3.2.56" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="TemplateClient.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="TemplateBack.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="TemplateServer.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Update="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<!-- 文件目标 -->
|
||||
<target xsi:type="File"
|
||||
name="fileTarget"
|
||||
fileName="logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=ToString}" />
|
||||
|
||||
<!-- 控制台目标 -->
|
||||
<target xsi:type="Console"
|
||||
name="consoleTarget"
|
||||
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=ToString}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- 记录所有级别高于 Debug 的日志到文件 -->
|
||||
<logger name="*" minlevel="Debug" writeTo="fileTarget" />
|
||||
|
||||
<!-- 记录所有级别高于 Info 的日志到控制台 -->
|
||||
<logger name="*" minlevel="Info" writeTo="consoleTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -1,25 +0,0 @@
|
||||
using NLog;
|
||||
|
||||
namespace NBConfigBuilder
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// 配置NLog
|
||||
var logger = LogManager.GetCurrentClassLogger();
|
||||
logger.Info("Application started");
|
||||
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
|
||||
logger.Info("Application closing");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
#if FANTASY_NET
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
#else
|
||||
using NBC;
|
||||
using NBC.Serialize;
|
||||
#endif
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
|
||||
namespace (namespace)
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName)Data : ASerialize, IConfigTable, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<(ConfigName)> List { get; set; } = new List<(ConfigName)>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, (ConfigName)> _configs = new ConcurrentDictionary<uint, (ConfigName)>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, (ConfigName)> _configs = new Dictionary<uint, (ConfigName)>();
|
||||
#endif
|
||||
private static (ConfigName)Data _instance = null;
|
||||
|
||||
public static (ConfigName)Data Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<(ConfigName)Data>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public (ConfigName) Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"(ConfigName) not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out (ConfigName) config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto
|
||||
{(Fields)
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using NBC;
|
||||
using NBC.Serialize;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
(Fields)
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<(ConfigName)> Context => ConfigTableHelper.Table<(ConfigName)>();
|
||||
|
||||
public static (ConfigName) Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static (ConfigName) Get(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static (ConfigName) Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Last(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<(ConfigName), bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<(ConfigName)>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.Serialize;
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
(Fields)
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<(ConfigName)> Context => ConfigTableHelper.Table<(ConfigName)>();
|
||||
|
||||
public static (ConfigName) Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static (ConfigName) Get(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static (ConfigName) Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Last(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<(ConfigName), bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<(ConfigName)>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 文件操作助手类,提供了各种文件操作方法。
|
||||
/// </summary>
|
||||
public static partial class FileHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取相对路径的完整路径。
|
||||
/// </summary>
|
||||
/// <param name="relativePath">相对路径。</param>
|
||||
/// <returns>完整路径。</returns>
|
||||
public static string GetFullPath(string relativePath)
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), relativePath));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取相对路径的完整路径。
|
||||
/// </summary>
|
||||
/// <param name="relativePath">相对于指定的目录的相对路径。</param>
|
||||
/// <param name="srcDir">指定的目录</param>
|
||||
/// <returns>完整路径。</returns>
|
||||
public static string GetFullPath(string relativePath, string srcDir)
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(srcDir, relativePath));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取相对路径的的文本信息。
|
||||
/// </summary>
|
||||
/// <param name="relativePath"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> GetTextByRelativePath(string relativePath)
|
||||
{
|
||||
var fullPath = GetFullPath(relativePath);
|
||||
return await File.ReadAllTextAsync(fullPath, Encoding.UTF8);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取绝对路径的的文本信息。
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> GetText(string fullPath)
|
||||
{
|
||||
return await File.ReadAllTextAsync(fullPath, Encoding.UTF8);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据文件夹路径创建文件夹,如果文件夹不存在会自动创建文件夹。
|
||||
/// </summary>
|
||||
/// <param name="directoryPath"></param>
|
||||
public static void CreateDirectory(string directoryPath)
|
||||
{
|
||||
if (directoryPath.LastIndexOf('/') != directoryPath.Length - 1)
|
||||
{
|
||||
directoryPath += "/";
|
||||
}
|
||||
|
||||
var directoriesByFilePath = GetDirectoriesByFilePath(directoryPath);
|
||||
|
||||
foreach (var dir in directoriesByFilePath)
|
||||
{
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件复制到目标路径,如果目标目录不存在会自动创建目录。
|
||||
/// </summary>
|
||||
/// <param name="sourceFile">源文件路径。</param>
|
||||
/// <param name="destinationFile">目标文件路径。</param>
|
||||
/// <param name="overwrite">是否覆盖已存在的目标文件。</param>
|
||||
public static void Copy(string sourceFile, string destinationFile, bool overwrite)
|
||||
{
|
||||
CreateDirectory(destinationFile);
|
||||
File.Copy(sourceFile, destinationFile, overwrite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件路径内的所有文件夹路径。
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件路径。</param>
|
||||
/// <returns>文件夹路径列表。</returns>
|
||||
public static IEnumerable<string> GetDirectoriesByFilePath(string filePath)
|
||||
{
|
||||
var dir = "";
|
||||
var fileDirectories = filePath.Split('/');
|
||||
|
||||
for (var i = 0; i < fileDirectories.Length - 1; i++)
|
||||
{
|
||||
dir = $"{dir}{fileDirectories[i]}/";
|
||||
yield return dir;
|
||||
}
|
||||
|
||||
if (fileDirectories.Length == 1)
|
||||
{
|
||||
yield return filePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件夹内的所有内容复制到目标位置。
|
||||
/// </summary>
|
||||
/// <param name="sourceDirectory">源文件夹路径。</param>
|
||||
/// <param name="destinationDirectory">目标文件夹路径。</param>
|
||||
/// <param name="overwrite">是否覆盖已存在的文件。</param>
|
||||
public static void CopyDirectory(string sourceDirectory, string destinationDirectory, bool overwrite)
|
||||
{
|
||||
// 创建目标文件夹
|
||||
|
||||
if (!Directory.Exists(destinationDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(destinationDirectory);
|
||||
}
|
||||
|
||||
// 获取当前文件夹中的所有文件
|
||||
|
||||
var files = Directory.GetFiles(sourceDirectory);
|
||||
|
||||
// 拷贝文件到目标文件夹
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
var fileName = Path.GetFileName(file);
|
||||
var destinationPath = Path.Combine(destinationDirectory, fileName);
|
||||
File.Copy(file, destinationPath, overwrite);
|
||||
}
|
||||
|
||||
// 获取源文件夹中的所有子文件夹
|
||||
|
||||
var directories = Directory.GetDirectories(sourceDirectory);
|
||||
|
||||
// 递归方式拷贝文件夹
|
||||
|
||||
foreach (var directory in directories)
|
||||
{
|
||||
var directoryName = Path.GetFileName(directory);
|
||||
var destinationPath = Path.Combine(destinationDirectory, directoryName);
|
||||
CopyDirectory(directory, destinationPath, overwrite);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取目录下的所有文件
|
||||
/// </summary>
|
||||
/// <param name="folderPath">文件夹路径。</param>
|
||||
/// <param name="searchPattern">需要查找的文件通配符</param>
|
||||
/// <param name="searchOption">查找的类型</param>
|
||||
/// <returns></returns>
|
||||
public static string[] GetDirectoryFile(string folderPath, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
return Directory.GetFiles(folderPath, searchPattern, searchOption);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空文件夹内的所有文件。
|
||||
/// </summary>
|
||||
/// <param name="folderPath">文件夹路径。</param>
|
||||
public static void ClearDirectoryFile(string folderPath)
|
||||
{
|
||||
if (!Directory.Exists(folderPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var files = Directory.GetFiles(folderPath);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// HashCode算法帮助类
|
||||
/// </summary>
|
||||
public static partial class HashCodeHelper
|
||||
{
|
||||
private static readonly SHA256 Sha256Hash = SHA256.Create();
|
||||
|
||||
/// <summary>
|
||||
/// 计算两个字符串的HashCode
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetHashCode(string a, string b)
|
||||
{
|
||||
var hash = 17;
|
||||
hash = hash * 31 + a.GetHashCode();
|
||||
hash = hash * 31 + b.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
#if FANTASY_NET || !FANTASY_WEBGL
|
||||
/// <summary>
|
||||
/// 使用bkdr算法生成一个long的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe long GetBKDRHashCode(string str)
|
||||
{
|
||||
ulong hash = 0;
|
||||
// 如果要修改这个种子、建议选择一个质数来做种子
|
||||
const uint seed = 13131; // 31 131 1313 13131 131313 etc..
|
||||
fixed (char* p = str)
|
||||
{
|
||||
for (var i = 0; i < str.Length; i++)
|
||||
{
|
||||
var c = p[i];
|
||||
var high = (byte)(c >> 8);
|
||||
var low = (byte)(c & byte.MaxValue);
|
||||
hash = hash * seed + high;
|
||||
hash = hash * seed + low;
|
||||
}
|
||||
}
|
||||
|
||||
return (long)hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用MurmurHash3算法生成一个uint的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe uint MurmurHash3(string str)
|
||||
{
|
||||
const uint seed = 0xc58f1a7b;
|
||||
uint hash = seed;
|
||||
uint c1 = 0xcc9e2d51;
|
||||
uint c2 = 0x1b873593;
|
||||
|
||||
fixed (char* p = str)
|
||||
{
|
||||
var current = p;
|
||||
|
||||
for (var i = 0; i < str.Length; i++)
|
||||
{
|
||||
var k1 = (uint)(*current);
|
||||
k1 *= c1;
|
||||
k1 = (k1 << 15) | (k1 >> (32 - 15));
|
||||
k1 *= c2;
|
||||
|
||||
hash ^= k1;
|
||||
hash = (hash << 13) | (hash >> (32 - 13));
|
||||
hash = hash * 5 + 0xe6546b64;
|
||||
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
hash ^= (uint)str.Length;
|
||||
hash ^= hash >> 16;
|
||||
hash *= 0x85ebca6b;
|
||||
hash ^= hash >> 13;
|
||||
hash *= 0xc2b2ae35;
|
||||
hash ^= hash >> 16;
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用MurmurHash3算法生成一个long的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe long ComputeHash64(string str)
|
||||
{
|
||||
const ulong seed = 0xc58f1a7bc58f1a7bUL; // 64-bit seed
|
||||
var hash = seed;
|
||||
var c1 = 0x87c37b91114253d5UL;
|
||||
var c2 = 0x4cf5ad432745937fUL;
|
||||
|
||||
fixed (char* p = str)
|
||||
{
|
||||
var current = p;
|
||||
|
||||
for (var i = 0; i < str.Length; i++)
|
||||
{
|
||||
var k1 = (ulong)(*current);
|
||||
k1 *= c1;
|
||||
k1 = (k1 << 31) | (k1 >> (64 - 31));
|
||||
k1 *= c2;
|
||||
|
||||
hash ^= k1;
|
||||
hash = (hash << 27) | (hash >> (64 - 27));
|
||||
hash = hash * 5 + 0x52dce729;
|
||||
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
hash ^= (ulong)str.Length;
|
||||
hash ^= hash >> 33;
|
||||
hash *= 0xff51afd7ed558ccdUL;
|
||||
hash ^= hash >> 33;
|
||||
hash *= 0xc4ceb9fe1a85ec53UL;
|
||||
hash ^= hash >> 33;
|
||||
return (long)hash;
|
||||
}
|
||||
#endif
|
||||
#if FANTASY_WEBGL
|
||||
/// <summary>
|
||||
/// 使用bkdr算法生成一个long的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static long GetBKDRHashCode(string str)
|
||||
{
|
||||
long hash = 0;
|
||||
// 如果要修改这个种子、建议选择一个质数来做种子
|
||||
const uint seed = 13131; // 31 131 1313 13131 131313 etc..
|
||||
foreach (var c in str)
|
||||
{
|
||||
var high = (byte)(c >> 8);
|
||||
var low = (byte)(c & byte.MaxValue);
|
||||
hash = hash * seed + high;
|
||||
hash = hash * seed + low;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
/// <summary>
|
||||
/// 使用MurmurHash3算法生成一个uint的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static uint MurmurHash3(string str)
|
||||
{
|
||||
const uint seed = 0xc58f1a7b;
|
||||
uint hash = seed;
|
||||
uint c1 = 0xcc9e2d51;
|
||||
uint c2 = 0x1b873593;
|
||||
|
||||
foreach (var t in str)
|
||||
{
|
||||
var k1 = (uint)(t);
|
||||
k1 *= c1;
|
||||
k1 = (k1 << 15) | (k1 >> (32 - 15));
|
||||
k1 *= c2;
|
||||
|
||||
hash ^= k1;
|
||||
hash = (hash << 13) | (hash >> (32 - 13));
|
||||
hash = hash * 5 + 0xe6546b64;
|
||||
}
|
||||
|
||||
hash ^= (uint)str.Length;
|
||||
hash ^= hash >> 16;
|
||||
hash *= 0x85ebca6b;
|
||||
hash ^= hash >> 13;
|
||||
hash *= 0xc2b2ae35;
|
||||
hash ^= hash >> 16;
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用MurmurHash3算法生成一个long的值
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static long ComputeHash64(string str)
|
||||
{
|
||||
const ulong seed = 0xc58f1a7bc58f1a7bUL; // 64-bit seed
|
||||
var hash = seed;
|
||||
var c1 = 0x87c37b91114253d5UL;
|
||||
var c2 = 0x4cf5ad432745937fUL;
|
||||
|
||||
foreach (var t in str)
|
||||
{
|
||||
var k1 = (ulong)(t);
|
||||
k1 *= c1;
|
||||
k1 = (k1 << 31) | (k1 >> (64 - 31));
|
||||
k1 *= c2;
|
||||
|
||||
hash ^= k1;
|
||||
hash = (hash << 27) | (hash >> (64 - 27));
|
||||
hash = hash * 5 + 0x52dce729;
|
||||
}
|
||||
|
||||
hash ^= (ulong)str.Length;
|
||||
hash ^= hash >> 33;
|
||||
hash *= 0xff51afd7ed558ccdUL;
|
||||
hash ^= hash >> 33;
|
||||
hash *= 0xc4ceb9fe1a85ec53UL;
|
||||
hash ^= hash >> 33;
|
||||
return (long)hash;
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// 根据字符串计算一个Hash值
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
/// <returns></returns>
|
||||
public static int ComputeSha256HashAsInt(string rawData)
|
||||
{
|
||||
var bytes = Sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData));
|
||||
return (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
namespace NBConfigBuilder;
|
||||
|
||||
/// <summary>
|
||||
/// 提供与时间相关的帮助方法。
|
||||
/// </summary>
|
||||
public static partial class TimeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 一小时的毫秒值。
|
||||
/// </summary>
|
||||
public const long Hour = 3600000;
|
||||
|
||||
/// <summary>
|
||||
/// 一分钟的毫秒值。
|
||||
/// </summary>
|
||||
public const long Minute = 60000;
|
||||
|
||||
/// <summary>
|
||||
/// 一天的毫秒值。
|
||||
/// </summary>
|
||||
public const long OneDay = 86400000;
|
||||
|
||||
// 1970年1月1日的Ticks
|
||||
private const long Epoch = 621355968000000000L;
|
||||
/// <summary>
|
||||
/// 获取当前时间的毫秒数,从1970年1月1日开始计算。
|
||||
/// </summary>
|
||||
public static long Now => (DateTime.UtcNow.Ticks - Epoch) / 10000;
|
||||
|
||||
/// <summary>
|
||||
/// 根据时间获取时间戳
|
||||
/// </summary>
|
||||
public static long Transition(DateTime dateTime)
|
||||
{
|
||||
return (dateTime.ToUniversalTime().Ticks - Epoch) / 10000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据时间获取 时间戳
|
||||
/// </summary>
|
||||
public static long TransitionToSeconds(DateTime dateTime)
|
||||
{
|
||||
return (dateTime.ToUniversalTime().Ticks - Epoch) / 10000000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将毫秒数转换为日期时间。
|
||||
/// </summary>
|
||||
/// <param name="timeStamp">要转换的毫秒数。</param>
|
||||
/// <returns>转换后的日期时间。</returns>
|
||||
public static DateTime Transition(this long timeStamp)
|
||||
{
|
||||
return new DateTime(Epoch + timeStamp * 10000, DateTimeKind.Utc).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将毫秒数转换为本地时间的日期时间。
|
||||
/// </summary>
|
||||
/// <param name="timeStamp">要转换的毫秒数。</param>
|
||||
/// <returns>转换后的本地时间的日期时间。</returns>
|
||||
public static DateTime TransitionLocal(this long timeStamp)
|
||||
{
|
||||
return new DateTime(Epoch + timeStamp * 10000, DateTimeKind.Utc).ToLocalTime();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,516 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"NBConfigBuilder/1.0.0": {
|
||||
"dependencies": {
|
||||
"EPPlus": "8.2.0",
|
||||
"Microsoft.CodeAnalysis.CSharp": "4.14.0",
|
||||
"NLog": "6.0.4",
|
||||
"Newtonsoft.Json": "13.0.4",
|
||||
"protobuf-net": "3.2.56"
|
||||
},
|
||||
"runtime": {
|
||||
"NBConfigBuilder.dll": {}
|
||||
}
|
||||
},
|
||||
"EPPlus/8.2.0": {
|
||||
"dependencies": {
|
||||
"EPPlus.Interfaces": "8.1.0",
|
||||
"Microsoft.Extensions.Configuration.Json": "8.0.1",
|
||||
"Microsoft.IO.RecyclableMemoryStream": "3.0.1",
|
||||
"System.ComponentModel.Annotations": "5.0.0",
|
||||
"System.Security.Cryptography.Pkcs": "8.0.1",
|
||||
"System.Security.Cryptography.Xml": "8.0.2",
|
||||
"System.Text.Encoding.CodePages": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/EPPlus.dll": {
|
||||
"assemblyVersion": "8.2.0.0",
|
||||
"fileVersion": "8.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EPPlus.Interfaces/8.1.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/EPPlus.Interfaces.dll": {
|
||||
"assemblyVersion": "8.1.0.0",
|
||||
"fileVersion": "8.1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Analyzers/3.11.0": {},
|
||||
"Microsoft.CodeAnalysis.Common/4.14.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.11.0",
|
||||
"System.Collections.Immutable": "9.0.0",
|
||||
"System.Reflection.Metadata": "9.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.CodeAnalysis.dll": {
|
||||
"assemblyVersion": "4.14.0.0",
|
||||
"fileVersion": "4.1400.25.26210"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"lib/net8.0/cs/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "cs"
|
||||
},
|
||||
"lib/net8.0/de/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "de"
|
||||
},
|
||||
"lib/net8.0/es/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "es"
|
||||
},
|
||||
"lib/net8.0/fr/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "fr"
|
||||
},
|
||||
"lib/net8.0/it/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "it"
|
||||
},
|
||||
"lib/net8.0/ja/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ja"
|
||||
},
|
||||
"lib/net8.0/ko/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ko"
|
||||
},
|
||||
"lib/net8.0/pl/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "pl"
|
||||
},
|
||||
"lib/net8.0/pt-BR/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "pt-BR"
|
||||
},
|
||||
"lib/net8.0/ru/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "ru"
|
||||
},
|
||||
"lib/net8.0/tr/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "tr"
|
||||
},
|
||||
"lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "zh-Hans"
|
||||
},
|
||||
"lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll": {
|
||||
"locale": "zh-Hant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/4.14.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.11.0",
|
||||
"Microsoft.CodeAnalysis.Common": "4.14.0",
|
||||
"System.Collections.Immutable": "9.0.0",
|
||||
"System.Reflection.Metadata": "9.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.CodeAnalysis.CSharp.dll": {
|
||||
"assemblyVersion": "4.14.0.0",
|
||||
"fileVersion": "4.1400.25.26210"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"lib/net8.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "cs"
|
||||
},
|
||||
"lib/net8.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "de"
|
||||
},
|
||||
"lib/net8.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "es"
|
||||
},
|
||||
"lib/net8.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "fr"
|
||||
},
|
||||
"lib/net8.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "it"
|
||||
},
|
||||
"lib/net8.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ja"
|
||||
},
|
||||
"lib/net8.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ko"
|
||||
},
|
||||
"lib/net8.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "pl"
|
||||
},
|
||||
"lib/net8.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "pt-BR"
|
||||
},
|
||||
"lib/net8.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "ru"
|
||||
},
|
||||
"lib/net8.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "tr"
|
||||
},
|
||||
"lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "zh-Hans"
|
||||
},
|
||||
"lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
||||
"locale": "zh-Hant"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration/8.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
|
||||
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.Configuration.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions/8.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.FileExtensions/8.0.1": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "8.0.0",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "8.0.0",
|
||||
"Microsoft.Extensions.FileProviders.Physical": "8.0.0",
|
||||
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.Configuration.FileExtensions.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.724.31311"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Json/8.0.1": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "8.0.0",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "8.0.1",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.Configuration.Json.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.1024.46610"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.FileProviders.Abstractions.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Physical/8.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "8.0.0",
|
||||
"Microsoft.Extensions.FileSystemGlobbing": "8.0.0",
|
||||
"Microsoft.Extensions.Primitives": "8.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.FileProviders.Physical.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileSystemGlobbing/8.0.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.FileSystemGlobbing.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Primitives/8.0.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.Primitives.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.23.53103"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.IO.RecyclableMemoryStream/3.0.1": {
|
||||
"runtime": {
|
||||
"lib/net6.0/Microsoft.IO.RecyclableMemoryStream.dll": {
|
||||
"assemblyVersion": "3.0.1.0",
|
||||
"fileVersion": "3.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.4": {
|
||||
"runtime": {
|
||||
"lib/net6.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.4.30916"
|
||||
}
|
||||
}
|
||||
},
|
||||
"NLog/6.0.4": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/NLog.dll": {
|
||||
"assemblyVersion": "6.0.0.0",
|
||||
"fileVersion": "6.0.4.4534"
|
||||
}
|
||||
}
|
||||
},
|
||||
"protobuf-net/3.2.56": {
|
||||
"dependencies": {
|
||||
"protobuf-net.Core": "3.2.56"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/protobuf-net.dll": {
|
||||
"assemblyVersion": "3.0.0.0",
|
||||
"fileVersion": "3.2.56.57311"
|
||||
}
|
||||
}
|
||||
},
|
||||
"protobuf-net.Core/3.2.56": {
|
||||
"runtime": {
|
||||
"lib/net8.0/protobuf-net.Core.dll": {
|
||||
"assemblyVersion": "3.0.0.0",
|
||||
"fileVersion": "3.2.56.57311"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/9.0.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/System.Collections.Immutable.dll": {
|
||||
"assemblyVersion": "9.0.0.0",
|
||||
"fileVersion": "9.0.24.52809"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ComponentModel.Annotations/5.0.0": {},
|
||||
"System.Reflection.Metadata/9.0.0": {
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "9.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/System.Reflection.Metadata.dll": {
|
||||
"assemblyVersion": "9.0.0.0",
|
||||
"fileVersion": "9.0.24.52809"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Security.Cryptography.Pkcs/8.0.1": {
|
||||
"runtime": {
|
||||
"lib/net8.0/System.Security.Cryptography.Pkcs.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.1024.46610"
|
||||
}
|
||||
},
|
||||
"runtimeTargets": {
|
||||
"runtimes/win/lib/net8.0/System.Security.Cryptography.Pkcs.dll": {
|
||||
"rid": "win",
|
||||
"assetType": "runtime",
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.1024.46610"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Security.Cryptography.Xml/8.0.2": {
|
||||
"dependencies": {
|
||||
"System.Security.Cryptography.Pkcs": "8.0.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/System.Security.Cryptography.Xml.dll": {
|
||||
"assemblyVersion": "8.0.0.0",
|
||||
"fileVersion": "8.0.1024.46610"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages/8.0.0": {}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"NBConfigBuilder/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"EPPlus/8.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-UFAjVAP4UyR9rPL/adHw1uezX1gDbt2mM7Bkb7cMmqbw51y0HFKyLoHpsjvNzKRL/u05vW4pHJAmkuvrPBcgSw==",
|
||||
"path": "epplus/8.2.0",
|
||||
"hashPath": "epplus.8.2.0.nupkg.sha512"
|
||||
},
|
||||
"EPPlus.Interfaces/8.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Nfc7ehsn8Sb8Ed8KYYuOxqt8gWqmy2Vhts5nfLMw3zISi+aZFwyW+k9s3FOpVuW91VDSrhVAId9brYtz9NnmKA==",
|
||||
"path": "epplus.interfaces/8.1.0",
|
||||
"hashPath": "epplus.interfaces.8.1.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Analyzers/3.11.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-v/EW3UE8/lbEYHoC2Qq7AR/DnmvpgdtAMndfQNmpuIMx/Mto8L5JnuCfdBYtgvalQOtfNCnxFejxuRrryvUTsg==",
|
||||
"path": "microsoft.codeanalysis.analyzers/3.11.0",
|
||||
"hashPath": "microsoft.codeanalysis.analyzers.3.11.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Common/4.14.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-PC3tuwZYnC+idaPuoC/AZpEdwrtX7qFpmnrfQkgobGIWiYmGi5MCRtl5mx6QrfMGQpK78X2lfIEoZDLg/qnuHg==",
|
||||
"path": "microsoft.codeanalysis.common/4.14.0",
|
||||
"hashPath": "microsoft.codeanalysis.common.4.14.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/4.14.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-568a6wcTivauIhbeWcCwfWwIn7UV7MeHEBvFB2uzGIpM2OhJ4eM/FZ8KS0yhPoNxnSpjGzz7x7CIjTxhslojQA==",
|
||||
"path": "microsoft.codeanalysis.csharp/4.14.0",
|
||||
"hashPath": "microsoft.codeanalysis.csharp.4.14.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==",
|
||||
"path": "microsoft.extensions.configuration/8.0.0",
|
||||
"hashPath": "microsoft.extensions.configuration.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==",
|
||||
"path": "microsoft.extensions.configuration.abstractions/8.0.0",
|
||||
"hashPath": "microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.FileExtensions/8.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-EJzSNO9oaAXnTdtdNO6npPRsIIeZCBSNmdQ091VDO7fBiOtJAAeEq6dtrVXIi3ZyjC5XRSAtVvF8SzcneRHqKQ==",
|
||||
"path": "microsoft.extensions.configuration.fileextensions/8.0.1",
|
||||
"hashPath": "microsoft.extensions.configuration.fileextensions.8.0.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Json/8.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-L89DLNuimOghjV3tLx0ArFDwVEJD6+uGB3BMCMX01kaLzXkaXHb2021xOMl2QOxUxbdePKUZsUY7n2UUkycjRg==",
|
||||
"path": "microsoft.extensions.configuration.json/8.0.1",
|
||||
"hashPath": "microsoft.extensions.configuration.json.8.0.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Abstractions/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==",
|
||||
"path": "microsoft.extensions.fileproviders.abstractions/8.0.0",
|
||||
"hashPath": "microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Physical/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-UboiXxpPUpwulHvIAVE36Knq0VSHaAmfrFkegLyBZeaADuKezJ/AIXYAW8F5GBlGk/VaibN2k/Zn1ca8YAfVdA==",
|
||||
"path": "microsoft.extensions.fileproviders.physical/8.0.0",
|
||||
"hashPath": "microsoft.extensions.fileproviders.physical.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.FileSystemGlobbing/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-OK+670i7esqlQrPjdIKRbsyMCe9g5kSLpRRQGSr4Q58AOYEe/hCnfLZprh7viNisSUUQZmMrbbuDaIrP+V1ebQ==",
|
||||
"path": "microsoft.extensions.filesystemglobbing/8.0.0",
|
||||
"hashPath": "microsoft.extensions.filesystemglobbing.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Primitives/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==",
|
||||
"path": "microsoft.extensions.primitives/8.0.0",
|
||||
"hashPath": "microsoft.extensions.primitives.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.IO.RecyclableMemoryStream/3.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-s/s20YTVY9r9TPfTrN5g8zPF1YhwxyqO6PxUkrYTGI2B+OGPe9AdajWZrLhFqXIvqIW23fnUE4+ztrUWNU1+9g==",
|
||||
"path": "microsoft.io.recyclablememorystream/3.0.1",
|
||||
"hashPath": "microsoft.io.recyclablememorystream.3.0.1.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-pdgNNMai3zv51W5aq268sujXUyx7SNdE2bj1wZcWjAQrKMFZV260lbqYop1d2GM67JI1huLRwxo9ZqnfF/lC6A==",
|
||||
"path": "newtonsoft.json/13.0.4",
|
||||
"hashPath": "newtonsoft.json.13.0.4.nupkg.sha512"
|
||||
},
|
||||
"NLog/6.0.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Xr+lIk1ZlTTFXEqnxQVLxrDqZlt2tm5X+/AhJbaY2emb/dVtGDiU5QuEtj3gHtwV/SWlP/rJ922I/BPuOJXlRw==",
|
||||
"path": "nlog/6.0.4",
|
||||
"hashPath": "nlog.6.0.4.nupkg.sha512"
|
||||
},
|
||||
"protobuf-net/3.2.56": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-4IPJeTYAMNewlN8MDaFkcmR/9hLhJeo9eARnTh104zh7mf+vXT2gu5MUfUnkSQU+CH578Q6vcdU7LQDQPG6eaw==",
|
||||
"path": "protobuf-net/3.2.56",
|
||||
"hashPath": "protobuf-net.3.2.56.nupkg.sha512"
|
||||
},
|
||||
"protobuf-net.Core/3.2.56": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-d6QOukTpDzs7zZv9tPnBZMtvHDNeHJQXUhMx54g4urUQsXK3oo9U70H9HvklYq7hlQ4A7AHJl7EVEqyCXXIl8Q==",
|
||||
"path": "protobuf-net.core/3.2.56",
|
||||
"hashPath": "protobuf-net.core.3.2.56.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/9.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QhkXUl2gNrQtvPmtBTQHb0YsUrDiDQ2QS09YbtTTiSjGcf7NBqtYbrG/BE06zcBPCKEwQGzIv13IVdXNOSub2w==",
|
||||
"path": "system.collections.immutable/9.0.0",
|
||||
"hashPath": "system.collections.immutable.9.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ComponentModel.Annotations/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==",
|
||||
"path": "system.componentmodel.annotations/5.0.0",
|
||||
"hashPath": "system.componentmodel.annotations.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reflection.Metadata/9.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ANiqLu3DxW9kol/hMmTWbt3414t9ftdIuiIU7j80okq2YzAueo120M442xk1kDJWtmZTqWQn7wHDvMRipVOEOQ==",
|
||||
"path": "system.reflection.metadata/9.0.0",
|
||||
"hashPath": "system.reflection.metadata.9.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Security.Cryptography.Pkcs/8.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA==",
|
||||
"path": "system.security.cryptography.pkcs/8.0.1",
|
||||
"hashPath": "system.security.cryptography.pkcs.8.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Security.Cryptography.Xml/8.0.2": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-aDM/wm0ZGEZ6ZYJLzgqjp2FZdHbDHh6/OmpGfb7AdZ105zYmPn/83JRU2xLIbwgoNz9U1SLUTJN0v5th3qmvjA==",
|
||||
"path": "system.security.cryptography.xml/8.0.2",
|
||||
"hashPath": "system.security.cryptography.xml.8.0.2.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Encoding.CodePages/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-OZIsVplFGaVY90G2SbpgU7EnCoOO5pw1t4ic21dBF3/1omrJFpAGoNAVpPyMVOC90/hvgkGG3VFqR13YgZMQfg==",
|
||||
"path": "system.text.encoding.codepages/8.0.0",
|
||||
"hashPath": "system.text.encoding.codepages.8.0.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net8.0",
|
||||
"frameworks": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "8.0.0"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.WindowsDesktop.App",
|
||||
"version": "8.0.0"
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true,
|
||||
"CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<!-- 文件目标 -->
|
||||
<target xsi:type="File"
|
||||
name="fileTarget"
|
||||
fileName="logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=ToString}" />
|
||||
|
||||
<!-- 控制台目标 -->
|
||||
<target xsi:type="Console"
|
||||
name="consoleTarget"
|
||||
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=ToString}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- 记录所有级别高于 Debug 的日志到文件 -->
|
||||
<logger name="*" minlevel="Debug" writeTo="fileTarget" />
|
||||
|
||||
<!-- 记录所有级别高于 Info 的日志到控制台 -->
|
||||
<logger name="*" minlevel="Info" writeTo="consoleTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
#if FANTASY_NET
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
#else
|
||||
using NBC;
|
||||
using NBC.Serialize;
|
||||
#endif
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
|
||||
namespace (namespace)
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName)Data : ASerialize, IConfigTable, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<(ConfigName)> List { get; set; } = new List<(ConfigName)>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, (ConfigName)> _configs = new ConcurrentDictionary<uint, (ConfigName)>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, (ConfigName)> _configs = new Dictionary<uint, (ConfigName)>();
|
||||
#endif
|
||||
private static (ConfigName)Data _instance = null;
|
||||
|
||||
public static (ConfigName)Data Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<(ConfigName)Data>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public (ConfigName) Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"(ConfigName) not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out (ConfigName) config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto
|
||||
{(Fields)
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using NBC;
|
||||
using NBC.Serialize;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
(Fields)
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<(ConfigName)> Context => ConfigTableHelper.Table<(ConfigName)>();
|
||||
|
||||
public static (ConfigName) Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static (ConfigName) Get(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static (ConfigName) Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Last(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<(ConfigName), bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<(ConfigName)>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.Serialize;
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class (ConfigName) : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
(Fields)
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<(ConfigName)> Context => ConfigTableHelper.Table<(ConfigName)>();
|
||||
|
||||
public static (ConfigName) Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static (ConfigName) Get(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static (ConfigName) Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static (ConfigName) Fist(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static (ConfigName) Last(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<(ConfigName), bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<(ConfigName)> GetList(Predicate<(ConfigName)> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<(ConfigName)>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"ExcelPath": "D:\\work\\Fishing2\\Config",
|
||||
"ClientPath": "D:\\work\\Fishing2\\Assets\\Scripts\\Generate\\Config",
|
||||
"ClientJsonPath": "D:\\work\\Fishing2\\Assets\\Resources\\config",
|
||||
"ServerPath": "D:\\work\\Fishing2Server\\Entity\\Generate\\ConfigTable\\Entity",
|
||||
"ServerJsonPath": "D:\\work\\Fishing2Server\\Config\\Json",
|
||||
"GenClient": true,
|
||||
"GenServer": true,
|
||||
"ExcelVersionPath": "D:\\work\\Fishing2\\Config\\Version.txt"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"ExcelPath": "..\\..\\..\\Fishing2\\Config",
|
||||
"ClientPath": "..\\..\\..\\Fishing2\\Assets\\Scripts\\Generate\\Config",
|
||||
"ClientJsonPath": "..\\..\\..\\Fishing2\\Assets\\Resources\\config",
|
||||
"ServerPath": "..\\..\\..\\Fishing2Server\\Entity\\Generate\\ConfigTable\\Entity",
|
||||
"ServerJsonPath": "..\\..\\..\\Fishing2Server\\Config\\Json",
|
||||
"GenClient": true,
|
||||
"GenServer": true,
|
||||
"ExcelVersionPath": "..\\..\\..\\Fishing2\\Config\\Version.txt"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"Export": {
|
||||
"NetworkProtocolDirectory": {
|
||||
"Value": "../../Config/NetworkProtocol/",
|
||||
"Comment": "ProtoBuf文件所在的文件夹位置"
|
||||
},
|
||||
"NetworkProtocolServerDirectory": {
|
||||
"Value": "../../Entity/Generate/NetworkProtocol/",
|
||||
"Comment": "ProtoBuf生成到服务端的文件夹位置"
|
||||
},
|
||||
"NetworkProtocolClientDirectory": {
|
||||
"Value": "../../../Fishing2/Assets/Scripts/Generate/NetworkProtocol/",
|
||||
"Comment": "ProtoBuf生成到客户端的文件夹位置"
|
||||
},
|
||||
"Serializes": {
|
||||
"Value": [
|
||||
// {
|
||||
// "KeyIndex": 0,
|
||||
// "NameSpace" : "MemoryPack",
|
||||
// "SerializeName": "MemoryPack",
|
||||
// "Attribute": "\t[MemoryPackable]",
|
||||
// "Ignore": "\t\t[MemoryPackIgnore]",
|
||||
// "Member": "MemoryPackOrder"
|
||||
// }
|
||||
],
|
||||
"Comment": "自定义序列化器"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
84
Tools/NetworkProtocol/Inner/InnerMessage.proto
Normal file
84
Tools/NetworkProtocol/Inner/InnerMessage.proto
Normal file
@@ -0,0 +1,84 @@
|
||||
syntax = "proto3";
|
||||
package Sining.Message;
|
||||
|
||||
///通知游戏服角色进入该游戏服
|
||||
message G2Common_EnterRequest // IRouteRequest,G2Common_EnterResponse
|
||||
{
|
||||
int64 AccountId = 1; //账号id
|
||||
int64 GateRouteId = 2; //网关路由地址
|
||||
int32 RouteType = 3; //登陆的路由类型
|
||||
}
|
||||
|
||||
message G2Common_EnterResponse // IRouteResponse
|
||||
{
|
||||
int64 UnitRouteId = 1; //实体的路由id
|
||||
int32 RouteType = 2; //登陆的场景类型
|
||||
}
|
||||
|
||||
message G2Common_ExitRequest // IRouteRequest,Common2G_ExitResponse
|
||||
{
|
||||
int64 AccountId = 1; //账号id
|
||||
int64 GateRouteId = 2;//网关路由地址
|
||||
}
|
||||
|
||||
message Common2G_ExitResponse // IRouteResponse
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
///获取玩家基础信息
|
||||
message S2G_GetPlayerBasicInfoRequest // IRouteRequest,G2S_GetPlayerBasicInfoResponse
|
||||
{
|
||||
repeated int64 IdList = 1; // 查询列表
|
||||
}
|
||||
///获取玩家基础信息响应
|
||||
message G2S_GetPlayerBasicInfoResponse // IRouteResponse
|
||||
{
|
||||
repeated RoleSimpleInfo RoleList = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message S2G_ChatMessage // IRouteMessage
|
||||
{
|
||||
ChatMessageInfo Message = 1; //聊天内容
|
||||
repeated int64 IdList = 2; // 群发列表
|
||||
}
|
||||
|
||||
///创建聊天频道
|
||||
message Club2Chat_CreateChannel // IRouteMessage
|
||||
{
|
||||
int64 ChannelId = 1; //频道id
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 请求进入房间
|
||||
message G2Map_EnterMapRequest // IRouteRequest,Map2G_EnterMapResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
int64 AccountId = 2; //账号id
|
||||
int32 MapId = 3; //地图id
|
||||
}
|
||||
|
||||
/// 请求进入房间响应
|
||||
message Map2G_EnterMapResponse // IRouteResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
int32 MapId = 2; //地图id
|
||||
repeated MapUnitInfo Units = 3; //房间玩家列表
|
||||
}
|
||||
|
||||
|
||||
/// 请求离开房间
|
||||
message G2Map_ExitRoomRequest // IRouteRequest,Map2G_ExiRoomResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
int64 AccountId = 2; //账号id
|
||||
}
|
||||
|
||||
/// 请求离开房间响应
|
||||
message Map2G_ExiRoomResponse // IRouteResponse
|
||||
{
|
||||
}
|
||||
BIN
Tools/NetworkProtocol/NetworkProtocol.zip
Normal file
BIN
Tools/NetworkProtocol/NetworkProtocol.zip
Normal file
Binary file not shown.
1
Tools/NetworkProtocol/OpCode.Cache
Normal file
1
Tools/NetworkProtocol/OpCode.Cache
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
102
Tools/NetworkProtocol/Outer/GameMessage.proto
Normal file
102
Tools/NetworkProtocol/Outer/GameMessage.proto
Normal file
@@ -0,0 +1,102 @@
|
||||
syntax = "proto3";
|
||||
package Fantasy.Network.Message;
|
||||
|
||||
////////////// ******** 物品信息 *******/////////////
|
||||
|
||||
///请求背包列表
|
||||
message C2Game_GetItemsRequest // ICustomRouteRequest,Game2C_GetItemsResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///请求背包列表响应
|
||||
message Game2C_GetItemsResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated ItemInfo Items = 1; //物品信息
|
||||
repeated ItemBindInfo Rigs = 2; //钓组信息
|
||||
}
|
||||
|
||||
///请求使用物品
|
||||
message C2Game_UseItemRequest // ICustomRouteRequest,Game2C_UseItemResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///请求使用物品响应
|
||||
message Game2C_UseItemResponse // ICustomRouteResponse
|
||||
{
|
||||
}
|
||||
|
||||
///物品变化
|
||||
message Game2C_ItemChange // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int32 Type = 1; //变化类型 0.新增 1,更新 -1删除
|
||||
repeated ItemInfo Items = 2; //物品信息
|
||||
repeated int64 Removes = 3; //移除物品(移除时有)
|
||||
}
|
||||
|
||||
////////////// ******** 钓组 *******/////////////
|
||||
|
||||
///请求安装或取下配件
|
||||
message C2Game_RigChangeRequest // ICustomRouteRequest,Game2C_RigChangeResponse,GameRoute
|
||||
{
|
||||
int64 RodId = 1;//杆子id
|
||||
int64 RigId = 2;//变更的配件
|
||||
bool IsAdd = 3;//是否添加
|
||||
}
|
||||
|
||||
///请求安装配件响应
|
||||
message Game2C_RigChangeResponse // ICustomRouteResponse
|
||||
{
|
||||
ItemBindInfo Rigs = 1; //变化钓组信息
|
||||
}
|
||||
|
||||
|
||||
////////////// ******** 鱼护 *******/////////////
|
||||
|
||||
///请求鱼护列表
|
||||
message C2Game_GetFishsRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///请求鱼护列表响应
|
||||
message Game2C_GetFishsResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated FishInfo Fishs = 1;
|
||||
}
|
||||
|
||||
///鱼护变化
|
||||
message Game2C_FishChange // ICustomRouteMessage,GameRoute
|
||||
{
|
||||
int32 Type = 1; //变化类型 0.新增 1,更新 -1删除
|
||||
repeated FishInfo Fishs = 2; //物品信息
|
||||
repeated int64 Removes = 3; //移除物品(移除时有)
|
||||
}
|
||||
|
||||
///请求出售
|
||||
message C2Game_SellFishRequest // ICustomRouteRequest,Game2C_SellFishResponse,GameRoute
|
||||
{
|
||||
repeated int64 Ids = 1; //出售id
|
||||
}
|
||||
|
||||
///请求出售响应
|
||||
message Game2C_SellFishResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated AwardInfo Awards = 1; //奖励
|
||||
}
|
||||
|
||||
|
||||
////////////// ******** 商店 *******/////////////
|
||||
|
||||
///请求购买
|
||||
message C2Game_BuyRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///请求购买响应
|
||||
message Game2C_BuyResponse // ICustomRouteResponse
|
||||
{
|
||||
repeated AwardInfo Awards = 1; //奖励
|
||||
}
|
||||
65
Tools/NetworkProtocol/Outer/MapMessage.proto
Normal file
65
Tools/NetworkProtocol/Outer/MapMessage.proto
Normal file
@@ -0,0 +1,65 @@
|
||||
syntax = "proto3";
|
||||
package Fantasy.Network.Message;
|
||||
|
||||
/// 请求创建房间
|
||||
message C2Map_CreateRoomRequest // ICustomRouteRequest,Map2C_CreateRoomResponse,MapRoute
|
||||
{
|
||||
int32 MapId = 1;//地图id
|
||||
}
|
||||
|
||||
/// 请求创建房间成功
|
||||
message Map2C_CreateRoomResponse // ICustomRouteResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
repeated MapUnitInfo Units = 2; //房间玩家列表
|
||||
}
|
||||
|
||||
|
||||
/// 请求网关离开房间(离开房间,但是不离开地图)
|
||||
message C2G_ExitRoomRequest // IRequest,G2C_ExitRoomResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
}
|
||||
|
||||
/// 请求网关进入离开响应
|
||||
message G2C_ExitRoomResponse // IResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
}
|
||||
|
||||
/// 请求网关进入地图
|
||||
message C2G_EnterMapRequest // IRequest,G2C_EnterMapResponse
|
||||
{
|
||||
string RoomCode = 1; //房间代码
|
||||
int32 MapId = 2; //地图id
|
||||
}
|
||||
|
||||
/// 请求网关进入房间响应
|
||||
message G2C_EnterMapResponse // IResponse
|
||||
{
|
||||
int32 MapId = 1; //地图id
|
||||
string RoomCode = 2; //房间代码
|
||||
repeated MapUnitInfo Units = 3; //房间玩家列表
|
||||
}
|
||||
|
||||
|
||||
// // 请求进入地图
|
||||
// message C2Map_EnterMapRequest // ICustomRouteRequest,Map2C_EnterMapResponse,MapRoute
|
||||
// {
|
||||
// int32 MapId = 1;//地图id
|
||||
// string RoomCode = 2;//房间id,如果是进入房间
|
||||
// }
|
||||
|
||||
|
||||
// message Map2C_EnterMapResponse // ICustomRouteResponse
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
/// 通知客户端切换地图
|
||||
message Map2C_ChangeMap // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int32 MapId = 1; //地图id
|
||||
int32 Node = 2; //站位节点
|
||||
}
|
||||
52
Tools/NetworkProtocol/Outer/OuterMessage.proto
Normal file
52
Tools/NetworkProtocol/Outer/OuterMessage.proto
Normal file
@@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
package Fantasy.Network.Message;
|
||||
|
||||
|
||||
// 协议分为:
|
||||
// ProtoBuf:可以在Outer和Inner文件里使用。
|
||||
// MemoryPack:可以在Outer和Inner文件里使用。
|
||||
// Bson:仅支持在Inner文件里使用。
|
||||
// 使用方式:
|
||||
// 在message协议上方添加// Protocol+空格+协议名字
|
||||
// 例如:// Protocol ProtoBuf 或 // Protocol MemoryPack
|
||||
message C2A_LoginRequest // IRequest,A2C_LoginResponse
|
||||
{
|
||||
string Username = 1;
|
||||
string Password = 2;
|
||||
int32 LoginType = 3; //登录方式
|
||||
int32 Region = 4; //登录地区,如果是注册,则必须传入
|
||||
}
|
||||
message A2C_LoginResponse // IResponse
|
||||
{
|
||||
string ToKen = 1;
|
||||
}
|
||||
|
||||
/// 客户端登录到Gate服务器
|
||||
message C2G_LoginRequest // IRequest,G2C_LoginResponse
|
||||
{
|
||||
string ToKen = 1;
|
||||
}
|
||||
message G2C_LoginResponse // IResponse
|
||||
{
|
||||
int64 RoleId = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// 通知客户端重复登录
|
||||
message G2C_RepeatLogin // IMessage
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
message C2Game_GetRoleInfoRequest // ICustomRouteRequest,Game2C_GetRoleInfoResponse,GameRoute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
message Game2C_GetRoleInfoResponse // ICustomRouteResponse
|
||||
{
|
||||
RoleInfo RoleInfo = 1; //账号信息
|
||||
string RoomCode = 2; //所在房间
|
||||
}
|
||||
85
Tools/NetworkProtocol/Outer/RoomMessage.proto
Normal file
85
Tools/NetworkProtocol/Outer/RoomMessage.proto
Normal file
@@ -0,0 +1,85 @@
|
||||
syntax = "proto3";
|
||||
package Fantasy.Network.Message;
|
||||
|
||||
|
||||
//************** 进入 离开 **********************
|
||||
///用户进入地图
|
||||
message Map2C_RoleEnterRoomNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
MapUnitInfo Info = 2;
|
||||
}
|
||||
|
||||
///用户离开地图
|
||||
message Map2C_RoleExitRoomNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1;//离开人员
|
||||
}
|
||||
|
||||
//************** 参数变化 **********************
|
||||
message C2Map_RolePropertyChange // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
repeated KeyValueInt64 Propertys = 1; //变化的属性信息
|
||||
}
|
||||
|
||||
///玩家状态变化同步
|
||||
message Map2C_RoleStateNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
UnitStateInfo State = 2;
|
||||
}
|
||||
|
||||
///玩家钓组变化
|
||||
message Map2C_RoleGearChangeNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
repeated GearInfo Gears = 2; //钓组数据
|
||||
}
|
||||
|
||||
//玩家属性值变化
|
||||
message Map2C_RolePropertyChangeNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1;
|
||||
repeated KeyValueInt64 Propertys = 2; //变化的属性信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
//************** 移动 旋转 **********************
|
||||
|
||||
// 角色移动
|
||||
message C2Map_Move // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
Vector3Info Position = 1; //当前位置
|
||||
Vector3Info Rotation = 2; //角色方向
|
||||
Vector3Info Direction = 3; // 移动方向
|
||||
bool IsStop = 4; // 是否是停止移动
|
||||
bool IsRun = 5;
|
||||
int64 Timestamp = 6; // 时间点
|
||||
}
|
||||
|
||||
// 角色朝向变化
|
||||
message C2Map_Look // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
Vector3Info Rotation = 1; //角色方向
|
||||
int64 Timestamp = 2; // 时间点
|
||||
}
|
||||
|
||||
///玩家移动推送
|
||||
message Map2C_MoveNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1; // id
|
||||
Vector3Info Position = 2; //当前位置
|
||||
Vector3Info Rotation = 3; //角色方向
|
||||
Vector3Info Direction = 4; // 移动方向
|
||||
bool IsStop = 5; // 是否停止移动
|
||||
bool IsRun = 6; //是否奔跑
|
||||
int64 Timestamp = 7; // 时间点
|
||||
}
|
||||
|
||||
///玩家旋转推送
|
||||
message Map2C_LookeNotify // ICustomRouteMessage,MapRoute
|
||||
{
|
||||
int64 Id = 1; // id
|
||||
Vector3Info Rotation = 2; //角色方向
|
||||
int64 Timestamp = 3; // 时间点
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user