Skip to content

Commit 592380c

Browse files
committed
i need to figure out how to upload releases through this
1 parent 92ffcbf commit 592380c

3 files changed

Lines changed: 249 additions & 33 deletions

File tree

Additions.cs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public void StartListening(string ChatRoom) {
338338

339339
while (true) {
340340
try {
341-
ChatContent = File.ReadLines(@"chats\"+ChatRoom+".txt").ToArray();
341+
ChatContent = File.ReadLines(ChatRoom+".txt").ToArray();
342342
} catch {
343343
Console.Write("");
344344
}
@@ -350,15 +350,25 @@ public void StartListening(string ChatRoom) {
350350
public class TextListener {
351351
private string TypedText;
352352
private int Pointer = 0;
353-
private bool EndProgram = false;
353+
private bool EnterPressed = false;
354+
private bool ESCPressed = false;
354355
private bool isListening = false;
355356
private Thread listeningThread;
356357
private readonly object lockObject = new object();
357358

358-
public void SetEndProgram(bool var) {
359+
public void SetEnterPressed(bool var) {
359360
Monitor.Enter(lockObject);
360361
try {
361-
EndProgram = var;
362+
EnterPressed = var;
363+
} finally {
364+
Monitor.Exit(lockObject);
365+
}
366+
}
367+
368+
public void SetESCPressed(bool var) {
369+
Monitor.Enter(lockObject);
370+
try {
371+
ESCPressed = var;
362372
} finally {
363373
Monitor.Exit(lockObject);
364374
}
@@ -382,10 +392,19 @@ public void SetPointer(int var) {
382392
}
383393
}
384394

385-
public bool GetEndProgram() {
395+
public bool GetEnterPressed() {
396+
Monitor.Enter(lockObject);
397+
try {
398+
return EnterPressed;
399+
} finally {
400+
Monitor.Exit(lockObject);
401+
}
402+
}
403+
404+
public bool GetESCPressed() {
386405
Monitor.Enter(lockObject);
387406
try {
388-
return EndProgram;
407+
return ESCPressed;
389408
} finally {
390409
Monitor.Exit(lockObject);
391410
}
@@ -417,7 +436,9 @@ public void StartListening() {
417436
if (Console.KeyAvailable) {
418437
var key = Console.ReadKey(true);
419438
if (key.Key == ConsoleKey.Enter) {
420-
SetEndProgram(true);
439+
SetEnterPressed(true);
440+
} else if (key.Key == ConsoleKey.Escape) {
441+
SetESCPressed(true);
421442
} else if (key.Key == ConsoleKey.Backspace && !string.IsNullOrEmpty(GetTypedText())) {
422443
Monitor.Enter(lockObject);
423444
try {

User.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,33 @@ public static string[][] All(string folder) {
474474

475475
return returnVal;
476476
}
477+
public static string[] Public() {
478+
if (!Directory.Exists("chatsPublic")) {
479+
Directory.CreateDirectory("chatsPublic");
480+
}
481+
if (!System.IO.File.Exists(@"chatsPublic\Main.txt")) {
482+
using (FileStream fs = File.Create(@"chatsPublic\Main.txt"))
483+
{
484+
// Add some text to file
485+
Byte[] title = new UTF8Encoding(true).GetBytes("");
486+
fs.Write(title, 0, title.Length);
487+
}
488+
// Open the stream and read it back.
489+
using (StreamWriter writer = new StreamWriter(@"chatsPublic\Main.txt"))
490+
{
491+
writer.WriteLine("Start Of Chat");
492+
}
493+
}
494+
FileInfo[] files = new DirectoryInfo("chatsPublic").GetFiles("*.txt");
495+
496+
string[] fileNames = new string[files.Length];
497+
498+
for (int i = 0; i < fileNames.Length; i++) {
499+
fileNames[i] = files[i].Name.Replace(".txt", "");
500+
}
501+
502+
return fileNames;
503+
}
477504
}
478505
public class Users
479506
{

0 commit comments

Comments
 (0)