@@ -11,6 +11,21 @@ class Patcher
1111 public const string PatchText = "PATCH" ;
1212 public const int EndOfFile = 0x454F46 ;
1313
14+ public void PatchStudy ( MemoryStream patch , Studier . IpsStudy study , MemoryStream source , MemoryStream target )
15+ {
16+ PatchStudy ( ( Stream ) patch , study , ( Stream ) source , ( Stream ) target ) ;
17+ }
18+ public void PatchStudy ( string patch , Studier . IpsStudy study , string source , string target )
19+ {
20+ using ( FileStream patchStream = File . OpenRead ( patch ) , sourceStream = File . OpenRead ( source ) , targetStream = File . Open ( target , FileMode . Create ) )
21+ {
22+ PatchStudy ( patchStream , study , sourceStream , targetStream ) ;
23+ }
24+ }
25+ public void PatchStudy ( FileStream patch , Studier . IpsStudy study , FileStream source , FileStream target )
26+ {
27+ PatchStudy ( ( Stream ) patch , study , ( Stream ) source , ( Stream ) target ) ;
28+ }
1429 public void PatchStudy ( Stream patch , Studier . IpsStudy study , Stream source , Stream target )
1530 {
1631 source . CopyTo ( target ) ;
@@ -46,13 +61,28 @@ public void PatchStudy(Stream patch, Studier.IpsStudy study, Stream source, Stre
4661 }
4762 if ( study . OutlenMax != 0xFFFFFFFF && source . Length <= study . OutlenMax ) throw new Exceptions . IpsNotThisException ( ) ; // Truncate data without this being needed is a poor idea.
4863 }
64+ public void Patch ( MemoryStream patch , MemoryStream source , MemoryStream target )
65+ {
66+ Patch ( ( Stream ) patch , ( Stream ) source , ( Stream ) target ) ;
67+ }
68+ public void Patch ( string patch , string source , string target )
69+ {
70+ using ( FileStream patchStream = File . OpenRead ( patch ) , sourceStream = File . OpenRead ( source ) , targetStream = File . Open ( target , FileMode . Create ) )
71+ {
72+ Patch ( patchStream , sourceStream , targetStream ) ;
73+ }
74+ }
75+ public void Patch ( FileStream patch , FileStream source , FileStream target )
76+ {
77+ Patch ( ( Stream ) patch , ( Stream ) source , ( Stream ) target ) ;
78+ }
4979 public void Patch ( Stream patch , Stream source , Stream target )
5080 {
5181 Studier studier = new Studier ( ) ;
5282 Studier . IpsStudy study = studier . Study ( patch ) ;
5383 PatchStudy ( patch , study , source , target ) ;
5484 }
55- public static long Clamp ( long value , long minimum , long maximum )
85+ private static long Clamp ( long value , long minimum , long maximum )
5686 {
5787 return ( value < minimum ) ? minimum : ( value > maximum ) ? maximum : value ;
5888 }
0 commit comments