Example #1
0
 public void GameReplaceFile(string File1, Stream NewStream)
 {
     this.Action(String.Format("Update {0}", File1), () =>
     {
         this.GameGetFile(File1, (OldStream) =>
         {
             OldStream.WriteStream(NewStream.Slice());
             //Console.WriteLine("ZeroBytes: {0}", OldStream.Length - OldStream.Position);
             OldStream.WriteByteRepeatedTo((byte)0x00, OldStream.Length);
             OldStream.Flush();
         });
     });
 }
        public void ReplaceFileWithStream(String Path, Stream NewStream, Action <long, long> Progress = null)
        {
            if (Progress == null)
            {
                Progress = (_Current, _Total) => { }
            }
            ;

            this.OpenFileRWScope(Path, (OldStream) =>
            {
                OldStream.WriteStream(NewStream, (Current, Total) =>
                {
                    Progress(Current, OldStream.Length);
                });
                long Waypoint = OldStream.Position;
                OldStream.WriteByteRepeatedTo(0x00, OldStream.Length, (Current, Total) =>
                {
                    Progress(Waypoint + Current, OldStream.Length);
                });
            });
        }