private void Awake() { l = GameObject.Find("S&L").GetComponent <L_>(); s = GameObject.Find("S&L").GetComponent <S_>(); me = GetComponent <Button>(); if (!l.loadMarblesID.Contains(IDCalibration)) { gameObject.SetActive(false); } }
void Awake() { l = GameObject.Find("S&L").GetComponent <L_>(); s = GameObject.Find("S&L").GetComponent <S_>(); money = int.Parse(Money.text); me = GetComponent <Button>(); foreach (var marbles in l.loadMarblesID) { if (marbles == IDCalibration) { me.interactable = false; } } }
//static Socket clientSocket; public static void Main(string[] args) { //byte[] bytes = { 0,1 }; //forward_to(bytes); //Console.WriteLine("x"); //Console.ReadKey(); string ip = "127.0.0.1"; for (Int32 i = 3700; i < 3720; i++) { Console.Title = ("Initialization..."); try { en_thd = true; Thread myThread = new Thread(() => clientconnection(ip, i)); myThread.Name = ("T" + i); threads_list.Add(myThread); myThread.Start(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } System.Threading.Thread.Sleep(50); } Console.Write("#"); if (on_error == true) { Console.Write("\n" + "Press Any key to continue."); Console.ReadKey(); } LoadUI(); string[] commands = { "", "help", "n", "new", "a", "attach", "s", "send", "s_all", "r", "restart", "set", "set lport", "set lv", "set accept_blank", "set crash_restart", "set c_r", "i", "info", "time", "c", "clear", "t", "time", "p", "ping", "q", "quit" }; while (true) { Console.Title = ("Running " + range.Count + " proxies..."); try { Console.ForegroundColor = ConsoleColor.Red; Console.Write("$ "); Console.ResetColor(); string choice = Console.ReadLine(); if (choice.Split(' ')[0].Equals("set") && choice.Length <= 3) { Console.WriteLine("'{0}' arguement incomplet", choice); } if (!commands.Any(choice.Split(' ')[0].Equals)) { Console.WriteLine("'{0}' n'est pas reconnu en tant que commande interne", choice); } // COMMANDS if (choice.StartsWith("n ") || choice.StartsWith("new ")) { string[] x = choice.Split(' '); if (!range.Contains(Int32.Parse(x[2]))) { if (x[1].Length < 1) { x[1] = "0"; } Thread myThread = new Thread(() => clientconnection(x[1], Int32.Parse(x[2]))); myThread.Start(); Console.WriteLine("[*] New proxy succesfully opened at : {0}:{1}", x[1], Int32.Parse(x[2])); LoadUI(); } else { Console.WriteLine("=> Proxy {0} is already running.", x[2]); } } if (choice.StartsWith("a ") || choice.StartsWith("attach ")) { string[] x = choice.Split(' '); clientconnection(x[1], Int32.Parse(x[2])); Console.WriteLine("[*] New proxy succesfully opened at : {0}:{1}", x[1], Int32.Parse(x[2])); } if (range.Count > 0 && en_thd == true) { if (choice.StartsWith("send")) { foreach (Socket S_ in socket_list) { if (remote_port == ((IPEndPoint)S_.LocalEndPoint).Port.ToString()) { S_.Send(System.Text.Encoding.UTF8.GetBytes(choice.Remove(0, 5))); } } } if (choice.StartsWith("s ")) { foreach (Socket S_ in socket_list) { if (remote_port == ((IPEndPoint)S_.LocalEndPoint).Port.ToString() && en_thd == true) { S_.Send(System.Text.Encoding.UTF8.GetBytes(choice.Remove(0, 2))); } else { Console.WriteLine("No one at {0}.", remote_port); } } } if (choice.StartsWith("s_all ") && choice.Contains("s_all ") && en_thd == true) { foreach (Socket S_ in socket_list) { S_.Send(System.Text.Encoding.UTF8.GetBytes(choice.Remove(0, 6))); } } if (choice == "r" || choice == "restart") { en_thd = false; foreach (Socket S_ in socket_list) { Console.WriteLine("Shutdown {0}", S_.Connected); S_.Close(); } foreach (Thread thread in threads_list) { range.Remove(int.Parse(thread.Name.Remove(0, 1))); thread.Abort(); Console.WriteLine("Closing {0}", thread.Name); } en_thd = true; LoadUI(); Console.WriteLine(); } } if (choice.StartsWith("set crash_restart ") || choice.StartsWith("set c_r ")) { string[] x = choice.Split(' '); switch (int.Parse(x[2])) { case 0: crash_restart = false; Console.WriteLine("=> CR=False"); break; case 1: crash_restart = true; Console.WriteLine("=> CR=True"); break; } } if (choice.StartsWith("set tport ")) { string[] x = choice.Split(' '); remote_port = x[2].ToString(); Console.WriteLine("=> TPORT={0}", x[2]); } if (choice.StartsWith("set lv ")) { string[] x = choice.Split(' '); v_mod = int.Parse(x[2]); } if (choice.StartsWith("set accept_blank ")) { string[] x = choice.Split(' '); switch (int.Parse(x[2])) { case 0: accept_blank = false; break; case 1: accept_blank = true; break; } } if (choice == "i" || choice == "info") { Console.WriteLine("Threads|State"); foreach (Thread thread in threads_list) { Console.WriteLine("{0}({1})", thread.Name, thread.ThreadState); } } if (choice == "t" || choice == "time") { Console.WriteLine("=> " + DateTime.Now.ToLongTimeString()); } if (choice == "c" || choice == "clear") { Console.Clear(); } if (choice.StartsWith("p") || choice.StartsWith("ping")) { ping(choice.Split(' ')[1]); } if (choice == "q" || choice == "quit") { Environment.Exit(0); } if (choice.StartsWith("help")) { Console.WriteLine(@" Commands Usage help | Display commands usage. n, new {ip,port} | Create new proxy. a, attach {ip,port} | Create a single thread proxy. s, send {message} | Send message to the current talking port. s_all {message} | Send a message to all running proxies. set tport {port} | Set the current talking port. set lv {0,1,2,3} | Change the hex format of response. set accept_blank {0,1} | Display or not \n response. set Crash_restart {0,1} | Automatically restart crashed proxies. p, ping {ip} | Regular ping. t, time | Show time. i, info | Display current running proxies. c, clear | Clear the console output. r, restart | Stop all proxies, without quitting main. q, quit | Stop and exit all threads. " ); } } catch (Exception ex) { Console.WriteLine("Err:" + ex.Message + "\n"); } } }
private void Start() { isOpen = true; s = GameObject.Find("S&L").GetComponent <S_>(); l = GameObject.Find("S&L").GetComponent <L_>(); }