Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using MySql;
- using MySql.Data.MySqlClient;
- using System.Threading.Tasks;
- namespace Test
- {
- class Program
- {
- public static string fileLoc = @"npc.txt";
- public static int counter = 0;
- public static string line;
- static void Main(string[] args)
- {
- //String name;
- #region start old
- //Console.WriteLine("Can You Enter Your Name :");
- //name = Console.ReadLine();
- // Console.WriteLine("Hallo " + name);
- // System.IO.StreamWriter file = new System.IO.StreamWriter(fileLoc);
- // file.WriteLine(name);
- // file.Close();
- #endregion
- WorkConsole();
- #region While Loop
- //while (number < 2)
- //{
- // Console.WriteLine(number);
- // number = number + 1;
- //}
- #endregion
- #region Do Loop
- //do
- //{
- // Console.WriteLine(number);
- // number = number + 1;
- //} while (number < 1000000);
- #endregion
- Console.ReadLine();
- }
- public static void CommandsAI(string command)
- {
- long number = 0;
- int contcase = 1;
- if (command == null)
- return;
- string[] data = command.Split('/');
- Console.WriteLine("What Do You Want? (enter /help for commands)");
- string input = Console.ReadLine();
- switch (input.ToLower())
- {
- case "/help":
- case "/Help":
- Console.WriteLine("/cerate : for cerate new npc");
- Console.WriteLine("/delete : for delete npc :( ");
- Console.WriteLine("/update : for update npc data");
- Console.WriteLine("/cerate 2 : for cerate new npc dialog");
- Console.WriteLine("/save : to save your work");
- Console.WriteLine("/view : for view npcs in npc.txt");
- Console.WriteLine("/exit : to save your work and exit");
- break;
- case "/view":
- System.IO.StreamReader file2 = new System.IO.StreamReader(fileLoc);
- while ((line = file2.ReadLine()) != null)
- {
- Console.WriteLine(line);
- counter++;
- }
- file2.Close();
- break;
- case "/open":
- DBConnect.OpenConnection();
- break;
- case "/close":
- DBConnect.CloseConnection();
- break;
- case "/exit":
- Environment.Exit(0);
- break;
- case "/cerate":
- DBConnect.Insert();
- break;
- case "/save":
- Console.WriteLine("Please Wait For 5s !");
- Console.WriteLine("all things has been saved!");
- do
- {
- Console.WriteLine(number);
- number = number + 1;
- } while (number < 15);
- break;
- case "/cerate2" :
- Console.WriteLine("Now, We Will Make A NPC Dialog");
- Console.WriteLine("ok enter npc region name");
- string npc_region = Console.ReadLine();
- Console.WriteLine("ok now enter npc Case");
- int npc_case = int.Parse(Console.ReadLine());
- Console.WriteLine("ok now enter npc Dialog Text");
- string npc_dialogtxt = Console.ReadLine();
- Console.WriteLine("ok now enter npc Dialog Option case " + contcase+ "");
- string npc_optionc1 = Console.ReadLine();
- String New_NPC = "#region" + npc_region + "@" + "case" + npc_case + ":" +"@"+ "{";
- New_NPC = New_NPC.Replace("@", "@" + System.Environment.NewLine);
- // New_NPC = New_NPC.Remove("@");
- Console.WriteLine("ok NPC Has Been Done ! ");
- System.IO.StreamWriter file = new System.IO.StreamWriter(fileLoc);
- file.WriteLine(New_NPC);
- file.Close();
- break;
- default:
- Console.WriteLine("I'm sorry, I don't understand that!");
- break;
- }
- }
- public static void WorkConsole()
- {
- while (true)
- {
- try
- {
- DBConnect.Initialize();
- CommandsAI(Console.ReadLine());
- }
- catch (Exception e) { Console.WriteLine(e); }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement