예제 #1
0
        /// <summary>
        /// Returns a string representation of the function.
        /// </summary>
        /// <returns>String representation of the function.</returns>
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(m_strName);
            stringBuilder.Append("(");
            for (int iIndex = 0; iIndex < m_listParameters.Count; iIndex++)
            {
                if (iIndex > 0)
                {
                    stringBuilder.Append(", ");
                }
                stringBuilder.Append(m_listParameters[iIndex]);
            }
            stringBuilder.Append(") [");
            stringBuilder.Append(ParameterCount.ToString("00000000"));
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
예제 #2
0
        public virtual void WriteXml(XmlWriter writer)
        {
            try
            {
                writer.WriteAttributeString("Type", GetType().AssemblyQualifiedName);
                writer.WriteAttributeString("Guid", Guid.ToString());
                writer.WriteAttributeString("StateCount", Store.Count.ToString());
                writer.WriteAttributeString("InputCount", InputNodes.Count.ToString());
                writer.WriteAttributeString("OutputCount", OutputNodes.Count.ToString());
                writer.WriteAttributeString("ParameterCount", ParameterCount.ToString());

                if (InputNodes.Count > 0)
                {
                    writer.WriteStartElement("InputNodes");
                    foreach (var inputNode in InputNodes)
                    {
                        InputNode item = inputNode as InputNode;
                        var       ext  = string.Join(",", item.GetSupportedExtensions());

                        writer.WriteStartElement("InputNode");

                        writer.WriteAttributeString("Identifier", item.Identity.ToString());
                        writer.WriteAttributeString("DisplayName", item.DisplayName);
                        writer.WriteAttributeString("Extension", ext);

                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }
                if (OutputNodes.Count > 0)
                {
                    writer.WriteStartElement("OutputNodes");

                    foreach (var item in OutputNodes)
                    {
                        var ext = string.Join(",", item.GetSupportedExtensions());

                        writer.WriteStartElement("OutputNode");

                        writer.WriteAttributeString("Identifier", item.Identity.ToString());
                        writer.WriteAttributeString("DisplayName", item.DisplayName);
                        writer.WriteAttributeString("Extension", ext);

                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }


                if (Store.Count > 0)
                {
                    XmlSerializer keySerializer = new XmlSerializer(typeof(SerializableDictionary <Guid, ModuleState>));
                    keySerializer.Serialize(writer, Store);
                }

                if (StateInfo.Count > 0)
                {
                    writer.WriteStartElement("StateInfo");
                    writer.WriteAttributeString("Count", StateInfo.Count.ToString());
                    XmlSerializer keySerializer = new XmlSerializer(typeof(SerializableDictionary <string, string>));
                    keySerializer.Serialize(writer, StateInfo);
                    writer.WriteEndElement();
                }

                WriteParameter(writer);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }