public (string target_alias, GateObject[] target_gates) SendExecBegin()
        {
            /* モード選択ボタンを無効化 */
            RBtn_ModeData.Enabled = false;
            RBtn_ModeFile.Enabled = false;
            RBtn_ModeLog.Enabled  = false;

            /* ターゲット編集ボックスを無効化 */
            CBox_TargetList.Enabled = false;

            return(CBox_TargetList.Text, GateManager.FindGateObjectFromWildcardAlias(CBox_TargetList.Text));
        }
Пример #2
0
        internal void StartAsync()
        {
            Stop();

            /* 進捗初期化 */
            cancel_req_ = false;
            Success     = false;
            ProgressMax = 1;
            ProgressNow = 1;

            /* 送信ログファイル取得 */
            var info = FileManager.PacketLogOpen.GetReadControllerFromPath(FilePath);

            if ((info == null) || (info.Format == null))
            {
                return;
            }

            var reader = info.Format.CreateReader() as PacketLogReader;

            if (reader == null)
            {
                return;
            }

            if (!reader.Open(info.Option, info.FilePath))
            {
                return;
            }

            /* フィルターモジュール生成 */
            var filter_obj = PacketFilterController.Build(Filter);

            if (filter_obj == null)
            {
                return;
            }

            /* 送信先ゲート取得 */
            var gate_objs = GateManager.FindGateObjectFromWildcardAlias(GateAlias);

            if (gate_objs == null)
            {
                return;
            }

            /* 送信タスク開始 */
            ar_task_ = (new ExecTaskHandler(ExecTask)).BeginInvoke(
                gate_objs, filter_obj, reader, null, null);
        }
Пример #3
0
        internal void StartAsync()
        {
            Stop();

            /* 進捗初期化 */
            cancel_req_ = false;
            Success     = false;
            ProgressMax = 1;
            ProgressNow = 1;

            var task_objs = (List <GateTaskObject>)null;

            /* 送信ファイル取得 */
            if (!File.Exists(FilePath))
            {
                return;
            }

            var file = (FileStream)null;

            try {
                file = File.OpenRead(FilePath);
            } catch {
                return;
            }

            /* 送信先ゲート取得 */
            var gate_objs = GateManager.FindGateObjectFromWildcardAlias(GateAlias);

            if (gate_objs == null)
            {
                return;
            }

            /* 送信オブジェクト生成 */
            task_objs = gate_objs.Select(gate_obj => new GateTaskObject(file, gate_obj, SendBlockSize, SendDelay)).ToList();

            ProgressMax = (uint)file.Length;
            ProgressNow = 0;

            /* 送信タスク開始 */
            ar_task_ = (new ExecTaskHandler(ExecTask)).BeginInvoke(task_objs, null, null);
        }
        private void UpdateTargetView()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)UpdateTargetView);
                return;
            }

            /* 表示更新 */
            if (CBox_TargetList.Text.Length > 0)
            {
                CBox_TargetList.BackColor = (GateManager.FindGateObjectFromWildcardAlias(CBox_TargetList.Text).Any(gate => gate.ConnectStatus == ConnectState.Connected))
                                          ? (Ratatoskr.Resource.AppColors.Ok)
                                          : (Ratatoskr.Resource.AppColors.Warning);
            }
            else
            {
                CBox_TargetList.BackColor = Ratatoskr.Resource.AppColors.Ng;
            }
        }
Пример #5
0
        public void API_GateDisconnect(string gate_alias)
        {
            var gate_objs = GateManager.FindGateObjectFromWildcardAlias(gate_alias);

            if (gate_objs == null)
            {
                return;
            }

            /* 対象の全ゲートを切断 */
            foreach (var gate_obj in gate_objs)
            {
                gate_obj.ConnectRequest = false;
            }

            /* 対象の全ゲートが切断されるのを待つ */
            while (gate_objs.FirstOrDefault(obj => (obj.DeviceClassID != Guid.Empty) && (obj.ConnectStatus != ConnectState.Disconnected)) != null)
            {
                API_Sleep(10);
            }
        }
Пример #6
0
        public void API_SendData(string gate_alias, byte[] data)
        {
            if (data == null)
            {
                return;
            }

            /* 送信先ゲート取得 */
            var gates = GateManager.FindGateObjectFromWildcardAlias(gate_alias);

            if (gates == null)
            {
                return;
            }

            /* 送信実行 */
            DebugManager.MessageOut(DebugMessageSender.User, DebugMessageType.SendEvent, "API_SendData");
            foreach (var obj in gates)
            {
                obj.SendRequest(data);
            }
        }