Skip to content
Snippets Groups Projects
Commit a4c37500 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Program.cs: Change `namespace ... {CODE}` to `namespace ...;`

parent f951eda5
Branches
No related tags found
No related merge requests found
......@@ -19,7 +19,8 @@ using Process = System.Diagnostics.Process;
using Config;
namespace i3csstatus {
namespace i3csstatus;
static class POSIX
{
[DllImport("libc", SetLastError = true)]
......@@ -30,6 +31,7 @@ namespace i3csstatus {
public static int EEXIST = 17;
public static int ERRNO { get => Marshal.GetLastPInvokeError();}
}
static class ProcesExtended
{
public static int KillBySignal(this Process p, int sig)
......@@ -37,6 +39,7 @@ namespace i3csstatus {
return POSIX.kill(p.Id, sig);
}
}
static class JsonExtended
{
public static JsonObject RemoveNull(this JsonObject o)
......@@ -52,6 +55,7 @@ namespace i3csstatus {
return o;
}
}
static class ColorToHexExtended
{
static public string ToHex(this Color c)
......@@ -59,13 +63,15 @@ namespace i3csstatus {
return $"#{c.R:X2}{c.G:X2}{c.B:X2}";
}
}
record Element(
string text,
string? short_text=null,
Color? color=null
);
#nullable restore
abstract class StatusBar
{
List<Module> modules = new();
......@@ -111,6 +117,8 @@ namespace i3csstatus {
public abstract void Schedule(int in_ms);
public abstract T GetGlobal<T>() where T: GlobalModuleResource, new();
}
class InnerStatusBar: StatusBar
{
StatusBar parrent;
......@@ -122,6 +130,8 @@ namespace i3csstatus {
public override void Schedule(int in_ms) => parrent.Schedule(in_ms);
public override T GetGlobal<T>() => parrent.GetGlobal<T>();
}
abstract class RootStatusBar: StatusBar
{
long nextRun = 0;
......@@ -195,6 +205,8 @@ namespace i3csstatus {
return (T)globalModuleResources[typeof(T)];
}
}
class StatusBarPlainText: RootStatusBar
{
public StatusBarPlainText(FileInfo configFile):base(configFile){}
......@@ -211,6 +223,8 @@ namespace i3csstatus {
w.WriteLine("");
}
}
class StatusBarTerminal: RootStatusBar
{
Thread inputThread;
......@@ -270,6 +284,8 @@ namespace i3csstatus {
w.WriteLine(json.ToJsonString(opt));
}
}
class Program
{
#pragma warning disable 1998
......@@ -311,4 +327,3 @@ namespace i3csstatus {
}
#pragma warning restore 1998
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment