public void Eventer_Tefreeca_client_event(object sender, EventArgs e) { //try //{ Tefreeca_client_EventArgs RecieveEventArg = e as Tefreeca_client_EventArgs; if (RecieveEventArg == null) { return; } Unit_Event_Type type = RecieveEventArg.type; switch (type) { case Unit_Event_Type.List_Account: { List <i_List_Account> DR = (List <i_List_Account>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_Account R in DR) { L.Add(new String[] { R.No.ToString(), R.Type_order_Site.ToString(), R.User_No.ToString(), R.ID.ToString(), R.PW.ToString(), R.State.ToString() }); } UI.set_Autolistview_delegate(listView_Account, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_Connect: { List <i_List_Connect> DR = (List <i_List_Connect>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_Connect R in DR) { L.Add(new String[] { R.No.ToString(), R.Order_No.ToString(), R.Unit_No.ToString(), R.Connect_URL.Replace("http://play.afreecatv.com/", "").ToString(), R.Proxy_host.ToString(), R.Type_order.ToString(), R.State.ToString(), R.Login_Account_no == -1 ? "" : R.Login_Account_no.ToString(), R.State_Account_on_connected.ToString(), R.Wait_count.ToString() }); } UI.set_Autolistview_delegate(listView_Connection, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_Order: { List <i_List_Order> DR = (List <i_List_Order>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_Order R in DR) { L.Add( new String[] { R.No.ToString(), R.User_No.ToString(), R.Connected_count.ToString(), R.Max_connect.ToString(), R.State.ToString(), R.URL.ToString(), R.Type_order.ToString(), }); } UI.set_Autolistview_delegate(listView_Order, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_Proxy: { List <i_List_Proxy> DR = (List <i_List_Proxy>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_Proxy R in DR) { L.Add( new String[] { R.No.ToString(), R.Host.ToString(), R.Error_count.ToString(), R.State.ToString(), R.Type.ToString(), }); } UI.set_Autolistview_delegate(listView_ProxyOnServer, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_Unit: { List <i_List_Unit> DR = (List <i_List_Unit>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_Unit R in DR) { L.Add( new String[] { R.No.ToString(), R.Connected_count.ToString(), R.Max_connect.ToString(), R.Proxy.ToString(), R.State.ToString(), R.Wait_count.ToString() }); } UI.set_Autolistview_delegate(listView_Unit, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_User: { List <i_List_User> DR = (List <i_List_User>)(RecieveEventArg.Data_object_list[0]); List <string[]> L = new List <string[]>(); foreach (i_List_User R in DR) { L.Add( new String[] { R.No.ToString(), R.Unit_No.ToString(), R.id.ToString(), R.Slot.ToString(), R.Slot_Account.ToString(), R.pay_type.ToString(), R.expire.ToString(), R.User_type.ToString(), R.is_Reseller.ToString(), R.my_Reseller_No.ToString() }); } UI.set_Autolistview_delegate(listView_LoginUser, L, Option_Audo_listview.Auto_display); } break; case Unit_Event_Type.List_ServerInfo: { i_List_ServerInfo DR = (i_List_ServerInfo)(RecieveEventArg.Data_object_list[0]); set_label_delegate(lb_mqc, DR.Command_Q_length.ToString()); } break; default: { } break; } //} //catch (Exception ex) //{ // Console.WriteLine("Error : {0}", ex.ToString()); // throw; //} }
private static void Commander(command_data_client CMD) { Console.WriteLine("Command] {0} : ", ((Command_Client)CMD.Command_code).ToString()); switch (CMD.Command_code) { case (int)Command_Client.Set_UnitNo: { int No = Convert.ToInt32(CMD.data); Unit_No = No; Add_Response( Command_Server.Login, new i_Login( Unit_No, "Administrator", MD5HashFunc("tyn787ft"), Type_User.Administrator ) ); Console.WriteLine("Login.."); } break; case (int)Command_Client.Login_success: { i_Login_success ils = JsonConvert.DeserializeObject <i_Login_success>(CMD.data.ToString()); User_No = ils.User_No; Unit_State = State_Unit.Logged; Session = ils.Session; Type_user = ils.Type_user; } break; case (int)Command_Client.Login_Failure: { } break; case (int)Command_Client.List_ServerInfo: { i_List_ServerInfo DR = JsonConvert.DeserializeObject <i_List_ServerInfo>(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_ServerInfo, new List <object> { DR }); } break; case (int)Command_Client.List_Connect: { List <i_List_Connect> DR = JsonConvert.DeserializeObject <List <i_List_Connect> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_Connect, new List <object> { DR }); } break; case (int)Command_Client.List_Account: { List <i_List_Account> DR = JsonConvert.DeserializeObject <List <i_List_Account> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_Account, new List <object> { DR }); } break; case (int)Command_Client.List_Order: { List <i_List_Order> DR = JsonConvert.DeserializeObject <List <i_List_Order> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_Order, new List <object> { DR }); } break; case (int)Command_Client.List_Proxy: { List <i_List_Proxy> DR = JsonConvert.DeserializeObject <List <i_List_Proxy> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_Proxy, new List <object> { DR }); } break; case (int)Command_Client.List_Unit: { List <i_List_Unit> DR = JsonConvert.DeserializeObject <List <i_List_Unit> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_Unit, new List <object> { DR }); } break; case (int)Command_Client.List_User: { List <i_List_User> DR = JsonConvert.DeserializeObject <List <i_List_User> >(CMD.data.ToString()); Make_Client_Event(Unit_Event_Type.List_User, new List <object> { DR }); } break; case (int)Command_Client.Managing_State: //일단 현재의 상태를 주기적으로 보내는 것으로 하자. { i_State istate = new i_State(); istate.State_unit = Unit_State; istate.State_connect = new List <i_Updated_Connection>(); Add_Response(Command_Server.State, istate); } break; case (int)Command_Client.Managing_RequestList: //현재 보고 있는 화면의 정보를 주기적으로 요청하는 명령어. { int[] Managing = new int[] { (int)Command_Server.List_Order, (int)Command_Server.List_User, (int)Command_Server.List_Unit, (int)Command_Server.List_Connect, (int)Command_Server.List_Proxy, (int)Command_Server.List_Account, }; if (Managing.Length > current_View_page) { Add_Response((Command_Server)Managing[current_View_page], null); } Add_Response(Command_Server.List_ServerInfo, null); } break; case (int)Command_Client.Updated_current_View_page: //현재 보고 있는 화면의 정보를 주기적으로 요청하는 명령어. { current_View_page = (int)CMD.data; } break; default: { Command_Client S = (Command_Client)CMD.Command_code; Console.WriteLine("Unknown Command : {0}", S.ToString()); } break; } }