faster socket, clean up on plugin

This commit is contained in:
Michal Courson
2026-02-26 17:38:50 -05:00
parent ad07bf7fe6
commit 8c83819a17
16 changed files with 74 additions and 513 deletions

View File

@ -10,28 +10,6 @@ using Newtonsoft.Json.Linq;
namespace ClipTrimDotNet
{
public class FileEntry
{
public FileEntry()
{
Volume = 1.0;
Playtype = "Play/Overlap";
}
[JsonProperty(PropertyName = "Volume")]
public double Volume { get; set; }
[JsonProperty(PropertyName = "Playtype")]
public string Playtype { get; set; }
}
public class CollectionEntry
{
public CollectionEntry()
{
Files = new Dictionary<string, FileEntry>();
}
[JsonProperty(PropertyName = "Files")]
public Dictionary<string, FileEntry> Files { get; set; }
}
public class GlobalSettings
{
public static GlobalSettings? _inst;
@ -50,59 +28,18 @@ namespace ClipTrimDotNet
public static GlobalSettings CreateDefaultSettings()
{
GlobalSettings instance = new GlobalSettings();
instance.BasePath = null;
instance.ProfileName = null;
instance.Collections = new Dictionary<string, CollectionEntry>();
return instance;
}
[FilenameProperty]
[JsonProperty(PropertyName = "basePath")]
public string? BasePath { get; set; }
[JsonProperty(PropertyName = "profileName")]
public string? ProfileName { get; set; }
[JsonProperty(PropertyName = "outputDevice")]
public string? OutputDevice { get; set; }
[JsonProperty(PropertyName = "collections")]
public Dictionary<string, CollectionEntry> Collections { get; set; }
public void SetCurrentProfile(string profile)
{
ProfileName = profile;
if(!Collections.ContainsKey(profile))
{
Collections.Add(profile, new CollectionEntry());
}
}
public FileEntry GetFileOptionsInCurrentProfile(string filename)
{
if(!Collections.TryGetValue(ProfileName, out CollectionEntry collection))
{
return new FileEntry();
}
if(!collection.Files.TryGetValue(filename, out FileEntry file))
{
return new FileEntry();
}
//Logger.Instance.LogMessage(TracingLevel.INFO, "fetched file settings " + filename + JsonConvert.SerializeObject(file));
return file;
}
public void SetFileOptionsCurrentProfile(string filename, FileEntry file)
{
//Logger.Instance.LogMessage(TracingLevel.INFO, "SetFileOptionsCurrentProfile ");
if (!Collections.TryGetValue(ProfileName, out CollectionEntry collection))
{
return;
}
//Logger.Instance.LogMessage(TracingLevel.INFO, "SetFileOptionsCurrentProfile 2");
//collection.Files[filename] = file;
Collections[ProfileName].Files[filename] = file;
}
}
}