before restrucktur

This commit is contained in:
unknown
2025-06-09 19:01:41 +02:00
parent 467d6af393
commit 7e2c8d971d
36 changed files with 450 additions and 1016 deletions

View File

@@ -0,0 +1,10 @@
namespace ShadowStream.ObjecktForJason;
public class DBJason
{
public string name;
public string path;
public string type;
public string format;
public double duration;
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace ShadowStream.ObjecktForJason;
public class Jason_Writer
{
private readonly string _folderPath;
public Jason_Writer(string folderName = "Temp Data")
{
_folderPath = Path.Combine(Environment.CurrentDirectory, folderName);
if (!Directory.Exists(_folderPath))
Directory.CreateDirectory(_folderPath);
}
// Save one list of locJason objects to JSON file with given name
public async Task SaveList(string listName, List<locJason> list)
{
string filePath = Path.Combine(_folderPath, $"{listName}.json");
string jsonString = JsonConvert.SerializeObject(list, Formatting.Indented);
File.WriteAllText(filePath, jsonString);
}
// Load one list of locJason objects from JSON file with given name
public List<locJason> LoadList(string listName)
{
string filePath = Path.Combine(_folderPath, $"{listName}.json");
if (!File.Exists(filePath))
return new List<locJason>(); // Return empty list if file doesn't exist
string jsonString = File.ReadAllText(filePath);
return JsonConvert.DeserializeObject<List<locJason>>(jsonString) ?? new List<locJason>();
}
// Check if list file exists
public bool ListExists(string listName)
{
string filePath = Path.Combine(_folderPath, $"{listName}.json");
return File.Exists(filePath);
}
}

View File

@@ -0,0 +1,8 @@
namespace ShadowStream.ObjecktForJason;
public class locJason
{
public string path;
public string imageData;
public string type;
}