示例#1
0
        public Wz_File LoadFile(string fileName, Wz_Node node, bool useBaseWz = false, bool loadWzAsFolder = false)
        {
            Wz_File file = null;

            try
            {
                file = new Wz_File(fileName, this);
                if (!file.Loaded)
                {
                    throw new Exception("The file is not a valid wz file.");
                }
                this.wz_files.Add(file);
                file.TextEncoding = this.TextEncoding;
                if (!this.encryption.encryption_detected)
                {
                    this.encryption.DetectEncryption(file);
                }
                node.Value = file;
                file.Node  = node;
                file.FileStream.Position = file.Header.DataStartPosition;
                file.GetDirTree(node, useBaseWz, loadWzAsFolder);
                file.DetectWzType();
                file.DetectWzVersion();
                return(file);
            }
            catch
            {
                if (file != null)
                {
                    file.Close();
                    this.wz_files.Remove(file);
                }
                throw;
            }
        }
示例#2
0
        public void LoadFile(string fileName, Wz_Node node, bool useBaseWz)
        {
            Wz_File file;

            try
            {
                file = new Wz_File(fileName, this);
                file.TextEncoding = this.TextEncoding;
                if (!this.encryption.encryption_detected)
                {
                    this.encryption.DetectEncryption(file);
                }
                this.wz_files.Add(file);
                node.Value = file;
                file.Node  = node;
                file.FileStream.Position = 62;
                file.GetDirTree(node, useBaseWz);
                file.DetectWzType();
                file.DetectWzVersion();
            }
            catch
            {
                throw;
            }
        }