/// <summary>
        /// Compare this parameter to another parameter.
        /// </summary>
        /// <param name="p">Specifies the other parameter to compare with this one.</param>
        /// <returns>Returns <i>true</i> if the two parameters are the same, <i>false</i> otherwise.</returns>
        public virtual bool Compare(BaseParameter p)
        {
            RawProto p1   = ToProto("foo");
            RawProto p2   = p.ToProto("foo");
            string   str1 = p1.ToString();
            string   str2 = p2.ToString();

            return(str1 == str2);
        }
Exemple #2
0
        /// <summary>
        /// Saves the RawProto to a file.
        /// </summary>
        /// <param name="p">Specifies the RawProto.</param>
        /// <param name="strFileName">Specifies the file name where the RawProto is to be saved.</param>
        public static void SaveToFile(RawProto p, string strFileName)
        {
            string strBody = "";

            if (p.Name != "root")
            {
                strBody = p.ToString();
            }
            else
            {
                foreach (RawProto child in p.Children)
                {
                    strBody += child.ToString();
                    strBody += Environment.NewLine;
                }
            }

            using (StreamWriter sw = new StreamWriter(strFileName))
            {
                sw.Write(strBody);
            }
        }