Пример #1
0
        /// <summary>
        /// 获取本地配置文件
        /// </summary>
        /// <returns></returns>
        private ModuleInfo GetLocalVersion(string filePath)
        {
            //获取本地的升级文件
            //  string filePath = string.Format("{0}/{1}", xapInfo.FileName, VersionFileName);
            if (IosManager.ExistsFile(filePath))
            {
                using (Stream localfilesm = new MemoryStream(IosManager.GetFileBytes(filePath)))
                {
                    XElement xmlClient = XElement.Load(System.Xml.XmlReader.Create(localfilesm));

                    ModuleInfo modeuleInfo = (from c in xmlClient.DescendantsAndSelf("ModuleInfo")
                                              select new ModuleInfo
                    {
                        ModuleName = c.Elements("ModuleName").SingleOrDefault().Value,
                        Version = c.Elements("Version").SingleOrDefault().Value,
                        FileName = c.Elements("FileName").SingleOrDefault().Value,
                        EnterAssembly = c.Elements("EnterAssembly").SingleOrDefault().Value,
                        IsSave = c.Elements("IsSave").SingleOrDefault().Value,
                        HostAddress = c.Elements("HostAddress").SingleOrDefault().Value,
                        ServerID = c.Elements("ServerID").SingleOrDefault().Value,
                        ClientID = c.Elements("ClientID").SingleOrDefault().Value,
                        Description = c.Elements("Description").SingleOrDefault().Value,
                    }).FirstOrDefault();
                    return(modeuleInfo);
                }
            }
            else
            {
                return(new ModuleInfo()
                {
                    Version = "1.0.0.0000"
                });
            }
        }
Пример #2
0
        ///<summary>
        /// 获取本地的xap文件包
        /// </summary>
        /// <returns>xap文件流</returns>
        private Stream GetLocalXapFile(string fileName)
        {
            string filePath = string.Format("{0}/{1}", fileName, fileName);

            byte[] fileBytes = IosManager.GetFileBytes(filePath);
            if ((fileBytes != null) && (fileBytes.Length > 0))
            {
                return(new MemoryStream(fileBytes, 0, fileBytes.Length));
            }
            return(Stream.Null);
        }