コード例 #1
0
ファイル: File_container.cs プロジェクト: wnhat/Mordor
        public FileManager(IP_TR ip_tr_)
        {
            this.log_list    = new List <string>();
            this.Ins_pc_list = new List <INS_pc_manage>();
            this.PathManager = new PanelPathManager();
            ip_tr            = ip_tr_;

            List <PC> refresh_pc_list = ip_tr.name_to_ip(new List <string> {
                "AVI"
            });

            foreach (var pc in refresh_pc_list)
            {
                Ins_pc_list.Add(new INS_pc_manage(pc, log_list));
            }
            Refresh_file_list();
        }
コード例 #2
0
        static void old()
        {
            var            timer          = new NetMQTimer(TimeSpan.FromSeconds(1800));
            ResponseSocket responseSocket = new ResponseSocket("@tcp://*:5555");

            //using (var req = new RequestSocket(">tcp://127.0.0.1:5555"))
            using (var poller = new NetMQPoller {
                responseSocket, timer
            })
            {
                SqlServerConnector sqlserver     = new SqlServerConnector();
                IP_TR          ip_tr             = new IP_TR();
                FileManager    file_container    = new FileManager(ip_tr);
                MissionManager TheMissionManager = new MissionManager(sqlserver, file_container);

                responseSocket.ReceiveReady += (s, a) =>
                {
                    NetMQMessage messageIn     = a.Socket.ReceiveMultipartMessage();
                    BaseMessage  switchmessage = new BaseMessage(messageIn);
                    switch (switchmessage.TheMessageType)
                    {
                    case MessageType.CLIENT_SEND_MISSION_RESULT:
                        // TODO:
                        break;

                    case MessageType.CLINET_GET_MISSION:
                        //
                        Console.WriteLine("start send mission");
                        PanelMissionMessage newmission = new PanelMissionMessage(MessageType.SERVER_SEND_MISSION, TheMissionManager.GetMission());
                        a.Socket.SendMultipartMessage(newmission);
                        break;

                    case MessageType.CLINET_GET_MISSION_LIST:
                        break;

                    case MessageType.CLINET_CLEAR_MISSION:
                        Console.WriteLine("start clean");
                        TheMissionManager.MissionQueue.Clear();
                        BaseMessage clearMissionMessage = new BaseMessage(MessageType.SERVER_SEND_FINISH);
                        a.Socket.SendMultipartMessage(clearMissionMessage);
                        break;

                    case MessageType.CLINET_ADD_MISSION:
                        Console.WriteLine("start add mission");
                        TheMissionManager.AddMisionByServer();
                        BaseMessage addMissionMessage = new BaseMessage(MessageType.SERVER_SEND_FINISH);
                        a.Socket.SendMultipartMessage(addMissionMessage);
                        break;

                    default:
                        break;
                    }
                    Console.WriteLine("finish");
                };

                timer.Elapsed += (s, a) =>
                {
                    //
                    Console.WriteLine("start refresh the panel list");
                    file_container.Refresh_file_list();
                };
                poller.Run();
            }
        }