├── .gitignore ├── LICENSE ├── README.md └── YAXBPC ├── CopyMe ├── apply_patch_linux.sh ├── apply_patch_linux_alternative.sh ├── apply_patch_mac.command ├── apply_patch_mac_alternative.command ├── apply_patch_windows.bat ├── apply_patch_windows_alternative.bat ├── how_to_apply_this_patch.txt ├── subscript1.ps1 ├── xdelta3 ├── xdelta3.exe ├── xdelta3.x86_64 ├── xdelta3.x86_64.exe └── xdelta3_mac ├── CustomExceptionHandler.cs ├── Database.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Licenses.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── YAXBPC.csproj ├── Yet Another xdelta-based Patch Creator.sln ├── app.config └── output6.ico /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | ./YAXBPC/[Bb]in/ 22 | ./YAXBPC/[Oo]bj/ 23 | 24 | # Visual Studio 2015 cache/options directory 25 | .vs/ 26 | # Uncomment if you have tasks that create the project's static files in wwwroot 27 | #wwwroot/ 28 | 29 | # MSTest test Results 30 | [Tt]est[Rr]esult*/ 31 | [Bb]uild[Ll]og.* 32 | 33 | # NUNIT 34 | *.VisualState.xml 35 | TestResult.xml 36 | 37 | # Build Results of an ATL Project 38 | [Dd]ebugPS/ 39 | [Rr]eleasePS/ 40 | dlldata.c 41 | 42 | # DNX 43 | project.lock.json 44 | artifacts/ 45 | 46 | *_i.c 47 | *_p.c 48 | *_i.h 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opendb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | *.sap 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | nCrunchTemp_* 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | # TODO: Comment the next line if you want to checkin your web deploy settings 141 | # but database connection strings (with potential passwords) will be unencrypted 142 | *.pubxml 143 | *.publishproj 144 | 145 | # NuGet Packages 146 | *.nupkg 147 | # The packages folder can be ignored because of Package Restore 148 | **/packages/* 149 | # except build/, which is used as an MSBuild target. 150 | !**/packages/build/ 151 | # Uncomment if necessary however generally it will be regenerated when needed 152 | #!**/packages/repositories.config 153 | # NuGet v3's project.json files produces more ignoreable files 154 | *.nuget.props 155 | *.nuget.targets 156 | 157 | # Microsoft Azure Build Output 158 | csx/ 159 | *.build.csdef 160 | 161 | # Microsoft Azure Emulator 162 | ecf/ 163 | rcf/ 164 | 165 | # Microsoft Azure ApplicationInsights config file 166 | ApplicationInsights.config 167 | 168 | # Windows Store app package directory 169 | AppPackages/ 170 | BundleArtifacts/ 171 | 172 | # Visual Studio cache files 173 | # files ending in .cache can be ignored 174 | *.[Cc]ache 175 | # but keep track of directories ending in .cache 176 | !*.[Cc]ache/ 177 | 178 | # Others 179 | ClientBin/ 180 | ~$* 181 | *~ 182 | *.dbmdl 183 | *.dbproj.schemaview 184 | *.pfx 185 | *.publishsettings 186 | node_modules/ 187 | orleans.codegen.cs 188 | 189 | # RIA/Silverlight projects 190 | Generated_Code/ 191 | 192 | # Backup & report files from converting an old project file 193 | # to a newer Visual Studio version. Backup files are not needed, 194 | # because we have git ;-) 195 | _UpgradeReport_Files/ 196 | Backup*/ 197 | UpgradeLog*.XML 198 | UpgradeLog*.htm 199 | 200 | # SQL Server files 201 | *.mdf 202 | *.ldf 203 | 204 | # Business Intelligence projects 205 | *.rdl.data 206 | *.bim.layout 207 | *.bim_*.settings 208 | 209 | # Microsoft Fakes 210 | FakesAssemblies/ 211 | 212 | # GhostDoc plugin setting file 213 | *.GhostDoc.xml 214 | 215 | # Node.js Tools for Visual Studio 216 | .ntvs_analysis.dat 217 | 218 | # Visual Studio 6 build log 219 | *.plg 220 | 221 | # Visual Studio 6 workspace options file 222 | *.opt 223 | 224 | # Visual Studio LightSwitch build output 225 | **/*.HTMLClient/GeneratedArtifacts 226 | **/*.DesktopClient/GeneratedArtifacts 227 | **/*.DesktopClient/ModelManifest.xml 228 | **/*.Server/GeneratedArtifacts 229 | **/*.Server/ModelManifest.xml 230 | _Pvt_Extensions 231 | 232 | # Paket dependency manager 233 | .paket/paket.exe 234 | 235 | # FAKE - F# Make 236 | .fake/ 237 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YAXBPC 2 | Yet another xdelta-based patch creator 3 | -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Do not use nounset here 3 | # Do not use errexit here 4 | 5 | # Roses are red, violets are blue, sugar is sweet, and so are you. 6 | # Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 7 | 8 | WORKINGDIR=$(pwd) 9 | SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" 10 | cd "$SCRIPTDIR" 11 | args="$@" 12 | dropin="$1" 13 | 14 | sourcefile='&sourcefile&' 15 | targetfile='&targetfile&' 16 | changes="changes.vcdiff" 17 | olddir="old" 18 | 19 | find_xdelta3() { 20 | chmod +x ./xdelta3 2>/dev/null 21 | chmod +x ./xdelta3.x86_64 2>/dev/null 22 | case $(uname -m) in 23 | i*86) arch=x86;; 24 | Pentium*|AMD?Athlon*) arch=x86;; 25 | amd64|x86_64) arch=x86_64;; 26 | *) arch=other;; 27 | esac 28 | if [ "$(uname)" = "Linux" ] && [ "$arch" = "x86_64" ] && [ -x ./xdelta3.x86_64 ] && file ./xdelta3.x86_64 | grep -q "GNU/Linux"; then 29 | app="./xdelta3.x86_64" 30 | elif [ "$(uname)" = "Linux" ] && [ "$arch" = "x86" ] && [ -x ./xdelta3 ] && file ./xdelta3 | grep -q "GNU/Linux"; then 31 | app="./xdelta3" 32 | elif hash xdelta3 2>/dev/null; then 33 | app="xdelta3" 34 | elif hash wine 2>/dev/null && [ -f "xdelta3.exe" ]; then 35 | app="wine ./xdelta3.exe" 36 | else 37 | echo "Error: The required application is not found or inaccessible." 38 | echo "Please either make sure the file \"xdelta3\" has execute rights, install xdelta3 [recommended], or install WinE." 39 | cd "$WORKINGDIR" 40 | return 1 41 | fi 42 | return 0 43 | } 44 | 45 | find_inputs() { 46 | if [ ! -z "$dropin" ] && [ ! "$dropin" = " " ]; then 47 | if [ -f "$dropin" ]; then 48 | sourcefile="$dropin" 49 | targetfile="$(dirname "$sourcefile")/$targetfile" 50 | olddir="$(dirname "$sourcefile")/$olddir" 51 | else 52 | echo "Warning: Input file \"$dropin\" is not found. Ignored." 53 | fi 54 | fi 55 | if [ ! -f "$sourcefile" ]; then 56 | if [ -f "../$sourcefile" ]; then 57 | sourcefile="../$sourcefile" 58 | targetfile="../$targetfile" 59 | olddir="../$olddir" 60 | else 61 | if [ -f "../../$sourcefile" ]; then 62 | sourcefile="../../$sourcefile" 63 | targetfile="../../$targetfile" 64 | olddir="../../$olddir" 65 | else 66 | if [ -f "../../../$sourcefile" ]; then 67 | sourcefile="../../../$sourcefile" 68 | targetfile="../../../$targetfile" 69 | olddir="../../../$olddir" 70 | else 71 | echo "Error: Source file not found." 72 | echo "The file \"$sourcefile\" must be in the same folder as this script." 73 | cd "$WORKINGDIR" 74 | return 1 75 | fi 76 | fi 77 | fi 78 | fi 79 | if [ ! -f "$changes" ]; then 80 | echo "Error: VCDIFF file \"$changes\" is missing." 81 | echo "Please extract everything from the archive." 82 | cd "$WORKINGDIR" 83 | return 1 84 | fi 85 | return 0 86 | } 87 | 88 | run_patch () { 89 | echo "Attempting to patch \"$sourcefile\"..." 90 | `$app -d -f -s "$sourcefile" "$changes" "$targetfile"` 91 | return $? 92 | } 93 | 94 | move_old_file () { 95 | if [ -f "$targetfile" ] && [ ! -f "do_not_move_old_file.txt" ]; then 96 | mkdir -p "$olddir" >/dev/null 97 | if mv "$sourcefile" "$olddir/"; then 98 | echo "Moved the old file to directory \"$olddir\"." 99 | return 0 100 | else 101 | echo "Warning: Couldn't moved the old file." 102 | return 1 103 | fi 104 | fi 105 | return 0 106 | } 107 | 108 | if find_xdelta3 && find_inputs; then 109 | if run_patch; then 110 | if ! move_old_file; then 111 | ignore=1 112 | fi 113 | echo "Done." 114 | cd "$WORKINGDIR" 115 | return 0 2>/dev/null || exit 0 116 | else 117 | echo "Error: Patching wasn't successful!" 118 | fi 119 | fi 120 | 121 | cd "$WORKINGDIR" 122 | return 1 2>/dev/null || exit 1 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_linux_alternative.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Do not use nounset here 3 | # Do not use errexit here 4 | 5 | # Roses are red, violets are blue, sugar is sweet, and so are you. 6 | # Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 7 | # Alternative scripts don't need know about what source/target files are; 8 | # they let xdelta3 use the default filenames stored in vcdiff file 9 | # (might not be correct, like tempSource.file, ???, or in the encoding it doesn't understand) 10 | 11 | WORKINGDIR=$(pwd) 12 | SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" 13 | cd "$SCRIPTDIR" 14 | args="$@" 15 | dropin="$1" 16 | 17 | sourcefile='' 18 | targetfile='' 19 | changes="changes.vcdiff" 20 | olddir="old" 21 | 22 | find_xdelta3() { 23 | chmod +x ./xdelta3 2>/dev/null 24 | chmod +x ./xdelta3.x86_64 2>/dev/null 25 | case $(uname -m) in 26 | i*86) arch=x86;; 27 | Pentium*|AMD?Athlon*) arch=x86;; 28 | amd64|x86_64) arch=x86_64;; 29 | *) arch=other;; 30 | esac 31 | if [ "$(uname)" = "Linux" ] && [ "$arch" = "x86_64" ] && [ -x ./xdelta3.x86_64 ] && file ./xdelta3.x86_64 | grep -q "GNU/Linux"; then 32 | app="./xdelta3.x86_64" 33 | elif [ "$(uname)" = "Linux" ] && [ "$arch" = "x86" ] && [ -x ./xdelta3 ] && file ./xdelta3 | grep -q "GNU/Linux"; then 34 | app="./xdelta3" 35 | elif hash xdelta3 2>/dev/null; then 36 | app="xdelta3" 37 | elif hash wine 2>/dev/null && [ -f "xdelta3.exe" ]; then 38 | app="wine ./xdelta3.exe" 39 | else 40 | echo "Error: The required application is not found or inaccessible." 41 | echo "Please either make sure the file \"xdelta3\" has execute rights, install xdelta3 [recommended], or install WinE." 42 | cd "$WORKINGDIR" 43 | return 1 44 | fi 45 | return 0 46 | } 47 | 48 | find_inputs() { 49 | if [ ! -z "$dropin" ] && [ ! "$dropin" = " " ]; then 50 | if [ -f "$dropin" ]; then 51 | sourcefile="$dropin" 52 | else 53 | echo "Warning: Input file \"$dropin\" is not found. Ignored." 54 | fi 55 | fi 56 | if [ ! -f "$changes" ]; then 57 | echo "Error: VCDIFF file \"$changes\" is missing." 58 | echo "Please extract everything from the archive." 59 | cd "$WORKINGDIR" 60 | return 1 61 | fi 62 | return 0 63 | } 64 | 65 | run_patch () { 66 | echo "Attempting to patch..." 67 | if [ ! -z "$sourcefile" ] && [ ! "$sourcefile" = " " ]; then 68 | `$app -d -f -s "$sourcefile" "$changes"` 69 | return $? 70 | else 71 | `$app -d -f "$changes"` 72 | return $? 73 | fi 74 | } 75 | 76 | if find_xdelta3 && find_inputs; then 77 | if run_patch; then 78 | echo "Done." 79 | cd "$WORKINGDIR" 80 | return 0 2>/dev/null || exit 0 81 | else 82 | echo "Error: Patching wasn't successful!" 83 | fi 84 | fi 85 | 86 | cd "$WORKINGDIR" 87 | return 1 2>/dev/null || exit 1 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_mac.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Do not use nounset here 3 | # Do not use errexit here 4 | 5 | # Roses are red, violets are blue, sugar is sweet, and so are you. 6 | # Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 7 | 8 | WORKINGDIR=$(pwd) 9 | SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" 10 | cd "$SCRIPTDIR" 11 | args="$@" 12 | dropin="$1" 13 | 14 | sourcefile='&sourcefile&' 15 | targetfile='&targetfile&' 16 | changes="changes.vcdiff" 17 | olddir="old" 18 | 19 | find_xdelta3() { 20 | chmod +x ./xdelta3_mac 2>/dev/null 21 | case $(uname -m) in 22 | i*86) arch=x86;; 23 | Pentium*|AMD?Athlon*) arch=x86;; 24 | amd64|x86_64) arch=x86_64;; 25 | *) arch=other;; 26 | esac 27 | if [ "x`uname -s`" = "xDarwin" ] && [ "$arch" = "x86_64" ] && [ -x ./xdelta3_mac ] && file ./xdelta3_mac | grep -q "Mach-O"; then 28 | app="./xdelta3_mac" 29 | elif hash xdelta3 2>/dev/null; then 30 | app="xdelta3" 31 | elif hash wine 2>/dev/null && [ -f "xdelta3.exe" ]; then 32 | app="wine ./xdelta3.exe" 33 | else 34 | echo "Error: The required application is not found or inaccessible." 35 | echo "Please either make sure the file \"xdelta3_mac\" has execute rights, install xdelta3 [recommended], or install WinE." 36 | cd "$WORKINGDIR" 37 | return 1 38 | fi 39 | return 0 40 | } 41 | 42 | find_inputs() { 43 | if [ ! -z "$dropin" ] && [ ! "$dropin" = " " ]; then 44 | if [ -f "$dropin" ]; then 45 | sourcefile="$dropin" 46 | targetfile="$(dirname "$sourcefile")/$targetfile" 47 | olddir="$(dirname "$sourcefile")/$olddir" 48 | else 49 | echo "Warning: Input file \"$dropin\" is not found. Ignored." 50 | fi 51 | fi 52 | if [ ! -f "$sourcefile" ]; then 53 | if [ -f "../$sourcefile" ]; then 54 | sourcefile="../$sourcefile" 55 | targetfile="../$targetfile" 56 | olddir="../$olddir" 57 | else 58 | if [ -f "../../$sourcefile" ]; then 59 | sourcefile="../../$sourcefile" 60 | targetfile="../../$targetfile" 61 | olddir="../../$olddir" 62 | else 63 | if [ -f "../../../$sourcefile" ]; then 64 | sourcefile="../../../$sourcefile" 65 | targetfile="../../../$targetfile" 66 | olddir="../../../$olddir" 67 | else 68 | echo "Error: Source file not found." 69 | echo "The file \"$sourcefile\" must be in the same folder as this script." 70 | cd "$WORKINGDIR" 71 | return 1 72 | fi 73 | fi 74 | fi 75 | fi 76 | if [ ! -f "$changes" ]; then 77 | echo "Error: VCDIFF file \"$changes\" is missing." 78 | echo "Please extract everything from the archive." 79 | cd "$WORKINGDIR" 80 | return 1 81 | fi 82 | return 0 83 | } 84 | 85 | run_patch () { 86 | echo "Attempting to patch \"$sourcefile\"..." 87 | `$app -d -f -s "$sourcefile" "$changes" "$targetfile"` 88 | return $? 89 | } 90 | 91 | move_old_file () { 92 | if [ -f "$targetfile" ] && [ ! -f "do_not_move_old_file.txt" ]; then 93 | mkdir -p "$olddir" >/dev/null 94 | if mv "$sourcefile" "$olddir/"; then 95 | echo "Moved the old file to directory \"$olddir\"." 96 | return 0 97 | else 98 | echo "Warning: Couldn't moved the old file." 99 | return 1 100 | fi 101 | fi 102 | return 0 103 | } 104 | 105 | if find_xdelta3 && find_inputs; then 106 | if run_patch; then 107 | if ! move_old_file; then 108 | ignore=1 109 | fi 110 | echo "Done." 111 | cd "$WORKINGDIR" 112 | return 0 2>/dev/null || exit 0 113 | else 114 | echo "Error: Patching wasn't successful!" 115 | fi 116 | fi 117 | 118 | cd "$WORKINGDIR" 119 | return 1 2>/dev/null || exit 1 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_mac_alternative.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Do not use nounset here 3 | # Do not use errexit here 4 | 5 | # Roses are red, violets are blue, sugar is sweet, and so are you. 6 | # Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 7 | # Alternative scripts don't need know about what source/target files are; 8 | # they let xdelta3 use the default filenames stored in vcdiff file 9 | # (might not be correct, like tempSource.file, ???, or in the encoding it doesn't understand) 10 | 11 | WORKINGDIR=$(pwd) 12 | SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" 13 | cd "$SCRIPTDIR" 14 | args="$@" 15 | dropin="$1" 16 | 17 | sourcefile='' 18 | targetfile='' 19 | changes="changes.vcdiff" 20 | olddir="old" 21 | 22 | find_xdelta3() { 23 | chmod +x ./xdelta3_mac 2>/dev/null 24 | case $(uname -m) in 25 | i*86) arch=x86;; 26 | Pentium*|AMD?Athlon*) arch=x86;; 27 | amd64|x86_64) arch=x86_64;; 28 | *) arch=other;; 29 | esac 30 | if [ "x`uname -s`" = "xDarwin" ] && [ "$arch" = "x86_64" ] && [ -x ./xdelta3_mac ] && file ./xdelta3_mac | grep -q "Mach-O"; then 31 | app="./xdelta3_mac" 32 | elif hash xdelta3 2>/dev/null; then 33 | app="xdelta3" 34 | elif hash wine 2>/dev/null && [ -f "xdelta3.exe" ]; then 35 | app="wine ./xdelta3.exe" 36 | else 37 | echo "Error: The required application is not found or inaccessible." 38 | echo "Please either make sure the file \"xdelta3_mac\" has execute rights, install xdelta3 [recommended], or install WinE." 39 | cd "$WORKINGDIR" 40 | return 1 41 | fi 42 | return 0 43 | } 44 | 45 | find_inputs() { 46 | if [ ! -z "$dropin" ] && [ ! "$dropin" = " " ]; then 47 | if [ -f "$dropin" ]; then 48 | sourcefile="$dropin" 49 | else 50 | echo "Warning: Input file \"$dropin\" is not found. Ignored." 51 | fi 52 | fi 53 | if [ ! -f "$changes" ]; then 54 | echo "Error: VCDIFF file \"$changes\" is missing." 55 | echo "Please extract everything from the archive." 56 | cd "$WORKINGDIR" 57 | return 1 58 | fi 59 | return 0 60 | } 61 | 62 | run_patch () { 63 | echo "Attempting to patch..." 64 | if [ ! -z "$sourcefile" ] && [ ! "$sourcefile" = " " ]; then 65 | `$app -d -f -s "$sourcefile" "$changes"` 66 | return $? 67 | else 68 | `$app -d -f "$changes"` 69 | return $? 70 | fi 71 | } 72 | 73 | if find_xdelta3 && find_inputs; then 74 | if run_patch; then 75 | echo "Done." 76 | cd "$WORKINGDIR" 77 | return 0 2>/dev/null || exit 0 78 | else 79 | echo "Error: Patching wasn't successful!" 80 | fi 81 | fi 82 | 83 | cd "$WORKINGDIR" 84 | return 1 2>/dev/null || exit 1 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_windows.bat: -------------------------------------------------------------------------------- 1 | 2 | @echo off 3 | setlocal 4 | 5 | rem Roses are red, violets are blue, sugar is sweet, and so are you. 6 | rem Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 7 | 8 | set "powershell=%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" 9 | if exist %powershell% ( 10 | rem If PowerShell is installed, execute the sub-script, and exit when it's done. Nothing is set up, so nothing to cleanup 11 | %powershell% -noprofile -executionpolicy bypass -file "%~dp0\subscript1.ps1" "%~1" 12 | goto :eof 13 | ) else ( 14 | echo PowerShell not found. Executing the legacy code path... 15 | ) 16 | 17 | for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x 18 | chcp 65001>nul 19 | set WORKINGDIR=%CD% 20 | chdir /d "%~dp0" 21 | (call ) 22 | 23 | set sourcefile=&sourcefile& 24 | set targetfile=&targetfile& 25 | set app=xdelta3.exe 26 | set changes=changes.vcdiff 27 | set sourcefiletmp=sourcefile.tmp 28 | set targetfiletmp=targetfile.tmp 29 | set movesourcefile=0 30 | set movetargetfile=0 31 | set olddir=old 32 | 33 | call :find_xdelta3 && call :find_inputs "%~1" && call :run_patch 34 | call :gtfo 35 | goto :eof 36 | 37 | 38 | :find_xdelta3 39 | (call) 40 | if exist "%app%" ( 41 | (call ) 42 | ) else ( 43 | echo The required application "%app%" can't be found! 44 | ) 45 | goto :eof 46 | 47 | :find_inputs 48 | (call) 49 | if exist "%~1" ( 50 | set "sourcefile=%~f1" 51 | set "targetfile=%~dp1%targetfile%" 52 | set "sourcefiletmp=%~dp1%sourcefiletmp%" 53 | set "targetfiletmp=%~dp1%targetfiletmp%" 54 | set "olddir=%~dp1%olddir%" 55 | (call ) 56 | ) 57 | if not exist "%sourcefile%" ( 58 | if exist "..\%sourcefile%" ( 59 | set "sourcefile=..\%sourcefile%" 60 | set "targetfile=..\%targetfile%" 61 | set "sourcefiletmp=..\sourcefile.tmp" 62 | set "targetfiletmp=..\targetfile.tmp" 63 | set "olddir=..\%olddir%" 64 | (call ) 65 | ) else ( 66 | if exist "..\..\%sourcefile%" ( 67 | set "sourcefile=..\..\%sourcefile%" 68 | set "targetfile=..\..\%targetfile%" 69 | set "sourcefiletmp=..\..\sourcefile.tmp" 70 | set "targetfiletmp=..\..\targetfile.tmp" 71 | set "olddir=..\..\%olddir%" 72 | (call ) 73 | ) else ( 74 | if exist "..\..\..\%sourcefile%" ( 75 | set "sourcefile=..\..\..\%sourcefile%" 76 | set "targetfile=..\..\..\%targetfile%" 77 | set "sourcefiletmp=..\..\..\sourcefile.tmp" 78 | set "targetfiletmp=..\..\..\targetfile.tmp" 79 | set "olddir=..\..\..\%olddir%" 80 | (call ) 81 | ) else ( 82 | echo Error: Source file "%sourcefile%" not found. 83 | echo You must put it in the same folder as this script. 84 | (call) 85 | ) 86 | ) 87 | ) 88 | ) else ( 89 | (call ) 90 | ) 91 | if not exist "%changes%" ( 92 | echo Error: VCDIFF file "%changes%" is missing. 93 | echo Please extract everything from the archive. 94 | (call) 95 | ) 96 | goto :eof 97 | 98 | :run_patch 99 | echo Attempting to patch "%sourcefile%"... 100 | if %movesourcefile% equ 1 ( 101 | move "%sourcefile%" "%sourcefiletmp%" > nul 102 | ) else ( 103 | set "sourcefiletmp=%sourcefile%" 104 | ) 105 | if %movetargetfile% equ 0 set "targetfiletmp=%targetfile%" 106 | %app% -d -f -s "%sourcefiletmp%" "%changes%" "%targetfiletmp%" 107 | if %movesourcefile% equ 1 move "%sourcefiletmp%" "%sourcefile%" > nul 108 | if %movetargetfile% equ 1 move "%targetfiletmp%" "%targetfile%" > nul 109 | if exist "%targetfile%" ( 110 | if not exist "do_not_move_old_file.txt" ( 111 | mkdir "%olddir%" 2>nul 112 | move "%sourcefile%" "%olddir%" 113 | ) 114 | echo Done. 115 | (call ) 116 | goto :eof 117 | ) 118 | echo Error occured! Patching wasn't successful! 119 | (call) 120 | pause 121 | goto :eof 122 | 123 | :gtfo 124 | chdir /d "%WORKINGDIR%" 125 | chcp %cp%>nul 126 | (call ) 127 | goto :eof 128 | -------------------------------------------------------------------------------- /YAXBPC/CopyMe/apply_patch_windows_alternative.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | rem Roses are red, violets are blue, sugar is sweet, and so are you. 5 | rem Enjoy your usual ratio: 5% of lines do the actual work, and the rest are there to make sure they work. (It's like 1%, actually) 6 | 7 | set app=xdelta3.exe 8 | set changes=changes.vcdiff 9 | set WORKINGDIR=%CD% 10 | chdir /d "%~dp0" 11 | 12 | if exist "%~1" ( 13 | echo Attempting to patch %~1... 14 | %app% -d -f -s "%~1" "%changes%" 15 | ) else ( 16 | echo Attempting to patch... 17 | %app% -d -f "%changes%" 18 | ) 19 | echo Done. Press enter to exit. 20 | chdir /d "%WORKINGDIR%" 21 | pause 22 | exit /b 23 | 24 | -------------------------------------------------------------------------------- /YAXBPC/CopyMe/how_to_apply_this_patch.txt: -------------------------------------------------------------------------------- 1 | Hi there! Yes, you! 2 | 3 | In short: 4 | - Move your original file (&sourcefile&) into this folder, or this folder's parent folder. For example: all these patches, scripts, xdelta3 binaries, how_to_appply_this_patch.txt are in folder Entertain/Animu/Nourin/patch_ep_01_v2. You should put it in either patch_ep_01_v2, Nourin, Animu, or Entertain. These scripts will first look for it in patch_ep_01_v2; if it can't find it there, it will look in Nourin, and then Animu, and finally Entertain. If the file can't be found in these four location, the scripts will give up. Please don't troll these poor scripts. Thanks. 5 | - Run the applying script written for your operating system: for Windows, apply_patch_windows.bat; for Linux/Unix, apply_patch_linux.sh; for Mac OSX, apply_patch_mac.command. 6 | - Alternative, you can drag-n-drop your original file onto the applying script. You don't need to move your file as told above if you choose this way. Only available in YAXBPC v2.1.0 or later. 7 | - Check if a new file was created (&targetfile&). If true, you're successful, so stop here. 8 | - If not, try the alternative script and check the output again. Comment: if used correctly, only windows scripts in legacy versions of windows have some real chance of failure. Otherwise, it shouldn't fail at all. 9 | - If the alternative script fails, redo carefully from the first step. 10 | - If nothing worked, you can resort to manual patching. Feel free to use any xdelta3 GUI if you don't like the following steps. 11 | + Move your original file (&sourcefile&) into this folder (the one where all these patches, scripts, xdelta3 binaries, how_to_appply_this_patch.txt are). 12 | + Open Command Prompt (Windows) or Terminal (Linux, Unix, Mac OSX). Change working directory to this folder. On Windows Explorer, you might want to right click in a blank area while pressing Shift to quickly do this step. 13 | + Copy and paste this line there, then press Enter: xdelta3 -d -f -s "&sourcefile&" "changes.vcdiff" "&targetfile&" 14 | + Done. Hint to users who think they know how to use xdelta3 and insist to run "xdelta3 -d changes.vcdiff": filenames stored in changes.vcdiff are not guaranteed to be correct, as the patch might have been created in a different type of system (Win32 vs. Linux, Win32 vs. Mac OSX) so xdelta3 might be unable to decode these filenames, or it might have been created "funnily" where filenames are replaced with garbage. 15 | 16 | You might want to check for some system requirements: 17 | - A *working* computer. 18 | - A *working* and *modern* PC operating system (Windows, Linux, Unix, Mac OSX). 19 | - These common OSes are officially supported and fully tested: Windows 7, Windows 10, Linux Mint 17.3, and whatever Mac OSX in 2014. 20 | - For Windows: Nothing prevents the script from executing the binary file xdelta3.exe (stupid antivirus for example). This patch makes heavy use of PowerShell when possible. It is installed by default in Windows 7 and later. If you're on Windows XP or Vista, please install it manually (see https://support.microsoft.com/en-us/kb/968929 ). 21 | - For Mac OSX: A pretty old (2014) 64-bit Mac OSX binary is bundled with the patch. If your OSX installation is 32-bit or the binary doesn't work on your new OSX, please install xdelta3 package. WinE on OSX might work, but it has never been tested. 22 | - For Linux: Either xdelta3 package installed [recommended], WinE package installed, or included Linux binaries' permission set to executable. Your shell should be bash or dash; sh still works as long as you don't "source" the script. 23 | - For FreeBSD and other Unix-/Linux-like OS: Either xdelta3 package installed [recommended] or WinE package installed. The requirement for shell is the same as above. Recent versions of FreeBSD can run the bundled Linux binaries if the Linux compatability layer is enabled and the required libraries (linux_base-c6 package and liblzma.so.5) are installed. However, it's difficult to quickly determine if they can really run perfectly on your, yes your, specific system. Hence, they're not used, and the xdelta3 binary installed in the system is used instead. 24 | - If you don't want to, or somehow can't use the bundled xdelta3 binaries, feel free to delete them and install xdelta3 on your system. The patch will use your system binaries instead. 25 | - Make sure that no program is accessing the original file (&sourcefile&) and any files in this patch. This is not a strict requirement, but patching might fail otherwise. 26 | 27 | Patch created with YAXBPC v2.3.3 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/subscript1.ps1: -------------------------------------------------------------------------------- 1 | $global:WORKINGDIR = get-location 2 | $global:SCRIPTDIR = split-path $MyInvocation.MyCommand.Definition -parent 3 | Set-Location $global:SCRIPTDIR 4 | 5 | $global:sourcefile = '&sourcefile&' # keep it in a pair of single quotes. Any single quote must be doubled (replace ' with '') 6 | $global:targetfile = '&targetfile&' 7 | $global:app = '.\xdelta3.exe' 8 | $global:changes = 'changes.vcdiff' 9 | $global:sourcefiletmp = 'sourcefile.tmp' 10 | $global:targetfiletmp = 'targetfile.tmp' 11 | $global:movesourcefile = 0 12 | $global:movetargetfile = 0 13 | $global:olddir = 'old' 14 | 15 | function check_sanity { 16 | $re = $true 17 | If (!(Test-Path -LiteralPath $global:app)) { 18 | Write-Host "Error: The required application '$global:app' is missing." 19 | $re = $false 20 | } 21 | if (!(Test-Path -LiteralPath "$global:changes")) { 22 | Write-Host "Error: The delta file '$global:changes' is missing." 23 | $re = $false 24 | } 25 | if (!$re) { 26 | Write-Host "Can't continue. Please extract everything from the archive." 27 | } 28 | return $re 29 | } 30 | 31 | function find_inputs ([String] $dropin = "") { 32 | if ($dropin) { 33 | if (Test-Path -LiteralPath $dropin) { 34 | $global:sourcefile = $dropin 35 | } else { 36 | Write-Host "Warning: Input file '$dropin' not found. Ignored." 37 | } 38 | } 39 | 40 | if (!(Test-Path -LiteralPath $global:sourcefile)) { 41 | if (Test-Path -LiteralPath ('..\' + $global:sourcefile)) { 42 | $global:sourcefile = '..\' + $global:sourcefile 43 | } elseif (Test-Path -LiteralPath ('..\..\' + $global:sourcefile)) { 44 | $global:sourcefile = '..\..\' + $global:sourcefile 45 | } elseif (Test-Path -LiteralPath ('..\..\..\' + $global:sourcefile)) { 46 | $global:sourcefile = '..\..\..\' + $global:sourcefile 47 | } else { 48 | Write-Host "Error: Source file '$global:sourcefile' not found." 49 | Write-Host "You must put it in the same folder as this script." 50 | return $false 51 | } 52 | } 53 | 54 | $parent = Split-Path $global:sourcefile -Parent 55 | if ($parent) { 56 | $global:targetfile = Join-Path $parent $global:targetfile 57 | $global:sourcefiletmp = Join-Path $parent $global:sourcefiletmp 58 | $global:targetfiletmp = Join-Path $parent $global:targetfiletmp 59 | $global:olddir = Join-Path $parent $global:olddir 60 | } 61 | 62 | return $true 63 | } 64 | 65 | function run_patch { 66 | Write-Host "Attempting to patch '$sourcefile' ..." 67 | 68 | if ($global:movesourcefile -eq 1) { 69 | Move-Item -literalPath $global:sourcefile $global:sourcefiletmp -force 70 | } else { 71 | $global:sourcefiletmp = $global:sourcefile 72 | } 73 | 74 | if ($global:movetargetfile -eq 0) { 75 | $global:targetfiletmp = $global:targetfile 76 | } 77 | 78 | Start-Process -FilePath "$global:app" -ArgumentList "-d -f -s `"$global:sourcefiletmp`" `"$global:changes`" `"$global:targetfiletmp`"" -NoNewWindow -Wait 79 | 80 | if ($global:movesourcefile -eq 1) { 81 | Move-Item -literalPath $global:sourcefiletmp $global:sourcefile -force 82 | } 83 | if ($global:movetargetfile -eq 1) { 84 | Move-Item -literalPath $global:targetfiletmp $global:targetfile -force 85 | } 86 | 87 | if (Test-Path -LiteralPath $global:targetfile) { 88 | if ( -Not (Test-Path -LiteralPath "do_not_move_old_file.txt")) { 89 | if ( -Not (Test-Path -LiteralPath $global:olddir)) { 90 | New-Item -Path $global:olddir -ItemType Directory | out-null 91 | } 92 | Move-Item -literalPath $global:sourcefile $global:olddir -force 93 | } 94 | Write-Host "Done." 95 | return $true 96 | } else { 97 | Write-Host "Error occured! Patching wasn't successful!" 98 | return $false 99 | } 100 | } 101 | 102 | if (((check_sanity) -eq $true) -and ((find_inputs $args[0]) -eq $true)) { 103 | $dummy = run_patch 104 | } 105 | 106 | Set-Location($global:WORKINGDIR) 107 | exit 0 108 | -------------------------------------------------------------------------------- /YAXBPC/CopyMe/xdelta3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/CopyMe/xdelta3 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/xdelta3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/CopyMe/xdelta3.exe -------------------------------------------------------------------------------- /YAXBPC/CopyMe/xdelta3.x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/CopyMe/xdelta3.x86_64 -------------------------------------------------------------------------------- /YAXBPC/CopyMe/xdelta3.x86_64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/CopyMe/xdelta3.x86_64.exe -------------------------------------------------------------------------------- /YAXBPC/CopyMe/xdelta3_mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/CopyMe/xdelta3_mac -------------------------------------------------------------------------------- /YAXBPC/CustomExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | using System.Threading; 6 | 7 | namespace YAXBPC 8 | { 9 | internal class CustomExceptionHandler 10 | { 11 | 12 | // Handles the exception event. 13 | public void OnThreadException(object sender, ThreadExceptionEventArgs t) 14 | { 15 | DialogResult result = DialogResult.Cancel; 16 | try 17 | { 18 | result = this.ShowThreadExceptionDialog(t.Exception); 19 | } 20 | catch 21 | { 22 | try 23 | { 24 | MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); 25 | } 26 | finally 27 | { 28 | Application.Exit(); 29 | } 30 | } 31 | 32 | // Exits the program when the user clicks Abort. 33 | if (result == DialogResult.Abort) 34 | Application.Exit(); 35 | } 36 | 37 | // Creates the error message and displays it. 38 | private DialogResult ShowThreadExceptionDialog(Exception e) 39 | { 40 | string errorMsg = "An error occurred please contact the adminstrator with the following information:\n\n"; 41 | errorMsg = errorMsg + e.Message + "\n\nStack Trace:\n" + e.StackTrace; 42 | return MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /YAXBPC/Database.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 © Nguyen Hung Quy (dreamer2908) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | * */ 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Text; 20 | using System.IO; 21 | 22 | namespace YAXBPC 23 | { 24 | class Database 25 | { 26 | public Database(string filePath) 27 | { 28 | this.filePath = filePath; 29 | } 30 | 31 | private string filePath = ""; 32 | 33 | // We store the name in /names/ and data in /data/ 34 | List names = new List(); 35 | List data = new List(); 36 | 37 | public string FilePath 38 | { 39 | get { return this.filePath; } 40 | set { this.filePath = value; } 41 | } 42 | 43 | /// 44 | /// Adds a new variable to database or updates an existing variable. 45 | /// 46 | /// The name of the variable you want to store. It mustn't contain any '=' or newline character 47 | /// Its value 48 | /// True if writing sucessfully, else false 49 | public Boolean Write(string name, string value) 50 | { 51 | if (name.Contains("=") || name.Contains("\r") || name.Contains("\n")) return false; 52 | int i = names.IndexOf(name); 53 | if (i < 0) 54 | { 55 | // add new item 56 | names.Add(name); 57 | data.Add(value); 58 | } 59 | else 60 | { 61 | // update item 62 | data[i] = value; 63 | } 64 | return true; 65 | } 66 | 67 | /// 68 | /// Reads a variable in database 69 | /// 70 | /// The name of the variable you want to read 71 | /// Its value if found, else null 72 | public string Read(string name) 73 | { 74 | int i = names.IndexOf(name); 75 | if (i >= 0) 76 | { 77 | return data[i]; 78 | } 79 | else 80 | { 81 | return null; 82 | } 83 | } 84 | 85 | /// 86 | /// Loads data from file 87 | /// 88 | /// Error message if any, "OK" if all OK 89 | public string Load() 90 | { 91 | try 92 | { 93 | string[] fileContent = System.IO.File.ReadAllLines(filePath); 94 | foreach (string t in fileContent) 95 | { 96 | int pos = t.IndexOf("="); 97 | if (pos > 0) 98 | { 99 | string name = t.Substring(0,pos); 100 | string value = (t.Length > pos + 1) ? t.Substring(pos + 1) : ""; 101 | this.Write(name, value); 102 | } 103 | } 104 | } 105 | catch (Exception e) 106 | { 107 | return e.Message; 108 | } 109 | return "OK"; 110 | } 111 | 112 | /// 113 | /// Writes data in cache to disk 114 | /// 115 | /// Error message if any 116 | public string Flush() 117 | { 118 | try 119 | { 120 | System.IO.File.WriteAllText(filePath, this.ToString()); 121 | } 122 | catch(Exception e) 123 | { 124 | return e.Message; 125 | } 126 | return null; 127 | } 128 | 129 | /// 130 | /// Returns all data currently storing in string format 131 | /// 132 | /// Data in string format 133 | public override string ToString() 134 | { 135 | string output = ""; 136 | int n = names.Count; 137 | for (int i = 0; i < n; i++) 138 | { 139 | output += names[i] + "=" + data[i] + "\n"; 140 | } 141 | return output; 142 | } 143 | 144 | /// 145 | /// Flushes data cache and closes. *Incomplete* 146 | /// 147 | public void Close() 148 | { 149 | this.Flush(); 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /YAXBPC/Form1.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 - 2016 © Nguyen Hung Quy (dreamer2908) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | * */ 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | using System.ComponentModel; 20 | using System.Drawing; 21 | using System.Diagnostics; 22 | using System.IO; 23 | using System.Text; 24 | using System.Windows.Forms; 25 | using System.Text.RegularExpressions; 26 | 27 | namespace YAXBPC 28 | { 29 | public partial class frmMain : Form 30 | { 31 | public frmMain() 32 | { 33 | InitializeComponent(); 34 | 35 | // Check OS 36 | runningInWindows = isMSWindowsEnv(); 37 | 38 | // Load settings 39 | programPath = System.Reflection.Assembly.GetExecutingAssembly().Location; 40 | settingsFile = Path.ChangeExtension(programPath, "ini"); 41 | programDir = Path.GetDirectoryName(programPath); 42 | settings = new Database(settingsFile); 43 | if (settings.Load() == "OK") loadSettings(); 44 | 45 | run64bitxdelta = chbRun64bitxdelta3.Checked; 46 | dist64bitxdelta = chbDist64bitxdelta3.Checked; 47 | funnyMode = chbFunnyMode.Checked; 48 | 49 | // debug mode 50 | debugMode = false; 51 | forceUnicodeMode = false; 52 | } 53 | 54 | #region Global variables & type defs 55 | 56 | // runtime environment & debug mode 57 | Boolean debugMode = false; 58 | Boolean forceUnicodeMode = false; 59 | String settingsFile = ""; 60 | String programPath = ""; 61 | String programDir = ""; 62 | Boolean runningInWindows = false; 63 | 64 | Database settings; 65 | String quote = '"'.ToString(); 66 | Int32 outputPlace = 0; 67 | Int32 currentlySelectedTab = 0; 68 | Int32 currentlyBeingEditedJob = 0; 69 | Boolean tryDetectingEpisodeNumber = false; 70 | Boolean useCustomParamenter = false; 71 | String customParamenter = ""; 72 | Boolean run64bitxdelta = false; 73 | Boolean dist64bitxdelta = false; 74 | Boolean funnyMode = false; 75 | Boolean batchProcessingMode = false; 76 | Boolean addNewPatchToApplyAllScripts = false; 77 | Boolean alwaysCopySourceFiles = false; 78 | Boolean skipAlternativeScripts = false; 79 | 80 | // shared variables for batch processing 81 | Int32 jobsCount = 0; 82 | Boolean thisJobDone = false; 83 | String sourceFile_currentJob = ""; 84 | String targetFile_currentJob = ""; 85 | String outputDir_currentJob = ""; 86 | 87 | public delegate void Int32_Delegate(Int32 index); 88 | public delegate void String_Delegate(String log); 89 | public delegate void Void_Delegate(); 90 | 91 | struct EpNum 92 | { 93 | public String text;// = ""; 94 | public Int32 number;// = -1; 95 | public Int32 length;// = 0; 96 | public Int32 priority;// = 0; 97 | } 98 | 99 | #endregion 100 | 101 | #region Delegate methods 102 | 103 | private void AddText2Log(string log) 104 | { 105 | if (this.rtbLog.InvokeRequired) 106 | { 107 | String_Delegate d = new String_Delegate(rtbLog.AppendText); 108 | this.Invoke 109 | (d, new object[] { log }); 110 | } 111 | else 112 | { 113 | rtbLog.AppendText(log); 114 | } 115 | } 116 | 117 | private void AddText2ApplyLog(string log) 118 | { 119 | if (this.rtbLog.InvokeRequired) 120 | { 121 | String_Delegate d = new String_Delegate(rtbApplyLog.AppendText); 122 | this.Invoke 123 | (d, new object[] { log }); 124 | } 125 | else 126 | { 127 | rtbApplyLog.AppendText(log); 128 | } 129 | } 130 | 131 | private bool copyTask(int index) 132 | { 133 | thisJobDone = false; 134 | if (this.listView1.InvokeRequired) 135 | { 136 | Int32_Delegate d = new Int32_Delegate(_CopyTask); 137 | this.Invoke 138 | (d, new object[] { index }); 139 | } 140 | else 141 | { 142 | _CopyTask(index); 143 | } 144 | return !thisJobDone; 145 | } 146 | 147 | private void _CopyTask(int index) 148 | { 149 | if (listView1.Items[index].ImageIndex != 0) 150 | { 151 | thisJobDone = false; 152 | sourceFile_currentJob = listView1.Items[index].SubItems[0].Text; 153 | targetFile_currentJob = listView1.Items[index].SubItems[1].Text; 154 | outputDir_currentJob = listView1.Items[index].SubItems[2].Text; 155 | listView1.Items[index].ImageIndex = 1; 156 | } 157 | else thisJobDone = true; 158 | } 159 | 160 | private void setTaskFinished(int index) 161 | { 162 | if (this.listView1.InvokeRequired) 163 | { 164 | Int32_Delegate d = new Int32_Delegate(_SetTaskFinished); 165 | this.Invoke 166 | (d, new object[] { index }); 167 | } 168 | else 169 | { 170 | _SetTaskFinished(index); 171 | } 172 | } 173 | 174 | private void _SetTaskFinished(int index) 175 | { 176 | listView1.Items[index].ImageIndex = 0; 177 | } 178 | 179 | private void getNumOfTask() 180 | { 181 | if (this.listView1.InvokeRequired) 182 | { 183 | Void_Delegate d = new Void_Delegate(_GetNumOfTask); 184 | this.Invoke 185 | (d, new object[] { }); 186 | } 187 | else 188 | { 189 | _GetNumOfTask(); 190 | } 191 | } 192 | 193 | private void _GetNumOfTask() 194 | { 195 | jobsCount = listView1.Items.Count; 196 | } 197 | 198 | #endregion 199 | 200 | #region Core methods 201 | 202 | private Boolean isMSWindowsEnv() 203 | { 204 | System.OperatingSystem osInfo = System.Environment.OSVersion; 205 | switch (osInfo.Platform) 206 | { 207 | case System.PlatformID.Win32Windows: 208 | { 209 | // Windows 95, Windows 98, Windows 98 Second Edition, or Windows Me. 210 | return true; 211 | } 212 | case System.PlatformID.Win32NT: 213 | { 214 | // Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8, or later 215 | return true; 216 | } 217 | default: return false; 218 | } 219 | } 220 | 221 | private Boolean stringContainsNonASCIIChar(string inputString) 222 | { 223 | if (forceUnicodeMode) return true; 224 | // Strip non-ASCII characters from the string using Regex 225 | string onlyAscii = Regex.Replace(inputString, @"[^\u0000-\u007F]", string.Empty); 226 | // If inputString is different from onlyAscii then it contains non-ascii char 227 | return (inputString != onlyAscii); 228 | } 229 | 230 | private Boolean stringContainsNon1252Char(string inputString) 231 | { 232 | // check if string contains any character not in windows-1252 233 | // by encoding to windows-1252 byte array and decode back to unicode 234 | // if something changes then true 235 | Encoding wind1252 = Encoding.GetEncoding(1252); 236 | return (inputString != wind1252.GetString(wind1252.GetBytes(inputString))); 237 | } 238 | 239 | private void generateOutputDirName(string sourceFile, string targetFile, int outputPlace, string customOutputDir) 240 | { 241 | string episodeNumber = ""; 242 | string outputDir = ""; 243 | string baseOutputDir = ""; 244 | string name2Detect = ""; 245 | 246 | // Generate parent dir 247 | switch (outputPlace) 248 | { 249 | case 0: 250 | if (File.Exists(sourceFile)) 251 | { 252 | baseOutputDir = Path.GetDirectoryName(sourceFile); 253 | name2Detect = Path.GetFileName(sourceFile); 254 | } 255 | break; 256 | case 1: 257 | if (File.Exists(targetFile)) 258 | { 259 | baseOutputDir = Path.GetDirectoryName(targetFile); 260 | name2Detect = Path.GetFileName(targetFile); 261 | } 262 | break; 263 | case 2: 264 | baseOutputDir = customOutputDir; 265 | if (File.Exists(sourceFile)) name2Detect = Path.GetFileName(sourceFile); 266 | break; 267 | } 268 | 269 | // Generate the name 270 | if (!chbNewAutoName.Checked) 271 | { 272 | if (chbDetEpNum.Checked) 273 | { 274 | episodeNumber = getEpisodeNumber(name2Detect); 275 | outputDir = Path.Combine(baseOutputDir, ((episodeNumber.Length > 0) ? episodeNumber : "patch")); 276 | } 277 | else 278 | { 279 | outputDir = Path.Combine(baseOutputDir, "patch"); 280 | } 281 | } 282 | else if (sourceFile.Length > 0 && targetFile.Length > 0) 283 | { 284 | // Already disabled, but just for sure 285 | if (chbDetEpNum.Checked) 286 | { 287 | episodeNumber = getEpisodeNumber(name2Detect); 288 | outputDir = Path.Combine(baseOutputDir, ((episodeNumber.Length > 0) ? episodeNumber : "patch")); 289 | } 290 | else 291 | { 292 | outputDir = Path.Combine(baseOutputDir, "patch"); 293 | } 294 | } 295 | 296 | txtOutputDir.Text = outputDir; 297 | } 298 | 299 | // I don't remember how I did this, but apparently it works well enough 300 | private string getEpisodeNumber(string sourceFile) 301 | { 302 | string episodeNumber = ""; 303 | int[] pos = new int[sourceFile.Length]; 304 | string SP = "_-[] v."; 305 | string[] SPC = { "_", "-", " ", "[", "]" }; 306 | int length = sourceFile.Length; 307 | 308 | EpNum[] text2Parse = new EpNum[length]; 309 | int found = 0; 310 | int count = 0; 311 | for (int cur = 0; cur < length; cur++) 312 | { 313 | if (SP.Contains(sourceFile.Substring(cur, 1))) 314 | { 315 | string strFound = sourceFile.Substring(found, cur - found + 1); 316 | int _length = strFound.Length; 317 | int _prio = 0; 318 | int _number = 0; 319 | if (length < 1 || SP.Contains(strFound)) continue; 320 | bool valid = int.TryParse(strFound.Substring(1, _length - 2), out _number); 321 | 322 | if (valid) 323 | { 324 | // Set its priority accoding to the patern 325 | if (strFound.Substring(_length - 1, 1) == "v") _prio += 1; // 02v (2) will get higher priority 326 | else 327 | { 328 | if (strFound.Substring(_length - 1, 1) == strFound.Substring(0, 1)) // _02_ too 329 | { 330 | if (strFound.Substring(0, 1) == "v") _prio -= 1; // but not v02v 331 | else _prio += 1; 332 | } 333 | } 334 | //else _prio -= 1; // No reason to reduce its priotity 335 | 336 | if (found > 0) { if (_length == 4) _prio += 1; } else { if (_length == 3) _prio += 1; } // An episode number usually contains 2 characters 337 | 338 | text2Parse[count] = new EpNum(); 339 | text2Parse[count].text = strFound; 340 | text2Parse[count].length = _length - 2; 341 | 342 | if (found == 0) text2Parse[count].length = _length - 1; 343 | 344 | text2Parse[count].priority = _prio; 345 | text2Parse[count].number = _number; 346 | 347 | count++; 348 | } 349 | found = cur; 350 | } 351 | } 352 | 353 | if (count > 0) 354 | { 355 | if (count > 1) 356 | { 357 | // Use priority to choose the best number 358 | int right = 0; 359 | int max = -10; 360 | for (int i = 0; i < count; i++) 361 | { 362 | if (text2Parse[i].priority > max) 363 | { 364 | right = i; 365 | max = text2Parse[i].priority; 366 | } 367 | } 368 | text2Parse[0] = text2Parse[right]; //Copy to the beginning 369 | } 370 | episodeNumber = text2Parse[0].number.ToString(); // Take the first one 371 | while (episodeNumber.Length < text2Parse[0].length) episodeNumber = "0" + episodeNumber; // Add "0" to get "01", and "02" instead of "1", and "2" 372 | } 373 | return episodeNumber; 374 | } 375 | 376 | // Temporary solution. It looks dirty to me, really >_> 377 | private string killAOption(string options) 378 | { 379 | string result = options; 380 | if (options.Contains("-A=")) 381 | { 382 | int i = options.IndexOf("-A="); 383 | result = options.Substring(0, i); 384 | string tmp = options.Substring(i + 3); 385 | if (tmp.Length > 0) 386 | { 387 | if (tmp[0] == '"') 388 | { 389 | // kill string in quotes 390 | if (tmp.Length > 1) 391 | { 392 | int quote = tmp.IndexOf('"', 1); 393 | if (quote >= 1 && quote + 1 < tmp.Length) result += " " + tmp.Substring(quote + 1); 394 | } 395 | } 396 | else 397 | { 398 | // kill string before the first white space. If no space found, kill all 399 | tmp = tmp.TrimEnd(); 400 | int space = tmp.IndexOf(' '); 401 | if (space >= 0 && space + 1 < tmp.Length) 402 | { 403 | result += " " + tmp.Substring(space + 1); 404 | } 405 | } 406 | } 407 | } 408 | return result; 409 | } 410 | 411 | private void createPatch(string _sourceFile, string _targetFile, string _outDir) 412 | { 413 | Boolean useRelativePath = chbOnlyStoreFileNameInVCDIFF.Checked || stringContainsNonASCIIChar(Path.GetFileName(_sourceFile)) || stringContainsNonASCIIChar(Path.GetFileName(_targetFile)); 414 | string sourceFile = _sourceFile; 415 | string targetFile = _targetFile; 416 | string sourceFileName = Path.GetFileName(_sourceFile); 417 | string targetFileName = Path.GetFileName(_targetFile); 418 | string outputDir = _outDir; 419 | string outputVcdiff = Path.Combine(outputDir, "changes.vcdiff"); 420 | bool plsRmTmpSourceFile = false; 421 | bool plsRmTmpTargetFile = false; 422 | 423 | if (runningInWindows) 424 | { 425 | if (alwaysCopySourceFiles || stringContainsNon1252Char(sourceFile)) 426 | { 427 | AddText2Log("Making a temporary copy of the source file...\n"); 428 | string tmpFname = Guid.NewGuid().ToString() + ".tmp"; 429 | File.Copy(sourceFile, tmpFname, true); 430 | sourceFile = tmpFname; 431 | sourceFileName = sourceFileName.Replace(""", ""); // xdelta3 in Windows doesn't support unicode. full-width quote will become normal quote when xdelta3 receives it, so problems will arise. Alter the filename in vcdiff header a bit to work around this. This filename is for decoration purpose so no problems. 432 | plsRmTmpSourceFile = true; 433 | } 434 | if (alwaysCopySourceFiles || stringContainsNon1252Char(targetFile)) 435 | { 436 | AddText2Log("Making a temporary copy of the target file...\n"); 437 | string tmpFname = Guid.NewGuid().ToString() + ".tmp"; 438 | File.Copy(targetFile, tmpFname, true); 439 | targetFile = tmpFname; 440 | targetFileName = targetFileName.Replace(""", ""); 441 | plsRmTmpTargetFile = true; 442 | } 443 | } 444 | 445 | Process xdelta = new Process(); 446 | if (runningInWindows && run64bitxdelta) xdelta.StartInfo.FileName = "xdelta3.x86_64.exe"; 447 | else xdelta.StartInfo.FileName = "xdelta3"; // Works with xdelta3.exe and xdelta3 package, doesn't work with ./xdelta3 448 | xdelta.StartInfo.CreateNoWindow = true; 449 | xdelta.StartInfo.UseShellExecute = false; 450 | 451 | // Capture xdelta3 console output. It can be useful 452 | xdelta.StartInfo.RedirectStandardOutput = true; 453 | xdelta.StartInfo.RedirectStandardError = true; 454 | // hookup the eventhandlers to capture the data that is received 455 | var sb = new StringBuilder(); 456 | xdelta.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); 457 | xdelta.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); 458 | 459 | if (!useCustomParamenter) 460 | { 461 | xdelta.StartInfo.Arguments = "-f -e -s %source% %patched% %vcdiff%"; 462 | } 463 | else { xdelta.StartInfo.Arguments = customParamenter; } 464 | 465 | xdelta.StartInfo.Arguments = "-D " + xdelta.StartInfo.Arguments; // disable external decompression in case of archives like gz. Can be overriden by later paramenters. Doesn't really matter as this app targets fansubbed mkv files. 466 | 467 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%source%", quote + sourceFile + quote).Replace("%patched%", quote + targetFile + quote).Replace("%vcdiff%", quote + outputVcdiff + quote); 468 | 469 | // Needs to kill -A option first 'cause xdelta3 always takes the last one, and all options must come before filenames 470 | xdelta.StartInfo.Arguments = killAOption(xdelta.StartInfo.Arguments); 471 | // See main_set_appheader in xdelta3-main.h for how xdelta3 stores filenames 472 | if (funnyMode) 473 | { 474 | xdelta.StartInfo.Arguments = "-A=\"" + "**STAR**STAR**STAR** Why am I suddenly seeing stars?" + "//" + "???!@#$%^&*() Either use the provided scripts or type the full command. Thx." + "/\" " + xdelta.StartInfo.Arguments; 475 | } 476 | else if (useRelativePath) 477 | { 478 | xdelta.StartInfo.Arguments = "-A=\"" + targetFileName + "//" + sourceFileName + "/\" " + xdelta.StartInfo.Arguments; 479 | } 480 | 481 | if (debugMode) MessageBox.Show(xdelta.StartInfo.Arguments); 482 | 483 | xdelta.Start(); 484 | // Capture xdelta3 console output 485 | xdelta.BeginOutputReadLine(); 486 | xdelta.BeginErrorReadLine(); 487 | 488 | xdelta.WaitForExit(); 489 | if (debugMode) MessageBox.Show(sb.ToString()); 490 | 491 | if (plsRmTmpSourceFile) 492 | { 493 | File.Delete(sourceFile); 494 | } 495 | if (plsRmTmpTargetFile) 496 | { 497 | File.Delete(targetFile); 498 | } 499 | 500 | if (xdelta.ExitCode != 0) // I, right here, abuse exception. Feel free to sue me. 501 | { 502 | throw new Exception(sb.ToString().Trim()); 503 | } 504 | } 505 | 506 | private void copyXdeltaBinaries(string outputFolder) 507 | { 508 | string source = Path.Combine(programDir, (dist64bitxdelta) ? "xdelta3.x86_64.exe" : "xdelta3.exe"); 509 | string source2 = Path.Combine(programDir, "xdelta3"); 510 | string source3 = Path.Combine(programDir, "xdelta3.x86_64"); 511 | string source4 = Path.Combine(programDir, "xdelta3_mac"); 512 | string target = Path.Combine(outputFolder, "xdelta3.exe"); 513 | string target2 = Path.Combine(outputFolder, "xdelta3"); 514 | string target3 = Path.Combine(outputFolder, "xdelta3.x86_64"); 515 | string target4 = Path.Combine(outputFolder, "xdelta3_mac"); 516 | 517 | File.Copy(source, target, true); 518 | File.Copy(source2, target2, true); 519 | File.Copy(source3, target3, true); 520 | File.Copy(source4, target4, true); 521 | } 522 | 523 | // # %^& must be escaped. \/<>"*:?| are forbidden in win32 filenames. []()!=,;`' work, so not needed 524 | private string escapeStringForBatch(string text) 525 | { 526 | string result = ""; 527 | for (int i = 0; i < text.Length; i++) 528 | { 529 | char chr = text[i]; 530 | switch (chr) 531 | { 532 | case '%': result += "%%"; break; 533 | case '&': result += "^&"; break; 534 | case '^': result += "^^"; break; 535 | default: result += chr; break; 536 | } 537 | } 538 | 539 | return result; 540 | } 541 | 542 | private void createApplyingScripts(string sourceFile, string targetFile, string outputDir) 543 | { 544 | // directly copy these alternative scripts to output dir 545 | if (!skipAlternativeScripts) 546 | { 547 | string[] alternativeScripts = { "apply_patch_windows_alternative.bat", "apply_patch_mac_alternative.command", "apply_patch_linux_alternative.sh" }; 548 | foreach (string s in alternativeScripts) 549 | { 550 | string source = Path.Combine(programDir, s); 551 | string target = Path.Combine(outputDir, s); 552 | File.Copy(source, target, true); 553 | } 554 | } 555 | 556 | // Linux & Mac scripts seamlessly work with non-ascii filenames. 557 | string linuxScript = File.ReadAllText(Path.Combine(programDir, "apply_patch_linux.sh")); 558 | string macScript = File.ReadAllText(Path.Combine(programDir, "apply_patch_mac.command")); 559 | string readMe = File.ReadAllText(Path.Combine(programDir, "how_to_apply_this_patch.txt")); 560 | 561 | readMe = readMe.Replace("&sourcefile&", sourceFile).Replace("&targetfile&", targetFile); 562 | linuxScript = linuxScript.Replace("&sourcefile&", sourceFile.Replace("'", "'\"'\"'")).Replace("&targetfile&", targetFile.Replace("'", "'\"'\"'")); // quote all single quotes as fnames are quoted in single quotes 563 | macScript = macScript.Replace("&sourcefile&", sourceFile.Replace("'", "'\"'\"'")).Replace("&targetfile&", targetFile.Replace("'", "'\"'\"'")); // just replace ' with '"'"' (single, double, single, double, single) 564 | 565 | // Unified both scripts. Now only apply_patch_windows.bat 566 | string winScript = File.ReadAllText(Path.Combine(programDir, "apply_patch_windows.bat")); 567 | // The brand-new PowerShell subscript 568 | string psScript = File.ReadAllText(Path.Combine(programDir, "subscript1.ps1")); 569 | 570 | winScript = winScript.Replace("&sourcefile&", escapeStringForBatch(sourceFile)).Replace("&targetfile&", escapeStringForBatch(targetFile)); 571 | psScript = psScript.Replace("&sourcefile&", sourceFile.Replace("'", "''")).Replace("&targetfile&", targetFile.Replace("'", "''")); // Any single quote in single-quoted PowerShell string must be doubled (replace ' with '') 572 | if (stringContainsNonASCIIChar(Path.GetFileName(sourceFile))) 573 | { 574 | winScript = winScript.Replace("set movesourcefile=0", "set movesourcefile=1"); 575 | psScript = psScript.Replace("movesourcefile = 0", "movesourcefile = 1"); // even though PS has native unicode support, calling xdelta3 with unicode paramenters still ends up in failure 576 | } 577 | if (stringContainsNonASCIIChar(Path.GetFileName(targetFile))) 578 | { 579 | winScript = winScript.Replace("set movetargetfile=0", "set movetargetfile=1"); 580 | psScript = psScript.Replace("movetargetfile = 0", "movetargetfile = 1"); 581 | } 582 | if (!(stringContainsNonASCIIChar(Path.GetFileName(sourceFile) + Path.GetFileName(targetFile)))) 583 | { 584 | winScript = winScript.Replace("chcp 65001", "rem chcp 65001"); 585 | } 586 | 587 | // Generate output file paths 588 | string macPath = Path.Combine(outputDir, "apply_patch_mac.command"); 589 | string winPath = Path.Combine(outputDir, "apply_patch_windows.bat"); 590 | string linuxPath = Path.Combine(outputDir, "apply_patch_linux.sh"); 591 | string readMePath = Path.Combine(outputDir, "how_to_apply_this_patch.txt"); 592 | string psPath = Path.Combine(outputDir, "subscript1.ps1"); 593 | 594 | // write outputs 595 | File.WriteAllText(winPath, winScript); 596 | File.WriteAllText(linuxPath, linuxScript); 597 | File.WriteAllText(macPath, macScript); 598 | File.WriteAllText(readMePath, readMe, Encoding.UTF8); 599 | File.WriteAllText(psPath, psScript, Encoding.UTF8); // encoding utf-8 with BOM 600 | 601 | // "Apply all" scripts 602 | if (addNewPatchToApplyAllScripts) 603 | { 604 | DirectoryInfo directoryInfo = Directory.GetParent(outputDir); 605 | if (directoryInfo == null) 606 | { 607 | throw new Exception("\"Apply all\" scripts can't be created if the output directory is the root directory as they need to be in one level upper."); // I, right here, abuse exception. Feel free to sue me. 608 | } 609 | string parentDirPath = directoryInfo.FullName; 610 | string outputDirName = new DirectoryInfo(outputDir).Name; 611 | 612 | string applyAllWinPath = Path.Combine(parentDirPath, "apply_all_patches_windows.bat"); 613 | string applyAllLinuxPath = Path.Combine(parentDirPath, "apply_all_patches_linux.sh"); 614 | string applyAllMacPath = Path.Combine(parentDirPath, "apply_all_patches_mac.command"); 615 | 616 | if (!File.Exists(applyAllLinuxPath)) 617 | { 618 | File.WriteAllText(applyAllLinuxPath, "#!/bin/sh\ncd \"$(cd \"$(dirname \"$0\")\" && pwd)\""); 619 | } 620 | if (!File.Exists(applyAllMacPath)) 621 | { 622 | File.WriteAllText(applyAllMacPath, "#!/bin/sh\ncd \"$(cd \"$(dirname \"$0\")\" && pwd)\""); 623 | } 624 | if (!File.Exists(applyAllWinPath)) 625 | { 626 | File.WriteAllText(applyAllWinPath, "chdir /d %~dp0\r\n@echo off\r\nsetlocal"); 627 | } 628 | File.AppendAllText(applyAllWinPath, "\r\ncall \".\\" + outputDirName + "\\apply_patch_windows.bat\""); // use "call blablah.bat" 629 | File.AppendAllText(applyAllLinuxPath, "\nsh './" + outputDirName + "/apply_patch_linux.sh'"); 630 | File.AppendAllText(applyAllMacPath, "\nsh './" + outputDirName + "/apply_patch_mac.command'"); 631 | } 632 | } 633 | 634 | private void createPatchBackground_sub(string sourceFile, string targetFile, string outputDir) 635 | { 636 | try 637 | { 638 | AddText2Log("Creating output directory...\n"); 639 | if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir); 640 | } 641 | catch (Exception e) 642 | { 643 | AddText2Log("Task failed: " + e.Message + "\n\n"); 644 | return; 645 | } 646 | 647 | try 648 | { 649 | AddText2Log("Creating patch...\n"); 650 | createPatch(sourceFile, targetFile, outputDir); 651 | } 652 | catch (Exception e) 653 | { 654 | AddText2Log("Task failed: " + e.Message + "\n\n"); 655 | return; 656 | } 657 | 658 | try 659 | { 660 | AddText2Log("Creating applying scripts...\n"); 661 | createApplyingScripts(Path.GetFileName(sourceFile), Path.GetFileName(targetFile), outputDir); 662 | } 663 | catch (Exception e) 664 | { 665 | AddText2Log("Task failed: " + e.Message + "\n\n"); 666 | return; 667 | } 668 | 669 | try 670 | { 671 | AddText2Log("Copying xdelta3 to output directory...\n"); 672 | copyXdeltaBinaries(outputDir); 673 | } 674 | catch (Exception e) 675 | { 676 | AddText2Log("Task failed: " + e.Message + "\n\n"); 677 | return; 678 | } 679 | 680 | AddText2Log("Done.\n\n"); 681 | } 682 | 683 | private void createPatchBackground(object sender, DoWorkEventArgs e) 684 | { 685 | if (!batchProcessingMode) 686 | { 687 | // Single job 688 | if (txtSourceFile.Text.Trim().Equals(String.Empty)) AddText2Log("Please specify the source file.\n\n"); 689 | else if (txtTargetFile.Text.Trim().Equals(String.Empty)) AddText2Log("Please specify the target file.\n\n"); 690 | else if (txtOutputDir.Text.Trim().Equals(String.Empty)) AddText2Log("Please specify the output directory.\n\n"); 691 | else createPatchBackground_sub(txtSourceFile.Text, txtTargetFile.Text, txtOutputDir.Text); 692 | } 693 | else 694 | { 695 | // Batch processing 696 | if (currentlySelectedTab == 1) 697 | { 698 | getNumOfTask(); 699 | int old = jobsCount; 700 | if (jobsCount > 0) 701 | for (int n = 0; n < jobsCount; n++) 702 | { 703 | if (copyTask(n)) 704 | { 705 | createPatchBackground_sub(sourceFile_currentJob, targetFile_currentJob, outputDir_currentJob); 706 | setTaskFinished(n); 707 | } 708 | getNumOfTask(); // Re-get the number of task(s) in case task(s) added/removed 709 | if (old != jobsCount) n = 0; // Re-start the queue. Currently, i's safe to assume this, because changing task order is not supported. 710 | } 711 | } 712 | } 713 | } 714 | 715 | private void applyPatchBackground(object sender, DoWorkEventArgs e) 716 | { 717 | //if (txtApplySource.Text.Trim().Equals(String.Empty)) # input fname is also not a compulsory paramenter if it has been already stored in vcdiff's header 718 | //{ 719 | // AddText2ApplyLog("Please specify the source file.\n\n"); 720 | // return; 721 | //} 722 | if (txtApplyVcdiffFile.Text.Trim().Equals(String.Empty)) 723 | { 724 | AddText2ApplyLog("Please specify the delta file.\n\n"); 725 | return; 726 | } 727 | //else if (txtApplyOutput.Text.Trim().Equals(String.Empty)) # output fname is not a compulsory paramenter if it has been already stored in vcdiff's header 728 | //{ 729 | // AddText2ApplyLog("Please specify the output file.\n\n"); 730 | // return; 731 | //} 732 | 733 | string inputFile = txtApplySource.Text; 734 | try 735 | { 736 | AddText2ApplyLog("Attempting to patch \"" + Path.GetFileName(inputFile) + "\"...\n"); 737 | string result = applyOnePatch(txtApplySource.Text, txtApplyVcdiffFile.Text, txtApplyOutput.Text); 738 | AddText2ApplyLog(result.Trim() + "\n\n"); 739 | 740 | } 741 | catch (Exception ex) 742 | { 743 | AddText2ApplyLog("Task failed: " + ex.Message.Trim() + "\n\n"); 744 | return; 745 | } 746 | } 747 | 748 | private string applyOnePatch(string _sourceFile, string vcdiffFile, string _outputFile) 749 | { 750 | string sourceFile = _sourceFile; 751 | string outputFile = _outputFile; 752 | bool plsRmTmpSourceFile = false; 753 | bool plsMvTmpOutputFile = false; 754 | 755 | if (runningInWindows) 756 | { 757 | if (alwaysCopySourceFiles || stringContainsNon1252Char(sourceFile)) 758 | { 759 | string tmpFname = Guid.NewGuid().ToString() + ".tmp"; 760 | File.Copy(sourceFile, tmpFname, true); 761 | sourceFile = tmpFname; // ascii-only and no path, so safe. Most likely will end up in YAXBPC program dir. 762 | plsRmTmpSourceFile = true; 763 | } 764 | if (alwaysCopySourceFiles || stringContainsNon1252Char(outputFile)) 765 | { 766 | string tmpFname = Guid.NewGuid().ToString() + ".tmp"; 767 | outputFile = tmpFname; 768 | plsMvTmpOutputFile = true; 769 | } 770 | } 771 | 772 | Process xdelta = new Process(); 773 | if (runningInWindows && run64bitxdelta) xdelta.StartInfo.FileName = "xdelta3.x86_64.exe"; 774 | else xdelta.StartInfo.FileName = "xdelta3"; // Works with xdelta3.exe and xdelta3 package, doesn't work with ./xdelta3 775 | xdelta.StartInfo.CreateNoWindow = true; 776 | xdelta.StartInfo.UseShellExecute = false; 777 | 778 | // Capture xdelta3 console output. It can be useful 779 | xdelta.StartInfo.RedirectStandardOutput = true; 780 | xdelta.StartInfo.RedirectStandardError = true; 781 | // hookup the eventhandlers to capture the data that is received 782 | var sb = new StringBuilder(); 783 | xdelta.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); 784 | xdelta.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); 785 | 786 | string paramenters = (chbUseCustomXdeltaParamsForApplying.Checked) ? txtCustomXdeltaParamsForApplying.Text : "-d -f -s %source% %vcdiff% %output%"; 787 | xdelta.StartInfo.Arguments = paramenters.Replace("%vcdiff%", quote + vcdiffFile + quote); 788 | if (outputFile == "" && sourceFile != "") // don't trim it, as filename consisting of all spaces is also valid 789 | { 790 | // output is not specified but source is. Handle thing a little differently 791 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%output%", ""); 792 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%source%", quote + sourceFile + quote); 793 | xdelta.StartInfo.WorkingDirectory = Path.GetDirectoryName(sourceFile); 794 | } 795 | else if (outputFile != "" && sourceFile == "") 796 | { 797 | // output is specified but source is not. Handle thing a little differently 798 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%output%", quote + outputFile + quote); 799 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%source%", "").Replace("-s ", ""); // will be improved when a paramenter parser is implemented 800 | xdelta.StartInfo.WorkingDirectory = Path.GetDirectoryName(vcdiffFile); 801 | } 802 | else if (outputFile == "" && sourceFile == "") 803 | { 804 | // both source and output are not specified. Handle thing a little differently 805 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%output%", ""); 806 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%source%", "").Replace("-s ", ""); // will be improved when a paramenter parser is implemented 807 | xdelta.StartInfo.WorkingDirectory = Path.GetDirectoryName(vcdiffFile); 808 | } 809 | else 810 | { 811 | // normal case: both source and output are specified 812 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%output%", quote + outputFile + quote); 813 | xdelta.StartInfo.Arguments = xdelta.StartInfo.Arguments.Replace("%source%", quote + sourceFile + quote); 814 | } 815 | if (debugMode) MessageBox.Show(xdelta.StartInfo.WorkingDirectory); 816 | 817 | xdelta.Start(); 818 | // Capture xdelta3 console output 819 | xdelta.BeginOutputReadLine(); 820 | xdelta.BeginErrorReadLine(); 821 | 822 | xdelta.WaitForExit(); 823 | if (debugMode) MessageBox.Show(sb.ToString()); 824 | 825 | if (plsRmTmpSourceFile) 826 | { 827 | File.Delete(sourceFile); 828 | } 829 | if (plsMvTmpOutputFile) 830 | { 831 | File.Move(outputFile, _outputFile); 832 | } 833 | 834 | return (xdelta.ExitCode == 0)? "All OK." : "Error: " + sb.ToString(); 835 | } 836 | 837 | #endregion 838 | 839 | #region Buttons and events 840 | 841 | private void frmMain_FormClosing(object sender, FormClosingEventArgs e) 842 | { 843 | saveSettings(); 844 | } 845 | 846 | private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) 847 | { 848 | currentlySelectedTab = tabControl1.SelectedIndex; 849 | switch (currentlySelectedTab) 850 | { 851 | case 0: btnStart.Text = "&Create Patch"; break; 852 | case 1: btnStart.Text = "&Start Processing"; break; 853 | case 2: btnStart.Text = "&Apply Patch"; break; 854 | default: btnStart.Text = "&Create Patch"; break; 855 | } 856 | batchProcessingMode = (currentlySelectedTab == 1); 857 | } 858 | 859 | #region File Patcher tab 860 | 861 | private void btnBrowseSourceFile_Click(object sender, EventArgs e) 862 | { 863 | if (ofdFileBrowser.ShowDialog() == DialogResult.OK) 864 | { 865 | txtSourceFile.Text = ofdFileBrowser.FileName; 866 | generateOutputDirName(txtSourceFile.Text, txtTargetFile.Text, outputPlace, txtDefaultOutDir.Text); // Generate a new output folder 867 | } 868 | } 869 | 870 | private void btnBrowseTargetFile_Click(object sender, EventArgs e) 871 | { 872 | if (ofdFileBrowser.ShowDialog() == DialogResult.OK) txtTargetFile.Text = ofdFileBrowser.FileName; 873 | 874 | if (chbNewAutoName.Checked || rdbTargetDir.Checked) 875 | { 876 | generateOutputDirName(txtSourceFile.Text, txtTargetFile.Text, outputPlace, txtDefaultOutDir.Text); // Generate a new output folder again 877 | } 878 | } 879 | 880 | private void btnBrowseOutputDir_Click(object sender, EventArgs e) 881 | { 882 | if (fbdDirBrowser.ShowDialog() == DialogResult.OK) txtOutputDir.Text = fbdDirBrowser.SelectedPath; 883 | } 884 | 885 | private void txtSourceFile_DragEnter(object sender, DragEventArgs e) 886 | { 887 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) // File only, you faggots! 888 | e.Effect = DragDropEffects.All; 889 | else 890 | e.Effect = DragDropEffects.None; 891 | } 892 | 893 | private void txtSourceFile_DragDrop(object sender, DragEventArgs e) 894 | { 895 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 896 | txtSourceFile.Text = files[0]; 897 | generateOutputDirName(txtSourceFile.Text, txtTargetFile.Text, outputPlace, txtDefaultOutDir.Text); // generate a new output folder whenever dropping 898 | } 899 | 900 | private void txtTargetFile_DragDrop(object sender, DragEventArgs e) 901 | { 902 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 903 | txtTargetFile.Text = files[0]; 904 | if (chbNewAutoName.Checked || rdbTargetDir.Checked) 905 | { 906 | generateOutputDirName(txtSourceFile.Text, txtTargetFile.Text, outputPlace, txtDefaultOutDir.Text); // Generate a new output folder and again, whenever a file is dropped 907 | } 908 | } 909 | 910 | private void txtTargetFile_DragEnter(object sender, DragEventArgs e) 911 | { 912 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) // File only, you faggots! 913 | e.Effect = DragDropEffects.All; 914 | else 915 | e.Effect = DragDropEffects.None; 916 | } 917 | 918 | private void txtOutputDir_DragEnter(object sender, DragEventArgs e) 919 | { 920 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) 921 | { 922 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 923 | if (Directory.Exists(files[0])) e.Effect = DragDropEffects.All; // Check if the first one is an existing folder 924 | } 925 | else 926 | e.Effect = DragDropEffects.None; 927 | } 928 | 929 | private void txtOutputDir_DragDrop(object sender, DragEventArgs e) 930 | { 931 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 932 | txtOutputDir.Text = files[0]; // Take the first one 933 | } 934 | 935 | private void btnSwapSnT_Click(object sender, EventArgs e) 936 | { 937 | string temp = txtSourceFile.Text; 938 | txtSourceFile.Text = txtTargetFile.Text; 939 | txtTargetFile.Text = temp; 940 | 941 | if (chbAddTextWhenSwap.Checked && txtOutputDir.Text.Length > 0 && !txtOutputDir.Text.EndsWith(txtAddTextWhenSwap.Text)) txtOutputDir.Text += txtAddTextWhenSwap.Text; // check if already added 942 | if (chbNewAutoName.Checked) 943 | { 944 | generateOutputDirName(txtSourceFile.Text, txtTargetFile.Text, outputPlace, txtDefaultOutDir.Text); // Again! 945 | } 946 | } 947 | 948 | private void btnResetForms_Click(object sender, EventArgs e) 949 | { 950 | if (btnResetForms.Text == "&Reset Forms") 951 | { 952 | txtSourceFile.Text = txtOutputDir.Text = txtTargetFile.Text = ""; 953 | } 954 | else 955 | { 956 | // Restore buttons 957 | btnResetForms.Text = "&Reset Forms"; 958 | btnAddEditJob.Text = "&Add to batch"; 959 | } 960 | } 961 | 962 | private void btnStart_Click(object sender, EventArgs e) 963 | { 964 | switch (currentlySelectedTab) 965 | { 966 | case 0: if (!bgwCreatePatch.IsBusy) bgwCreatePatch.RunWorkerAsync(); break; 967 | case 1: if (!bgwCreatePatch.IsBusy) bgwCreatePatch.RunWorkerAsync(); break; 968 | case 2: if (!bgwApplyPatch.IsBusy) bgwApplyPatch.RunWorkerAsync(); break; 969 | default: if (!bgwCreatePatch.IsBusy) bgwCreatePatch.RunWorkerAsync(); break; 970 | } 971 | } 972 | 973 | private void btnExit_Click(object sender, EventArgs e) 974 | { 975 | this.Close(); 976 | } 977 | 978 | private void btnAddEditJob_Click(object sender, EventArgs e) 979 | { 980 | if (btnAddEditJob.Text == "&Add to batch") // Check if this is an edit or a new 981 | { 982 | // Add a new job 983 | if (txtTargetFile.Text.Length > 0 && txtOutputDir.Text.Length > 0 && txtSourceFile.Text.Length > 0) // Validate all fields 984 | { 985 | ListViewItem temp = listView1.Items.Add(txtSourceFile.Text); // Add to listview 986 | temp.SubItems.Add(txtTargetFile.Text); 987 | temp.SubItems.Add(txtOutputDir.Text); 988 | temp.ImageIndex = 2; 989 | } 990 | } 991 | else 992 | { 993 | // Save changes to listview 994 | ListViewItem temp = listView1.Items[currentlyBeingEditedJob]; 995 | temp.SubItems[0].Text = txtSourceFile.Text; 996 | temp.SubItems[1].Text = txtTargetFile.Text; 997 | temp.SubItems[2].Text = txtOutputDir.Text; 998 | btnAddEditJob.Text = "&Add to batch"; 999 | btnResetForms.Text = "&Reset Forms"; 1000 | } 1001 | } 1002 | 1003 | private void txtBatchSourceDir_DragEnter(object sender, DragEventArgs e) 1004 | { 1005 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) 1006 | { 1007 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1008 | if (Directory.Exists(files[0])) e.Effect = DragDropEffects.All; // Check if the first one is an existing folder 1009 | } 1010 | else 1011 | e.Effect = DragDropEffects.None; 1012 | } 1013 | 1014 | private void txtBatchSourceDir_DragDrop(object sender, DragEventArgs e) 1015 | { 1016 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1017 | txtBatchSourceDir.Text = files[0]; // Take the first one 1018 | } 1019 | 1020 | private void txtBatchTargetDir_DragEnter(object sender, DragEventArgs e) 1021 | { 1022 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) 1023 | { 1024 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1025 | if (Directory.Exists(files[0])) e.Effect = DragDropEffects.All; // Check if the first one is an existing folder 1026 | } 1027 | else 1028 | e.Effect = DragDropEffects.None; 1029 | } 1030 | 1031 | private void txtBatchTargetDir_DragDrop(object sender, DragEventArgs e) 1032 | { 1033 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1034 | txtBatchTargetDir.Text = files[0]; // Take the first one 1035 | } 1036 | 1037 | #endregion 1038 | 1039 | #region Batch Worker tab 1040 | 1041 | private void btnRemove_Click(object sender, EventArgs e) 1042 | { 1043 | RemoveTask(); 1044 | } 1045 | 1046 | private void RemoveTask() 1047 | { 1048 | foreach (ListViewItem temp in listView1.SelectedItems) 1049 | { 1050 | temp.Remove(); 1051 | } 1052 | } 1053 | 1054 | private void btnClear_Click(object sender, EventArgs e) 1055 | { 1056 | this.listView1.Items.Clear(); // Goodbye~ 1057 | } 1058 | 1059 | private void btnEdit_Click(object sender, EventArgs e) 1060 | { 1061 | EditTask(); 1062 | } 1063 | 1064 | private void EditTask() 1065 | { 1066 | if (listView1.SelectedItems.Count > 0) 1067 | { 1068 | ListViewItem temp = listView1.SelectedItems[0]; // Get the first pair 1069 | currentlyBeingEditedJob = listView1.SelectedItems[0].Index; 1070 | txtSourceFile.Text = temp.SubItems[0].Text; 1071 | txtTargetFile.Text = temp.SubItems[1].Text; 1072 | txtOutputDir.Text = temp.SubItems[2].Text; 1073 | btnAddEditJob.Text = "&Save"; 1074 | btnResetForms.Text = "&Cancel"; 1075 | 1076 | // Switch to File Patch tab 1077 | tabControl1.SelectedTab = tabControl1.TabPages[0]; 1078 | txtSourceFile.Focus(); 1079 | } 1080 | } 1081 | 1082 | private void editToolStripMenuItem_Click(object sender, EventArgs e) 1083 | { 1084 | EditTask(); 1085 | } 1086 | 1087 | private void removeToolStripMenuItem_Click(object sender, EventArgs e) 1088 | { 1089 | RemoveTask(); 1090 | } 1091 | 1092 | private void resetToolStripMenuItem_Click(object sender, EventArgs e) 1093 | { 1094 | foreach (ListViewItem temp in this.listView1.SelectedItems) 1095 | { 1096 | temp.ImageIndex = 2; 1097 | } 1098 | } 1099 | 1100 | private void btnBrowseBatchSourceDir_Click(object sender, EventArgs e) 1101 | { 1102 | if (fbdDirBrowser.ShowDialog() == DialogResult.OK) txtBatchSourceDir.Text = fbdDirBrowser.SelectedPath; 1103 | } 1104 | 1105 | private void btnBrowseBatchTargetDir_Click(object sender, EventArgs e) 1106 | { 1107 | if (fbdDirBrowser.ShowDialog() == DialogResult.OK) txtBatchTargetDir.Text = fbdDirBrowser.SelectedPath; 1108 | } 1109 | 1110 | private void btnBatchLoadDirs_Click(object sender, EventArgs e) 1111 | { 1112 | MessageBox.Show("This function hasn't been implemented!"); 1113 | } 1114 | 1115 | #endregion 1116 | 1117 | #region Settings tab 1118 | 1119 | private void chbUseCusXdelPara_CheckedChanged(object sender, EventArgs e) 1120 | { 1121 | useCustomParamenter = chbUseCustomXdeltaParams.Checked; 1122 | } 1123 | 1124 | private void txtCusXdelta_TextChanged(object sender, EventArgs e) 1125 | { 1126 | customParamenter = txtCustomXdeltaParams.Text; 1127 | } 1128 | 1129 | private void chbDetEpNum_CheckedChanged(object sender, EventArgs e) 1130 | { 1131 | tryDetectingEpisodeNumber = chbDetEpNum.Checked; 1132 | } 1133 | 1134 | private void btnSetxdeltaHighCompression_Click(object sender, EventArgs e) 1135 | { 1136 | txtCustomXdeltaParams.Text = "-e -f -7 -B1073741824 -S djw -s %source% %patched% %vcdiff%"; 1137 | } 1138 | 1139 | private void btnSetxdeltaHighMem_Click(object sender, EventArgs e) 1140 | { 1141 | txtCustomXdeltaParams.Text = "-e -f -B1073741824 -s %source% %patched% %vcdiff%"; 1142 | } 1143 | 1144 | private void btnSetxdeltaDefault_Click(object sender, EventArgs e) 1145 | { 1146 | txtCustomXdeltaParams.Text = "-e -f -s %source% %patched% %vcdiff%"; 1147 | } 1148 | 1149 | private void btnCusXdelHelp_Click(object sender, EventArgs e) 1150 | { 1151 | System.Diagnostics.Process.Start(@"http://xdelta.org/"); 1152 | } 1153 | 1154 | private void btnBrowseDefaultOutDir_Click(object sender, EventArgs e) 1155 | { 1156 | if (fbdDirBrowser.ShowDialog() == DialogResult.OK) 1157 | { 1158 | txtDefaultOutDir.Text = fbdDirBrowser.SelectedPath; 1159 | } 1160 | } 1161 | 1162 | private void rdbSourceDir_CheckedChanged(object sender, EventArgs e) 1163 | { 1164 | outputPlace = 0; 1165 | } 1166 | 1167 | private void rdbTargetDir_CheckedChanged(object sender, EventArgs e) 1168 | { 1169 | outputPlace = 1; 1170 | } 1171 | 1172 | private void rdbThisFol_CheckedChanged(object sender, EventArgs e) 1173 | { 1174 | outputPlace = 2; 1175 | } 1176 | 1177 | private void chbRun64bitxdelta3_CheckedChanged(object sender, EventArgs e) 1178 | { 1179 | run64bitxdelta = chbRun64bitxdelta3.Checked; 1180 | } 1181 | 1182 | private void chbDist64bitxdelta3_CheckedChanged(object sender, EventArgs e) 1183 | { 1184 | dist64bitxdelta = chbDist64bitxdelta3.Checked; 1185 | } 1186 | 1187 | private void btnApplySetxdeltaDefault_Click(object sender, EventArgs e) 1188 | { 1189 | txtCustomXdeltaParamsForApplying.Text = "-d -f -s %source% %vcdiff% %output%"; 1190 | } 1191 | 1192 | private void chbFunnyMode_CheckedChanged(object sender, EventArgs e) 1193 | { 1194 | funnyMode = chbFunnyMode.Checked; 1195 | } 1196 | 1197 | private void chbAddNewPatchToApplyAllScripts_CheckedChanged(object sender, EventArgs e) 1198 | { 1199 | addNewPatchToApplyAllScripts = chbAddNewPatchToApplyAllScripts.Checked; 1200 | } 1201 | 1202 | private void chbAlwaysCopySourceFiles_CheckedChanged(object sender, EventArgs e) 1203 | { 1204 | alwaysCopySourceFiles = chbAlwaysCopySourceFiles.Checked; 1205 | } 1206 | 1207 | private void chbSkipAlternativeScripts_CheckedChanged(object sender, EventArgs e) 1208 | { 1209 | skipAlternativeScripts = chbSkipAlternativeScripts.Checked; 1210 | } 1211 | 1212 | #endregion 1213 | 1214 | #region Apply tab 1215 | 1216 | private void txtApplySource_DragEnter(object sender, DragEventArgs e) 1217 | { 1218 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) // File only, you faggots! 1219 | e.Effect = DragDropEffects.All; 1220 | else 1221 | e.Effect = DragDropEffects.None; 1222 | } 1223 | 1224 | private void txtApplyVcdiffFile_DragEnter(object sender, DragEventArgs e) 1225 | { 1226 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) // File only, you faggots! 1227 | e.Effect = DragDropEffects.All; 1228 | else 1229 | e.Effect = DragDropEffects.None; 1230 | } 1231 | 1232 | private void txtApplyOutput_DragEnter(object sender, DragEventArgs e) 1233 | { 1234 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) // File only, you faggots! 1235 | e.Effect = DragDropEffects.All; 1236 | else 1237 | e.Effect = DragDropEffects.None; 1238 | } 1239 | 1240 | private void txtApplySource_DragDrop(object sender, DragEventArgs e) 1241 | { 1242 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1243 | txtApplySource.Text = files[0]; 1244 | } 1245 | 1246 | private void txtApplyVcdiffFile_DragDrop(object sender, DragEventArgs e) 1247 | { 1248 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1249 | txtApplyVcdiffFile.Text = files[0]; 1250 | } 1251 | 1252 | private void txtApplyOutput_DragDrop(object sender, DragEventArgs e) 1253 | { 1254 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); 1255 | txtApplyOutput.Text = files[0]; 1256 | } 1257 | 1258 | private void btnBrowseApplySource_Click(object sender, EventArgs e) 1259 | { 1260 | if (openFileDialog2.ShowDialog() == DialogResult.OK) txtApplySource.Text = openFileDialog2.FileName; 1261 | } 1262 | 1263 | private void btnBrowseApplyVcdiffFile_Click(object sender, EventArgs e) 1264 | { 1265 | if (openFileDialog3.ShowDialog() == DialogResult.OK) txtApplyVcdiffFile.Text = openFileDialog3.FileName; 1266 | } 1267 | 1268 | private void btnBrowseApplyOutput_Click(object sender, EventArgs e) 1269 | { 1270 | if (saveFileDialog1.InitialDirectory.Length < 1) saveFileDialog1.InitialDirectory = openFileDialog2.InitialDirectory; 1271 | if (saveFileDialog1.ShowDialog() == DialogResult.OK) txtApplyOutput.Text = saveFileDialog1.FileName; 1272 | } 1273 | 1274 | private void btnResetFormsApplyTab_Click(object sender, EventArgs e) 1275 | { 1276 | txtApplyOutput.Text = ""; 1277 | txtApplySource.Text = ""; 1278 | txtApplyVcdiffFile.Text = ""; 1279 | } 1280 | 1281 | #endregion 1282 | 1283 | #endregion 1284 | 1285 | #region Setting methods 1286 | 1287 | private Boolean loadSettingsSub_Boolean(string name, Boolean defaultValue) 1288 | { 1289 | string text = settings.Read(name); 1290 | return (text != null) ? text == "true" : defaultValue; 1291 | } 1292 | 1293 | private String loadSettingsSub_String(string name, String defaultValue) 1294 | { 1295 | string text = settings.Read(name); 1296 | return (text != null) ? text : defaultValue; 1297 | } 1298 | 1299 | private void loadSettings() 1300 | { 1301 | customParamenter = txtCustomXdeltaParams.Text = loadSettingsSub_String("Setting.CustomParamenter", txtCustomXdeltaParams.Text); 1302 | useCustomParamenter = chbUseCustomXdeltaParams.Checked = loadSettingsSub_Boolean("Setting.UseCustomParamenter", chbUseCustomXdeltaParams.Checked); 1303 | 1304 | txtCustomXdeltaParamsForApplying.Text = loadSettingsSub_String("Setting.CustomApplyingParamenter", txtCustomXdeltaParamsForApplying.Text); 1305 | chbUseCustomXdeltaParamsForApplying.Checked = loadSettingsSub_Boolean("Setting.UseCustomApplyingParamenter", chbUseCustomXdeltaParamsForApplying.Checked); 1306 | 1307 | tryDetectingEpisodeNumber = chbDetEpNum.Checked = loadSettingsSub_Boolean("Setting.DetectEpNum", chbDetEpNum.Checked); 1308 | txtAddTextWhenSwap.Text = loadSettingsSub_String("Setting.AddThisTextWhenSwap", txtAddTextWhenSwap.Text); 1309 | chbAddTextWhenSwap.Checked = loadSettingsSub_Boolean("Setting.AddTextWhenSwap", chbAddTextWhenSwap.Checked); 1310 | chbNewAutoName.Checked = loadSettingsSub_Boolean("Setting.chbNewAutoName", chbNewAutoName.Checked); 1311 | 1312 | run64bitxdelta = chbRun64bitxdelta3.Checked = loadSettingsSub_Boolean("Setting.chbRun64bitxdelta3", chbRun64bitxdelta3.Checked); 1313 | dist64bitxdelta = chbDist64bitxdelta3.Checked = loadSettingsSub_Boolean("Setting.chbDist64bitxdelta3", chbDist64bitxdelta3.Checked); 1314 | 1315 | string text = settings.Read("OutDir.Place2Go"); 1316 | int number = 0; 1317 | if (int.TryParse(text, out number)) this.outputPlace = number; 1318 | switch (outputPlace) 1319 | { 1320 | case 0: rdbSourceDir.Checked = true; break; 1321 | case 1: rdbTargetDir.Checked = true; break; 1322 | case 2: rdbThisFol.Checked = true; break; 1323 | default: rdbSourceDir.Checked = true; break; 1324 | } 1325 | txtDefaultOutDir.Text = loadSettingsSub_String("OutDir.txtDefaultOutDir", txtDefaultOutDir.Text); 1326 | 1327 | funnyMode = chbFunnyMode.Checked = loadSettingsSub_Boolean("Setting.chbFunnyMode", chbFunnyMode.Checked); 1328 | 1329 | addNewPatchToApplyAllScripts = chbAddNewPatchToApplyAllScripts.Checked = loadSettingsSub_Boolean("Setting.chbAddNewPatchToApplyAllScripts", chbAddNewPatchToApplyAllScripts.Checked); 1330 | alwaysCopySourceFiles = chbAlwaysCopySourceFiles.Checked = loadSettingsSub_Boolean("Setting.chbAlwaysCopySourceFiles", chbAlwaysCopySourceFiles.Checked); 1331 | chbOnlyStoreFileNameInVCDIFF.Checked = loadSettingsSub_Boolean("Setting.chbOnlyStoreFileNameInVCDIFF", chbOnlyStoreFileNameInVCDIFF.Checked); 1332 | skipAlternativeScripts = chbSkipAlternativeScripts.Checked = loadSettingsSub_Boolean("Setting.chbSkipAlternativeScripts", chbSkipAlternativeScripts.Checked); 1333 | chbSaveFormsInCreatePatchTab.Checked = loadSettingsSub_Boolean("Setting.chbSaveFormsInCreatePatchTab", chbSaveFormsInCreatePatchTab.Checked); 1334 | if (chbSaveFormsInCreatePatchTab.Checked) 1335 | { 1336 | txtSourceFile.Text = settings.Read("CreatePatch.txtSourceFile"); 1337 | txtTargetFile.Text = settings.Read("CreatePatch.txtTargetFile"); 1338 | txtOutputDir.Text = settings.Read("CreatePatch.txtOutputDir"); 1339 | } 1340 | } 1341 | 1342 | private void saveSettings() 1343 | { 1344 | settings.Write("Setting.CustomParamenter", txtCustomXdeltaParams.Text); 1345 | settings.Write("Setting.UseCustomParamenter", (useCustomParamenter) ? "true" : "false"); 1346 | settings.Write("Setting.CustomApplyingParamenter", txtCustomXdeltaParamsForApplying.Text); 1347 | settings.Write("Setting.UseCustomApplyingParamenter", (chbUseCustomXdeltaParamsForApplying.Checked) ? "true" : "false"); 1348 | settings.Write("Setting.DetectEpNum", (tryDetectingEpisodeNumber) ? "true" : "false"); 1349 | settings.Write("Setting.AddThisTextWhenSwap", txtAddTextWhenSwap.Text); 1350 | settings.Write("Setting.AddTextWhenSwap", (chbAddTextWhenSwap.Checked) ? "true" : "false"); 1351 | settings.Write("Setting.chbNewAutoName", (chbNewAutoName.Checked) ? "true" : "false"); 1352 | settings.Write("Setting.chbRun64bitxdelta3", (chbRun64bitxdelta3.Checked) ? "true" : "false"); 1353 | settings.Write("Setting.chbDist64bitxdelta3", (chbDist64bitxdelta3.Checked) ? "true" : "false"); 1354 | settings.Write("OutDir.Place2Go", this.outputPlace.ToString()); 1355 | settings.Write("OutDir.txtDefaultOutDir", this.txtDefaultOutDir.Text); 1356 | settings.Write("Setting.chbOnlyStoreFileNameInVCDIFF", (chbOnlyStoreFileNameInVCDIFF.Checked) ? "true" : "false"); 1357 | settings.Write("Setting.chbFunnyMode", (chbFunnyMode.Checked) ? "true" : "false"); 1358 | settings.Write("Setting.chbAddNewPatchToApplyAllScripts", (chbAddNewPatchToApplyAllScripts.Checked) ? "true" : "false"); 1359 | settings.Write("Setting.chbAlwaysCopySourceFiles", (chbAlwaysCopySourceFiles.Checked) ? "true" : "false"); 1360 | settings.Write("Setting.chbSkipAlternativeScripts", (chbSkipAlternativeScripts.Checked) ? "true" : "false"); 1361 | settings.Write("Setting.chbSaveFormsInCreatePatchTab", (chbSaveFormsInCreatePatchTab.Checked) ? "true" : "false"); 1362 | if (chbSaveFormsInCreatePatchTab.Checked) 1363 | { 1364 | settings.Write("CreatePatch.txtSourceFile", txtSourceFile.Text); 1365 | settings.Write("CreatePatch.txtTargetFile", txtTargetFile.Text); 1366 | settings.Write("CreatePatch.txtOutputDir", txtOutputDir.Text); 1367 | } 1368 | else 1369 | { 1370 | settings.Write("CreatePatch.txtSourceFile", ""); 1371 | settings.Write("CreatePatch.txtTargetFile", ""); 1372 | settings.Write("CreatePatch.txtOutputDir", ""); 1373 | } 1374 | settings.Close(); 1375 | } 1376 | 1377 | #endregion 1378 | 1379 | } 1380 | } 1381 | -------------------------------------------------------------------------------- /YAXBPC/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 697, 17 122 | 123 | 124 | 532, 17 125 | 126 | 127 | 417, 17 128 | 129 | 130 | 131 | AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w 132 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 133 | ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo 134 | CAAAAk1TRnQBSQFMAgEBAwEAAUABAQFAAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo 135 | AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA 136 | AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 137 | AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA 138 | AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm 139 | AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM 140 | AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA 141 | ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz 142 | AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ 143 | AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM 144 | AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA 145 | AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA 146 | AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ 147 | AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ 148 | AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA 149 | AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm 150 | ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ 151 | Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz 152 | AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA 153 | AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM 154 | AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM 155 | ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM 156 | Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA 157 | AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM 158 | AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ 159 | AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz 160 | AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm 161 | AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw 162 | AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/wgAAf89AAH/AQgBcQGX 163 | AQg6AAHwAXEBdwJPAVUBlwHxCAABAi4AAQgBmAGXAU8BmAFyAU8BdwFVAfAHAAEtAQIsAAHyAZcBVQFx 164 | AQgB/wHyAk8CVQHwBgABMwEtAQIrAAGYAXIBlwHyAf8BmAHyAQgCTwJVAfQFAAIzAS0BAikAAQgBlwGY 165 | Av8B8gFPAZ0B/wGYAU8CVQGYBQADMwEtAQInAAH0AZgBlwGYAvYClwFPAfMB/wGYA08FAAQzAS0BAiYA 166 | AQgCmAFyApgBTwF3AU8BmAL/AQcBTwFVAfMEAAUzAS0mAAOYAZcEVQJPAfIC/wEIAU8B8AQABTMnAAH/ 167 | ApgClwNVAk8BnQL/AZgBVQH/BAAEMygAAfQCmAKXA1UDTwEIAf8BcgFPBQADMyoAAQgDlwNVAXcBVQFP 168 | AXcB8gGdAZgFAAIzKwAB9AOXBlUBTwGdAZcGAAEzLQABCAGYAXEBnQFxAXcCVQFPApcBCDgAAfQB8AH0 169 | NwABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGAFwAD/wEAAf4F/wIAAfgBPwT/AgAB8AEP 170 | AfcD/wIAAeABBwHzA/8CAAHAAQMB8QP/AgABwAEBAfAD/wIAAYABAQHwAX8C/wMAAQEB8AE/Av8EAAHw 171 | AT8C/wQAAfABfwL/BAAB8AP/AwABAQHxA/8CAAGAAQEB8wP/AgABgAEDAfcD/wIAAcABAwT/AgAB/AF/ 172 | BP8CAAs= 173 | 174 | 175 | 176 | 17, 17 177 | 178 | 179 | 131, 17 180 | 181 | 182 | 243, 17 183 | 184 | 185 | 789, 17 186 | 187 | 188 | 17, 54 189 | 190 | 191 | 147, 54 192 | 193 | 194 | 275, 54 195 | 196 | 197 | 198 | 199 | AAABAAEAICAAAAAAAACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAA 200 | AAAAAAAA////AHim1wDMzMwAn8btAKKstADS5PYAsL7LAO3s6wC51vMAhrjoANzc3AC4uLgAydXfALPI 201 | 2wChtccAw8LCAK7M6gD29vUAerDnAJe+5ADV1NMA5OTkAMTc9ACCrtoAvsvWAKmzuwCiwuEAj7ffAJuv 202 | wQC3xdIAjr3qAKbM7wCw0vEAvL2/ALOzswDx8fEAmMLrAMfHxwCisL0AqMbkAPr6+gCntcIA6OjoAODg 203 | 4ADY2NgAvtr0AJ3B5QCdrLgApsjqAMXR3ADQ0dMArM7vAJO/6wC10/AAs8HOAM7h9wCdxOkA7u7vAOTm 204 | 6QCqy+sAwNjyAL7M2QDn5uUAi7vpAKTJ7QCy0e4A0tHQAKDE5wD9/f0A+Pj4APT08wDq6uoA4uLiALW1 205 | tQCRueEA3t7eANra2gDW1tYAqsjmALHG2QC71/QAqcvvALXU8wCeqrYApbTAAJvD5wDB2vQAr9DvAKHI 206 | 7QC8y9cA8vLzAPDw7wDr6+wAkr7pAMHBwQDT09QApsrsAKjM7QCz0/IAq8zuALfU8QC0w88Agq3YAO3t 207 | 7QCWwesA2NfWAJzE6wC/2vUAutbyAKjI6QCy0vAA9PT1AHqm1wDu8O8Ap7TAAKTJ6wC92PQApsruAK/Q 208 | 8QD+/v4A/Pz8APv7+wD5+fkA9/f3APX19ADz8/IA7+/wAO/v7gCHuekAo7G+AOnp6QDn5+cA5eXlAJTA 209 | 7ADj4+MA4eHhAJzC6ADf398A3d3dAKHB4ADb29sAxsbGAKPD4gDZ2dkAssDNANXV1QCuz/AArc/uAPLy 210 | 8QCerLkA8PDxAO7u7QCMu+gA7OztAOzr6wDr6+oAprXBAObm5gClyu0Ap8vuANfX1wCpzO4Aq83vANHR 211 | 0QCqzO0ArM3uAL3Z9QCv0fAAsdHxALDQ8AC21fMAsM/vALHR7wC21PIAt9XyALbT8QCz0u8AuNXxALnW 212 | 8QC21PAAvcvWAL3M2AC+zdgAeabXAPj49wD39/YA9vb2APX19QD09PQA8/PzAPLy8gCHuOgA8fHwAPDw 213 | 8ADv7+8A7u7uAO3t7gCmtMAA7e3sAOzs7ADs7OsA6+vrAOrq6QDp6egA6OjnAJzD5wDm5uUA5OfpAOXl 214 | 5ACfxOcA5OTlAOTk4wDj4+IA4+PkAKLI7QDj4uIA4uLhAOLh4QCkyewApMrtAOHh4ADg4N8ApsrtAN/f 215 | 3gCoy+4AqMzuAKjL7QDd3dwAqczvAN3d3gDS4/YA3NzbAKrM7gDb29oAq87vAKvN7gDa2tkA2dnYAKzO 216 | 7gDO4fYA2NjXAK3O7wDZ2doArc/vANfX1gDW1tUArs/vANXV1ACv0fEA1NTTAK/Q8ACw0PEAs9PxALPS 217 | 8AC31fMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 218 | AAAAAAAAAAAAAAAAAAApeyl6enl5RUVFeHh5e73ESgAAAAAAAAAAAAAAAAAAALl8Rikpenp5RUV4AXp8 219 | JMqQSgAAAAAAAAAAAAAAAAAAuXxGKSl6e3lFRXh4enwkyE1OSgAAAAAAAAAAAAAAAAC5fIoWSUmNJEVF 220 | eHh5Rr9oigMLDAAAAAAAAAAAAAAAAHx8SSwiHYxUC0iESEi+hMMWX7yNDAAAAAAAAAAAAAAAfLtIGhtk 221 | 8qLGxEV4eHp8v0gQeL1NIwAAAAAAAAAAAAB8wgWiWDaxrWEw5oS7eSm8wouOJqT1IwAAAAAAAAAAALwz 222 | G/s2srD34Z8qf3h4eXu8wkieFtjaIwAAAAAAAAAAJA/sNrO0b5PlUp8qf3h4enu7viTDxMQkAAAAAAAA 223 | AADHj/c2Zf6UNCBLZ1aW1sNMSIfEwooWyHwAAAAAAAAAAL0ZYm+s+/R2HBR0cTkqf3h4RXl6KSkpegAA 224 | AAAAAAAAEsK24+mjIBxEWSVrAjkqf3h4eHhFRUVFAAAAAAAAAAC8vtW331IvMeIlNR9eAjkqOnh4eHh4 225 | eHgAAAAAAAAAAH1+3uYe2/CmQQRACsCZAomC08p5KyS7RQAAAAAAAAAAvb+KiNORlAam3GmBE8BeAjkn 226 | 5nmKyrtFAAAAAAAAAAC9JEwsg2AH9Oel14aBCh9ruM4wiyvIRkUAAAAAAAAAAEfBlX5HfSQ+9Ofj12lA 227 | NSV0GKCdxXl5RQAAAAAAAAAAflzo7t3x3YMH7+el3AQlWdJu/KJVmnp5AAAAAAAAAACVgFzBlX5HfZc+ 228 | 9OemQeI8PSH9qaPGXXoAAAAAAAAAACSY7uDe3t2cTvM38gamQheorgkJCetzvgAAAAAAAAAAJGgtTODg 229 | 3suSiouRlDhX+a6vUWx1qygkAAAAAAAAAADBx2iYgFzBlb9+R3+2dndvCW0ubFerUHAAAAAAAAAAAIDJ 230 | 8ero3fjqjdXdjYVa4qr/p2wuURHQRgAAAAAAAAAAxMv17ere+kzZ5Bbxh+Bm5f9RbFFjMlt8AAAAAAAA 231 | AACYzMucyceYxIBcwsEklcW161NTEQ1yR7oAAAAAAAAAAAjN9vqQ8dX28fXVLeTdz4UZTw47l7+/vAAA 232 | AAAAAAAAmz9Dau4V1Pj1ktmh6IrRzMScaMHBJCS9AAAAAAAAAADBysnHmMSAXMHBJCSVlX5+fr5HR0dH 233 | R7oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 234 | AAAAAAAAAAAAAP//////////8AAH//AAA//wAAH/8AAA//AAAH/wAAA/8AAAH/AAAA/wAAAP8AAAD/AA 235 | AA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AA 236 | AA/wAAAP8AAAD/////////// 237 | 238 | 239 | -------------------------------------------------------------------------------- /YAXBPC/Licenses.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Apache License 4 | 5 | Version 2.0, January 2004 6 | 7 | http://www.apache.org/licenses/ 8 | 9 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 10 | 11 | 1. Definitions. 12 | 13 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 14 | 15 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 16 | 17 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 18 | 19 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 20 | 21 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 22 | 23 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 24 | 25 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 26 | 27 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 28 | 29 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 30 | 31 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 32 | 33 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 34 | 35 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 36 | 37 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 38 | 39 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 40 | You must cause any modified files to carry prominent notices stating that You changed the files; and 41 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 42 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 43 | 44 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 45 | 46 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 47 | 48 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 49 | 50 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 51 | 52 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 53 | 54 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 55 | 56 | END OF TERMS AND CONDITIONS 57 | * */ 58 | 59 | using System; 60 | using System.Collections.Generic; 61 | using System.Text; 62 | 63 | namespace YAXBPC 64 | { 65 | class Licenses 66 | { 67 | // This "class" stores the full text of the license(s) that this program use, that is, Apache License, Version 2.0 at the moment. 68 | // Please write any licenses-related information here and include it with the distribution. 69 | 70 | // xdelta is licensed under GNU General Public License v2.0. Distributing it in binary form is permitted. 71 | // Go here to get more information and source code/Windows binaries downloads http://xdelta.org/ 72 | // Linux binaries are taken from Debian packages pool http://packages.debian.org/search?keywords=xdelta3 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /YAXBPC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace YAXBPC 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | //CustomExceptionHandler eh = new CustomExceptionHandler(); 16 | //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(eh.OnThreadException); 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frmMain()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /YAXBPC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Yet Another xdelta-based Patch Creator")] 9 | [assembly: AssemblyDescription("Yet Another xdelta-based Patch Creator")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Yet Another xdelta-based Patch Creator")] 13 | [assembly: AssemblyCopyright("Copyleft © dreamer2908, 2012 - 2016. All wrongs reserved.")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("74ce6b2a-b97c-4a4b-91cc-9343b4a87ecb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("2.3.3.0")] 37 | -------------------------------------------------------------------------------- /YAXBPC/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.4927 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace YAXBPC.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("YAXBPC.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /YAXBPC/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /YAXBPC/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.4927 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace YAXBPC.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /YAXBPC/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YAXBPC/YAXBPC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {E6705EBA-C89B-469C-A3D2-EFF38720699E} 9 | WinExe 10 | Properties 11 | YAXBPC 12 | YAXBPC 13 | v2.0 14 | 512 15 | 16 | 17 | output6.ico 18 | C7CEA19FC3A8571A1312CE9C22DE22B830C12DE2 19 | YAXBPC_1_TemporaryKey.pfx 20 | true 21 | false 22 | false 23 | publish\ 24 | true 25 | Disk 26 | false 27 | Foreground 28 | 7 29 | Days 30 | false 31 | false 32 | true 33 | 1 34 | 1.0.0.%2a 35 | false 36 | true 37 | true 38 | 39 | 40 | true 41 | full 42 | false 43 | bin\Debug\ 44 | DEBUG;TRACE 45 | prompt 46 | 4 47 | 48 | 49 | pdbonly 50 | true 51 | bin\Release\ 52 | TRACE 53 | prompt 54 | 4 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Form 69 | 70 | 71 | Form1.cs 72 | 73 | 74 | 75 | 76 | 77 | Form1.cs 78 | 79 | 80 | ResXFileCodeGenerator 81 | Resources.Designer.cs 82 | Designer 83 | 84 | 85 | True 86 | Resources.resx 87 | True 88 | 89 | 90 | 91 | SettingsSingleFileGenerator 92 | Settings.Designer.cs 93 | 94 | 95 | True 96 | Settings.settings 97 | True 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | False 106 | .NET Framework Client Profile 107 | false 108 | 109 | 110 | False 111 | .NET Framework 2.0 %28x86%29 112 | true 113 | 114 | 115 | False 116 | .NET Framework 3.0 %28x86%29 117 | false 118 | 119 | 120 | False 121 | .NET Framework 3.5 122 | false 123 | 124 | 125 | False 126 | .NET Framework 3.5 SP1 127 | false 128 | 129 | 130 | 131 | 138 | 139 | xcopy "$(ProjectDir)CopyMe\*.*" "$(TargetDir)" /Y 140 | 141 | -------------------------------------------------------------------------------- /YAXBPC/Yet Another xdelta-based Patch Creator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual C# Express 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YAXBPC", "YAXBPC.csproj", "{E6705EBA-C89B-469C-A3D2-EFF38720699E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {E6705EBA-C89B-469C-A3D2-EFF38720699E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {E6705EBA-C89B-469C-A3D2-EFF38720699E}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {E6705EBA-C89B-469C-A3D2-EFF38720699E}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {E6705EBA-C89B-469C-A3D2-EFF38720699E}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /YAXBPC/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /YAXBPC/output6.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamer2908/YAXBPC/6b6743297ab6fb9c9c0c80a6cd66fa5ed04ff72b/YAXBPC/output6.ico --------------------------------------------------------------------------------