public MainForm(Configuration config, RCUserHandler rcUser, ServerMonitorControl control) { this.InitializeComponent(); this.Text = LocalizeText.Get(151); this.menuItem1.Text = LocalizeText.Get(138); this.MenuItemAboutMe.Text = LocalizeText.Get(139); this.MenuItemClose.Text = LocalizeText.Get(140); this.menuItem5.Text = LocalizeText.Get(141); this.MenuItemUser.Text = LocalizeText.Get(142); this.menuItem4.Text = LocalizeText.Get(143); this.MenuItemHelp.Text = LocalizeText.Get(144); this.TSBServer.Text = LocalizeText.Get(147); this.TSBServer.ToolTipText = LocalizeText.Get(148); this.TSBUser.Text = LocalizeText.Get(149); this.TSBUser.ToolTipText = LocalizeText.Get(150); this.Text = LocalizeText.Get(151); if (rcUser.Authority < Authority.GSM) { this.toolStrip.Items.Remove(this.TSBServer); if (rcUser.Authority != Authority.UserMonitor) { this.toolStrip.Items.Remove(this.TSBUser); } } this._config = config; this._rcUser = rcUser; this._rcUser.ReceivedUserListReply += this.RC_ReceivedUserListReply; this._rcUser.ChildProcessLogOpened += this.OnSplitChildProcessLog; this._rcUser.ChildProcessLogged += delegate(object s, EventArgs <ChildProcessLogMessage> e) { LogGenerator logGenerator = this.childProcessLogs.FindGenerator(e.Value.ClientID, e.Value.ProcessName, e.Value.ProcessID); if (logGenerator != null) { logGenerator.LogGenerated(null, e.Value.ToString()); } }; this._serverMonitorControl = control; this._serverMonitorControl.OnSplitGeneralLog += this.OnSplitGeneralLog; this._serverMonitorControl.OnSplitProcessLog += this.OnSplitProcessLog; this._serverMonitorControl.OnSplitAllProcessLog += this.OnSplitAllProcessLog; this.bAlarm = true; this.alarmForm = this._serverMonitorControl.alarmForm; this.alarmForm.OnClose += this.UpdateAlarmTime; this.UpdateAlarm(this.bAlarm); this.alarmSound = new SoundPlayer(Resources.AlarmSound); this._userCountData = new UserCountData(this._rcUser); this.childProcessLogs = new ChildProcessLogGeneratorCollection(); this.childProcessLogs.OnLogClosed += delegate(object s, EventArgs <ChildProcessLogDisconnectMessage> e) { this._rcUser.SendMessage <ChildProcessLogDisconnectMessage>(e.Value); }; MainForm.Instance = this; }
public UserView(RCUserHandler rcUser, IEnumerable <Member> memberList) { this.InitializeComponent(); this.UserId.Text = LocalizeText.Get(173); this.UserAuthority.Text = LocalizeText.Get(174); this.BtnAddUser.Text = LocalizeText.Get(175); this.BtnRemoveUser.Text = LocalizeText.Get(176); this.BtnChangeUser.Text = LocalizeText.Get(177); this.BtnOK.Text = LocalizeText.Get(178); this.Text = LocalizeText.Get(179); this._rcUser = rcUser; foreach (Member member in memberList) { this.AddMember(member.ID, member.Authority); } }
public UserCountData(RCUserHandler client) { this.tableDict = new Dictionary <string, DataTable>(); client.UserCountLogged += this.OnUserCountLog; }
private static void Main(string[] args) { Application.EnableVisualStyles(); string text = "HeroesOpToolConfig.xml"; if (args.Length > 0) { text = args[0]; } XmlTextReader xmlTextReader = null; Configuration configuration; try { xmlTextReader = new XmlTextReader(text); configuration = (Configuration) new System.Xml.Serialization.XmlSerializer(typeof(Configuration)).Deserialize(xmlTextReader); } catch (Exception ex) { Utility.ShowErrorMessage(string.Format("Error occured while reading configuration file : {0}\nSource message : {1}", text, ex.Message)); return; } finally { if (xmlTextReader != null) { xmlTextReader.Close(); } } try { LocalizeText.LoadText(configuration.TextFile); LocalizeText.SetLocale(configuration.Language); } catch (Exception ex2) { Utility.ShowErrorMessage("Error occured while reading text file! - " + ex2.ToString()); return; } HeroesOpTool.Thread = new JobProcessor(); HeroesOpTool.Thread.ExceptionOccur += delegate(object sender, EventArgs <Exception> e) { Utility.ShowErrorMessage(e.Value.ToString()); }; HeroesOpTool.Thread.Start(); RCUserHandler rcUser = new RCUserHandler(configuration); ServerMonitorControl serverMonitorControl = new ServerMonitorControl(rcUser); serverMonitorControl.CreateControl(); Login login = new Login(configuration, rcUser, serverMonitorControl); if (login.ShowDialog() == DialogResult.OK) { try { Application.Run(new MainForm(configuration, rcUser, serverMonitorControl)); } catch (Exception ex3) { Utility.ShowErrorMessage(ex3.ToString()); } } HeroesOpTool.Thread.Stop(); }
public RemoteControlSystemManager(RCUserHandler _userClient, ICollection <RCClient> _clientList, IWorkGroupStructureNode[] workGroupStructure, IWorkGroupStructureNode[] serverGroupStructure, IEnumerable <RCProcess> _processTemplateInfo) { this.InitializeComponent(); this.tabPageRCCControl.Text = LocalizeText.Get(345); this.tabPageWorkGroupControl.Text = LocalizeText.Get(346); this.tabPageProcessTemplate.Text = LocalizeText.Get(347); this.buttonOK.Text = LocalizeText.Get(348); this.buttonCancel.Text = LocalizeText.Get(349); this.tabPageServerGroupControl.Text = LocalizeText.Get(515); this.Text = LocalizeText.Get(350); if (_userClient.Authority < Authority.Supervisor) { this.tabPageWorkGroupControl.Enabled = false; this.tabPageProcessTemplate.Enabled = false; this.tabControl.Controls.Remove(this.tabPageWorkGroupControl); this.tabControl.Controls.Remove(this.tabPageServerGroupControl); this.tabControl.Controls.Remove(this.tabPageProcessTemplate); } this.userClient = _userClient; this.clientList = new SortedList(); this.userClient.ClientAdd += this.RC_ClientAdd; this.userClient.ClientRemove += this.RC_ClientRemove; Dictionary <int, RCClient> dictionary = new Dictionary <int, RCClient>(); foreach (RCClient rcclient in _clientList) { this.clientList.Add(rcclient.ID, rcclient); RCClient rcclient2 = rcclient.Clone(); foreach (RCProcess rcprocess in rcclient.ProcessList) { WorkGroupStructureNode workGroupStructureNode = null; if (workGroupStructure != null) { foreach (WorkGroupStructureNode workGroupStructureNode2 in workGroupStructure) { workGroupStructureNode = workGroupStructureNode2.GetParent(new WorkGroupCondition(rcclient.Name, rcprocess.Name)); if (workGroupStructureNode != null) { break; } } } if (workGroupStructureNode != null) { if (workGroupStructureNode.Authority > this.userClient.Authority) { ((RCProcessCollection)rcclient2.ProcessList).Remove(rcprocess.Name); } } else if (this.userClient.Authority < Authority.Supervisor) { ((RCProcessCollection)rcclient2.ProcessList).Remove(rcprocess.Name); } } if (rcclient.ProcessList.Count == 0 | rcclient2.ProcessList.Count > 0) { dictionary.Add(rcclient2.ID, rcclient2); } } RCProcessCollection rcprocessCollection = new RCProcessCollection(); foreach (RCProcess item in _processTemplateInfo) { rcprocessCollection.Add(item); } this.rcClientControl.AddClients(dictionary.Values); this.rcClientControl.SetTemplateList(rcprocessCollection); this.workGroupControl.AddWorkGroup(workGroupStructure); this.workGroupControl.AddClients(dictionary.Values); this.serverGroupControl.AddServerGroup(serverGroupStructure); this.serverGroupControl.AddClients(dictionary.Values); this.processTemplateControl.SetTemplateList(rcprocessCollection); }
public ServerCommandForm(Authority rcAuthority, IEnumerable <KeyValuePair <RCProcess, RCClient> > commandBridges) { this.InitializeComponent(); this.groupBoxCommand.Text = LocalizeText.Get(519); this.groupBoxServer.Text = LocalizeText.Get(518); this.groupBoxArgList.Text = LocalizeText.Get(485); this.checkSchedule.Text = LocalizeText.Get(520); this.buttonCancel.Text = LocalizeText.Get(12); this.buttonOK.Text = LocalizeText.Get(244); this.textBox1.Text = LocalizeText.Get(522); this.Text = LocalizeText.Get(521); this.commandBridges = new Dictionary <int, RCProcess>(); this.schedulesByTime = new Dictionary <string, Dictionary <string, RCProcessScheduler> >(); this.schedulesOther = new Dictionary <string, Dictionary <string, RCProcessScheduler> >(); this.commandDict = new Dictionary <string, HashSet <ServerCommandForm.ServerGroupItem> >(); this.controlArgs = new List <Control>(); this.clientAuthority = rcAuthority; foreach (KeyValuePair <RCProcess, RCClient> keyValuePair in commandBridges) { string key = this.MakeKey(keyValuePair.Value.ID, keyValuePair.Key.Name); this.commandBridges.Add(keyValuePair.Value.ID, keyValuePair.Key.Clone()); this.schedulesOther.Add(key, new Dictionary <string, RCProcessScheduler>()); this.schedulesByTime.Add(key, new Dictionary <string, RCProcessScheduler>()); if (keyValuePair.Key.State == RCProcess.ProcessState.On) { IEnumerable <string> commandBridgeServer = RCUserHandler.GetCommandBridgeServer(keyValuePair.Key); foreach (RCProcess.CustomCommandParser customCommandParser in RCProcess.CustomCommandParser.GetFromRawString(keyValuePair.Key.CustomCommandString)) { HashSet <ServerCommandForm.ServerGroupItem> hashSet; if (this.commandDict.ContainsKey(customCommandParser.RawCommand)) { hashSet = this.commandDict[customCommandParser.RawCommand]; } else { this.listBoxCommand.Items.Add(new CommandForm.CommandItem(customCommandParser)); hashSet = new HashSet <ServerCommandForm.ServerGroupItem>(); this.commandDict.Add(customCommandParser.RawCommand, hashSet); } foreach (string serverGroup in commandBridgeServer) { ServerCommandForm.ServerGroupItem item = new ServerCommandForm.ServerGroupItem(serverGroup, keyValuePair.Key.Name, keyValuePair.Value.ID); if (!hashSet.Contains(item)) { hashSet.Add(item); } } } } foreach (RCProcessScheduler rcprocessScheduler in keyValuePair.Key.Schedules) { if (rcprocessScheduler.ExeType == RCProcessScheduler.EExeType.StdInput && rcprocessScheduler.ScheduleType == RCProcessScheduler.EScheduleType.Once) { this.AddSchedule(key, rcprocessScheduler.ScheduleTime, rcprocessScheduler.Name, rcprocessScheduler.Command); } else { this.schedulesOther[key].Add(rcprocessScheduler.Name, rcprocessScheduler); } } } }