ResolveStreamEventArgs is used for applying a patch.
It is the responsibility to provide a valid stream.
Inheritance: System.EventArgs, IDisposable
Esempio n. 1
0
 private MpqArchive()
 {
     this.syncRoot = new object();
     this.resolveStreamEventArgs = new ResolveStreamEventArgs();
     this.fileCollection         = new MpqFileCollection(this);
     this.listFileParsed         = false;
 }
Esempio n. 2
0
        private void ResolveBaseFile(object sender, ResolveStreamEventArgs e)
        {
            var file = sender as MpqFile;

            if (file == null)
            {
                throw new InvalidOperationException();
            }

            bool archiveFound = false;

            foreach (var archive in archiveList)
            {
                if (!archiveFound)
                {
                    if (archive == file.Archive)
                    {
                        archiveFound = true;
                    }
                    continue;
                }

                var foundFile = archive.FindFile(file.Name);

                if (foundFile != null)
                {
                    e.Stream = foundFile.Open();
                    return;
                }
            }
        }