# HG changeset patch # User IBBoard # Date 1538849943 -3600 # Node ID a54c09901f4efcf0260db02a91be2ad4382cde66 Initial commit to Mercurial at v1.9.3 - now GPLed! diff -r 000000000000 -r a54c09901f4e .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,2 @@ +bin/ +obj/ \ No newline at end of file diff -r 000000000000 -r a54c09901f4e .vscode/launch.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.vscode/launch.json Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Texture Tool", + "type": "mono", + "request": "launch", + "program": "${workspaceRoot}/bin/Debug/TextureTool.exe", + "cwd": "${workspaceRoot}" + } + ] +} \ No newline at end of file diff -r 000000000000 -r a54c09901f4e .vscode/tasks.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.vscode/tasks.json Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,43 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build TextureTool (Debug)", + "type": "shell", + "command": "xbuild", + "args": [ + // Ask msbuild to generate full paths for file names. + "/property:GenerateFullPaths=true", + "/t:build" + ], + "group": "build", + "presentation": { + // Reveal the output only if unrecognized errors occur. + "reveal": "silent" + }, + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile" + }, + + { + "label": "Build TextureTool (Release)", + "type": "shell", + "command": "xbuild", + "args": [ + "/p:Configuration=Release", + // Ask msbuild to generate full paths for file names. + "/property:GenerateFullPaths=true", + "/t:build" + ], + "group": "build", + "presentation": { + // Reveal the output only if unrecognized errors occur. + "reveal": "silent" + }, + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff -r 000000000000 -r a54c09901f4e AboutTextureTool.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AboutTextureTool.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,129 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for AboutTextureTool. + /// + public class AboutTextureTool : System.Windows.Forms.Form + { + private System.Windows.Forms.Button bttnClose; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public AboutTextureTool() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + string version = Application.ProductVersion.Substring(0, Application.ProductVersion.LastIndexOf('.')); + + if (version.EndsWith(".0")) + { + version = version.Substring(0, version.Length-2); + } + + label2.Text = "Dawn of War Texture Tool v"+version; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttnClose = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // bttnClose + // + this.bttnClose.Location = new System.Drawing.Point(200, 120); + this.bttnClose.Name = "bttnClose"; + this.bttnClose.TabIndex = 0; + this.bttnClose.Text = "Close"; + this.bttnClose.Click += new System.EventHandler(this.bttnClose_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 40); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(272, 32); + this.label1.TabIndex = 1; + this.label1.Text = "Created by IBBoard for Skins @ Hive World Terra (http://skins.hiveworldterra.co." + + "uk)"; + // + // label2 + // + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.label2.Location = new System.Drawing.Point(8, 8); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(264, 23); + this.label2.TabIndex = 2; + this.label2.Text = "Dawn of War Texture Tool v1.6"; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(8, 80); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(272, 32); + this.label3.TabIndex = 3; + this.label3.Text = "WTP, RSH and RTX Compiler and Extractor, and DDS to TGA and TGA to DDS converter"; + // + // AboutTextureTool + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(282, 145); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.bttnClose); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "AboutTextureTool"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "About"; + this.ResumeLayout(false); + + } + #endregion + + private void bttnClose_Click(object sender, System.EventArgs e) + { + this.Close(); + } + } +} diff -r 000000000000 -r a54c09901f4e AboutTextureTool.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AboutTextureTool.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + (Default) + + + False + + + AboutTextureTool + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e App.ico Binary file App.ico has changed diff -r 000000000000 -r a54c09901f4e AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AssemblyInfo.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,62 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("Dawn of War Texture Tool")] +[assembly: AssemblyDescription("A WTP, RSH and RTX compiler and extractor")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TextureTool")] +[assembly: AssemblyCopyright("2006-2018 IBBoard")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.9.3.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff -r 000000000000 -r a54c09901f4e COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/COPYING Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff -r 000000000000 -r a54c09901f4e DXTFormat.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DXTFormat.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,147 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using IBBoard.Graphics; +using IBBoard.Graphics.OpenILPort; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for DXTFormat. + /// + public class DXTFormat : System.Windows.Forms.Form + { + public Converter.DXTType ChosenFormat = Converter.DXTType.None; + + private System.Windows.Forms.Button bttnDxt1; + private System.Windows.Forms.Button bttnDxt3; + private System.Windows.Forms.Button bttnDxt5; + private System.Windows.Forms.Label lblMessage; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public DXTFormat() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code fibble + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttnDxt1 = new System.Windows.Forms.Button(); + this.bttnDxt3 = new System.Windows.Forms.Button(); + this.bttnDxt5 = new System.Windows.Forms.Button(); + this.lblMessage = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // bttnDxt1 + // + this.bttnDxt1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.bttnDxt1.Location = new System.Drawing.Point(7, 90); + this.bttnDxt1.Name = "bttnDxt1"; + this.bttnDxt1.Size = new System.Drawing.Size(94, 23); + this.bttnDxt1.TabIndex = 0; + this.bttnDxt1.Text = "DXT1"; + this.bttnDxt1.Click += new System.EventHandler(this.bttnDxt1_Click); + // + // bttnDxt3 + // + this.bttnDxt3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.bttnDxt3.Location = new System.Drawing.Point(107, 90); + this.bttnDxt3.Name = "bttnDxt3"; + this.bttnDxt3.Size = new System.Drawing.Size(94, 23); + this.bttnDxt3.TabIndex = 1; + this.bttnDxt3.Text = "DXT3"; + this.bttnDxt3.Click += new System.EventHandler(this.bttnDxt3_Click); + // + // bttnDxt5 + // + this.bttnDxt5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.bttnDxt5.Location = new System.Drawing.Point(210, 90); + this.bttnDxt5.Name = "bttnDxt5"; + this.bttnDxt5.Size = new System.Drawing.Size(94, 23); + this.bttnDxt5.TabIndex = 2; + this.bttnDxt5.Text = "DXT5"; + this.bttnDxt5.Click += new System.EventHandler(this.bttnDxt5_Click); + // + // lblMessage + // + this.lblMessage.Location = new System.Drawing.Point(8, 8); + this.lblMessage.Name = "lblMessage"; + this.lblMessage.Size = new System.Drawing.Size(296, 72); + this.lblMessage.TabIndex = 5; + this.lblMessage.Text = "Please select a DXT Compression level to convert the images to.\r\n\r\nInformation on" + + " DXT levels is available at http://en.wikipedia.org/wiki/S3TC"; + // + // DXTFormat + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(316, 121); + this.ControlBox = false; + this.Controls.Add(this.lblMessage); + this.Controls.Add(this.bttnDxt5); + this.Controls.Add(this.bttnDxt3); + this.Controls.Add(this.bttnDxt1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "DXTFormat"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "DXTFormat"; + this.ResumeLayout(false); + + } + #endregion + + private void bttnDxt1_Click(object sender, System.EventArgs e) + { + ChosenFormat = Converter.DXTType.DXT1; + this.Close(); + } + + private void bttnDxt3_Click(object sender, System.EventArgs e) + { + ChosenFormat = Converter.DXTType.DXT3; + this.Close(); + } + + private void bttnDxt5_Click(object sender, System.EventArgs e) + { + ChosenFormat = Converter.DXTType.DXT5; + this.Close(); + } + } +} diff -r 000000000000 -r a54c09901f4e DXTFormat.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DXTFormat.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e ErrorDetails.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ErrorDetails.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,88 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for ErrorDetails. + /// + public class ErrorDetails : System.Windows.Forms.Form + { + private System.Windows.Forms.TextBox txtDetails; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public ErrorDetails(string details) + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + txtDetails.Text = details; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtDetails = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // txtDetails + // + this.txtDetails.Location = new System.Drawing.Point(0, 0); + this.txtDetails.Multiline = true; + this.txtDetails.Name = "txtDetails"; + this.txtDetails.ReadOnly = true; + this.txtDetails.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.txtDetails.Size = new System.Drawing.Size(434, 270); + this.txtDetails.TabIndex = 0; + this.txtDetails.Text = ""; + this.txtDetails.WordWrap = false; + // + // ErrorDetails + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(434, 270); + this.Controls.Add(this.txtDetails); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ErrorDetails"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Error Details"; + this.ResumeLayout(false); + + } + #endregion + } +} diff -r 000000000000 -r a54c09901f4e ErrorDetails.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ErrorDetails.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + False + + + Private + + + False + + + ErrorDetails + + + (Default) + + + False + + + False + + + 2, 2 + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e Options.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Options.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,979 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.IO; +using System.Text.RegularExpressions; + +using IBBoard; +using IBBoard.Graphics; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for Options. + /// + public class Options : System.Windows.Forms.Form + { + private Preferences pref; + + private System.Windows.Forms.Button bttnImportTeamcolour; + private System.Windows.Forms.Button bttnOK; + private System.Windows.Forms.Button bttnCancel; + private System.Windows.Forms.ColorDialog colorDialog; + private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.Label lblDoWPath; + private System.Windows.Forms.Button bttnDoWPath; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog; + private System.Windows.Forms.Button bttnPrimary; + private System.Windows.Forms.Button bttnSecondary; + private System.Windows.Forms.Button bttnTrim; + private System.Windows.Forms.Button bttnWeapon; + private System.Windows.Forms.Button bttnTrim2; + private System.Windows.Forms.PictureBox pbBadge; + private System.Windows.Forms.Label lblBadge; + private System.Windows.Forms.Label lblBanner; + private System.Windows.Forms.PictureBox pbBanner; + private System.Windows.Forms.Button bttnSave; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TextBox txtDoWPath; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button bttnTexturePath; + private System.Windows.Forms.TextBox txtTexturePath; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button bttnTeamcolourPath; + private System.Windows.Forms.TextBox txtTeamcolourPath; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.RadioButton rbBasicMode; + private System.Windows.Forms.RadioButton rbAdvancedMode; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public Options(Preferences p) + { + pref = p; + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + pbBadge.Tag = ""; + pbBanner.Tag = ""; + + colorDialog.FullOpen = true; + txtDoWPath.Text = pref["DoWPath"].ToString(); + txtTeamcolourPath.Text = pref["TeamcolourPath"].ToString(); + txtTexturePath.Text = pref["TexturePath"].ToString(); + + if ((bool)pref["settingBasic"]) + { + rbBasicMode.Checked = true; + } + else + { + rbAdvancedMode.Checked = true; + } + + SetButtonColour(bttnPrimary, Color.FromArgb((byte)pref["PrimaryRed"], (byte)pref["PrimaryGreen"], (byte)pref["PrimaryBlue"])); + SetButtonColour(bttnSecondary, Color.FromArgb((byte)pref["SecondaryRed"], (byte)pref["SecondaryGreen"], (byte)pref["SecondaryBlue"])); + SetButtonColour(bttnTrim, Color.FromArgb((byte)pref["TrimRed"], (byte)pref["TrimGreen"], (byte)pref["TrimBlue"])); + SetButtonColour(bttnWeapon, Color.FromArgb((byte)pref["WeaponRed"], (byte)pref["WeaponGreen"], (byte)pref["WeaponBlue"])); + SetButtonColour(bttnTrim2, Color.FromArgb((byte)pref["EyesRed"], (byte)pref["EyesGreen"], (byte)pref["EyesBlue"])); + + string temp = pref["BadgeName"].ToString(); + + if (temp.LastIndexOf(IBBoard.Constants.DirectoryChar)==-1) + { + temp = pref["DoWPath"].ToString().TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"badges"+IBBoard.Constants.DirectoryChar+pref["BadgeName"].ToString(); + } + + if (File.Exists(temp)) + { + SetPictureBoxImage(pbBadge, temp); + } + + temp = pref["BannerName"].ToString(); + + if (temp.LastIndexOf(IBBoard.Constants.DirectoryChar)==-1) + { + temp = pref["DoWPath"].ToString().TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"banners"+IBBoard.Constants.DirectoryChar+pref["BannerName"].ToString(); + } + + if (File.Exists(temp)) + { + SetPictureBoxImage(pbBanner, temp); + } + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.colorDialog = new System.Windows.Forms.ColorDialog(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.bttnImportTeamcolour = new System.Windows.Forms.Button(); + this.bttnOK = new System.Windows.Forms.Button(); + this.bttnCancel = new System.Windows.Forms.Button(); + this.txtDoWPath = new System.Windows.Forms.TextBox(); + this.lblDoWPath = new System.Windows.Forms.Label(); + this.bttnDoWPath = new System.Windows.Forms.Button(); + this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); + this.pbBanner = new System.Windows.Forms.PictureBox(); + this.lblBanner = new System.Windows.Forms.Label(); + this.lblBadge = new System.Windows.Forms.Label(); + this.pbBadge = new System.Windows.Forms.PictureBox(); + this.bttnTrim2 = new System.Windows.Forms.Button(); + this.bttnWeapon = new System.Windows.Forms.Button(); + this.bttnTrim = new System.Windows.Forms.Button(); + this.bttnSecondary = new System.Windows.Forms.Button(); + this.bttnPrimary = new System.Windows.Forms.Button(); + this.bttnSave = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.rbAdvancedMode = new System.Windows.Forms.RadioButton(); + this.rbBasicMode = new System.Windows.Forms.RadioButton(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.bttnTeamcolourPath = new System.Windows.Forms.Button(); + this.txtTeamcolourPath = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.bttnTexturePath = new System.Windows.Forms.Button(); + this.txtTexturePath = new System.Windows.Forms.TextBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.SuspendLayout(); + // + // bttnImportTeamcolour + // + this.bttnImportTeamcolour.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnImportTeamcolour.Location = new System.Drawing.Point(16, 168); + this.bttnImportTeamcolour.Name = "bttnImportTeamcolour"; + this.bttnImportTeamcolour.Size = new System.Drawing.Size(128, 23); + this.bttnImportTeamcolour.TabIndex = 3; + this.bttnImportTeamcolour.Text = "Import Teamcolour"; + this.bttnImportTeamcolour.Click += new System.EventHandler(this.bttnImportTeamcolour_Click); + // + // bttnOK + // + this.bttnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnOK.Location = new System.Drawing.Point(368, 240); + this.bttnOK.Name = "bttnOK"; + this.bttnOK.TabIndex = 2; + this.bttnOK.Text = "OK"; + this.bttnOK.Click += new System.EventHandler(this.bttnOK_Click); + // + // bttnCancel + // + this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnCancel.Location = new System.Drawing.Point(280, 240); + this.bttnCancel.Name = "bttnCancel"; + this.bttnCancel.TabIndex = 1; + this.bttnCancel.Text = "Cancel"; + this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); + // + // txtDoWPath + // + this.txtDoWPath.Cursor = System.Windows.Forms.Cursors.Default; + this.txtDoWPath.Location = new System.Drawing.Point(112, 8); + this.txtDoWPath.Name = "txtDoWPath"; + this.txtDoWPath.Size = new System.Drawing.Size(240, 20); + this.txtDoWPath.TabIndex = 3; + this.txtDoWPath.TabStop = false; + this.txtDoWPath.Text = ""; + this.txtDoWPath.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textbox_KeyDown); + this.txtDoWPath.TextChanged += new System.EventHandler(this.textbox_TextChanged); + this.txtDoWPath.Leave += new System.EventHandler(this.txtDoWPath_Leave); + // + // lblDoWPath + // + this.lblDoWPath.Location = new System.Drawing.Point(8, 8); + this.lblDoWPath.Name = "lblDoWPath"; + this.lblDoWPath.TabIndex = 4; + this.lblDoWPath.Text = "Dawn of War Path:"; + this.lblDoWPath.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // bttnDoWPath + // + this.bttnDoWPath.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnDoWPath.Location = new System.Drawing.Point(360, 8); + this.bttnDoWPath.Name = "bttnDoWPath"; + this.bttnDoWPath.Size = new System.Drawing.Size(56, 23); + this.bttnDoWPath.TabIndex = 4; + this.bttnDoWPath.Text = "Select"; + this.bttnDoWPath.Click += new System.EventHandler(this.bttnDoWPath_Click); + // + // pbBanner + // + this.pbBanner.Location = new System.Drawing.Point(296, 64); + this.pbBanner.Name = "pbBanner"; + this.pbBanner.Size = new System.Drawing.Size(64, 96); + this.pbBanner.TabIndex = 8; + this.pbBanner.TabStop = false; + this.pbBanner.Click += new System.EventHandler(this.pbBanner_Click); + // + // lblBanner + // + this.lblBanner.Location = new System.Drawing.Point(232, 72); + this.lblBanner.Name = "lblBanner"; + this.lblBanner.Size = new System.Drawing.Size(64, 23); + this.lblBanner.TabIndex = 7; + this.lblBanner.Text = "Banner:"; + this.lblBanner.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // lblBadge + // + this.lblBadge.Location = new System.Drawing.Point(24, 72); + this.lblBadge.Name = "lblBadge"; + this.lblBadge.Size = new System.Drawing.Size(48, 23); + this.lblBadge.TabIndex = 6; + this.lblBadge.Text = "Badge:"; + this.lblBadge.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // pbBadge + // + this.pbBadge.BackColor = System.Drawing.SystemColors.Control; + this.pbBadge.Location = new System.Drawing.Point(80, 72); + this.pbBadge.Name = "pbBadge"; + this.pbBadge.Size = new System.Drawing.Size(64, 64); + this.pbBadge.TabIndex = 5; + this.pbBadge.TabStop = false; + this.pbBadge.Click += new System.EventHandler(this.pbBadge_Click); + // + // bttnTrim2 + // + this.bttnTrim2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.bttnTrim2.Location = new System.Drawing.Point(336, 16); + this.bttnTrim2.Name = "bttnTrim2"; + this.bttnTrim2.Size = new System.Drawing.Size(72, 40); + this.bttnTrim2.TabIndex = 4; + this.bttnTrim2.Tag = "Eye"; + this.bttnTrim2.Text = "Trim 2/Eye"; + this.bttnTrim2.Click += new System.EventHandler(this.bttnTrim2_Click); + // + // bttnWeapon + // + this.bttnWeapon.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.bttnWeapon.Location = new System.Drawing.Point(256, 16); + this.bttnWeapon.Name = "bttnWeapon"; + this.bttnWeapon.Size = new System.Drawing.Size(72, 40); + this.bttnWeapon.TabIndex = 3; + this.bttnWeapon.Tag = "Weapon"; + this.bttnWeapon.Text = "Weapon"; + this.bttnWeapon.Click += new System.EventHandler(this.bttnWeapon_Click); + // + // bttnTrim + // + this.bttnTrim.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.bttnTrim.Location = new System.Drawing.Point(176, 16); + this.bttnTrim.Name = "bttnTrim"; + this.bttnTrim.Size = new System.Drawing.Size(72, 40); + this.bttnTrim.TabIndex = 2; + this.bttnTrim.Tag = "Trim"; + this.bttnTrim.Text = "Trim"; + this.bttnTrim.Click += new System.EventHandler(this.bttnTrim_Click); + // + // bttnSecondary + // + this.bttnSecondary.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.bttnSecondary.Location = new System.Drawing.Point(96, 16); + this.bttnSecondary.Name = "bttnSecondary"; + this.bttnSecondary.Size = new System.Drawing.Size(72, 40); + this.bttnSecondary.TabIndex = 1; + this.bttnSecondary.Tag = "Secondary"; + this.bttnSecondary.Text = "Secondary"; + this.bttnSecondary.Click += new System.EventHandler(this.bttnSecondary_Click); + // + // bttnPrimary + // + this.bttnPrimary.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.bttnPrimary.Location = new System.Drawing.Point(16, 16); + this.bttnPrimary.Name = "bttnPrimary"; + this.bttnPrimary.Size = new System.Drawing.Size(72, 40); + this.bttnPrimary.TabIndex = 0; + this.bttnPrimary.Tag = "Primary"; + this.bttnPrimary.Text = "Primary"; + this.bttnPrimary.Click += new System.EventHandler(this.bttnPrimary_Click); + // + // bttnSave + // + this.bttnSave.Enabled = false; + this.bttnSave.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnSave.Location = new System.Drawing.Point(8, 240); + this.bttnSave.Name = "bttnSave"; + this.bttnSave.Size = new System.Drawing.Size(112, 23); + this.bttnSave.TabIndex = 7; + this.bttnSave.Text = "Save Preferences"; + this.bttnSave.Click += new System.EventHandler(this.bttnSave_Click); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(8, 8); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(432, 224); + this.tabControl1.TabIndex = 8; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.rbAdvancedMode); + this.tabPage1.Controls.Add(this.rbBasicMode); + this.tabPage1.Controls.Add(this.label3); + this.tabPage1.Controls.Add(this.label2); + this.tabPage1.Controls.Add(this.bttnTeamcolourPath); + this.tabPage1.Controls.Add(this.txtTeamcolourPath); + this.tabPage1.Controls.Add(this.label1); + this.tabPage1.Controls.Add(this.bttnTexturePath); + this.tabPage1.Controls.Add(this.txtTexturePath); + this.tabPage1.Controls.Add(this.lblDoWPath); + this.tabPage1.Controls.Add(this.bttnDoWPath); + this.tabPage1.Controls.Add(this.txtDoWPath); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Size = new System.Drawing.Size(424, 198); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Game/Path Settings"; + // + // rbAdvancedMode + // + this.rbAdvancedMode.Location = new System.Drawing.Point(200, 120); + this.rbAdvancedMode.Name = "rbAdvancedMode"; + this.rbAdvancedMode.Size = new System.Drawing.Size(80, 24); + this.rbAdvancedMode.TabIndex = 13; + this.rbAdvancedMode.Text = "Advanced"; + this.rbAdvancedMode.CheckedChanged += new System.EventHandler(this.rbMode_CheckedChanged); + // + // rbBasicMode + // + this.rbBasicMode.Location = new System.Drawing.Point(120, 120); + this.rbBasicMode.Name = "rbBasicMode"; + this.rbBasicMode.Size = new System.Drawing.Size(72, 24); + this.rbBasicMode.TabIndex = 12; + this.rbBasicMode.Text = "Basic"; + this.rbBasicMode.CheckedChanged += new System.EventHandler(this.rbMode_CheckedChanged); + // + // label3 + // + this.label3.Location = new System.Drawing.Point(8, 120); + this.label3.Name = "label3"; + this.label3.TabIndex = 11; + this.label3.Text = "Texture Mode:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 72); + this.label2.Name = "label2"; + this.label2.TabIndex = 10; + this.label2.Text = "Teamcolour Path:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // bttnTeamcolourPath + // + this.bttnTeamcolourPath.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnTeamcolourPath.Location = new System.Drawing.Point(360, 72); + this.bttnTeamcolourPath.Name = "bttnTeamcolourPath"; + this.bttnTeamcolourPath.Size = new System.Drawing.Size(56, 23); + this.bttnTeamcolourPath.TabIndex = 9; + this.bttnTeamcolourPath.Text = "Select"; + this.bttnTeamcolourPath.Click += new System.EventHandler(this.bttnTeamcolourPath_Click); + // + // txtTeamcolourPath + // + this.txtTeamcolourPath.Cursor = System.Windows.Forms.Cursors.Default; + this.txtTeamcolourPath.Location = new System.Drawing.Point(112, 72); + this.txtTeamcolourPath.Name = "txtTeamcolourPath"; + this.txtTeamcolourPath.Size = new System.Drawing.Size(240, 20); + this.txtTeamcolourPath.TabIndex = 8; + this.txtTeamcolourPath.TabStop = false; + this.txtTeamcolourPath.Text = ""; + this.txtTeamcolourPath.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textbox_KeyDown); + this.txtTeamcolourPath.TextChanged += new System.EventHandler(this.textbox_TextChanged); + this.txtTeamcolourPath.Leave += new System.EventHandler(this.textbox_Leave); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 40); + this.label1.Name = "label1"; + this.label1.TabIndex = 7; + this.label1.Text = "Texture Path:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // bttnTexturePath + // + this.bttnTexturePath.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnTexturePath.Location = new System.Drawing.Point(360, 40); + this.bttnTexturePath.Name = "bttnTexturePath"; + this.bttnTexturePath.Size = new System.Drawing.Size(56, 23); + this.bttnTexturePath.TabIndex = 6; + this.bttnTexturePath.Text = "Select"; + this.bttnTexturePath.Click += new System.EventHandler(this.bttnTexturePath_Click); + // + // txtTexturePath + // + this.txtTexturePath.Cursor = System.Windows.Forms.Cursors.Default; + this.txtTexturePath.Location = new System.Drawing.Point(112, 40); + this.txtTexturePath.Name = "txtTexturePath"; + this.txtTexturePath.Size = new System.Drawing.Size(240, 20); + this.txtTexturePath.TabIndex = 5; + this.txtTexturePath.TabStop = false; + this.txtTexturePath.Text = ""; + this.txtTexturePath.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textbox_KeyDown); + this.txtTexturePath.TextChanged += new System.EventHandler(this.textbox_TextChanged); + this.txtTexturePath.Leave += new System.EventHandler(this.textbox_Leave); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.bttnTrim2); + this.tabPage2.Controls.Add(this.pbBadge); + this.tabPage2.Controls.Add(this.lblBadge); + this.tabPage2.Controls.Add(this.lblBanner); + this.tabPage2.Controls.Add(this.bttnImportTeamcolour); + this.tabPage2.Controls.Add(this.pbBanner); + this.tabPage2.Controls.Add(this.bttnWeapon); + this.tabPage2.Controls.Add(this.bttnPrimary); + this.tabPage2.Controls.Add(this.bttnSecondary); + this.tabPage2.Controls.Add(this.bttnTrim); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Size = new System.Drawing.Size(424, 198); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Team Colouring Settings"; + // + // Options + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(450, 270); + this.ControlBox = false; + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.bttnSave); + this.Controls.Add(this.bttnCancel); + this.Controls.Add(this.bttnOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MinimizeBox = false; + this.Name = "Options"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Options"; + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.ResumeLayout(false); + + } + #endregion + + private void bttnDoWPath_Click(object sender, System.EventArgs e) + { + setPath(txtDoWPath); + } + + private void bttnOK_Click(object sender, System.EventArgs e) + { + setPrefs(); + + this.Close(); + } + + private void bttnCancel_Click(object sender, System.EventArgs e) + { + this.Close(); + } + + private void bttnPrimary_Click(object sender, System.EventArgs e) + { + colorDialog.Color = bttnPrimary.BackColor; + DialogResult dr = colorDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetButtonColour(bttnPrimary, colorDialog.Color); + } + } + + private void bttnSecondary_Click(object sender, System.EventArgs e) + { + colorDialog.Color = bttnSecondary.BackColor; + DialogResult dr = colorDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetButtonColour(bttnSecondary, colorDialog.Color); + } + } + + private void bttnTrim_Click(object sender, System.EventArgs e) + { + colorDialog.Color = bttnTrim.BackColor; + DialogResult dr = colorDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetButtonColour(bttnTrim, colorDialog.Color); + } + } + + private void bttnWeapon_Click(object sender, System.EventArgs e) + { + colorDialog.Color = bttnWeapon.BackColor; + DialogResult dr = colorDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetButtonColour(bttnWeapon, colorDialog.Color); + } + } + + private void bttnTrim2_Click(object sender, System.EventArgs e) + { + colorDialog.Color = bttnTrim2.BackColor; + DialogResult dr = colorDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetButtonColour(bttnTrim2, colorDialog.Color); + } + } + + private void SetButtonColour(Button bttn, Color colour) + { + if (bttn.BackColor!=colour) + { + bttn.BackColor = colour; + + if (colour.R<128 && colour.G<128 && colour.B<128) + { + bttn.ForeColor = Color.White; + } + else + { + bttn.ForeColor = Color.Black; + } + + if (bttn == bttnSecondary) + { + pbBadge.BackColor = colour; + SetPictureBoxImage(pbBadge, null); + pbBanner.BackColor = colour; + SetPictureBoxImage(pbBanner, null); + } + + setSaveEnabled(); + } + } + + private void pbBadge_Click(object sender, System.EventArgs e) + { + openFileDialog.InitialDirectory = txtDoWPath.Text.TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"badges"+IBBoard.Constants.DirectoryChar; + openFileDialog.Filter = "Badge Image (*.tga)|*.tga"; + openFileDialog.FileName = ""; + openFileDialog.CheckFileExists = true; + DialogResult dr = openFileDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetPictureBoxImage(pbBadge, openFileDialog.FileName); + } + } + + private void pbBanner_Click(object sender, System.EventArgs e) + { + openFileDialog.InitialDirectory = txtDoWPath.Text.TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"banners"+IBBoard.Constants.DirectoryChar; + openFileDialog.Filter = "Banner Image (*.tga)|*.tga"; + openFileDialog.FileName = ""; + openFileDialog.CheckFileExists = true; + DialogResult dr = openFileDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + SetPictureBoxImage(pbBanner, openFileDialog.FileName); + } + } + + private bool SetPictureBoxImage(PictureBox box, string filepath) + { + if (filepath == "") + { + box.Image = null; + box.Tag = ""; + return true; + } + + if (filepath==null) + { + filepath = (string)box.Tag; + } + + bool success = false; + + if (File.Exists(filepath)) + { + try + { + Bitmap bmp = IBBoard.Graphics.ImageConverter.TGAtoBMP(filepath, box.BackColor); + + if (bmp.Width!=64) + { + MessageBox.Show(this, "The image you selected was not the correct width. Badges and banners must be 64px wide.", "Invalid image"); + } + else if (box == pbBadge && bmp.Height!=64) + { + MessageBox.Show(this, "The image you selected was not the correct size. Badges must be 64px high.", "Invalid image"); + } + else if (box == pbBanner && bmp.Height!=96) + { + MessageBox.Show(this, "The image you selected was not the correct size. Banners must be 96px high.", "Invalid image"); + } + else + { + box.Image = bmp; + box.Image.RotateFlip(RotateFlipType.RotateNoneFlipY); + box.Tag = filepath; + success = true; + } + } + catch(InvalidOperationException ex) + { + if (box==pbBanner) + { + MessageBox.Show(this, ex.Message, "Invalid banner"); + } + else + { + MessageBox.Show(this, ex.Message, "Invalid badge"); + } + } + } + else + { + box.Image = null; + box.Tag = ""; + + } + + setSaveEnabled(); + + return success; + } + + private void bttnImportTeamcolour_Click(object sender, System.EventArgs e) + { + openFileDialog.Filter = "Team Colour files (*.teamcolour)|*.teamcolour"; + openFileDialog.FileName = ""; + openFileDialog.InitialDirectory = txtTeamcolourPath.Text; + openFileDialog.CheckFileExists = true; + DialogResult dr = openFileDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + string error = ""; + string temp = ""; + + FileInfo file = new FileInfo(openFileDialog.FileName); + TextReader tr = file.OpenText(); + string content = tr.ReadToEnd(); + tr.Close(); + Match match = Regex.Match(content, "\"BADGES:([\\w\\.]+)\""); + + if (match.Success) + { + temp = txtDoWPath.Text.TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"badges"+IBBoard.Constants.DirectoryChar+match.Groups[1].Value; + SetPictureBoxImage(pbBadge, temp); + } + else + { + SetPictureBoxImage(pbBadge, ""); + } + + match = Regex.Match(content, "\"BANNERS:([\\w\\.]+)\""); + if (match.Success) + { + temp = txtDoWPath.Text.ToString().TrimEnd(IBBoard.Constants.DirectoryChar)+IBBoard.Constants.DirectoryChar+"banners"+IBBoard.Constants.DirectoryChar+match.Groups[1].Value; + + SetPictureBoxImage(pbBanner, temp); + } + else + { + SetPictureBoxImage(pbBanner, ""); + } + + match = Regex.Match(content, "Primary =\\s+{\\s+b = ([12]?[0-9]?[0-9]),\\s+g = ([12]?[0-9]?[0-9]),\\s+r = ([12]?[0-9]?[0-9]),"); + if (match.Success) + { + SetButtonColour(bttnPrimary, Color.FromArgb(byte.Parse(match.Groups[3].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[1].Value))); + } + else + { + error+= "\r\n* Primary"; + } + + match = Regex.Match(content, "Secondary =\\s+{\\s+b = ([12]?[0-9]?[0-9]),\\s+g = ([12]?[0-9]?[0-9]),\\s+r = ([12]?[0-9]?[0-9]),"); + if (match.Success) + { + SetButtonColour(bttnSecondary, Color.FromArgb(byte.Parse(match.Groups[3].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[1].Value))); + } + else + { + error+= "\r\n* Secondary"; + } + + match = Regex.Match(content, "Trim =\\s+{\\s+b = ([12]?[0-9]?[0-9]),\\s+g = ([12]?[0-9]?[0-9]),\\s+r = ([12]?[0-9]?[0-9]),"); + if (match.Success) + { + SetButtonColour(bttnTrim, Color.FromArgb(byte.Parse(match.Groups[3].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[1].Value))); + } + else + { + error+= "\r\n* Trim"; + } + + match = Regex.Match(content, "Weapons =\\s+{\\s+b = ([12]?[0-9]?[0-9]),\\s+g = ([12]?[0-9]?[0-9]),\\s+r = ([12]?[0-9]?[0-9]),"); + if (match.Success) + { + SetButtonColour(bttnWeapon, Color.FromArgb(byte.Parse(match.Groups[3].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[1].Value))); + } + else + { + error+= "\r\n* Weapon"; + } + + match = Regex.Match(content, "Eyes =\\s+{\\s+b = ([12]?[0-9]?[0-9]),\\s+g = ([12]?[0-9]?[0-9]),\\s+r = ([12]?[0-9]?[0-9]),"); + if (match.Success) + { + SetButtonColour(bttnTrim2, Color.FromArgb(byte.Parse(match.Groups[3].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[1].Value))); + } + else + { + error+= "\r\n* Trim 2/Eye"; + } + + if (error!="") + { + MessageBox.Show(this, "Invalid .teamcolour file - Error loading:"+error, "Import error"); + } + } + } + + private void bttnSave_Click(object sender, System.EventArgs e) + { + setPrefs(); + pref.Save(); + bttnSave.Enabled = false; + } + + private void textbox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + if (sender is TextBox) + { + if(e.KeyData == (Keys.Control|Keys.A) && e.Control) + { + ((TextBox)sender).SelectAll(); + } + } + } + + private void setSaveEnabled() + { + if (bttnOK.Enabled && (!folderMatches(txtDoWPath.Text, "DoWPath") + || !folderMatches(txtTexturePath.Text, "TexturePath") + || !folderMatches(txtTeamcolourPath.Text, "TeamcolourPath") + || modeChanged() || !coloursMatch(bttnPrimary, "Primary") + || !coloursMatch(bttnSecondary, "Secondary") || !coloursMatch(bttnTrim, "Trim") + || !coloursMatch(bttnTrim2, "Eyes") || !coloursMatch(bttnWeapon, "Weapon") + || pbBadge.Tag.ToString()!=pref["BadgeName"].ToString() + || pbBanner.Tag.ToString()!=pref["BannerName"].ToString())) + { + bttnSave.Enabled = true; + } + else + { + bttnSave.Enabled = pref.IsModified(); + } + } + + private void txtDoWPath_Leave(object sender, System.EventArgs e) + { + textbox_Leave(sender, e); + + if (!foldersExist()) + { + MessageBox.Show(this, "Could not find 'badges' and 'banners' folder in "+txtDoWPath.Text+"\r\nPlease check that it points to your Dawn of War/Dark Crusade installation folder", "Invalid path", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void textbox_Leave(object sender, System.EventArgs e) + { + if (sender is TextBox) + { + TextBox tb = (TextBox)sender; + if (!tb.Text.EndsWith(Path.DirectorySeparatorChar.ToString())) + { + tb.Text = tb.Text + Path.DirectorySeparatorChar; + } + } + } + + private bool foldersExist() + { + if (!txtDoWPath.Text.EndsWith(Path.DirectorySeparatorChar.ToString())) + { + return (Directory.Exists(txtDoWPath.Text+Path.DirectorySeparatorChar+"Badges") && + Directory.Exists(txtDoWPath.Text+Path.DirectorySeparatorChar+"Banners")); + } + else + { + return (Directory.Exists(txtDoWPath.Text+"Badges") && + Directory.Exists(txtDoWPath.Text+"Banners")); + } + } + + private bool folderMatches(string path, string prefID) + { + if (!path.EndsWith(Path.DirectorySeparatorChar.ToString())) + { + return (path.ToLower()+Path.DirectorySeparatorChar == pref[prefID].ToString().ToLower()); + } + else + { + return (path.ToLower() == pref[prefID].ToString().ToLower()); + } + } + + private bool coloursMatch(Button bttn, string colourName) + { + return (bttn.BackColor.R == (byte)pref[colourName+"Red"] && bttn.BackColor.G == (byte)pref[colourName+"Green"] && bttn.BackColor.B == (byte)pref[colourName+"Blue"]); + } + + private void setPrefs() + { + pref["DoWPath"] = txtDoWPath.Text; + pref["TeamcolourPath"] = txtTeamcolourPath.Text; + pref["TexturePath"] = txtTexturePath.Text; + + pref["settingBasic"] = rbBasicMode.Checked; + + pref["PrimaryRed"] = bttnPrimary.BackColor.R; + pref["PrimaryGreen"] = bttnPrimary.BackColor.G; + pref["PrimaryBlue"] = bttnPrimary.BackColor.B; + pref["SecondaryRed"] = bttnSecondary.BackColor.R; + pref["SecondaryGreen"] = bttnSecondary.BackColor.G; + pref["SecondaryBlue"] = bttnSecondary.BackColor.B; + pref["TrimRed"] = bttnTrim.BackColor.R; + pref["TrimGreen"] = bttnTrim.BackColor.G; + pref["TrimBlue"] = bttnTrim.BackColor.B; + pref["WeaponRed"] = bttnWeapon.BackColor.R; + pref["WeaponGreen"] = bttnWeapon.BackColor.G; + pref["WeaponBlue"] = bttnWeapon.BackColor.B; + pref["EyesRed"] = bttnTrim2.BackColor.R; + pref["EyesGreen"] = bttnTrim2.BackColor.G; + pref["EyesBlue"] = bttnTrim2.BackColor.B; + + pref["BadgeName"] = pbBadge.Tag.ToString(); + pref["BannerName"] = pbBanner.Tag.ToString(); + } + + private void textbox_TextChanged(object sender, System.EventArgs e) + { + setOkayEnabled(); + setSaveEnabled(); + } + + private void bttnTexturePath_Click(object sender, System.EventArgs e) + { + setPath(txtTexturePath); + } + + private void bttnTeamcolourPath_Click(object sender, System.EventArgs e) + { + setPath(txtTeamcolourPath); + } + + private void setPath(TextBox textbox) + { + folderBrowserDialog.SelectedPath = textbox.Text; + DialogResult dr = folderBrowserDialog.ShowDialog(this); + + if (dr==DialogResult.OK) + { + textbox.Text = folderBrowserDialog.SelectedPath + Path.DirectorySeparatorChar; + } + } + + private void setOkayEnabled() + { + bool enabled = true; + + if (foldersExist()) + { + txtDoWPath.ForeColor = SystemColors.WindowText; + } + else + { + enabled = false; + txtDoWPath.ForeColor = Color.Red; + } + + if (Directory.Exists(txtTexturePath.Text)) + { + txtTexturePath.ForeColor = SystemColors.WindowText; + } + else + { + enabled = false; + txtTexturePath.ForeColor = Color.Red; + } + + if (Directory.Exists(txtTeamcolourPath.Text)) + { + txtTeamcolourPath.ForeColor = SystemColors.WindowText; + } + else + { + enabled = false; + txtTeamcolourPath.ForeColor = Color.Red; + } + + bttnOK.Enabled = enabled; + } + + private bool modeChanged() + { + bool basicMode = (bool)pref["settingBasic"]; + return ((rbAdvancedMode.Checked && basicMode) || (rbBasicMode.Checked && !basicMode)); + } + + private void rbMode_CheckedChanged(object sender, System.EventArgs e) + { + setSaveEnabled(); + } + } +} diff -r 000000000000 -r a54c09901f4e Options.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Options.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + 17, 17 + + + Private + + + Private + + + Private + + + 125, 17 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 252, 17 + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + True + + + False + + + True + + + Private + + + Private + + + 8, 8 + + + False + + + True + + + True + + + Private + + + Private + + + 8, 8 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + True + + + True + + + Private + + + Private + + + 8, 8 + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Options + + + Private + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e OrganiseLayers.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrganiseLayers.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,369 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for OrganiseLayers. + /// + public class OrganiseLayers : System.Windows.Forms.Form + { + private System.Windows.Forms.TextBox txtLayer1; + private System.Windows.Forms.TextBox txtLayer2; + private System.Windows.Forms.TextBox txtLayer3; + private System.Windows.Forms.TextBox txtLayer4; + private System.Windows.Forms.TextBox txtLayer5; + private System.Windows.Forms.TextBox txtLayer6; + private System.Windows.Forms.Button bttnOK; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + + string[] filepaths; + + public OrganiseLayers(string[] filepaths_in) + { + + filepaths = filepaths_in; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + txtLayer1.Text = filepaths[0].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + + if (filepaths.Length==3) + { + txtLayer2.Text = filepaths[1].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + txtLayer3.Text = filepaths[2].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + } + else if (filepaths.Length==2) + { + txtLayer4.Text = filepaths[1].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + } + else if (filepaths.Length==4) + { + txtLayer2.Text = filepaths[1].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + txtLayer3.Text = filepaths[2].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + txtLayer4.Text = filepaths[3].Substring(filepaths[0].LastIndexOf(IBBoard.Constants.DirectoryChar)+1); + } + else + { + throw new InvalidOperationException("Between one and three additional texture maps must be specified."); + } + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtLayer1 = new System.Windows.Forms.TextBox(); + this.txtLayer2 = new System.Windows.Forms.TextBox(); + this.txtLayer3 = new System.Windows.Forms.TextBox(); + this.txtLayer4 = new System.Windows.Forms.TextBox(); + this.txtLayer5 = new System.Windows.Forms.TextBox(); + this.txtLayer6 = new System.Windows.Forms.TextBox(); + this.bttnOK = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txtLayer1 + // + this.txtLayer1.Enabled = false; + this.txtLayer1.Location = new System.Drawing.Point(120, 8); + this.txtLayer1.Name = "txtLayer1"; + this.txtLayer1.Size = new System.Drawing.Size(264, 20); + this.txtLayer1.TabIndex = 0; + // + // txtLayer2 + // + this.txtLayer2.Location = new System.Drawing.Point(120, 32); + this.txtLayer2.Name = "txtLayer2"; + this.txtLayer2.Size = new System.Drawing.Size(264, 20); + this.txtLayer2.TabIndex = 1; + // + // txtLayer3 + // + this.txtLayer3.Location = new System.Drawing.Point(120, 56); + this.txtLayer3.Name = "txtLayer3"; + this.txtLayer3.Size = new System.Drawing.Size(264, 20); + this.txtLayer3.TabIndex = 2; + // + // txtLayer4 + // + this.txtLayer4.Location = new System.Drawing.Point(120, 80); + this.txtLayer4.Name = "txtLayer4"; + this.txtLayer4.Size = new System.Drawing.Size(264, 20); + this.txtLayer4.TabIndex = 3; + // + // txtLayer5 + // + this.txtLayer5.Location = new System.Drawing.Point(120, 104); + this.txtLayer5.Name = "txtLayer5"; + this.txtLayer5.Size = new System.Drawing.Size(264, 20); + this.txtLayer5.TabIndex = 4; + // + // txtLayer6 + // + this.txtLayer6.Enabled = false; + this.txtLayer6.Location = new System.Drawing.Point(120, 128); + this.txtLayer6.Name = "txtLayer6"; + this.txtLayer6.Size = new System.Drawing.Size(264, 20); + this.txtLayer6.TabIndex = 5; + // + // bttnOK + // + this.bttnOK.Location = new System.Drawing.Point(296, 176); + this.bttnOK.Name = "bttnOK"; + this.bttnOK.Size = new System.Drawing.Size(88, 24); + this.bttnOK.TabIndex = 12; + this.bttnOK.Text = "OK"; + this.bttnOK.Click += new System.EventHandler(this.bttnOK_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(104, 23); + this.label1.TabIndex = 13; + this.label1.Text = "Texture:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 56); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(104, 23); + this.label2.TabIndex = 14; + this.label2.Text = "Reflection:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(8, 32); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(104, 23); + this.label3.TabIndex = 15; + this.label3.Text = "Specularity Map:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(8, 80); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(104, 23); + this.label4.TabIndex = 16; + this.label4.Text = "Self Illumination:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(8, 104); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(104, 23); + this.label5.TabIndex = 17; + this.label5.Text = "Opacity:"; + this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight; + // + // OrganiseLayers + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(392, 210); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.bttnOK); + this.Controls.Add(this.txtLayer6); + this.Controls.Add(this.txtLayer5); + this.Controls.Add(this.txtLayer4); + this.Controls.Add(this.txtLayer3); + this.Controls.Add(this.txtLayer2); + this.Controls.Add(this.txtLayer1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "OrganiseLayers"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Organise RSH Layers"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + public string[] Organise(Form parent) + { + try + { + this.ShowDialog(parent); + string[] paths = new string[6]; + paths[0] = filepaths[0]; + + if (txtLayer2.Text!="") + { + for (int i = 1; i= 3) + { + for (int i = 1; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e TextureTool.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextureTool.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,1263 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.IO; +using IBBoard.Relic.RelicTools; +using IBBoard; +using IBBoard.Graphics; +using IBBoard.Graphics.OpenILPort; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for TextureTool. + /// + public class TextureTool : System.Windows.Forms.Form + { + private Preferences pref; + + private System.Windows.Forms.Button bttnMakeWTP; + private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.Button bttnExtractWTP; + private System.Windows.Forms.TextBox tbOutput; + private System.Windows.Forms.MainMenu mainMenu1; + private System.Windows.Forms.MenuItem miFile; + private System.Windows.Forms.MenuItem menuItem1; + private System.Windows.Forms.MenuItem menuItem2; + private System.Windows.Forms.MenuItem menuItem3; + private System.Windows.Forms.Button bttnMakeRSH; + private System.Windows.Forms.Button bttnMakeRTX; + private System.Windows.Forms.Button bttnExtractRSH; + private System.Windows.Forms.Button bttnExtractRTX; + private System.Windows.Forms.MenuItem menuItem4; + private System.Windows.Forms.MenuItem miBasicMode; + private System.Windows.Forms.MenuItem miAdvancedMode; + private System.Windows.Forms.MenuItem menuItem5; + private System.Windows.Forms.MenuItem miOptions; + private System.Windows.Forms.Button bttnCompileTGA; + private System.Windows.Forms.Button bttnCompileDDS; + private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.Button bttnDDsToTGA; + private System.Windows.Forms.Button bttnHardCodeRSH; + private System.ComponentModel.IContainer components; + + private char folderSlash = Path.DirectorySeparatorChar; + private System.Windows.Forms.MenuItem menuItem6; + private System.Windows.Forms.MenuItem miErrorDetails; + + private string errorDetails = ""; + + public TextureTool() + { + try + { + // + // Required for Windows Form Designer support + // + pref = new Preferences("TextureTool"); + InitializeComponent(); + this.miBasicMode.Checked = (bool)pref["settingBasic"]; + this.miAdvancedMode.Checked = !this.miBasicMode.Checked; + SetModeLayout(); + WTPFile.OnCompilationEvent+=new IBBoard.Relic.RelicTools.RelicChunkyFile.CompilationEventDelegate(WTPFile_OnCompilationEvent); + } + catch(Exception ex) + { + MessageBox.Show(this, "Major error: "+ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + } + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + try + { + Application.EnableVisualStyles(); + Application.Run(new TextureTool()); + } + catch(Exception ex) + { + MessageBox.Show("Major error: "+ex.Message, "Unexpected Error"); + } + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TextureTool)); + this.bttnMakeWTP = new System.Windows.Forms.Button(); + this.tbOutput = new System.Windows.Forms.TextBox(); + this.bttnExtractWTP = new System.Windows.Forms.Button(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.mainMenu1 = new System.Windows.Forms.MainMenu(); + this.miFile = new System.Windows.Forms.MenuItem(); + this.menuItem1 = new System.Windows.Forms.MenuItem(); + this.menuItem4 = new System.Windows.Forms.MenuItem(); + this.miBasicMode = new System.Windows.Forms.MenuItem(); + this.miAdvancedMode = new System.Windows.Forms.MenuItem(); + this.menuItem5 = new System.Windows.Forms.MenuItem(); + this.miOptions = new System.Windows.Forms.MenuItem(); + this.menuItem2 = new System.Windows.Forms.MenuItem(); + this.menuItem3 = new System.Windows.Forms.MenuItem(); + this.bttnMakeRSH = new System.Windows.Forms.Button(); + this.bttnMakeRTX = new System.Windows.Forms.Button(); + this.bttnExtractRSH = new System.Windows.Forms.Button(); + this.bttnExtractRTX = new System.Windows.Forms.Button(); + this.bttnCompileTGA = new System.Windows.Forms.Button(); + this.bttnCompileDDS = new System.Windows.Forms.Button(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.bttnDDsToTGA = new System.Windows.Forms.Button(); + this.bttnHardCodeRSH = new System.Windows.Forms.Button(); + this.menuItem6 = new System.Windows.Forms.MenuItem(); + this.miErrorDetails = new System.Windows.Forms.MenuItem(); + this.SuspendLayout(); + // + // bttnMakeWTP + // + this.bttnMakeWTP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnMakeWTP.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnMakeWTP.Location = new System.Drawing.Point(8, 248); + this.bttnMakeWTP.Name = "bttnMakeWTP"; + this.bttnMakeWTP.Size = new System.Drawing.Size(128, 23); + this.bttnMakeWTP.TabIndex = 0; + this.bttnMakeWTP.Text = "Make WTP"; + this.toolTip.SetToolTip(this.bttnMakeWTP, "Make a collection of TGA files in to a WTP file"); + this.bttnMakeWTP.Click += new System.EventHandler(this.bttnMakeWTP_Click); + // + // tbOutput + // + this.tbOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbOutput.Location = new System.Drawing.Point(8, 0); + this.tbOutput.Multiline = true; + this.tbOutput.Name = "tbOutput"; + this.tbOutput.ReadOnly = true; + this.tbOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.tbOutput.Size = new System.Drawing.Size(404, 244); + this.tbOutput.TabIndex = 1; + this.tbOutput.TabStop = false; + this.tbOutput.Text = ""; + // + // bttnExtractWTP + // + this.bttnExtractWTP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnExtractWTP.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnExtractWTP.Location = new System.Drawing.Point(8, 280); + this.bttnExtractWTP.Name = "bttnExtractWTP"; + this.bttnExtractWTP.Size = new System.Drawing.Size(128, 23); + this.bttnExtractWTP.TabIndex = 2; + this.bttnExtractWTP.Text = "Extract WTP"; + this.toolTip.SetToolTip(this.bttnExtractWTP, "Extract a collection of TGA files from a WTP file"); + this.bttnExtractWTP.Click += new System.EventHandler(this.bttnExtractWTP_Click); + // + // mainMenu1 + // + this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.miFile, + this.menuItem4, + this.menuItem2}); + // + // miFile + // + this.miFile.Index = 0; + this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.menuItem1}); + this.miFile.Text = "&File"; + // + // menuItem1 + // + this.menuItem1.Index = 0; + this.menuItem1.Text = "&Quit"; + this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); + // + // menuItem4 + // + this.menuItem4.Index = 1; + this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.miBasicMode, + this.miAdvancedMode, + this.menuItem5, + this.miOptions}); + this.menuItem4.Text = "&Edit"; + // + // miBasicMode + // + this.miBasicMode.Checked = true; + this.miBasicMode.Index = 0; + this.miBasicMode.RadioCheck = true; + this.miBasicMode.Text = "&Basic Mode"; + this.miBasicMode.Click += new System.EventHandler(this.miBasicMode_Click); + // + // miAdvancedMode + // + this.miAdvancedMode.Index = 1; + this.miAdvancedMode.RadioCheck = true; + this.miAdvancedMode.Text = "&Advanced Mode"; + this.miAdvancedMode.Click += new System.EventHandler(this.miAdvancedMode_Click); + // + // menuItem5 + // + this.menuItem5.Index = 2; + this.menuItem5.Text = "-"; + // + // miOptions + // + this.miOptions.Index = 3; + this.miOptions.Text = "&Options"; + this.miOptions.Click += new System.EventHandler(this.miOptions_Click); + // + // menuItem2 + // + this.menuItem2.Index = 2; + this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.miErrorDetails, + this.menuItem6, + this.menuItem3}); + this.menuItem2.Text = "&Help"; + // + // menuItem3 + // + this.menuItem3.Index = 2; + this.menuItem3.Text = "&About"; + this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); + // + // bttnMakeRSH + // + this.bttnMakeRSH.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnMakeRSH.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnMakeRSH.Location = new System.Drawing.Point(144, 248); + this.bttnMakeRSH.Name = "bttnMakeRSH"; + this.bttnMakeRSH.Size = new System.Drawing.Size(128, 23); + this.bttnMakeRSH.TabIndex = 4; + this.bttnMakeRSH.Text = "Make RSH"; + this.toolTip.SetToolTip(this.bttnMakeRSH, "Make a DDS file in to a RSH file"); + this.bttnMakeRSH.Click += new System.EventHandler(this.bttnMakeRSH_Click); + // + // bttnMakeRTX + // + this.bttnMakeRTX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnMakeRTX.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnMakeRTX.Location = new System.Drawing.Point(280, 248); + this.bttnMakeRTX.Name = "bttnMakeRTX"; + this.bttnMakeRTX.Size = new System.Drawing.Size(128, 23); + this.bttnMakeRTX.TabIndex = 5; + this.bttnMakeRTX.Text = "Make RTX"; + this.toolTip.SetToolTip(this.bttnMakeRTX, "Make a DDS file in to an RTX file"); + this.bttnMakeRTX.Click += new System.EventHandler(this.bttnMakeRTX_Click); + // + // bttnExtractRSH + // + this.bttnExtractRSH.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnExtractRSH.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnExtractRSH.Location = new System.Drawing.Point(144, 280); + this.bttnExtractRSH.Name = "bttnExtractRSH"; + this.bttnExtractRSH.Size = new System.Drawing.Size(128, 23); + this.bttnExtractRSH.TabIndex = 6; + this.bttnExtractRSH.Text = "Extract RSH"; + this.toolTip.SetToolTip(this.bttnExtractRSH, "Extract a DDS file from an RSH file"); + this.bttnExtractRSH.Click += new System.EventHandler(this.bttnExtractRSH_Click); + // + // bttnExtractRTX + // + this.bttnExtractRTX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnExtractRTX.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnExtractRTX.Location = new System.Drawing.Point(280, 280); + this.bttnExtractRTX.Name = "bttnExtractRTX"; + this.bttnExtractRTX.Size = new System.Drawing.Size(128, 23); + this.bttnExtractRTX.TabIndex = 7; + this.bttnExtractRTX.Text = "Extract RTX"; + this.toolTip.SetToolTip(this.bttnExtractRTX, "Extract a DDS file from an RTX file"); + this.bttnExtractRTX.Click += new System.EventHandler(this.bttnExtractRTX_Click); + // + // bttnCompileTGA + // + this.bttnCompileTGA.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnCompileTGA.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnCompileTGA.Location = new System.Drawing.Point(8, 312); + this.bttnCompileTGA.Name = "bttnCompileTGA"; + this.bttnCompileTGA.Size = new System.Drawing.Size(200, 23); + this.bttnCompileTGA.TabIndex = 8; + this.bttnCompileTGA.Text = "Compile TGA"; + this.toolTip.SetToolTip(this.bttnCompileTGA, "Compile a single TGA from team colouring and a WTP file"); + this.bttnCompileTGA.Click += new System.EventHandler(this.bttnCompileTGA_Click); + // + // bttnCompileDDS + // + this.bttnCompileDDS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnCompileDDS.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnCompileDDS.Location = new System.Drawing.Point(212, 344); + this.bttnCompileDDS.Name = "bttnCompileDDS"; + this.bttnCompileDDS.Size = new System.Drawing.Size(196, 23); + this.bttnCompileDDS.TabIndex = 9; + this.bttnCompileDDS.Text = "TGA -> DDS"; + this.toolTip.SetToolTip(this.bttnCompileDDS, "Convert a TGA file to a DDS file"); + this.bttnCompileDDS.Click += new System.EventHandler(this.bttnCompileDDS_Click); + // + // bttnDDsToTGA + // + this.bttnDDsToTGA.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnDDsToTGA.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnDDsToTGA.Location = new System.Drawing.Point(8, 344); + this.bttnDDsToTGA.Name = "bttnDDsToTGA"; + this.bttnDDsToTGA.Size = new System.Drawing.Size(200, 23); + this.bttnDDsToTGA.TabIndex = 10; + this.bttnDDsToTGA.Text = "DDS -> TGA"; + this.toolTip.SetToolTip(this.bttnDDsToTGA, "Convert a DDS file to a TGA"); + this.bttnDDsToTGA.Click += new System.EventHandler(this.bttnDDsToTGA_Click); + // + // bttnHardCodeRSH + // + this.bttnHardCodeRSH.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttnHardCodeRSH.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnHardCodeRSH.Location = new System.Drawing.Point(212, 312); + this.bttnHardCodeRSH.Name = "bttnHardCodeRSH"; + this.bttnHardCodeRSH.Size = new System.Drawing.Size(196, 23); + this.bttnHardCodeRSH.TabIndex = 11; + this.bttnHardCodeRSH.Text = "Enable/Disable Teamcolouring"; + this.toolTip.SetToolTip(this.bttnHardCodeRSH, "Modify an RSH file to load/not load team colouring"); + this.bttnHardCodeRSH.Click += new System.EventHandler(this.bttnHardCodeRSH_Click); + // + // menuItem6 + // + this.menuItem6.Index = 1; + this.menuItem6.Text = "-"; + // + // miErrorDetails + // + this.miErrorDetails.Index = 0; + this.miErrorDetails.Text = "Error &details"; + this.miErrorDetails.Click += new System.EventHandler(this.miErrorDetails_Click); + // + // TextureTool + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(416, 377); + this.Controls.Add(this.bttnHardCodeRSH); + this.Controls.Add(this.bttnDDsToTGA); + this.Controls.Add(this.bttnCompileDDS); + this.Controls.Add(this.bttnCompileTGA); + this.Controls.Add(this.bttnExtractRTX); + this.Controls.Add(this.bttnExtractRSH); + this.Controls.Add(this.bttnMakeRTX); + this.Controls.Add(this.bttnMakeRSH); + this.Controls.Add(this.bttnExtractWTP); + this.Controls.Add(this.bttnMakeWTP); + this.Controls.Add(this.tbOutput); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Menu = this.mainMenu1; + this.MinimumSize = new System.Drawing.Size(424, 400); + this.Name = "TextureTool"; + this.Text = "Dawn of War Texture Tool"; + this.ResumeLayout(false); + + } + #endregion + + private void bttnMakeWTP_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "Texture Images (*.tga)|*.tga"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + bool error = false; + + int arrayLength = openFileDialog.FileNames.Length; + bool [] use = new bool[arrayLength]; + + string fileA; + string fileB; + int posOfDot_a, posOfDot_b; + string fileA_Underscore, fileB_Underscore; + + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void bttnExtractWTP_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "WTP Textures (*.wtp)|*.wtp"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)+1); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void bttnMakeRSH_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "DDS Texture Images (*.dds)|*.dds"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + if (openFileDialog.FileNames.Length==1 && (bool)pref["settingBasic"] == false) + { + DialogResult dr = MessageBox.Show(this, "Do you want to include additional maps?", "Add maps?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); + + if (dr == DialogResult.Yes) + { + string main = openFileDialog.FileNames[0]; + string dir = main.Substring(0, main.LastIndexOf(folderSlash)); + + openFileDialog.InitialDirectory = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)); + openFileDialog.FileName = ""; + openFileDialog.Filter = "DDS Texture Images (*.dds)|*.dds"; + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + try + { + string[]files = new string[openFileDialog.FileNames.Length+1]; + files[0] = main; + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + } + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)+1); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void miBasicMode_Click(object sender, System.EventArgs e) + { + miBasicMode.Checked = true; + miAdvancedMode.Checked = false; + pref["settingBasic"] = true; + SetModeLayout(); + } + + private void SetModeLayout() + { + int height = this.Height; + + if (miBasicMode.Checked) + { + bttnMakeWTP.Top = height - 112; + bttnMakeRSH.Top = height - 112; + bttnMakeRTX.Top = height - 112; + bttnExtractWTP.Top = height - 80; + bttnExtractRSH.Top = height - 80; + bttnExtractRTX.Top = height - 80; + tbOutput.Height = height - 120; + bttnCompileDDS.Visible = false; + bttnCompileTGA.Visible = false; + bttnHardCodeRSH.Visible = false; + bttnDDsToTGA.Visible = false; + } + else + { + bttnMakeWTP.Top = height - 180; + bttnMakeRSH.Top = height - 180; + bttnMakeRTX.Top = height - 180; + bttnExtractWTP.Top = height - 148; + bttnExtractRSH.Top = height - 148; + bttnExtractRTX.Top = height - 148; + tbOutput.Height = height - 184; + bttnCompileDDS.Visible = true; + bttnCompileTGA.Visible = true; + bttnHardCodeRSH.Visible = true; + bttnDDsToTGA.Visible = true; + } + } + + private void miAdvancedMode_Click(object sender, System.EventArgs e) + { + miBasicMode.Checked = false; + miAdvancedMode.Checked = true; + pref["settingBasic"] = false; + SetModeLayout(); + } + + private void bttnCompileTGA_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "WTP Textures (*.wtp)|*.wtp"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + bool error = false; + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)+1); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void miOptions_Click(object sender, System.EventArgs e) + { + Options opt = new Options(pref); + opt.ShowDialog(this); + miBasicMode.Checked = (bool)pref["settingBasic"]; + miAdvancedMode.Checked = !miBasicMode.Checked; + SetModeLayout(); + opt.Dispose(); + } + + private void bttnCompileDDS_Click(object sender, System.EventArgs e) + { + try + { + Converter.DXTType type = Converter.DXTType.None; + DXTFormat format = new DXTFormat(); + format.ShowDialog(this); + type = format.ChosenFormat; + format.Dispose(); + + openFileDialog.FileName = ""; + openFileDialog.Filter = "TGA images (*.tga)|*.tga"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + BinaryReader br; + BinaryWriter bw; + FileInfo fileInfo; + + bool overwrite = false; + bool prompt = true; + bool doIt = true; + YesNoToAllDialog yesno; + + bool error = false; + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)+1); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void bttnDDsToTGA_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "DDS images (*.dds)|*.dds"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + YesNoToAllDialog yesno; + FileInfo fileInfo; + BinaryReader br; + BinaryWriter bw; + + bool overwrite = false; + bool prompt = true; + bool doIt = true; + + byte[] data; + + bool error = false; + + for (int i = 0; i1) + { + AddContent("\r\nOne or more errors occured during mass compilation. Please read the output for details.\r\n\r\n"); + } + + pref["TexturePath"] = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf(folderSlash)+1); + } + } + catch(Exception ex) + { + MajorError(ex); + } + } + + private void bttnHardCodeRSH_Click(object sender, System.EventArgs e) + { + try + { + openFileDialog.FileName = ""; + openFileDialog.Filter = "RSH Texture (*.rsh)|*.rsh"; + openFileDialog.InitialDirectory = pref["TexturePath"].ToString(); + openFileDialog.Multiselect = true; + openFileDialog.ShowDialog(this); + + RelicChunkyFile file; + RSHFile rsh; + ChunkyChunk chunk; + ChunkyDataCHAN chan; + + if (openFileDialog.FileName!="" && openFileDialog.FileNames.Length!=0) + { + for (int i = 0; i + + + Local + 8.0.50727 + 2.0 + {0E4E40C8-5594-4833-86BA-4AD2BC01444E} + Debug + AnyCPU + W40k_TT2.ico + + + TextureTool + + + JScript + Grid + IE50 + false + WinExe + IBBoard.Relic.TextureTool + OnBuildSuccess + + + + + + + + + bin\Debug\ + 285212672 + + + DEBUG;TRACE + + + true + 4096 + false + false + false + 4 + full + prompt + WinExe + IBBoard.Relic.TextureTool + W40k_TT2.ico + + + bin\Release\ + 285212672 + + + TRACE + + + 4096 + true + false + false + 4 + none + prompt + WinExe + IBBoard.Relic.TextureTool + W40k_TT2.ico + + + + + + + + + {DC228FE8-B0D1-4CE8-869D-404B9173AA58} + IBBoard.Graphics.OpenILPort + + + {7CCF5C77-6038-45DE-BFA7-1A5378B3E08B} + IBBoard.Graphics + + + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105} + IBBoard + + + {D3B2F94E-ADE9-45E1-829F-698C0F4F1CFC} + RelicTools + + + + + Form + + + Code + + + Form + + + Form + + + Form + + + Form + + + Form + + + Form + + + AboutTextureTool.cs + Designer + + + DXTFormat.cs + Designer + + + ErrorDetails.cs + + + Options.cs + + + OrganiseLayers.cs + + + + TextureTool.cs + Designer + + + YesNoToAllDialog.cs + + + + + + + + + + {0E4E40C8-5594-4833-86BA-4AD2BC01444E} + IBBoard.Relic.TextureTool + + + + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e TextureTool.csproj.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextureTool.csproj.user Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,58 @@ + + + 7.10.3077 + Debug + AnyCPU + + + + + + + 0 + ProjectFiles + 0 + + + false + false + false + false + false + + + Project + + + + + + + + + + + true + + + false + false + false + false + false + + + Project + + + + + + + + + + + true + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e TextureTool.exe.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextureTool.exe.manifest Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,22 @@ + + + +.NET control deployment tool + + + + + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e TextureTool.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextureTool.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + Private + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + 144, 17 + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 254, 17 + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + False + + + (Default) + + + False + + + False + + + TextureTool + + + 4, 4 + + + True + + + 80 + + + True + + + Private + + + + AAABAAIAICAAAAAAAACoCAAAJgAAABAQAAAAAAAAaAUAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAAAE + AAAAAAAAAAAAAAABAAAAAQAAAAAAAP///wADAhQAAgENAAUBHgAJBxYAHhhDACMiKgAFARoABAEWAAgC + JwAUC0QACAUaACcbbgAFABwAAwARAB4NaAAGBBAAYVmGAB8AmwAeAJYAHgCUAB0AkwAdAJEAHQCOABwA + iwAbAIYAGgB9ABgAegAXAHcAEQBSAA8ASQAOAEYACwA4AAoANAAHACQABwAjAAYAHwAGAB0AGwGIABwB + hwAaAYEAFgFtABYBaAAVAWEAEwFdABMBWQAfApYADgFBABoCeQANAT0ADAE6AAoBLAAbBHUAHgWAACUJ + lwAnCpkAIQmBACMLiwAoDZYAHwp0ACkOmAAlDocAKA+OAC0TlwAlEH0ANBekADMbmQAxG4YAOySbAAMC + BwBCMIgAJwCnAB8AkwAYAHEAHAF7ACQCngAjA5YAIgOOAAoEIABEJa4ANSJ3AEsypwApG1oARzZ/AFVG + jAAvALcAAgAIADAEvwBFG78ATCm2AHpc2ABhYGQAhIOHADcAyQA8A9QAUSHRAGg93ABdN8kARUNHAGVk + ZgCcm50AGhYdADMrOAACAAMALSouACEdIQCKiIoA6OfoANrZ2gC6uboAnZydAHpxeQBcWVsAFxMVAA4M + DQBSTlAAkYmKAP8AAAAHBgYAraqqANjW1gB+fX0AdnV1ALCvrwCqqakAi4qKAIiHhwCEg4MAcWdmAKqj + ogB+cnAAp5qYALKqqADLxMIA0MrIAJyZmACrqKcA6efmAJuWkwDj39wAWFNPAM/MyQD08e4A+ff1AGxr + agCamZgA5eTjAMnIxwC+uLAAYF9dAHx7eQDu7esA8e7nAJqZlgBramYA4+LeANva1gDm5+UA0dLRAJma + mQDl5+cA7/DwAOfo6ADm5+cA5OXlAOLj4wDc3d0A2NnZANPU1AC6u7sAt7i4ALO0tACxsrIAsLGxAK6v + rwCfoKAAmJmZAF5kZwCDhYYAlJmdAN/g4QDP0NEAw8TFAGhtdgA9QkwAWl1jAJGVnQCipKgAUlNVALS2 + ugArLzkATE5TAC0vNQBwcXQAhYaJAH5/ggAOEBcAAgQMAB0eIgARExwAODk+AGdobwAHCBAAAwQWAC8w + RAAAAAYAAAAFAAAAAgAAAAEAAgILAAUFDAAFBQoADQ0TAElJTgAdHR8Aenp8AKenqQCTk5UA19fZAMPD + xQDr6+wA5+foAOXl5gDf3+AA2trbANnZ2gC8vL0As7O0AKysrQCioqMAhYWGAIGBggD5+fkA9PT0AO7u + 7gDs7OwA6urqANfX1wDe3t4A1tbWAM7OzgDMzMwAysrKAMbGxgDBwcEAvr6+ALa2tgCmpqYAm5ubAJeX + lwCQkJAAjY2NAHl5eQAEBAQAAwMDAP7+0wIETyIyMjAwHx4eLS0sKioqKjUdS0tLS0tLS0tH/tMEIjIy + MjAfHh4tLCoqNR1LKCgZGS8vLy8vLy8vL1LTAjBAGUtLS0tL+Bk/+Pj4U/j4+FH4+OYoPigvGSgvUNME + NXP+/v7+/vju+Pju7u747u7u+O7uqeb+/v7+KC9Q0yNN/v7+/v7++O74+O747vju+O747vjm1v7+/v5L + L1ACI03+/v7+/v747vj47vju+O747vju+Mn+/v7+/iovWgIjN/7+/v7+/vju+Pju+O747vju+O74yf7+ + /v7+NS9aBCM3/v7+/v7++O74+O747vju+O747vjB/v7+/v4oL1oEIzv+/v7+/vju7u747u7u+O7u7vju + +Mn+/v7+/hkvWgQjO/7+/v7+/vj4+Pz4+Phj+Pj42/jqgID+/v7+GS9aBCM9/v7+/v7Be3RpcfzlmrLj + qfJ1cKmdZcT+/v4ZL1oEIz7+/v7+072b1f7+yMrj8uNkB9P+xAHygP7+/igvYAQjRNX+/v7FkXH+/r/E + 5qy3t7zW0/7A7JyA/v7+KC9gBCNV1f7+/tNpkcG//OWFrOPyeba0ybjshsT+/v4+L2AEI1TL/v7+/v5x + gH9lvIWst/K2p4qnk4L8/v7+/kEvYAQjR9P+/v7+B3v82mXmrOO38qmntWyP2sP+/v7+PC9gBCNR/v7+ + /sVkevzaZeas47fyqae1k+zevsT+/v5BL18EIzVP/v7+yXp6/Npl5qzjt/Kpp5OTk+rs2v7+/kFMXwIj + LTD+/v7Wenr8ZWXlrOPyqdunk5PsogHl/tPTQEhYAiM0LP7+/r16gNplZeXjt/Kpp6eTk+zsAeP+/k9D + Vkx2IzRL0/7+vXqA2rDm5eO38qmnk5Oj7OwBt/7+BkBednYENCoy/tPWgIDa5uas47fyqaeTk+zsogGJ + /tNHTF92dgU0MirT/sl/f2Xm5ay38qmnp5OT7OzqkHH+CzdWE3Z2djT4LTD4+Pja+Lz447f4qaf4+Pjs + +Or4Zvj4+F92dnZ2+O74+O7u7vju+O74+O74+O7u7vju+O747u7u+HZ2dnb47vj47vj4+O747vj47vj4 + 7vju+O747vju+Ph2dnZ2dvju+Pju+PgC+O748vju+Pju+O747u74+O74+HZ2dnZ2+O74+O7u7vj47viF + +O74+O747vju+O747u7u+HZ2dnb47vj47vj4+O747vj47vj47vju+O747vju+Ph2dnZ2+O7u7vju7u74 + 7vju+O7u7vju+O747u74+O7u7vh2dnZ2+Pj4dvj4+C34Tfgv+Pj4E/hW+F/5+XZ2+Pj4dnZ2dnZ2dnZ2 + dnZ2dnZ2HUxWXl9eWBN2dnZ2dnZ2dnZ2dnYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAABgAAAAcAA + AAPAAAADwAAAB8AAAAfAAAADwAAAB4AAAAPEAADH//AP/ygAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAA + AAAAAAAAAAEAAAABAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAMDcwADwyqYABAQEAAgI + CAAMDAwAERERABYWFgAcHBwAIiIiACkpKQBVVVUATU1NAEJCQgA5OTkAgHz/AFBQ/wCTANYA/+zMAMbW + 7wDW5+cAkKmtAAAAMwAAAGYAAACZAAAAzAAAMwAAADMzAAAzZgAAM5kAADPMAAAz/wAAZgAAAGYzAABm + ZgAAZpkAAGbMAABm/wAAmQAAAJkzAACZZgAAmZkAAJnMAACZ/wAAzAAAAMwzAADMZgAAzJkAAMzMAADM + /wAA/2YAAP+ZAAD/zAAzAAAAMwAzADMAZgAzAJkAMwDMADMA/wAzMwAAMzMzADMzZgAzM5kAMzPMADMz + /wAzZgAAM2YzADNmZgAzZpkAM2bMADNm/wAzmQAAM5kzADOZZgAzmZkAM5nMADOZ/wAzzAAAM8wzADPM + ZgAzzJkAM8zMADPM/wAz/zMAM/9mADP/mQAz/8wAM///AGYAAABmADMAZgBmAGYAmQBmAMwAZgD/AGYz + AABmMzMAZjNmAGYzmQBmM8wAZjP/AGZmAABmZjMAZmZmAGZmmQBmZswAZpkAAGaZMwBmmWYAZpmZAGaZ + zABmmf8AZswAAGbMMwBmzJkAZszMAGbM/wBm/wAAZv8zAGb/mQBm/8wAzAD/AP8AzACZmQAAmTOZAJkA + mQCZAMwAmQAAAJkzMwCZAGYAmTPMAJkA/wCZZgAAmWYzAJkzZgCZZpkAmWbMAJkz/wCZmTMAmZlmAJmZ + mQCZmcwAmZn/AJnMAACZzDMAZsxmAJnMmQCZzMwAmcz/AJn/AACZ/zMAmcxmAJn/mQCZ/8wAmf//AMwA + AACZADMAzABmAMwAmQDMAMwAmTMAAMwzMwDMM2YAzDOZAMwzzADMM/8AzGYAAMxmMwCZZmYAzGaZAMxm + zACZZv8AzJkAAMyZMwDMmWYAzJmZAMyZzADMmf8AzMwAAMzMMwDMzGYAzMyZAMzMzADMzP8AzP8AAMz/ + MwCZ/2YAzP+ZAMz/zADM//8AzAAzAP8AZgD/AJkAzDMAAP8zMwD/M2YA/zOZAP8zzAD/M/8A/2YAAP9m + MwDMZmYA/2aZAP9mzADMZv8A/5kAAP+ZMwD/mWYA/5mZAP+ZzAD/mf8A/8wAAP/MMwD/zGYA/8yZAP/M + zAD/zP8A//8zAMz/ZgD//5kA///MAGZm/wBm/2YAZv//AP9mZgD/Zv8A//9mACEApQBfX18Ad3d3AIaG + hgCWlpYAy8vLALKysgDX19cA3d3dAOPj4wDq6uoA8fHxAPj4+ADw+/8ApKCgAICAgAAAAP8AAP8AAAD/ + /wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAA9wAA9/f3APf39wD39wAA9/D39/Dw8Pfw + 8PD38PD3APfw9/fw9/D38Pfw9/D3AAD38Pf38Pfw9/D38Pfw9wD38PDw9/Dw8Pfw8PD38PcAAPf39wD3 + 9/cA9/f3APcAAAAAAAAAAAAAAAAAAAAAAAAAAAD3AAD3APcAAPcAAAAAAAD38Pf38Pfw9/fw9wAAAAAA + 9/D39/D38Pf38PcAAAAAAPfw9wD38PcA9/D3AAAAAAD38Pf38Pfw9/fw9wAAAAD38PDw9/D38Pfw8PD3 + AAAAAPf39wD3APcA9/f3AAAAAAAAAAAAAAAAAAAAAAAAAP//AADYiQAAgAAAAIABAACAAQAAAAEAAIiL + AAD//wAA7W8AAMAHAADABwAAxEcAAMAHAACAAwAAxUcAAP//AAA= + + + \ No newline at end of file diff -r 000000000000 -r a54c09901f4e W40k_TT2.ico Binary file W40k_TT2.ico has changed diff -r 000000000000 -r a54c09901f4e YesNoToAllDialog.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/YesNoToAllDialog.cs Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,164 @@ +// This file is a part of the Texture Tool program and is copyright 2006-2018 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IBBoard.Relic.TextureTool +{ + /// + /// Summary description for YesNoToAllDialog. + /// + public class YesNoToAllDialog : System.Windows.Forms.Form + { + private System.Windows.Forms.Button bttnYesAll; + private System.Windows.Forms.Button bttnNoAll; + private System.Windows.Forms.Button bttnNo; + private System.Windows.Forms.Button bttnYes; + private System.Windows.Forms.Label lblMessage; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + private bool all = false; + + public YesNoToAllDialog(string title, string message) + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + lblMessage.Text = message; + this.Text = title; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttnYesAll = new System.Windows.Forms.Button(); + this.bttnNoAll = new System.Windows.Forms.Button(); + this.bttnNo = new System.Windows.Forms.Button(); + this.bttnYes = new System.Windows.Forms.Button(); + this.lblMessage = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // bttnYesAll + // + this.bttnYesAll.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnYesAll.Location = new System.Drawing.Point(8, 88); + this.bttnYesAll.Name = "bttnYesAll"; + this.bttnYesAll.TabIndex = 0; + this.bttnYesAll.Text = "Yes To All"; + this.bttnYesAll.Click += new System.EventHandler(this.bttnYesAll_Click); + // + // bttnNoAll + // + this.bttnNoAll.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnNoAll.Location = new System.Drawing.Point(248, 88); + this.bttnNoAll.Name = "bttnNoAll"; + this.bttnNoAll.TabIndex = 1; + this.bttnNoAll.Text = "No To All"; + this.bttnNoAll.Click += new System.EventHandler(this.bttnNoAll_Click); + // + // bttnNo + // + this.bttnNo.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnNo.Location = new System.Drawing.Point(168, 88); + this.bttnNo.Name = "bttnNo"; + this.bttnNo.TabIndex = 2; + this.bttnNo.Text = "No"; + this.bttnNo.Click += new System.EventHandler(this.bttnNo_Click); + // + // bttnYes + // + this.bttnYes.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.bttnYes.Location = new System.Drawing.Point(88, 88); + this.bttnYes.Name = "bttnYes"; + this.bttnYes.TabIndex = 3; + this.bttnYes.Text = "Yes"; + this.bttnYes.Click += new System.EventHandler(this.bttnYes_Click); + // + // lblMessage + // + this.lblMessage.Location = new System.Drawing.Point(16, 8); + this.lblMessage.Name = "lblMessage"; + this.lblMessage.Size = new System.Drawing.Size(304, 72); + this.lblMessage.TabIndex = 4; + this.lblMessage.Text = "label1"; + // + // YesNoToAllDialog + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(330, 122); + this.ControlBox = false; + this.Controls.Add(this.lblMessage); + this.Controls.Add(this.bttnYes); + this.Controls.Add(this.bttnNo); + this.Controls.Add(this.bttnNoAll); + this.Controls.Add(this.bttnYesAll); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "YesNoToAllDialog"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "YesNoToAllDialog"; + this.ResumeLayout(false); + + } + #endregion + + private void bttnYesAll_Click(object sender, System.EventArgs e) + { + this.DialogResult = DialogResult.Yes; + all = true; + } + + private void bttnYes_Click(object sender, System.EventArgs e) + { + this.DialogResult = DialogResult.Yes; + all = false; + } + + private void bttnNo_Click(object sender, System.EventArgs e) + { + this.DialogResult = DialogResult.No; + all = false; + } + + private void bttnNoAll_Click(object sender, System.EventArgs e) + { + this.DialogResult = DialogResult.No; + all = true; + } + + public bool ToAll + { + get{ return all; } + } + } +} diff -r 000000000000 -r a54c09901f4e YesNoToAllDialog.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/YesNoToAllDialog.resx Sat Oct 06 19:19:03 2018 +0100 @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + YesNoToAllDialog + + + Private + + \ No newline at end of file