Esempio n. 1
0
        public bool installPatch(string path)
        {
            FileStream fileStream = File.OpenRead(path);

            try
            {
                ReOpen();

                using (ZipInputStream s = new ZipInputStream(fileStream))
                {
                    ZipEntry theEntry;
                    while ((theEntry = s.GetNextEntry()) != null)
                    {
                        if (theEntry.IsFile)
                        {
                            byte[] buff = new byte[theEntry.Size];
                            s.Read(buff, 0, (int)theEntry.Size);
                            string newName = "..\\" + theEntry.Name.Replace("/", "\\");
                            jumpArc.putFile(newName, buff);
                            Console.WriteLine("补丁文件:" + newName);
                        }
                    }
                    jumpArc.Save();
                }
                Console.WriteLine("补丁安装成功");
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("补丁安装失败" + ex.ToString());
            }

            return(false);
        }