diff --git a/DBLinks.cs b/DBLinks.cs index 66a9930..6d1810e 100644 --- a/DBLinks.cs +++ b/DBLinks.cs @@ -30,11 +30,11 @@ namespace _2chSQL using (var conn = new NpgsqlConnection(connString)) { - Console.Out.WriteLine("Opening connection"); + //Console.Out.WriteLine("Opening connection"); conn.Open(); - using (var command = new NpgsqlCommand("SELECT * FROM dvach", conn)) + using (var command = new NpgsqlCommand("SELECT post_id, substring(post,1,200) FROM dvach ORDER BY post_id DESC limit 20", conn)) { var reader = command.ExecuteReader(); @@ -42,7 +42,7 @@ namespace _2chSQL { Console.WriteLine( string.Format( - "Post ID {0}: ({1})", + " {0}: {1}", reader.GetInt32(0).ToString(), reader.GetString(1) //reader.GetString(2) @@ -72,7 +72,7 @@ namespace _2chSQL using (var conn = new NpgsqlConnection(connString)) { - Console.Out.WriteLine("Opening connection"); + //Console.Out.WriteLine("Opening connection"); conn.Open(); using (var command = new NpgsqlCommand("UPDATE dvach " + diff --git a/Program.cs b/Program.cs index 257498c..b99570c 100644 --- a/Program.cs +++ b/Program.cs @@ -7,16 +7,26 @@ namespace Driver { public class Program { - static void Main() + public static void ClearScreen() { + Console.Clear(); Console.WriteLine("Добро пожаловать на кибердвач! Введите команду 'list' чтобы показать все посты в треде, введите команду 'update' чтобы изменить содержимое поста, введите команду 'add' чтобы добавить пост"); Console.WriteLine("Введите Exit для выхода из программы"); + } + static void Main() + { + ClearScreen(); while (true) { string input = Console.ReadLine(); - if (input == "list") DBLinks.DbList(); - if (input == "upd") + if (input == "list") { + ClearScreen(); + DBLinks.DbList(); + } + if (input == "upd") + { + ClearScreen(); Console.WriteLine("Введите через знак $ номер поста и текст, который хотите туда сохранить"); string updline = Console.ReadLine(); string[] update = updline.Split('$'); @@ -27,6 +37,7 @@ namespace Driver } if(input == "add") { + ClearScreen(); Console.WriteLine("Напишите что-нибудь"); DBLinks.DbAdd(Console.ReadLine()); DBLinks.DbList(); diff --git a/bin/Debug/net6.0/2chSQL.dll b/bin/Debug/net6.0/2chSQL.dll index 0818dc1..4d68353 100644 Binary files a/bin/Debug/net6.0/2chSQL.dll and b/bin/Debug/net6.0/2chSQL.dll differ diff --git a/bin/Debug/net6.0/2chSQL.pdb b/bin/Debug/net6.0/2chSQL.pdb index 5268761..afc60a1 100644 Binary files a/bin/Debug/net6.0/2chSQL.pdb and b/bin/Debug/net6.0/2chSQL.pdb differ diff --git a/obj/Debug/net6.0/2chSQL.dll b/obj/Debug/net6.0/2chSQL.dll index 0818dc1..4d68353 100644 Binary files a/obj/Debug/net6.0/2chSQL.dll and b/obj/Debug/net6.0/2chSQL.dll differ diff --git a/obj/Debug/net6.0/2chSQL.pdb b/obj/Debug/net6.0/2chSQL.pdb index 5268761..afc60a1 100644 Binary files a/obj/Debug/net6.0/2chSQL.pdb and b/obj/Debug/net6.0/2chSQL.pdb differ diff --git a/obj/Debug/net6.0/ref/2chSQL.dll b/obj/Debug/net6.0/ref/2chSQL.dll index b2f3e36..211128f 100644 Binary files a/obj/Debug/net6.0/ref/2chSQL.dll and b/obj/Debug/net6.0/ref/2chSQL.dll differ diff --git a/obj/Debug/net6.0/refint/2chSQL.dll b/obj/Debug/net6.0/refint/2chSQL.dll index b2f3e36..211128f 100644 Binary files a/obj/Debug/net6.0/refint/2chSQL.dll and b/obj/Debug/net6.0/refint/2chSQL.dll differ