Ejemplo n.º 1
0
 public override byte[] Serialize()
 {
     using (var stream = new MemoryStream())
     {
         stream.WriteASCII(StringValueAttribute.Get(MessageType));
         stream.WriteASCII(' ');
         stream.WriteASCII(VersionM.ToString("D"));
         stream.WriteASCII('.');
         stream.WriteASCII(VersionN.ToString("D"));
         stream.WriteASCII(' ');
         stream.WriteASCII(FileId.ToString());
         stream.WriteASCII("\r\n\r\n");
         return stream.ToArray();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取版本信息--本地
        /// </summary>
        /// <returns></returns>
        private static string GetVersionLoad()
        {
            string currentPath = AppDomain.CurrentDomain.BaseDirectory;
            string iisBinPath  = AppDomain.CurrentDomain.RelativeSearchPath;
            string loadPath    = string.IsNullOrEmpty(iisBinPath) ? currentPath : iisBinPath;

            try
            {
                VersionM versionM = XMLSerializer.Deserialize <VersionM>(Path.Combine(loadPath, filePathVersion));

                return(versionM?.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }