Beispiel #1
0
            public ConnectionClient(IniWatcher ini, IMyGridTerminalSystem gts, IMyIntergridCommunicationSystem igc, CommandLine commandLine, IProcessManager manager, Action <string> logger)
            {
                this.gts    = gts;
                this.igc    = igc;
                this.logger = logger;

                this.mainProcess = manager.Spawn(this.listen, "cc-listen", period: 5);
                this.listenerCmd = new CommandLine("Connection client listener", null, this.mainProcess);
                this.listenerCmd.RegisterCommand(new Command("ac-progress", Command.Wrap(this.progress), "", nArgs: 1));
                this.listenerCmd.RegisterCommand(new Command("ac-done", Command.Wrap(this.done), ""));
                this.listenerCmd.RegisterCommand(new Command("ac-cancel", Command.Wrap(this.serverCancel), ""));
                this.listenerCmd.RegisterCommand(new Command("ac-ko", Command.Wrap(this.ko), ""));
                this.listener = this.igc.UnicastListener;

                ini.Add(this);
                this.Read(ini);
                this.addCmds(commandLine);

                manager.AddOnSave(this.save);
                if (ini.ContainsKey(SECTION, "state"))
                {
                    ConnectionState state;
                    Enum.TryParse(ini.Get(SECTION, "state").ToString(), out state);
                    this.State = state;
                }
            }