Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad2e074991 | |||
| dc7ddc0c6c | |||
| 5459eac680 |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
SzCli/bin/
|
||||||
|
SzCli/obj/
|
||||||
|
SzLib/bin/
|
||||||
|
SzLib/obj/
|
||||||
34
SzCli/LocalFileManager.cs
Normal file
34
SzCli/LocalFileManager.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using SzLib;
|
||||||
|
|
||||||
|
namespace SzCli;
|
||||||
|
|
||||||
|
public class LocalFileManager : ISzFileManager
|
||||||
|
{
|
||||||
|
public string DataPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data");
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SaveFile(string path, string fileContent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(path, fileContent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error saving file: {e.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,2 +1,26 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
using System;
|
||||||
Console.WriteLine("Hello, World!");
|
using SzLib;
|
||||||
|
|
||||||
|
namespace SzCli;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var parser = new SzParser(new LocalFileManager());
|
||||||
|
|
||||||
|
Console.WriteLine("Creating test dataset...");
|
||||||
|
var dataset = Test.CreateTestDataset();
|
||||||
|
Console.WriteLine($"Successfully created test dataset with id {dataset.Id}");
|
||||||
|
|
||||||
|
Console.WriteLine("Attempting to save dataset...");
|
||||||
|
var saved = parser.SaveDataset(dataset);
|
||||||
|
Console.WriteLine($"Successfully saved dataset? {saved}");
|
||||||
|
|
||||||
|
Console.WriteLine("Attempting to load dataset...");
|
||||||
|
var loadedDataset = parser.LoadDataset(dataset.Id);
|
||||||
|
Console.WriteLine($"Successfully loaded dataset? {loadedDataset != null}. Id is {loadedDataset.Id}");
|
||||||
|
|
||||||
|
Console.WriteLine(loadedDataset.DataObjects["test"].Fields["value"].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
SzCli/Test.cs
Normal file
36
SzCli/Test.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using SzLib.DataObjects;
|
||||||
|
|
||||||
|
namespace SzCli;
|
||||||
|
|
||||||
|
public static class Test
|
||||||
|
{
|
||||||
|
public static SzDataset CreateTestDataset()
|
||||||
|
{
|
||||||
|
var ds = new SzDataset()
|
||||||
|
{
|
||||||
|
Name = "TestDataset",
|
||||||
|
Id = "test-dataset",
|
||||||
|
DataObjectTemplateId = "0",
|
||||||
|
DataObjectType = "item",
|
||||||
|
Uuid = Guid.NewGuid(),
|
||||||
|
};
|
||||||
|
|
||||||
|
var testDataObject = new SzDataObject()
|
||||||
|
{
|
||||||
|
Name = "TestObject",
|
||||||
|
Id = "test",
|
||||||
|
};
|
||||||
|
|
||||||
|
var testField = new SzField()
|
||||||
|
{
|
||||||
|
Id = "value",
|
||||||
|
FieldType = SzFieldType.Number,
|
||||||
|
Value = "200"
|
||||||
|
};
|
||||||
|
|
||||||
|
testDataObject.Fields.Add(testField.Id, testField);
|
||||||
|
ds.DataObjects.Add(testDataObject.Id, testDataObject);
|
||||||
|
|
||||||
|
return ds;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = "")]
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SzCli")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0a91734a27836b548e422e7f53f42a86a6e65aa0")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("SzCli")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("SzCli")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
c84592cdeb0dc4a761e7751dfbf7a0fd24d31f7e0652aede57d423374036e623
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.TargetFramework = net8.0
|
|
||||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
|
||||||
build_property.TargetFrameworkVersion = v8.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = SzCli
|
|
||||||
build_property.ProjectDir = /data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// <auto-generated/>
|
|
||||||
global using System;
|
|
||||||
global using System.Collections.Generic;
|
|
||||||
global using System.IO;
|
|
||||||
global using System.Linq;
|
|
||||||
global using System.Net.Http;
|
|
||||||
global using System.Threading;
|
|
||||||
global using System.Threading.Tasks;
|
|
||||||
Binary file not shown.
@@ -1,142 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj",
|
|
||||||
"projectName": "SzCli",
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj",
|
|
||||||
"packagesPath": "/home/chris/.nuget/packages/",
|
|
||||||
"outputPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/chris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/usr/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj": {
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Ref",
|
|
||||||
"version": "[8.0.22, 8.0.22]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"projectName": "SzLib",
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"packagesPath": "/home/chris/.nuget/packages/",
|
|
||||||
"outputPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/chris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/usr/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Ref",
|
|
||||||
"version": "[8.0.22, 8.0.22]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/chris/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/chris/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/home/chris/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {
|
|
||||||
"SzLib/1.0.0": {
|
|
||||||
"type": "project",
|
|
||||||
"framework": ".NETCoreApp,Version=v8.0",
|
|
||||||
"compile": {
|
|
||||||
"bin/placeholder/SzLib.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"bin/placeholder/SzLib.dll": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"SzLib/1.0.0": {
|
|
||||||
"type": "project",
|
|
||||||
"path": "../SzLib/SzLib.csproj",
|
|
||||||
"msbuildProject": "../SzLib/SzLib.csproj"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": [
|
|
||||||
"SzLib >= 1.0.0"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/home/chris/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj",
|
|
||||||
"projectName": "SzCli",
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj",
|
|
||||||
"packagesPath": "/home/chris/.nuget/packages/",
|
|
||||||
"outputPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/chris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/usr/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj": {
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Ref",
|
|
||||||
"version": "[8.0.22, 8.0.22]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "ca9xSR6LgAg=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzCli/SzCli.csproj",
|
|
||||||
"expectedPackageFiles": [
|
|
||||||
"/home/chris/.nuget/packages/microsoft.aspnetcore.app.ref/8.0.22/microsoft.aspnetcore.app.ref.8.0.22.nupkg.sha512"
|
|
||||||
],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@ namespace SzLib.DataObjects;
|
|||||||
|
|
||||||
public class SzDataObject
|
public class SzDataObject
|
||||||
{
|
{
|
||||||
public required string Name;
|
public required string Name {get; set;}
|
||||||
public required string Id;
|
public required string Id {get; set;}
|
||||||
public Dictionary<string, SzField> Fields = [];
|
public Dictionary<string, SzField> Fields {get; set;} = [];
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,9 @@ namespace SzLib.DataObjects;
|
|||||||
|
|
||||||
public class SzDataObjectTemplate
|
public class SzDataObjectTemplate
|
||||||
{
|
{
|
||||||
public required string Name;
|
public required string Name {get; set;}
|
||||||
public required string Id;
|
public required string Id {get; set;}
|
||||||
public Guid? Uuid;
|
public Guid? Uuid {get; set;}
|
||||||
public required string DataObjectType;
|
public required string DataObjectType {get; set;}
|
||||||
public Dictionary<string, SzTemplateField> TemplateFields = [];
|
public Dictionary<string, SzTemplateField> TemplateFields {get; set;} = [];
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,11 @@ namespace SzLib.DataObjects;
|
|||||||
|
|
||||||
public class SzDataset
|
public class SzDataset
|
||||||
{
|
{
|
||||||
public required string Name;
|
public required string Name {get; set;}
|
||||||
public required string Id;
|
public required string Id {get; set;}
|
||||||
public Guid? Uuid;
|
public Guid? Uuid {get; set;}
|
||||||
|
|
||||||
public required string DataObjectType;
|
public required string DataObjectType {get; set;}
|
||||||
public required string DataObjectTemplateId;
|
public required string DataObjectTemplateId {get; set;}
|
||||||
public Dictionary<string, SzDataObject> DataObjects = [];
|
public Dictionary<string, SzDataObject> DataObjects {get; set;} = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ namespace SzLib.DataObjects;
|
|||||||
|
|
||||||
public class SzField
|
public class SzField
|
||||||
{
|
{
|
||||||
public required string Id;
|
public required string Id {get; set;}
|
||||||
public required SzFieldType FieldType;
|
public required SzFieldType FieldType {get; set;}
|
||||||
public bool IsList = false;
|
public bool IsList {get; set;} = false;
|
||||||
public string Value = "";
|
public string Value {get; set;} = "";
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,10 @@ namespace SzLib.DataObjects;
|
|||||||
|
|
||||||
public class SzTemplateField
|
public class SzTemplateField
|
||||||
{
|
{
|
||||||
public required string Name;
|
public required string Name {get; set;}
|
||||||
public required string Id;
|
public required string Id {get; set;}
|
||||||
public bool IsList = false;
|
public bool IsList {get; set;} = false;
|
||||||
public string DefaultValue = "";
|
public string DefaultValue {get; set;} = "";
|
||||||
public bool IsSpecialType = false;
|
public bool IsSpecialType {get; set;} = false;
|
||||||
public string SpecialTypeValue = "";
|
public string SpecialTypeValue {get; set;} = "";
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,7 @@ namespace SzLib;
|
|||||||
|
|
||||||
public interface ISzFileManager
|
public interface ISzFileManager
|
||||||
{
|
{
|
||||||
public Path DataPath {get; set;}
|
public string DataPath {get;}
|
||||||
|
|
||||||
|
public bool SaveFile(string path, string fileContent);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,73 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using SzLib.DataObjects;
|
||||||
|
|
||||||
namespace SzLib;
|
namespace SzLib;
|
||||||
|
|
||||||
public class SzParser(ISzFileManager szFileManager)
|
public class SzParser(ISzFileManager szFileManager)
|
||||||
{
|
{
|
||||||
public readonly ISzFileManager FileManager = szFileManager;
|
private readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true };
|
||||||
}
|
|
||||||
|
public string SerializeDatasetToJson(SzDataset dataset)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var jsonString = JsonSerializer.Serialize(dataset, _jsonOptions);
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
catch (JsonException e)
|
||||||
|
{
|
||||||
|
throw new Exception("Parse Error: " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SzDataset? DeserializeDataset(string jsonString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = JsonSerializer.Deserialize<SzDataset>(jsonString, _jsonOptions);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception("Could not deserialize JSON to type SzDataset: " + e.Message, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SaveDataset(SzDataset dataset)
|
||||||
|
{
|
||||||
|
var datasetDir = Path.Combine(szFileManager.DataPath, "datasets", dataset.Id);
|
||||||
|
Directory.CreateDirectory(datasetDir);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = SerializeDatasetToJson(dataset);
|
||||||
|
File.WriteAllText(Path.Combine(datasetDir, "dataset.json"), json);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error saving dataset: " + e.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SzDataset? LoadDataset(string datasetId)
|
||||||
|
{
|
||||||
|
var datasetPath = Path.Combine(szFileManager.DataPath, "datasets", datasetId, "dataset.json");
|
||||||
|
if (!File.Exists(datasetPath))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Dataset not found: " + datasetId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DeserializeDataset(File.ReadAllText(datasetPath));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error loading dataset: {e.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = "")]
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SzLib")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0a91734a27836b548e422e7f53f42a86a6e65aa0")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("SzLib")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("SzLib")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
c4fac1ee3ada9b23fef8f772fe12079089fe1f0f9fd88ed354bd91dd8a45b58a
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.TargetFramework = net8.0
|
|
||||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
|
||||||
build_property.TargetFrameworkVersion = v8.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = SzLib
|
|
||||||
build_property.ProjectDir = /data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// <auto-generated/>
|
|
||||||
global using System;
|
|
||||||
global using System.Collections.Generic;
|
|
||||||
global using System.IO;
|
|
||||||
global using System.Linq;
|
|
||||||
global using System.Net.Http;
|
|
||||||
global using System.Threading;
|
|
||||||
global using System.Threading.Tasks;
|
|
||||||
Binary file not shown.
@@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"projectName": "SzLib",
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"packagesPath": "/home/chris/.nuget/packages/",
|
|
||||||
"outputPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/chris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/usr/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Ref",
|
|
||||||
"version": "[8.0.22, 8.0.22]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/chris/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/chris/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/home/chris/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net8.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net8.0": []
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/home/chris/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"projectName": "SzLib",
|
|
||||||
"projectPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"packagesPath": "/home/chris/.nuget/packages/",
|
|
||||||
"outputPath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/chris/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net8.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/usr/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net8.0": {
|
|
||||||
"targetAlias": "net8.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"downloadDependencies": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.AspNetCore.App.Ref",
|
|
||||||
"version": "[8.0.22, 8.0.22]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/8.0.416/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "rw6Dqopfnh8=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/data/Projects/bellsworne/sessionzero/SessionZeroCS/SessionZero/SzLib/SzLib.csproj",
|
|
||||||
"expectedPackageFiles": [
|
|
||||||
"/home/chris/.nuget/packages/microsoft.aspnetcore.app.ref/8.0.22/microsoft.aspnetcore.app.ref.8.0.22.nupkg.sha512"
|
|
||||||
],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user