示例#1
0
        /// <summary>
        /// Search Bundle`s *.addin file
        /// </summary>
        /// <returns>错误返回NULL</returns>
        public static AddinMetadata SearchXml(string dirName, string addinFile)
        {
            string xmlpatch = dirName + "\\" + addinFile;

            if (System.IO.File.Exists(xmlpatch))
            {
                string xml = string.Empty;
                using (StreamReader reader = File.OpenText(xmlpatch))
                {
                    xml = reader.ReadToEnd();
                }
                return((AddinMetadata)XmlConvertor.XmlToObject(typeof(AddinMetadata), xml));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
 /// <summary>
 /// 序列号对像为字符串 serialize an object to string.
 /// </summary>
 /// <param name="obj">
 ///  对像 the object.
 /// </param>
 /// <returns>
 /// 返回序列化字符串  the serialized string.
 /// </returns>
 public static string ObjectToXml(object obj)
 {
     return(XmlConvertor.ObjectToXml(obj, false));
 }