//�y���J�t�@���N�V�����z public void Job(ServiceCmd serviceCmd) { //���݂̃��[�U�[��WindowsIdentity�I�u�W�F�N�g��擾 var wi = WindowsIdentity.GetCurrent(); if (wi != null) { //WindowsPrincipal�I�u�W�F�N�g��쐬���� var wp = new WindowsPrincipal(wi); //Administrators�O���[�v�ɑ����Ă��邩���ׂ� if (!wp.IsInRole(WindowsBuiltInRole.Administrator)) { Msg.Show(MsgKind.Error, _kernel.IsJp() ? "BJD.exe�́u�Ǘ��҂Ƃ��Ď��s�v����Ă��܂���" : "Execute BJD.exe as a Administrator"); return; } } switch (serviceCmd) { case ServiceCmd.Install: InstallUtil(true); break; case ServiceCmd.Uninstall: if (_sc.Status != ServiceControllerStatus.Stopped) { _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); } InstallUtil(false); break; case ServiceCmd.Start: _sc.Start(); _sc.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 10)); break; case ServiceCmd.Stop: _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); break; case ServiceCmd.Automatic: SetStartupType("Automatic"); break; case ServiceCmd.Manual: SetStartupType("Manual"); break; case ServiceCmd.Disable: SetStartupType("Disabled"); break; } Init(); }
//【公開ファンクション】 public void Job(ServiceCmd serviceCmd) { //現在のユーザーのWindowsIdentityオブジェクトを取得 var wi = WindowsIdentity.GetCurrent(); if (wi != null) { //WindowsPrincipalオブジェクトを作成する var wp = new WindowsPrincipal(wi); //Administratorsグループに属しているか調べる if (!wp.IsInRole(WindowsBuiltInRole.Administrator)) { Msg.Show(MsgKind.Error, _kernel.IsJp() ? "BJD.exeは「管理者として実行」されていません" : "Execute BJD.exe as a Administrator"); return; } } switch (serviceCmd) { case ServiceCmd.Install: InstallUtil(true); break; case ServiceCmd.Uninstall: if (_sc.Status != ServiceControllerStatus.Stopped) { _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); } InstallUtil(false); break; case ServiceCmd.Start: _sc.Start(); _sc.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 10)); break; case ServiceCmd.Stop: _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); break; case ServiceCmd.Automatic: SetStartupType("Automatic"); break; case ServiceCmd.Manual: SetStartupType("Manual"); break; case ServiceCmd.Disable: SetStartupType("Disabled"); break; } Init(); }
void Job(ServiceCmd serviceCmd) { Enabled = false; Cursor.Current = Cursors.WaitCursor; _setupService.Job(serviceCmd); DispInit(); Enabled = true; Cursor.Current = Cursors.Default; }
//�y���J�t�@���N�V�����z public void Job(ServiceCmd serviceCmd) { //���݂̃��[�U�[��WindowsIdentity�I�u�W�F�N�g��擾 var wi = WindowsIdentity.GetCurrent(); if (wi != null){ //WindowsPrincipal�I�u�W�F�N�g��쐬���� var wp = new WindowsPrincipal(wi); //Administrators�O���[�v�ɑ����Ă��邩���ׂ� if (!wp.IsInRole(WindowsBuiltInRole.Administrator)){ Msg.Show(MsgKind.Error, _kernel.IsJp() ? "BJD.exe�́u�Ǘ��҂Ƃ��Ď��s�v����Ă��܂���" : "Execute BJD.exe as a Administrator"); return; } } switch (serviceCmd) { case ServiceCmd.Install: InstallUtil(true); break; case ServiceCmd.Uninstall: if (_sc.Status != ServiceControllerStatus.Stopped) { _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); } InstallUtil(false); break; case ServiceCmd.Start: _sc.Start(); _sc.WaitForStatus(ServiceControllerStatus.Running,new TimeSpan(0,0,10)); break; case ServiceCmd.Stop: _sc.Stop(); _sc.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10)); break; case ServiceCmd.Automatic: SetStartupType("Automatic"); break; case ServiceCmd.Manual: SetStartupType("Manual"); break; case ServiceCmd.Disable: SetStartupType("Disabled"); break; } Init(); }
public static object Result(ServiceCmd Commond, byte[] body) { Bind tbind = Cmd.runClient(new Bind(Commond, body)); switch ((CenterCmd)tbind.header.CommandID) { case CenterCmd.CS_SELECT_TEXAS_POT: return(TexasPot_Select_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_OPERTOR_TEXAS_POT: return(TexasPot_Operator_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_SELECT_SCALE_POT: return(Scale_Select_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_OPERTOR_SCALE_POT: return(Scale_Operator_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_SELECT_TEXPROPOT_POT: return(TexPro_Select_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_OPERTOR_TEXPROPOT_POT: return(TexPro_Operator_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_OPERTOR_BACCARAT_POT: return(Baccarat_Operator_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_SELECT_BACCARAT_POT: return(Baccarat_Select_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_SELECT_MINI_POT: return(MiniGamePot_Select_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_OPERTOR_MINI_POT: return(MiniGamePot_Operator_S.ParseFrom(tbind.body.ToBytes())); case CenterCmd.CS_CONNECT_ERROR: return(null); } return(null); }
object runService(ServiceCmd pCmd, object[] pArgs) { if (RootNode == null) { return(null); } switch (pCmd) { case ServiceCmd.getTop: return(this); case ServiceCmd.invalidate: this.Invalidate(); break; } return(null); }
//void MobTreeView_GroupClick(object sender, ExpandableListView.GroupClickEventArgs e) //{ // OnGroupClick(this, e.ClickedView, e.GroupPosition, e.Id); //} //void MobTreeView_ItemClick(object sender, AdapterView.ItemClickEventArgs e) //{ // Toast.MakeText(ToolMobile.getContext(), "itm", ToastLength.Short); //} //void MobTreeView_ChildClick(object sender, ExpandableListView.ChildClickEventArgs e) //{ //} object runService(ServiceCmd pCmd, object[] pArgs) { if (RootNode == null) { return(null); } switch (pCmd) { case ServiceCmd.getTopView: return(this); case ServiceCmd.invalidate: this.Invalidate(); break; case ServiceCmd.getParentNode: { Node node_ = pArgs != null && pArgs.Length > 0 ? pArgs[0] as Node : null; Node parent_ = null; foreach (Node n in RootNode.getAllSubNodes()) { if (!n.isChild()) { parent_ = n; } if (object.ReferenceEquals(n, node_) && !object.ReferenceEquals(node_, parent_)) { return(parent_); } } } break; } return(null); }
/// <summary> /// 初始Bind命令的消息头 /// </summary> /// <param name="Sequence">序列号</param> public Bind(ServiceCmd Command, byte[] _body) { header = new Head(Command); body = new Bodys(_body); header.Length = (ushort)(Head.HeaderLength + body.Length); }
public Head(ServiceCmd CommandID) { Converter.Int16ToBytes((ushort)CommandID).CopyTo(initValue, 2); }
public int DoServiceCommand(ServiceCmd cmd) { switch (cmd) { case ServiceCmd.Install: if (IsServiceInstalled()) { Console.WriteLine("Service allready installed!"); return(-1); } System.Diagnostics.Process.Start(Application.StartupPath + "\\" + Settings.ServiceProcess, "/i"); Console.WriteLine("Wait..."); Thread.Sleep(1000); if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } return(1); case ServiceCmd.Uninstall: if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } System.Diagnostics.Process.Start(Application.StartupPath + "\\" + Settings.ServiceProcess, "/u"); Console.WriteLine("Wait..."); Thread.Sleep(1000); if (IsServiceInstalled()) { Console.WriteLine("Service is installed!"); return(-1); } return(1); case ServiceCmd.Start: if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } if (IsServiceStarted()) { Console.WriteLine("Service allready started!"); return(-1); } DoStart(); return(1); case ServiceCmd.Stop: if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } if (!IsServiceStarted()) { Console.WriteLine("Service allready stoped!"); return(-1); } DoStop(); return(1); case ServiceCmd.Restart: if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } if (!IsServiceStarted()) { Console.WriteLine("Service allready stoped!"); return(-1); } DoRestart(); return(1); case ServiceCmd.Pause: if (!IsServiceInstalled()) { Console.WriteLine("Service not installed!"); return(-1); } if (!IsServiceStarted()) { Console.WriteLine("Service allready stoped!"); return(-1); } DoPause(); return(1); case ServiceCmd.RunAsWindow: if (Environment.OSVersion.Platform == PlatformID.Unix) { System.Diagnostics.Process.Start("mono", Application.StartupPath + "\\" + Settings.WindowsAppProcess + " -winform"); } else { System.Diagnostics.Process.Start(Application.StartupPath + "\\" + Settings.WindowsAppProcess, "-winform"); } return(1); } return(0); }