示例#1
0
        /// <summary>
        /// Serializes a ModuleProcessInfo object to xml
        /// </summary>
        /// <param name="mpi">Object to serialize</param>
        /// <returns>string containing serialized xml object</returns>
        public static string ToXml(ModuleProcessInfo mpi)
        {
            XmlSerializer serializer;

            System.IO.StringWriter    stream;
            System.Text.StringBuilder sb;

            sb         = new System.Text.StringBuilder();
            stream     = new System.IO.StringWriter(sb);
            serializer = new XmlSerializer(typeof(ModuleProcessInfo));
            serializer.Serialize(stream, mpi, null);
            stream.Flush();
            return(sb.ToString());
        }
        /// <summary>
        /// Serializes a ModuleProcessInfo object to xml
        /// </summary>
        /// <param name="mpi">Object to serialize</param>
        /// <returns>string containing serialized xml object</returns>
        public static string ToXml(ModuleProcessInfo mpi)
        {
            XmlSerializer serializer;
            System.IO.StringWriter stream;
            System.Text.StringBuilder sb;

            sb = new System.Text.StringBuilder();
            stream = new System.IO.StringWriter(sb);
            serializer = new XmlSerializer(typeof(ModuleProcessInfo));
            serializer.Serialize(stream, mpi, null);
            stream.Flush();
            return sb.ToString();
        }
        /// <summary>
        /// Initializes a new instance of the Module class
        /// </summary>
        /// <param name="name">Module name</param>
        protected ModuleClient(string name)
        {
            this.name = name;
            this.alias = name;
            this.busy = false;
            this.ready = false;
            this.enabled = true;
            this.checkInterval = GlobalCheckInterval;
            this.executableInfo = new ModuleProcessInfo();
            //this.waitingResponse = new List<Command>(10);
            //this.responses = new List<Response>();
            //this.commands = new List<Command>();
            this.prototypes = new PrototypeCollection(this);
            this.lockList = new List<Command>();
            this.restartActions = new ActionCollection(this);
            this.restartTestActions = new ActionCollection(this);
            this.startupActions = new ActionCollection(this);
            this.stopActions = new ActionCollection(this);
            this.testTimeOutActions = new ActionCollection(this);

            this.restartRequested = false;
            this.restartTestRequested = false;
            this.rnd = new Random(name.GetHashCode());
            this.simOptions = ModuleSimulationOptions.SimulationDisabled;

            // Shared Variable related prototypes
            this.Prototypes.Add(Prototype.CreateVar);
            this.Prototypes.Add(Prototype.ListVars);
            this.Prototypes.Add(Prototype.Prototypes);
            this.Prototypes.Add(Prototype.ReadVar);
            this.Prototypes.Add(Prototype.ReadVars);
            this.Prototypes.Add(Prototype.StatVar);
            this.Prototypes.Add(Prototype.WriteVar);

            this.readyEvent = new ManualResetEvent(false);
        }