1
This commit is contained in:
47
IDIS.YL106.Model/Src/Program.cs
Normal file
47
IDIS.YL106.Model/Src/Program.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using IDIS.Model;
|
||||
using IDIS.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IDIS.YL106.Model;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
var list = new List<IDIS_Model>
|
||||
{
|
||||
new Data_Oder(),
|
||||
new Object_Equipment(),
|
||||
new Object_Material(),
|
||||
new Object_Product(),
|
||||
new Procedure_Assembly(),
|
||||
new Procedure_Transport()
|
||||
};
|
||||
|
||||
var currentDirectory = Environment.CurrentDirectory;
|
||||
#if DEBUG
|
||||
currentDirectory = new DirectoryInfo(currentDirectory).Parent!.Parent!.Parent?.FullName!;
|
||||
#endif
|
||||
currentDirectory = Path.Combine(currentDirectory, "Samples");
|
||||
|
||||
Console.WriteLine("生成的样本将保存于: " + currentDirectory);
|
||||
|
||||
new DirectoryInfo(currentDirectory).Create();
|
||||
foreach (var x in list)
|
||||
{
|
||||
var templatePath = Path.Combine(currentDirectory, $"{x.GetType().Name}_Template.json");
|
||||
var registerPath = Path.Combine(currentDirectory, $"{x.GetType().Name}_Register.json");
|
||||
var registerData = new IDIS_Register_Data
|
||||
{
|
||||
Handle = $"88.123.99/{DateTime.Now.Ticks}",
|
||||
TemplateVersion = "Template-1.0.0",
|
||||
Value = x.AsValueInfo()
|
||||
};
|
||||
File.WriteAllText(templatePath,JsonConvert.SerializeObject(x.AsTemplate(),Formatting.Indented));
|
||||
File.WriteAllText(registerPath,JsonConvert.SerializeObject(registerData,Formatting.Indented));
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"生成了{x.GetType().Name}的样本,模板保存于\n{templatePath},注册数据保存于\n{registerPath}");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user