mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
Intoduced project
This commit is contained in:
7
Transformation-2023-9-15/.vscode/launch.json
vendored
Normal file
7
Transformation-2023-9-15/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": []
|
||||
}
|
||||
40
Transformation-2023-9-15/Program.cs
Normal file
40
Transformation-2023-9-15/Program.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
const string XML_PATH = "D:/Simon/source/hamann-xml/transformations_2023-9-14_test/";
|
||||
const string GIT_PATH = "../../hamann-xml/";
|
||||
const string BRANCH_NAME = "testdata";
|
||||
|
||||
if (File.Exists(GIT_PATH + ".git/HEAD") || !Directory.Exists(XML_PATH)) {
|
||||
var text = File.ReadAllText(GIT_PATH + ".git/HEAD").Trim();
|
||||
if (!text.EndsWith(BRANCH_NAME)) {
|
||||
throw new("Not it the Branch " + BRANCH_NAME);
|
||||
}
|
||||
} else {
|
||||
throw new("Specified Paths do not exist");
|
||||
}
|
||||
|
||||
var xmls = Directory.GetFiles(XML_PATH, "*.xml");
|
||||
|
||||
if (xmls == null || !xmls.Any()) {
|
||||
throw new("No XML Data fonund!");
|
||||
}
|
||||
|
||||
List<(string, XDocument)> Documents = new();
|
||||
|
||||
foreach (var f in xmls) {
|
||||
Documents.Add((f, XDocument.Load(f, LoadOptions.PreserveWhitespace)));
|
||||
Console.WriteLine("" + f);
|
||||
}
|
||||
|
||||
|
||||
void SaveHamannFile(XElement element, string basefilepath, string oldfile) {
|
||||
var filename = "hamann_" + ".xml";
|
||||
var path = Path.Combine(basefilepath, filename);
|
||||
|
||||
if (!Directory.Exists(basefilepath))
|
||||
Directory.CreateDirectory(basefilepath);
|
||||
using (var targetStream = System.IO.File.Create(path))
|
||||
element.Save(targetStream, SaveOptions.DisableFormatting);
|
||||
|
||||
}
|
||||
11
Transformation-2023-9-15/Transformation-2023-9-15.csproj
Normal file
11
Transformation-2023-9-15/Transformation-2023-9-15.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>Transformation_2023_9_15</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user