Skip to content

Commit

Permalink
Merge pull request #84 from AZProductions/0.7.5_pre-5_1
Browse files Browse the repository at this point in the history
Added `Conf.txt`, instad of static `FR.txt`. New settings.
  • Loading branch information
KookaburraShell committed Jul 30, 2021
2 parents c66e61d + ef562ec commit 6274512
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/Isettingsconf.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace KookaburraShell
namespace KookaburraShell
{
class Isettingsconf
{
Expand All @@ -8,9 +8,9 @@ class Isettingsconf
public static bool Networkkey { get; set; }
public static bool Quietmode { get; set; }
public static string Envloc { get; set; }
// Env loc of the running file.
public static int SavedHeight { get; set; }
public static int SavedWidth { get; set; }
public static bool EasterEgg1 { get; set; }
public static bool ShowRainbow { get; set; }
public static bool FR { get; set; }
}
}
138 changes: 117 additions & 21 deletions src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Spectre.Console;
using Spectre.Console;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -43,7 +43,13 @@ static void Main(string[] args)
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("to read the Terms of Service.");
Console.WriteLine("");
if (!File.Exists(Isettingsconf.Envloc + @"\FR.txt"))
try
{
string[] vs = File.ReadAllLines(Isettingsconf.Envloc + @"\conf.txt");
foreach (string Lines in vs) { if (Lines == "FR=true") { Isettingsconf.FR = true; } }
}
catch { Isettingsconf.FR = true; /*Revert to default, shows FR.*/ }
if (Isettingsconf.FR)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write("Type ");
Expand All @@ -67,7 +73,7 @@ static void Main(string[] args)
bool validcommandfound = false;
if (Isettingsconf.Currentdir == "")
{
if (Isettingsconf.EasterEgg1 == true)
if (Isettingsconf.ShowRainbow == true)
{
AnsiConsole.Markup("[orange1]K[/][yellow1]o[/][greenyellow]o[/][lime]k[/][aqua]a[/][turquoise2]b[/][blue]u[/][hotpink_1]r[/][deeppink2]r[/][red]a[/][blue]@[/][white]>[/]");
}
Expand Down Expand Up @@ -1489,18 +1495,114 @@ void SpeedClear()
void packagecheck()
{
bool Errormsg = false;
// Build Counter
/* try
{
string lines = System.IO.File.ReadAllText(@"D:\Projects\Kookaburra\builds.txt");
int result = Int16.Parse(lines);
result++;
File.WriteAllText(@"D:\Projects\Kookaburra\builds.txt", result.ToString());
}
catch { }*/
if (Directory.Exists(Isettingsconf.Envloc)) { }
else { try { Directory.CreateDirectory(Isettingsconf.Envloc); } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Restart with admin priviliges."); } }

string path4 = Isettingsconf.Envloc + @"\conf.txt";
if (!File.Exists(path4))
{
try
{
using (StreamWriter sw = File.CreateText(path4))
{
sw.WriteLine("# KookaburraShell - Conf.txt");
sw.WriteLine("show_startup=true");
sw.WriteLine("startup_location=default");
//sw.WriteLine("startup_message=null");
sw.WriteLine("FR=true");
}
}
catch
{
if (!Errormsg)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write("[");
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write("Note");
Console.ForegroundColor = ConsoleColor.White;
Console.Write("] ");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("To finish setting up Kookaburra, Please restart it as administrator.");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Failed to Create/Write text_editor.txt");
// make white-space between input and info
Console.WriteLine("");
Errormsg = true;
}
}
} //Todo, add conf.txt

try
{
Console.ForegroundColor = ConsoleColor.White;
string[] vs = File.ReadAllLines(path4);
foreach (string Lines in vs)
{
if (Lines.StartsWith("#")) { }
else if (Lines.StartsWith("show_startup="))
{
string result = Lines.Replace("show_startup=", "");
if (result == "true") {/*TODO*/ }
else if (result == "false") {/*TODO*/}
else
{
Console.WriteLine("error");
}
}
else if (Lines.StartsWith("startup_location="))
{
string result = Lines.Replace("startup_location=", "");
if (File.Exists(result))
{
Isettingsconf.Envloc = result;
}
else if (result == "default") { }
else
{
Console.WriteLine("error");
}
}
else if (Lines.StartsWith("FR="))
{
string result = Lines.Replace("FR=", "");
if (result == "true")
{
string text = File.ReadAllText(path4);
text = text.Replace("FR=true", "FR=false");
File.WriteAllText(path4, text);
Isettingsconf.FR = true;
}
else
{
Isettingsconf.FR = false;
}
}
else { Console.WriteLine("error"); }
}
}
catch
{
if (!Errormsg)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write("[");
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write("Note");
Console.ForegroundColor = ConsoleColor.White;
Console.Write("] ");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("To finish setting up Kookaburra, Please restart it as administrator.");
Console.ForegroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Failed to Create/Write text_editor.txt");
// make white-space between input and info
Console.WriteLine("");
Errormsg = true;
}
}

string path2 = Isettingsconf.Envloc + @"\text_editor.txt";
if (!File.Exists(path2))
{
Expand Down Expand Up @@ -1540,12 +1642,6 @@ void packagecheck()
}
}

string path3 = Isettingsconf.Envloc + @"\FR.txt";
if (!File.Exists(path3))
{
File.Create(path3);
}


string path = Isettingsconf.Envloc + @"\custom_commands.txt";
if (!File.Exists(path))
Expand Down Expand Up @@ -2605,9 +2701,9 @@ void Checkenvironment()
DateTime d2 = new DateTime(DateTime.Now.Year, 6, DateTime.Now.Day);
if (d1 == d2)
{
Isettingsconf.EasterEgg1 = true;
Isettingsconf.ShowRainbow = true;
}
else { Isettingsconf.EasterEgg1 = false; }
else { Isettingsconf.ShowRainbow = false; }
}

void Debuger()
Expand All @@ -2622,4 +2718,4 @@ void Debuger()
}
}
}
}
}

0 comments on commit 6274512

Please sign in to comment.