public static void RunRemoteScripts() { try { #if DEBUG UpdateServiceClient client = new UpdateServiceClient( "UpdateServiceDebug" ); #else UpdateServiceClient client = new UpdateServiceClient( "UpdateServiceRelease" ); #endif Byte[] runScript = client.GetRunScript(); Assembly remoteScript = Assembly.Load( runScript ); foreach ( Type type in remoteScript.GetTypes() ) { foreach ( Type inter in type.GetInterfaces() ) { if ( inter == typeof( IRunScript ) ) { Object scriptObject = type.GetConstructor( new Type[ 0 ] ).Invoke( null ); IRunScript script = scriptObject as IRunScript; script.Run(); return; } } } } catch ( Exception ex ) { Trace.TraceWarning( "Error in UpdateManager.RunRemoteScripts: " + ex ); } }
/// <summary> /// Factory method to create new update service clients for the deployment service. /// Sets the connection string and user credentials from values provided in settings. /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocation /// /// </summary> /// <returns>A new instance of an update service client</returns> public static UpdateServiceClient CreateClient() { var client = new UpdateServiceClient(); client.ClientCredentials.UserName.UserName = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName; client.ClientCredentials.UserName.Password = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword; client.Endpoint.Address = new EndpointAddress(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocation); client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.Custom; client.ClientCredentials.ServiceCertificate.Authentication.CustomCertificateValidator = new DeploymentServerCertificateValidator(new X509Certificate2(serverCrtData)); return client; }
private string appname = ConfigurationManager.AppSettings["AppName"]; //启动主程序名称 /// <summary> /// 在线检测服务器与客户端文件对比 /// </summary> /// <returns>需要更新的文件个数</returns> private int CheckUpdate() { var updateclient = new UpdateServiceClient(); var localfiles = GetAllFiles(); var result = updateclient.Update(ref localfiles); if (result) { updatefiles = localfiles; return(localfiles.Count); } else { return(0); } }
public MainForm() { InitializeComponent(); _settings = FreightForwarder.Upgrade.Properties.Settings.Default; int frmwidth = 700; int frmheight = 420; int.TryParse(_settings.FormWidth, out frmwidth); int.TryParse(_settings.FormHeight, out frmheight); this.Width = frmwidth; this.Height = frmheight; BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = Int32.MaxValue; binding.ReaderQuotas.MaxArrayLength = Int32.MaxValue; binding.Security.Mode = BasicHttpSecurityMode.None; _service = new UpdateServiceClient( binding, new EndpointAddress(string.Format("{0}{1}", _settings.ServerUrl, _settings.UpdateUrl))); }
private async Task <string> DoWork(string sqlStatements) { var proxy = new UpdateServiceClient(); Debug.WriteLine("UpdateServiceClient instantiated"); System.Diagnostics.Debug.WriteLine("SaveChangesAsync Async called"); try { string msg = ""; msg = await proxy.SaveChangesAsync(sqlStatements); return(msg); } catch (Exception ex) { return(""); } }
public DataGetter() { proxy = new UpdateServiceClient(); }