Exemplo n.º 1
0
        public void LoadGateSet()
        {
            GateManager    gateManager = new GateManager();
            OpenFileDialog dialog      = new OpenFileDialog();

            dialog.Filter = "xml gate set|*.xml";
            dialog.Title  = "Open gate set";
            dialog.ShowDialog();
            if (dialog.FileName != "")
            {
                System.IO.FileStream fs =
                    (System.IO.FileStream)dialog.OpenFile();
                gateManager.LoadGateSetFromXml(fs);
                fs.Close();
            }

            GatedDemodulationConfigSet gateConfigSet = new GatedDemodulationConfigSet();

            gateConfigSet = gateManager.GateSet;
            List <string> gateConfigNames = new List <string>();

            currentGateSetDictionary.Clear();
            log("Gate configs loaded:");
            foreach (GatedDemodulationConfig config in gateConfigSet.GatedDemodulationConfigs)
            {
                gateConfigNames.Add(config.Name);
                log(config.Name);
                currentGateSetDictionary.Add(config.Name, config);
            }
            mainWindow.PopulateGateConfigList(gateConfigNames);
        }
        private void UpdateTargetList()
        {
            CBox_TargetList.BeginUpdate();
            {
                var target_now = CBox_TargetList.Text;

                CBox_TargetList.ClearItemGroup();

                var group = (ComboBoxEx.ItemGroup)null;

                /* ゲート一覧のターゲットリスト */
                group      = CBox_TargetList.AddItemGroup();
                group.Font = new Font(CBox_TargetList.Font.Name, CBox_TargetList.Font.Size, FontStyle.Bold);
                group.Items.Add("*");
                foreach (var gate in GateManager.GetGateList())
                {
                    group.Items.Add(gate.Alias);
                }

                /* 過去設定値 */
                group = CBox_TargetList.AddItemGroup();
                foreach (var target in target_log_list_)
                {
                    group.Items.Add(target);
                }

                CBox_TargetList.Text = target_now;
            }
            CBox_TargetList.EndUpdate();
        }
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(_instance);
     }
     _instance = this;
 }
        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));
        }
Exemplo n.º 5
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player" && tileType == TileType.Gate && property.isContactToGo)
     {
         Systems                  = GameObject.Find("Systems");
         SystemGate               = Systems.GetComponent <GateManager>();
         SystemGate.NextUp        = property.StageConnectedTo;
         SystemGate.EnteringSound = property.EnteringSound;
         SystemGate.TransitTo     = property.ConnectTo;
         StartCoroutine(SystemGate.ExitAndEnter());
     }
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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;
            }
        }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
0
        public void AddGate(GateProperty gatep, DeviceConfig devconf, Guid devc_id, DeviceProperty devp)
        {
            if (gatec_list_.Count >= ConfigManager.System.ApplicationCore.GateNum.Value)
            {
                return;
            }

            var gate = GateManager.CreateGateObject(gatep, devconf, devc_id, devp);

            if (gate == null)
            {
                return;
            }

            var gatec = new MainWindow_Gate(gate);

            /* リストへ追加 */
            gatec_list_.Add(gatec);

            /* フォームに追加 */
            Panel_GateList.Controls.Add(gatec);
        }
Exemplo n.º 12
0
        public void SaveGateSet()
        {
            GateManager gateManager = new GateManager();
            GatedDemodulationConfigSet gateConfigSet = new GatedDemodulationConfigSet();

            foreach (string key in currentGateSetDictionary.Keys)
            {
                gateConfigSet.AddGatedDemodulationConfig(currentGateSetDictionary[key]);
            }
            gateManager.GateSet = gateConfigSet;
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "xml gate set|*.xml";
            dialog.Title  = "Save gate set";
            dialog.ShowDialog();
            if (dialog.FileName != "")
            {
                System.IO.FileStream fs =
                    (System.IO.FileStream)dialog.OpenFile();
                gateManager.SaveGateSetAsXml(fs);
                fs.Close();
            }
            log("Saved gate config to " + dialog.FileName.ToString());
        }
Exemplo n.º 13
0
    /// <summary>
    /// Used to initialise the singleton World object
    /// </summary>
    internal void Awaken()
    {
        if (Instance != null)
        {
            return;
        }

        Instance = this;

        _kernel = Flow.Create.NewKernel();

        _player = FindObjectOfType <Player>();

        GameCanvas = FindObjectOfType <GameCanvasController>();

        _gateManager = FindObjectOfType <GateManager>();

        _game = FindObjectOfType <Game>();

        // TODO: combine scenes
        _loaded = true;

        ActivateGame(false);
    }
Exemplo n.º 14
0
    void Start ()
    {
        gateManager = gameObject.GetComponentInParent<GateManager>();
        EventManager.StartListening("FinishMatch", Reset);

    }
Exemplo n.º 15
0
        public void FormKeyAction(MainWindowActionId id)
        {
            if (InvokeRequired)
            {
                Invoke((FormKeyActionHandler)FormKeyAction, id);
                return;
            }

            switch (id)
            {
            case MainWindowActionId.ApplicationExit:
                Program.ShutdownRequest();
                break;

            case MainWindowActionId.TimeStamp:
                GatePacketManager.SetTimeStamp(ConfigManager.Language.MainMessage.TimeStampManual.Value);
                break;

            case MainWindowActionId.PacketRedraw:
                FormTaskManager.RedrawPacketRequest();
                break;

            case MainWindowActionId.PacketClear:
                GatePacketManager.ClearPacket();
                break;

            case MainWindowActionId.PacketSaveConvertOff:
                FormUiManager.SavePacketLog(true, false);
                break;

            case MainWindowActionId.PacketSaveConvertOn:
                FormUiManager.SavePacketLog(true, true);
                break;

            case MainWindowActionId.PacketSaveAsConvertOff:
                FormUiManager.SavePacketLog(false, false);
                break;

            case MainWindowActionId.PacketSaveAsConvertOn:
                FormUiManager.SavePacketLog(false, true);
                break;

            case MainWindowActionId.FileOpen:
                FormUiManager.FileOpen();
                break;

            case MainWindowActionId.AutoTimeStampToggle:
                ConfigManager.System.AutoTimeStamp.Enable.Value = !ConfigManager.System.AutoTimeStamp.Enable.Value;
                FormUiManager.MainFrameMenuBarUpdate();
                break;

            case MainWindowActionId.AutoScrollToggle:
                ConfigManager.System.AutoScroll.Value = !ConfigManager.System.AutoScroll.Value;
                FormUiManager.MainFrameMenuBarUpdate();
                break;

            case MainWindowActionId.ProfileAdd:
                ConfigManager.CreateNewProfile("New Profile", null, true);
                break;

            case MainWindowActionId.ProfileRemove:
                ConfigManager.DeleteProfile(ConfigManager.GetCurrentProfileID());
                break;

            case MainWindowActionId.ProfileEdit:
                if (FormUiManager.ShowProfileEditDialog("Edit Profile", ConfigManager.User, ConfigManager.User.ProfileName.Value))
                {
                    ConfigManager.SaveCurrentProfile(true);
                    FormUiManager.MainFrameMenuBarUpdate();
                }
                break;

            case MainWindowActionId.ProfileExport:
                FormUiManager.SaveUserConfig();
                break;

            case MainWindowActionId.Gate1_Connect:
            case MainWindowActionId.Gate2_Connect:
            case MainWindowActionId.Gate3_Connect:
            case MainWindowActionId.Gate4_Connect:
            case MainWindowActionId.Gate5_Connect:
                var gate_list = GateManager.GetGateList();
                var gate_id   = (int)(id - MainWindowActionId.Gate1_Connect);

                if (gate_id < gate_list.Length)
                {
                    gate_list[gate_id].ConnectRequest = !gate_list[gate_id].ConnectRequest;
                }
                break;

            case MainWindowActionId.ShowScriptWindow:
                FormUiManager.ScriptWindowVisible(true);
                break;

            case MainWindowActionId.ShowOptionDialog:
                FormUiManager.ShowOptionDialog();
                break;

            case MainWindowActionId.ShowAppDocument:
                FormUiManager.ShowAppDocument();
                break;

            case MainWindowActionId.ShowAppDocument_PacketFilter:
                FormUiManager.ShowAppDocument();
                break;

            case MainWindowActionId.ShowAppInformation:
                FormUiManager.ShowAppInfo();
                break;
            }
        }
Exemplo n.º 16
0
        public static IList <GateDto> GetAllGates()
        {
            var manager = new GateManager();

            return(manager.GetAllGates());
        }
Exemplo n.º 17
0
 void OnEnable()
 {
     Instance = this;
 }
Exemplo n.º 18
0
    /// <summary>
    /// Used to initialise the singleton World object
    /// </summary>
    internal void Awaken()
    {
        if (Instance != null)
            return;

        Instance = this;

        _kernel = Flow.Create.NewKernel();

        _player = FindObjectOfType<Player>();

        GameCanvas = FindObjectOfType<GameCanvasController>();

        _gateManager = FindObjectOfType<GateManager>();

        _game = FindObjectOfType<Game>();

        // TODO: combine scenes
        _loaded = true;

        ActivateGame(false);
    }
Exemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     player   = GameObject.Find("Player");
     trigger  = transform.Find("GateTrigger").gameObject;
 }