当前位置: 首页>>代码示例>>C#>>正文


C# Business.EnsureExecutableIsAvailabeOnServer方法代码示例

本文整理汇总了C#中Business.EnsureExecutableIsAvailabeOnServer方法的典型用法代码示例。如果您正苦于以下问题:C# Business.EnsureExecutableIsAvailabeOnServer方法的具体用法?C# Business.EnsureExecutableIsAvailabeOnServer怎么用?C# Business.EnsureExecutableIsAvailabeOnServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Business的用法示例。


在下文中一共展示了Business.EnsureExecutableIsAvailabeOnServer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateInstanceOnServer

        //private string _serviceUserName;
        //private string _servicePassword;
        internal void UpdateInstanceOnServer(Business.Server server, SetStatusLabelDelegate setStatusLabelDelegate)
        {
            //ImpersonateUser impersonateUser = null;

            try
            {
                //if (server.UseImpersonation == true)
                //{
                //    setStatusLabelDelegate("Impersonating user: " + server.UserName);

                //    impersonateUser = new ImpersonateUser(server.UserName, Encryption.Decrypt(server.Password));
                //}

                setStatusLabelDelegate("Checking MemCacheD.exe on remote server.");

                string binaryPath = server.EnsureExecutableIsAvailabeOnServer(false);

                string userName = null;
                string password = null;

                if (server.UseImpersonation == true)
                {
                    userName = server.UserName;
                    password = Encryption.Decrypt(server.Password);
                }

                setStatusLabelDelegate("Updating service on remote server.");

                WmiService.CreateOrUpdate(server.ServerName, userName, password, this.ServiceName, this.DisplayName, this.CreateImagePath(), StartMode.Auto, null, null);

            }
            finally
            {
                //if (impersonateUser != null && impersonateUser.IsImpersonating == true)
                //	impersonateUser.Undo();
            }

            /*
            string description = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName).GetValue("Description").ToString();
            string imagePath = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName).GetValue("ImagePath").ToString();
            string newImagePath = imagePath.Substring(0, imagePath.LastIndexOf("memcached.exe") + ((string)("memcached.exe")).Length);

            int tcpPort;
            if (int.TryParse(txtTcpPort.Text, out tcpPort) == true)
                newImagePath += " -p " + tcpPort;

            int udpPort;
            if (int.TryParse(txtUdpPort.Text, out udpPort) == true)
                newImagePath += " -U " + udpPort;

            if (chkMaximizeCoreFile.Checked == true)
                newImagePath += " -r";

            int maxMemory;
            if (int.TryParse(txtMemoryLimit.Text, out maxMemory) == true)
                newImagePath += " -m " + maxMemory;

            Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName, true).SetValue("ImagePath", newImagePath);

            Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + _serviceController.ServiceName, true).SetValue("DisplayName", txtInstanceName.Text);

            bool requiresRestart = false;
            if (_serviceController.Status == ServiceControllerStatus.Running)
            {
                requiresRestart = true;
                lblStatus.Text = "Stopping " + txtInstanceName.Text;
                Refresh();

                _serviceController.Stop();
            }

            lblStatus.Text = "Removing " + _serviceController.DisplayName;
            Refresh();
            ServiceUtility.UninstallService(_serviceController.ServiceName);

            lblStatus.Text = "Reinstalling " + txtInstanceName.Text;
            Refresh();
            ServiceUtility.InstallService(_serviceController.ServiceName, txtInstanceName.Text, description, newImagePath);

            if (requiresRestart == true)
            {
                lblStatus.Text = "Starting " + txtInstanceName.Text;
                Refresh();
                _serviceController.Start();
            }

            lblStatus.Text = "Ready.";

             */
        }
开发者ID:tekintian,项目名称:MemCacheDManager,代码行数:92,代码来源:Instance.cs


注:本文中的Business.EnsureExecutableIsAvailabeOnServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。