mirror of
https://github.com/tonytins/staggerpost.git
synced 2025-07-15 02:46:48 -04:00
Huge Refactor
- Cleaned up Program.cs by moving a lot of functions to their own classes - Renamed topics to community - Choosing a community is no longer optional with the switch to JSON - Added csharpier tool and reformttered all code
This commit is contained in:
parent
d91ff3352b
commit
188318c724
12 changed files with 396 additions and 382 deletions
98
Tracer.cs
98
Tracer.cs
|
@ -7,60 +7,60 @@ namespace StaggerPost;
|
|||
/// </summary>
|
||||
internal static class Tracer
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes a line of text to the console, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="content">The text to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void WriteLine(string content) =>
|
||||
Console.WriteLine(content);
|
||||
const string LOG = "[LOG]:";
|
||||
|
||||
/// <summary>
|
||||
/// Writes text to the console without a newline, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="content">The text to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Write(string content) =>
|
||||
Console.Write(content);
|
||||
/// <summary>
|
||||
/// Writes a line of text to the console, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="content">The text to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void LogLine(string content) => Console.WriteLine($"{LOG} {content}");
|
||||
|
||||
/// <summary>
|
||||
/// Writes multiple lines of text to the console, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="contents">A collection of text lines to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void WriteLine(IEnumerable<string> contents)
|
||||
{
|
||||
foreach (var content in contents)
|
||||
{
|
||||
Console.WriteLine(content);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Writes text to the console without a newline, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="content">The text to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Log(string content) => Console.Write($"{LOG} {content}");
|
||||
|
||||
/// <summary>
|
||||
/// Writes multiple text entries to the console without newlines, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="contents">A collection of text entries to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Write(IEnumerable<string> contents)
|
||||
{
|
||||
foreach (var content in contents)
|
||||
{
|
||||
Console.Write(content);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Writes multiple lines of text to the console, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="contents">A collection of text lines to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void LogLine(IEnumerable<string> contents)
|
||||
{
|
||||
foreach (var content in contents)
|
||||
{
|
||||
Console.WriteLine($"{LOG} {content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current working directory in DEBUG mode or the application's base directory in release mode.
|
||||
/// </summary>
|
||||
internal static string AppDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes multiple text entries to the console without newlines, but only when in DEBUG mode.
|
||||
/// </summary>
|
||||
/// <param name="contents">A collection of text entries to write to the console.</param>
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Log(IEnumerable<string> contents)
|
||||
{
|
||||
foreach (var content in contents)
|
||||
{
|
||||
Console.Write($"{LOG} {content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current working directory in DEBUG mode or the application's base directory in release mode.
|
||||
/// </summary>
|
||||
internal static string AppDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return Directory.GetCurrentDirectory();
|
||||
return Directory.GetCurrentDirectory();
|
||||
#else
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue