Keep the files in N1MM's folders
The folders under the user's own directory are N1MM's now, with N1MM's names, read out of N1MMLibrary.dll: Databases, SupportFiles, UserDefinedContests, FunctionKeyMessages, CallHistoryFiles, ExportFiles, GoalFiles, LettersFiles, QsoRecording, SkinsAndLayouts, SystemFiles, TransactionLogFiles, Diagnostics and Wav. A station that runs both programs keeps its files in one shape. An operator's recordings go in Wav/<his callsign>, which is where N1MM plays them from, and the folder is made when he takes the radio. Cabrillo and ADIF start in ExportFiles, call history files in CallHistoryFiles, and the .mc function key files in FunctionKeyMessages. N1MM's three *DDL folders and its Piper folders are left out: they hold the migrations for N1MM's own admin databases and the program it speaks with. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
@@ -2,6 +2,13 @@ namespace Nonemm.App.Configuration;
|
||||
|
||||
/// Where the operator's files live. Windows keeps them under Documents the way
|
||||
/// N1MM does; everywhere else follows the XDG configuration directory.
|
||||
///
|
||||
/// The folders inside are N1MM's own, with N1MM's names, so a station that runs
|
||||
/// both programs keeps its files in the same shape: `Wav/<operator>/Cq.wav` is
|
||||
/// where N1MM looks for that operator's recordings, and so is this. N1MM's
|
||||
/// three `*DDL` folders and its `Piper` folders are left out: those hold the
|
||||
/// migrations for N1MM's own admin databases and the program it speaks with,
|
||||
/// and neither has anything to do with a log.
|
||||
public sealed class UserPaths
|
||||
{
|
||||
public UserPaths(string root)
|
||||
@@ -10,6 +17,17 @@ public sealed class UserPaths
|
||||
Databases = Path.Combine(root, "Databases");
|
||||
UserDefinedContests = Path.Combine(root, "UserDefinedContests");
|
||||
SupportFiles = Path.Combine(root, "SupportFiles");
|
||||
FunctionKeyMessages = Path.Combine(root, "FunctionKeyMessages");
|
||||
CallHistoryFiles = Path.Combine(root, "CallHistoryFiles");
|
||||
ExportFiles = Path.Combine(root, "ExportFiles");
|
||||
GoalFiles = Path.Combine(root, "GoalFiles");
|
||||
LettersFiles = Path.Combine(root, "LettersFiles");
|
||||
QsoRecording = Path.Combine(root, "QsoRecording");
|
||||
SkinsAndLayouts = Path.Combine(root, "SkinsAndLayouts");
|
||||
SystemFiles = Path.Combine(root, "SystemFiles");
|
||||
TransactionLogFiles = Path.Combine(root, "TransactionLogFiles");
|
||||
Diagnostics = Path.Combine(root, "Diagnostics");
|
||||
Wav = Path.Combine(root, "Wav");
|
||||
}
|
||||
|
||||
public static UserPaths Default() => new(DefaultRoot());
|
||||
@@ -22,6 +40,38 @@ public sealed class UserPaths
|
||||
|
||||
public string SupportFiles { get; }
|
||||
|
||||
/// The `.mc` function key files, which N1MM imports and exports here.
|
||||
public string FunctionKeyMessages { get; }
|
||||
|
||||
public string CallHistoryFiles { get; }
|
||||
|
||||
/// Cabrillo and ADIF, in and out.
|
||||
public string ExportFiles { get; }
|
||||
|
||||
/// N1MM's rate targets, its letter and number recordings, its recorded
|
||||
/// contacts, its window layouts, its own settings files, its transaction
|
||||
/// logs and its traces. Nothing here writes to them yet; they are made so
|
||||
/// that a station that keeps files in them does not lose them when it moves
|
||||
/// between the two programs.
|
||||
public string GoalFiles { get; }
|
||||
|
||||
public string LettersFiles { get; }
|
||||
|
||||
public string QsoRecording { get; }
|
||||
|
||||
public string SkinsAndLayouts { get; }
|
||||
|
||||
public string SystemFiles { get; }
|
||||
|
||||
public string TransactionLogFiles { get; }
|
||||
|
||||
public string Diagnostics { get; }
|
||||
|
||||
/// The voice keyer's recordings. Each operator has a folder of his own
|
||||
/// under it, named for his callsign, which is how N1MM finds the voice of
|
||||
/// whoever is at the microphone.
|
||||
public string Wav { get; }
|
||||
|
||||
public string SettingsFile => Path.Combine(Root, "settings.json");
|
||||
|
||||
public string CountryFile => Path.Combine(SupportFiles, "wl_cty.dat");
|
||||
@@ -32,14 +82,42 @@ public sealed class UserPaths
|
||||
/// from so a later version can read more out of it.
|
||||
public string ClusterListFile => Path.Combine(SupportFiles, "cluster-list.html");
|
||||
|
||||
/// One operator's recordings: `Wav/OM3KFF/Cq.wav` and the rest. Without an
|
||||
/// operator the folder itself is the answer, which is where a station with
|
||||
/// one operator keeps them.
|
||||
public string WavFor(string operatorCallsign) =>
|
||||
operatorCallsign.Trim().Length == 0
|
||||
? Wav
|
||||
: Path.Combine(Wav, operatorCallsign.Trim().ToUpperInvariant());
|
||||
|
||||
public void CreateFolders()
|
||||
{
|
||||
Directory.CreateDirectory(Root);
|
||||
Directory.CreateDirectory(Databases);
|
||||
Directory.CreateDirectory(UserDefinedContests);
|
||||
Directory.CreateDirectory(SupportFiles);
|
||||
foreach (string folder in All())
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
}
|
||||
|
||||
/// Every folder that is made at startup, the root first.
|
||||
public IReadOnlyList<string> All() =>
|
||||
[
|
||||
Root,
|
||||
Databases,
|
||||
UserDefinedContests,
|
||||
SupportFiles,
|
||||
FunctionKeyMessages,
|
||||
CallHistoryFiles,
|
||||
ExportFiles,
|
||||
GoalFiles,
|
||||
LettersFiles,
|
||||
QsoRecording,
|
||||
SkinsAndLayouts,
|
||||
SystemFiles,
|
||||
TransactionLogFiles,
|
||||
Diagnostics,
|
||||
Wav,
|
||||
];
|
||||
|
||||
private static string DefaultRoot() =>
|
||||
OperatingSystem.IsWindows()
|
||||
? Path.Combine(
|
||||
|
||||
Reference in New Issue
Block a user