/// <summary> /// Reads options for APCService. /// </summary> private void ReadConfig() { System.IO.FileStream fs = null; try { TraceOut.Put("Reading configuration file..."); // File exists - read from it. fs = new System.IO.FileStream(iniConfigFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); optFormatter = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); APCServiceOptions _opt = ((APCServiceOptions)(optFormatter.Deserialize(fs))); _opt.CopyTo(this.opt); TraceOut.Put("Acting with following options: " + Environment.NewLine + this.opt.ToString()); } catch (Exception ix) { // No file - setting default options. TraceOut.Put(ix); TraceOut.Put("Service Provider will be set by default..."); APCServiceOptions _opt = new APCServiceOptions(); _opt.CopyTo(this.opt); } finally { if (fs != null) { fs.Close(); } } }
/// <summary> /// Creates the instance of the class with specified parameters. /// </summary> /// <param name="aScriptFileName">The name of the main script file.</param> /// <param name="aServiceName">The name of current Service.</param> /// <param name="aSPType">The type of Service Provider for that script.</param> /// <param name="aAPCServiceOptions">The options (like Logon info and so on) of type <see cref="Diacom.APCService.APCServiceOptions"/>.</param> public ScriptHandler(string aScriptFileName, string aServiceName, System.Type aSPType, APCServiceOptions aAPCServiceOptions) { this.ScriptFileName = aScriptFileName; this.ServiceName = aServiceName; this.SPType = aSPType; this.opt = aAPCServiceOptions; this.StartThreadHandle = new Thread(new ThreadStart(this.Run)); this.StartThreadHandle.IsBackground = true; this.StartThreadHandle.Name = "APCSSH:" + this.ScriptFileName.Substring(this.ScriptFileName.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1); }
/// <summary> /// Constructor for the form. /// </summary> public ConfigureForm(string aServiceName, string aMachineName, APCServiceOptions aAPCSrvOpt) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.Text = String.Format("{0} on {1} configuration", aServiceName, aMachineName); this.propertyGrid1.SelectedObject = new APCServiceOptions(); }
/// <summary> /// Copies data from specified class. /// </summary> /// <param name="aDestination">Destination class.</param> public void CopyTo(APCServiceOptions aDestination) { aDestination.APCScriptFileName = this.APCScriptFileName; aDestination.APCServiceStatesFolders = this.APCServiceStatesFolders; aDestination.ControlLineID = this.ControlLineID; aDestination.ControlLineLogonType = this.ControlLineLogonType; aDestination.ControlLinePassword = this.ControlLinePassword; aDestination.LogonTimeout = this.LogonTimeout; aDestination.ServerIPAddress = this.ServerIPAddress; aDestination.ServerPort = this.ServerPort; aDestination.ServiceProviderType = this.ServiceProviderType; aDestination.SetSPTypesDinamically(this.GetSPTypesDinamically()); aDestination.MachineName = this.MachineName; aDestination.MachinePort = this.MachinePort; }
/// <summary> /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context. /// </summary> /// <param name="context">An <see cref="ITypeDescriptorContext"/> that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be a null reference (Nothing in Visual Basic).</param> /// <returns>A <see cref="TypeConverter.StandardValuesCollection"/> that holds a standard set of valid values, or a null reference (Nothing in Visual Basic) if the data type does not support a standard set of values.</returns> public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return(new System.ComponentModel.TypeConverter.StandardValuesCollection(APCServiceOptions.GetSPTypes())); }