├── .gitattributes
├── .gitignore
├── Cache Editor API
├── Archive.cs
├── BZip2
│ ├── BZip2.cs
│ ├── BZip2Constants.cs
│ ├── BZip2Exception.cs
│ ├── BZip2InputStream.cs
│ ├── BZip2OutputStream.cs
│ ├── Checksums
│ │ ├── Adler32.cs
│ │ ├── CRC32.cs
│ │ ├── IChecksum.cs
│ │ └── StrangeCRC.cs
│ ├── Core
│ │ ├── FileSystemScanner.cs
│ │ ├── INameTransform.cs
│ │ ├── IScanFilter.cs
│ │ ├── NameFilter.cs
│ │ ├── PathFilter.cs
│ │ ├── StreamUtils.cs
│ │ └── WindowsPathUtils.cs
│ └── SharpZipBaseException.cs
├── Cache Editor API.csproj
├── Cache.cs
├── CacheItemNode.cs
├── Config
│ ├── ChangesItemSprite.cs
│ ├── ChangesModel.cs
│ ├── ItemDefinition.cs
│ ├── NPCDefinition.cs
│ ├── ObjectDefinition.cs
│ └── VarBit.cs
├── Controls
│ ├── ModelViewer.Designer.cs
│ ├── ModelViewer.cs
│ ├── ModelViewer.resx
│ └── SelectablePictureBox.cs
├── DataBuffer.cs
├── EditorClassifications.cs
├── FastPixel.cs
├── Graphics3D
│ ├── Animable.cs
│ ├── Class40.cs
│ ├── Class43.cs
│ ├── Class47.cs
│ ├── DrawingArea.cs
│ ├── Ground.cs
│ ├── Model.cs
│ ├── ModelHeader.cs
│ ├── ModelTransform.cs
│ ├── NetDrawingTools.cs
│ ├── Object1.cs
│ ├── Object2.cs
│ ├── Object3.cs
│ ├── Object4.cs
│ ├── Object5.cs
│ ├── Rasterizer.cs
│ ├── VertexNormal.cs
│ └── WorldController.cs
├── IPlugin.cs
├── ImageArchive.cs
├── Map.cs
├── Properties
│ └── AssemblyInfo.cs
├── RSFont.cs
├── RSImage.cs
├── RSInterface.cs
├── SubArchive.cs
└── nQuant
│ ├── Box.cs
│ ├── ColorData.cs
│ ├── CubeCut.cs
│ ├── IWuQuantizer.cs
│ ├── Lookup.cs
│ ├── LookupData.cs
│ ├── Nuget
│ └── nQuant.nuspec
│ ├── Pixel.cs
│ ├── QuantizationException.cs
│ ├── QuantizedPalette.cs
│ ├── WuQuantizer.cs
│ ├── WuQuantizerBase.cs
│ └── nQuant.Core.csproj
├── Cache Editor.sln
├── Cache Editor
├── App.config
├── BatchExport.Designer.cs
├── BatchExport.cs
├── BatchExport.resx
├── Cache Editor.csproj
├── ExtensionManager_vsix_OSReg_256x.ico
├── FilesLoader.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── InputBox.cs
├── InputBox.resx
├── MultiSelectTreeView.cs
├── PluginContainer.cs
├── PluginDescription.Designer.cs
├── PluginDescription.cs
├── PluginDescription.resx
├── PluginSummary.Designer.cs
├── PluginSummary.cs
├── PluginSummary.resx
├── PluginTabPage.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── files.txt
├── HexEditor
├── HexEditor.cs
├── HexEditor.csproj
└── Properties
│ └── AssemblyInfo.cs
├── ImageViewer
├── ImageViewer.cs
├── ImageViewer.csproj
├── Properties
│ └── AssemblyInfo.cs
└── Toolbox.resx
├── ItemViewer
├── Configure.Designer.cs
├── Configure.cs
├── Configure.resx
├── ItemToolbox.Designer.cs
├── ItemToolbox.cs
├── ItemToolbox.resx
├── ItemViewer.cs
├── ItemViewer.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Window.Designer.cs
├── Window.cs
└── Window.resx
├── ModelViewer
├── Configure.Designer.cs
├── Configure.cs
├── Configure.resx
├── ModelViewer.cs
├── ModelViewer.csproj
├── Properties
│ └── AssemblyInfo.cs
├── SelectablePictureBox.cs
├── ToolboxControls.Designer.cs
├── ToolboxControls.cs
└── ToolboxControls.resx
├── NPCViewer
├── Configure.Designer.cs
├── Configure.cs
├── Configure.resx
├── NPCViewer.cs
├── NPCViewer.csproj
├── ObjectToolbox.Designer.cs
├── ObjectToolbox.cs
├── ObjectToolbox.resx
├── Properties
│ └── AssemblyInfo.cs
├── Window.Designer.cs
├── Window.cs
└── Window.resx
├── ObjectViewer
├── Configure.Designer.cs
├── Configure.cs
├── Configure.resx
├── ObjectToolbox.Designer.cs
├── ObjectToolbox.cs
├── ObjectToolbox.resx
├── ObjectViewer.cs
├── ObjectViewer.csproj
├── Properties
│ └── AssemblyInfo.cs
├── Window.Designer.cs
└── Window.cs
├── PaletteViewer
├── PaletteViewer.cs
├── PaletteViewer.csproj
└── Properties
│ └── AssemblyInfo.cs
├── README.md
└── VarBitViewer
├── ItemToolbox.Designer.cs
├── ItemToolbox.cs
├── ItemToolbox.resx
├── Properties
└── AssemblyInfo.cs
├── VarBitViewer.cs
└── VarBitViewer.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 |
11 | [Dd]ebug/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | [Bb]in/
16 | [Oo]bj/
17 |
18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
19 | !packages/*/build/
20 |
21 | # MSTest test Results
22 | [Tt]est[Rr]esult*/
23 | [Bb]uild[Ll]og.*
24 |
25 | *_i.c
26 | *_p.c
27 | *.ilk
28 | *.meta
29 | *.obj
30 | *.pch
31 | *.pdb
32 | *.pgc
33 | *.pgd
34 | *.rsp
35 | *.sbr
36 | *.tlb
37 | *.tli
38 | *.tlh
39 | *.tmp
40 | *.tmp_proj
41 | *.log
42 | *.vspscc
43 | *.vssscc
44 | .builds
45 | *.pidb
46 | *.log
47 | *.scc
48 |
49 | # Visual C++ cache files
50 | ipch/
51 | *.aps
52 | *.ncb
53 | *.opensdf
54 | *.sdf
55 | *.cachefile
56 |
57 | # Visual Studio profiler
58 | *.psess
59 | *.vsp
60 | *.vspx
61 |
62 | # Guidance Automation Toolkit
63 | *.gpState
64 |
65 | # ReSharper is a .NET coding add-in
66 | _ReSharper*/
67 | *.[Rr]e[Ss]harper
68 |
69 | # TeamCity is a build add-in
70 | _TeamCity*
71 |
72 | # DotCover is a Code Coverage Tool
73 | *.dotCover
74 |
75 | # NCrunch
76 | *.ncrunch*
77 | .*crunch*.local.xml
78 |
79 | # Installshield output folder
80 | [Ee]xpress/
81 |
82 | # DocProject is a documentation generator add-in
83 | DocProject/buildhelp/
84 | DocProject/Help/*.HxT
85 | DocProject/Help/*.HxC
86 | DocProject/Help/*.hhc
87 | DocProject/Help/*.hhk
88 | DocProject/Help/*.hhp
89 | DocProject/Help/Html2
90 | DocProject/Help/html
91 |
92 | # Click-Once directory
93 | publish/
94 |
95 | # Publish Web Output
96 | *.Publish.xml
97 |
98 | # NuGet Packages Directory
99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
100 | #packages/
101 |
102 | # Windows Azure Build Output
103 | csx
104 | *.build.csdef
105 |
106 | # Windows Store app package directory
107 | AppPackages/
108 |
109 | # Others
110 | sql/
111 | *.Cache
112 | ClientBin/
113 | [Ss]tyle[Cc]op.*
114 | ~$*
115 | *~
116 | *.dbmdl
117 | *.[Pp]ublish.xml
118 | *.pfx
119 | *.publishsettings
120 |
121 | # RIA/Silverlight projects
122 | Generated_Code/
123 |
124 | # Backup & report files from converting an old project file to a newer
125 | # Visual Studio version. Backup files are not needed, because we have git ;-)
126 | _UpgradeReport_Files/
127 | Backup*/
128 | UpgradeLog*.XML
129 | UpgradeLog*.htm
130 |
131 | # SQL Server files
132 | App_Data/*.mdf
133 | App_Data/*.ldf
134 |
135 |
136 | #LightSwitch generated files
137 | GeneratedArtifacts/
138 | _Pvt_Extensions/
139 | ModelManifest.xml
140 |
141 | # =========================
142 | # Windows detritus
143 | # =========================
144 |
145 | # Windows image file caches
146 | Thumbs.db
147 | ehthumbs.db
148 |
149 | # Folder config file
150 | Desktop.ini
151 |
152 | # Recycle Bin used on file shares
153 | $RECYCLE.BIN/
154 |
155 | # Mac desktop service store files
156 | .DS_Store
157 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/BZip2.cs:
--------------------------------------------------------------------------------
1 | // BZip2.cs
2 | //
3 | // Copyright (C) 2010 David Pierson
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | // Suppress this in CF and 1.1, not needed. Static classes introduced in C# version 2.0
37 | #if !NETCF_2_0 && !NET_1_1
38 |
39 | using System;
40 | using System.IO;
41 |
42 | namespace ICSharpCode.SharpZipLib.BZip2 {
43 |
44 | ///
45 | /// An example class to demonstrate compression and decompression of BZip2 streams.
46 | ///
47 | public static class BZip2
48 | {
49 | ///
50 | /// Decompress the input writing
51 | /// uncompressed data to the output stream
52 | ///
53 | /// The readable stream containing data to decompress.
54 | /// The output stream to receive the decompressed data.
55 | /// Both streams are closed on completion if true.
56 | public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
57 | {
58 | if (inStream == null || outStream == null) {
59 | throw new Exception("Null Stream");
60 | }
61 |
62 | try {
63 | using (BZip2InputStream bzipInput = new BZip2InputStream(inStream)) {
64 | bzipInput.IsStreamOwner = isStreamOwner;
65 | Core.StreamUtils.Copy(bzipInput, outStream, new byte[4096]);
66 | }
67 | } finally {
68 | if (isStreamOwner) {
69 | // inStream is closed by the BZip2InputStream if stream owner
70 | outStream.Close();
71 | }
72 | }
73 | }
74 |
75 | ///
76 | /// Compress the input stream sending
77 | /// result data to output stream
78 | ///
79 | /// The readable stream to compress.
80 | /// The output stream to receive the compressed data.
81 | /// Both streams are closed on completion if true.
82 | /// Block size acts as compression level (1 to 9) with 1 giving
83 | /// the lowest compression and 9 the highest.
84 | public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)
85 | {
86 | if (inStream == null || outStream == null) {
87 | throw new Exception("Null Stream");
88 | }
89 |
90 | try {
91 | using (BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level)) {
92 | bzipOutput.IsStreamOwner = isStreamOwner;
93 | Core.StreamUtils.Copy(inStream, bzipOutput, new byte[4096]);
94 | }
95 | } finally {
96 | if (isStreamOwner) {
97 | // outStream is closed by the BZip2OutputStream if stream owner
98 | inStream.Close();
99 | }
100 | }
101 | }
102 |
103 | }
104 | }
105 | #endif
106 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/BZip2Exception.cs:
--------------------------------------------------------------------------------
1 | // BZip2.cs
2 | //
3 | // Copyright 2004 John Reilly
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | using System;
37 |
38 | #if !NETCF_1_0 && !NETCF_2_0
39 | using System.Runtime.Serialization;
40 | #endif
41 |
42 | namespace ICSharpCode.SharpZipLib.BZip2
43 | {
44 | ///
45 | /// BZip2Exception represents exceptions specific to Bzip2 algorithm
46 | ///
47 | #if !NETCF_1_0 && !NETCF_2_0
48 | [Serializable]
49 | #endif
50 | public class BZip2Exception : SharpZipBaseException
51 | {
52 |
53 | #if !NETCF_1_0 && !NETCF_2_0
54 | ///
55 | /// Deserialization constructor
56 | ///
57 | /// for this constructor
58 | /// for this constructor
59 | protected BZip2Exception(SerializationInfo info, StreamingContext context)
60 | : base(info, context)
61 |
62 | {
63 | }
64 | #endif
65 | ///
66 | /// Initialise a new instance of BZip2Exception.
67 | ///
68 | public BZip2Exception()
69 | {
70 | }
71 |
72 | ///
73 | /// Initialise a new instance of BZip2Exception with its message set to message.
74 | ///
75 | /// The message describing the error.
76 | public BZip2Exception(string message) : base(message)
77 | {
78 | }
79 |
80 | ///
81 | /// Initialise an instance of BZip2Exception
82 | ///
83 | /// A message describing the error.
84 | /// The exception that is the cause of the current exception.
85 | public BZip2Exception(string message, Exception exception)
86 | : base(message, exception)
87 | {
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/Checksums/IChecksum.cs:
--------------------------------------------------------------------------------
1 | // IChecksum.cs - Interface to compute a data checksum
2 | // Copyright (C) 2001 Mike Krueger
3 | //
4 | // This file was translated from java, it was part of the GNU Classpath
5 | // Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
6 | //
7 | // This program is free software; you can redistribute it and/or
8 | // modify it under the terms of the GNU General Public License
9 | // as published by the Free Software Foundation; either version 2
10 | // of the License, or (at your option) any later version.
11 | //
12 | // This program is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU General Public License
18 | // along with this program; if not, write to the Free Software
19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 | //
21 | // Linking this library statically or dynamically with other modules is
22 | // making a combined work based on this library. Thus, the terms and
23 | // conditions of the GNU General Public License cover the whole
24 | // combination.
25 | //
26 | // As a special exception, the copyright holders of this library give you
27 | // permission to link this library with independent modules to produce an
28 | // executable, regardless of the license terms of these independent
29 | // modules, and to copy and distribute the resulting executable under
30 | // terms of your choice, provided that you also meet, for each linked
31 | // independent module, the terms and conditions of the license of that
32 | // module. An independent module is a module which is not derived from
33 | // or based on this library. If you modify this library, you may extend
34 | // this exception to your version of the library, but you are not
35 | // obligated to do so. If you do not wish to do so, delete this
36 | // exception statement from your version.
37 |
38 | namespace ICSharpCode.SharpZipLib.Checksums
39 | {
40 |
41 | ///
42 | /// Interface to compute a data checksum used by checked input/output streams.
43 | /// A data checksum can be updated by one byte or with a byte array. After each
44 | /// update the value of the current checksum can be returned by calling
45 | /// getValue
. The complete checksum object can also be reset
46 | /// so it can be used again with new data.
47 | ///
48 | public interface IChecksum
49 | {
50 | ///
51 | /// Returns the data checksum computed so far.
52 | ///
53 | long Value
54 | {
55 | get;
56 | }
57 |
58 | ///
59 | /// Resets the data checksum as if no update was ever called.
60 | ///
61 | void Reset();
62 |
63 | ///
64 | /// Adds one byte to the data checksum.
65 | ///
66 | ///
67 | /// the data value to add. The high byte of the int is ignored.
68 | ///
69 | void Update(int value);
70 |
71 | ///
72 | /// Updates the data checksum with the bytes taken from the array.
73 | ///
74 | ///
75 | /// buffer an array of bytes
76 | ///
77 | void Update(byte[] buffer);
78 |
79 | ///
80 | /// Adds the byte array to the data checksum.
81 | ///
82 | ///
83 | /// The buffer which contains the data
84 | ///
85 | ///
86 | /// The offset in the buffer where the data starts
87 | ///
88 | ///
89 | /// the number of data bytes to add.
90 | ///
91 | void Update(byte[] buffer, int offset, int count);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/Core/INameTransform.cs:
--------------------------------------------------------------------------------
1 | // INameTransform.cs
2 | //
3 | // Copyright 2005 John Reilly
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | namespace ICSharpCode.SharpZipLib.Core
37 | {
38 | ///
39 | /// INameTransform defines how file system names are transformed for use with archives, or vice versa.
40 | ///
41 | public interface INameTransform
42 | {
43 | ///
44 | /// Given a file name determine the transformed value.
45 | ///
46 | /// The name to transform.
47 | /// The transformed file name.
48 | string TransformFile(string name);
49 |
50 | ///
51 | /// Given a directory name determine the transformed value.
52 | ///
53 | /// The name to transform.
54 | /// The transformed directory name
55 | string TransformDirectory(string name);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/Core/IScanFilter.cs:
--------------------------------------------------------------------------------
1 | // IScanFilter.cs
2 | //
3 | // Copyright 2006 John Reilly
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | namespace ICSharpCode.SharpZipLib.Core
37 | {
38 | ///
39 | /// Scanning filters support filtering of names.
40 | ///
41 | public interface IScanFilter
42 | {
43 | ///
44 | /// Test a name to see if it 'matches' the filter.
45 | ///
46 | /// The name to test.
47 | /// Returns true if the name matches the filter, false if it does not match.
48 | bool IsMatch(string name);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/Core/WindowsPathUtils.cs:
--------------------------------------------------------------------------------
1 | // WindowsPathUtils.cs
2 | //
3 | // Copyright 2007 John Reilly
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | namespace ICSharpCode.SharpZipLib.Core
37 | {
38 | ///
39 | /// WindowsPathUtils provides simple utilities for handling windows paths.
40 | ///
41 | public abstract class WindowsPathUtils
42 | {
43 | ///
44 | /// Initializes a new instance of the class.
45 | ///
46 | internal WindowsPathUtils()
47 | {
48 | }
49 |
50 | ///
51 | /// Remove any path root present in the path
52 | ///
53 | /// A containing path information.
54 | /// The path with the root removed if it was present; path otherwise.
55 | /// Unlike the class the path isnt otherwise checked for validity.
56 | public static string DropPathRoot(string path)
57 | {
58 | string result = path;
59 |
60 | if ( (path != null) && (path.Length > 0) ) {
61 | if ((path[0] == '\\') || (path[0] == '/')) {
62 | // UNC name ?
63 | if ((path.Length > 1) && ((path[1] == '\\') || (path[1] == '/'))) {
64 | int index = 2;
65 | int elements = 2;
66 |
67 | // Scan for two separate elements \\machine\share\restofpath
68 | while ((index <= path.Length) &&
69 | (((path[index] != '\\') && (path[index] != '/')) || (--elements > 0))) {
70 | index++;
71 | }
72 |
73 | index++;
74 |
75 | if (index < path.Length) {
76 | result = path.Substring(index);
77 | }
78 | else {
79 | result = "";
80 | }
81 | }
82 | }
83 | else if ((path.Length > 1) && (path[1] == ':')) {
84 | int dropCount = 2;
85 | if ((path.Length > 2) && ((path[2] == '\\') || (path[2] == '/'))) {
86 | dropCount = 3;
87 | }
88 | result = result.Remove(0, dropCount);
89 | }
90 | }
91 | return result;
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Cache Editor API/BZip2/SharpZipBaseException.cs:
--------------------------------------------------------------------------------
1 | // SharpZipBaseException.cs
2 | //
3 | // Copyright 2004 John Reilly
4 | //
5 | // This program is free software; you can redistribute it and/or
6 | // modify it under the terms of the GNU General Public License
7 | // as published by the Free Software Foundation; either version 2
8 | // of the License, or (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program; if not, write to the Free Software
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 | //
19 | // Linking this library statically or dynamically with other modules is
20 | // making a combined work based on this library. Thus, the terms and
21 | // conditions of the GNU General Public License cover the whole
22 | // combination.
23 | //
24 | // As a special exception, the copyright holders of this library give you
25 | // permission to link this library with independent modules to produce an
26 | // executable, regardless of the license terms of these independent
27 | // modules, and to copy and distribute the resulting executable under
28 | // terms of your choice, provided that you also meet, for each linked
29 | // independent module, the terms and conditions of the license of that
30 | // module. An independent module is a module which is not derived from
31 | // or based on this library. If you modify this library, you may extend
32 | // this exception to your version of the library, but you are not
33 | // obligated to do so. If you do not wish to do so, delete this
34 | // exception statement from your version.
35 |
36 | using System;
37 |
38 | #if !NETCF_1_0 && !NETCF_2_0
39 | using System.Runtime.Serialization;
40 | #endif
41 |
42 | namespace ICSharpCode.SharpZipLib
43 | {
44 | ///
45 | /// SharpZipBaseException is the base exception class for the SharpZipLibrary.
46 | /// All library exceptions are derived from this.
47 | ///
48 | /// NOTE: Not all exceptions thrown will be derived from this class.
49 | /// A variety of other exceptions are possible for example
50 | #if !NETCF_1_0 && !NETCF_2_0
51 | [Serializable]
52 | #endif
53 | public class SharpZipBaseException : ApplicationException
54 | {
55 | #if !NETCF_1_0 && !NETCF_2_0
56 | ///
57 | /// Deserialization constructor
58 | ///
59 | /// for this constructor
60 | /// for this constructor
61 | protected SharpZipBaseException(SerializationInfo info, StreamingContext context )
62 | : base( info, context )
63 | {
64 | }
65 | #endif
66 |
67 | ///
68 | /// Initializes a new instance of the SharpZipBaseException class.
69 | ///
70 | public SharpZipBaseException()
71 | {
72 | }
73 |
74 | ///
75 | /// Initializes a new instance of the SharpZipBaseException class with a specified error message.
76 | ///
77 | /// A message describing the exception.
78 | public SharpZipBaseException(string message)
79 | : base(message)
80 | {
81 | }
82 |
83 | ///
84 | /// Initializes a new instance of the SharpZipBaseException class with a specified
85 | /// error message and a reference to the inner exception that is the cause of this exception.
86 | ///
87 | /// A message describing the exception.
88 | /// The inner exception
89 | public SharpZipBaseException(string message, Exception innerException)
90 | : base(message, innerException)
91 | {
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Cache Editor API/Cache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.IO;
7 |
8 | namespace Cache_Editor_API
9 | {
10 | public class Cache
11 | {
12 | public FileStream DataFile { get; set; }
13 | public Archive[] Archives { get; set; }
14 | public List SubArchives { get; set; }
15 |
16 | public static string[] ArchiveNames = { "Sub-Archives", "Models", "Animations", "Midis", "Maps" };
17 | public static string[] SubNames = { "Sub-archive 0", "Title", "Config", "Interface", "Media", "Versions", "Textures", "Chat", "Sounds" };
18 |
19 | public Cache()
20 | {
21 | Archives = new Archive[5];
22 | SubArchives = new List();
23 | }
24 |
25 | public void LoadCache(string folder)
26 | {
27 | DataFile = new FileStream(folder + "main_file_cache.dat", FileMode.Open);
28 |
29 | for (int i = 0; i < 5; i++)
30 | {
31 | Archives[i] = new Archive(ArchiveNames[i], DataFile, new FileStream(folder + "main_file_cache.idx" + i, FileMode.Open));
32 | Archives[i].ArchiveIndex = i;
33 | }
34 | }
35 |
36 | public void WriteFile(CacheItemNode node, byte[] data)
37 | {
38 | if(node.SubArchive != -1)
39 | {
40 | SubArchives[node.SubArchive].WriteFile(node.FileIndex, data);
41 | }
42 | else if(node.Archive != -1)
43 | {
44 | Archives[node.Archive].WriteFile(node.FileIndex, data, data.Length);
45 | }
46 | }
47 |
48 | public void Close()
49 | {
50 | try
51 | {
52 | DataFile.Close();
53 | }
54 | catch (Exception) { }
55 |
56 | if (Archives == null)
57 | return;
58 |
59 | for (int i = 0; i < Archives.Length; i++)
60 | {
61 | try
62 | {
63 | Archives[i].IndexFile.Close();
64 | }
65 | catch (Exception) { }
66 | }
67 |
68 | Archives = null;
69 | SubArchives = null;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Cache Editor API/CacheItemNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace Cache_Editor_API
9 | {
10 | public class CacheItemNode : TreeNode
11 | {
12 | public int Archive { get; set; }
13 | public int SubArchive { get; set; }
14 | public int FileIndex { get; set; }
15 | public int Size { get; set; }
16 |
17 | public CacheItemNode(string text, string name, int archive, int sub_archive, int file_index, int size)
18 | : base(text)
19 | {
20 | this.Name = name;
21 | this.Archive = archive;
22 | this.SubArchive = sub_archive;
23 | this.FileIndex = file_index;
24 | this.Size = size;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Cache Editor API/Config/ChangesItemSprite.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Config
8 | {
9 | [System.AttributeUsage(System.AttributeTargets.Property)]
10 | public class ChangesItemSprite : Attribute
11 | {
12 | private bool changes;
13 | public bool Changes { get { return changes; } set { changes = value; } }
14 |
15 | public ChangesItemSprite(bool changes_sprite)
16 | {
17 | changes = changes_sprite;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Cache Editor API/Config/ChangesModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Config
8 | {
9 | [System.AttributeUsage(System.AttributeTargets.Property)]
10 | public class ChangesModel : Attribute
11 | {
12 | private bool changes;
13 | public bool Changes { get { return changes; } set { changes = value; } }
14 |
15 | public ChangesModel(bool changes_model)
16 | {
17 | changes = changes_model;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Cache Editor API/Config/VarBit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Cache_Editor_API;
7 |
8 | namespace Cache_Editor_API.Config
9 | {
10 | public class VarBit
11 | {
12 | public static void UnpackVariables(Cache loaded_cache, DataBuffer data_file)
13 | {
14 | int cacheSize = data_file.ReadShort();
15 | if (cache == null)
16 | cache = new VarBit[cacheSize];
17 | Count = cacheSize;
18 | for (int j = 0; j < cacheSize; j++)
19 | {
20 | if (cache[j] == null)
21 | cache[j] = new VarBit();
22 | cache[j].ReadVariable(data_file);
23 | //if (cache[j].aBoolean651)
24 | // Varp.cache[cache[j].anInt648].aBoolean713 = true;
25 | }
26 | }
27 |
28 | private void ReadVariable(DataBuffer stream)
29 | {
30 | do
31 | {
32 | int j = stream.ReadByte();
33 | if (j == 0)
34 | return;
35 | if (j == 1)
36 | {
37 | Variable = stream.ReadShort();
38 | LowerBit = stream.ReadByte();
39 | UpperBit = stream.ReadByte();
40 | }
41 | else if (j == 10)
42 | stream.ReadString();
43 | else if (j == 2)
44 | aBoolean651 = true;
45 | else if (j == 3)
46 | stream.ReadInteger();
47 | else if (j == 4)
48 | stream.ReadInteger();
49 | } while (true);
50 | }
51 |
52 | public static VarBit GetVarBit(int index)
53 | {
54 | if (index < cache.Length)
55 | return cache[index];
56 | return null;
57 | }
58 |
59 | private VarBit()
60 | {
61 | aBoolean651 = false;
62 | }
63 |
64 | public static VarBit[] cache;
65 | public static int Count { get; private set; }
66 |
67 | public int Variable { get; set; }
68 | public int LowerBit { get; set; }
69 | public int UpperBit { get; set; }
70 | public bool aBoolean651 { get; set; }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Cache Editor API/Controls/ModelViewer.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Cache_Editor_API.Controls
2 | {
3 | partial class ModelViewer
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // ModelViewer
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.Name = "ModelViewer";
38 | this.ResumeLayout(false);
39 |
40 | }
41 |
42 | #endregion
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Cache Editor API/Controls/SelectablePictureBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace Cache_Editor_API.Controls
6 | {
7 | public class SelectablePictureBox : PictureBox
8 | {
9 | public SelectablePictureBox()
10 | {
11 | this.SetStyle(ControlStyles.Selectable, true);
12 | this.TabStop = true;
13 | }
14 | protected override void OnMouseDown(MouseEventArgs e)
15 | {
16 | this.Focus();
17 | base.OnMouseDown(e);
18 | }
19 | protected override void OnEnter(EventArgs e)
20 | {
21 | this.Invalidate();
22 | base.OnEnter(e);
23 | }
24 | protected override void OnLeave(EventArgs e)
25 | {
26 | this.Invalidate();
27 | base.OnLeave(e);
28 | }
29 | protected override void OnPaint(PaintEventArgs pe)
30 | {
31 | base.OnPaint(pe);
32 | if (this.Focused)
33 | {
34 | var rc = this.ClientRectangle;
35 | rc.Inflate(-2, -2);
36 | ControlPaint.DrawFocusRectangle(pe.Graphics, rc);
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Cache Editor API/DataBuffer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API
8 | {
9 | public class DataBuffer
10 | {
11 | public byte[] Buffer { get; set; }
12 | public int Location { get; set; }
13 |
14 | public DataBuffer(byte[] buffer)
15 | {
16 | Buffer = buffer;
17 | Location = 0;
18 | }
19 |
20 | public byte ReadByte()
21 | {
22 | return Buffer[Location++];
23 | }
24 |
25 | public sbyte ReadSignedByte()
26 | {
27 | return (sbyte)Buffer[Location++];
28 | }
29 |
30 | public int ReadShort()
31 | {
32 | return (Buffer[Location++] << 8) + Buffer[Location++];
33 | }
34 |
35 | public int ReadSignedShort()
36 | {
37 | return (short)((Buffer[Location++] << 8) + Buffer[Location++]);
38 | }
39 |
40 | public int Read3Bytes()
41 | {
42 | return (Buffer[Location++] << 16) + (Buffer[Location++] << 8) + Buffer[Location++];
43 | }
44 |
45 | public int ReadInteger()
46 | {
47 | return (Buffer[Location++] << 24) + (Buffer[Location++] << 16) + (Buffer[Location++] << 8) + Buffer[Location++];
48 | }
49 |
50 | public int ReadSmart()
51 | {
52 | int i = Buffer[Location];
53 | if (i < 128)
54 | return ReadByte() - 64;
55 | return ReadShort() - 49152;
56 | }
57 |
58 | public string ReadString()
59 | {
60 | StringBuilder sb = new StringBuilder();
61 | while (Location < Buffer.Length)
62 | {
63 | byte b = Buffer[Location++];
64 | if (b == 0xA)
65 | break;
66 | sb.Append((char)b);
67 | }
68 |
69 | return sb.ToString();
70 | }
71 |
72 | public void WriteByte(byte b)
73 | {
74 | Buffer[Location++] = b;
75 | }
76 |
77 | public void WriteShort(int b)
78 | {
79 | Buffer[Location++] = (byte)(b >> 8);
80 | Buffer[Location++] = (byte)b;
81 | }
82 |
83 | public void Write3Bytes(int b)
84 | {
85 | Buffer[Location++] = (byte)(b >> 16);
86 | Buffer[Location++] = (byte)(b >> 8);
87 | Buffer[Location++] = (byte)b;
88 | }
89 |
90 | public void WriteInteger(int b)
91 | {
92 | Buffer[Location++] = (byte)(b >> 24);
93 | Buffer[Location++] = (byte)(b >> 16);
94 | Buffer[Location++] = (byte)(b >> 8);
95 | Buffer[Location++] = (byte)b;
96 | }
97 |
98 | public void Write(byte[] buffer)
99 | {
100 | Array.Copy(buffer, 0, Buffer, Location, buffer.Length);
101 | Location += buffer.Length;
102 | }
103 |
104 | public void Write(byte[] buffer, int src_offset, int length)
105 | {
106 | Array.Copy(buffer, src_offset, Buffer, Location, length);
107 | Location += length;
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Cache Editor API/EditorClassifications.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.ComponentModel;
7 |
8 | namespace Cache_Editor_API
9 | {
10 | public class EditorClassifications
11 | {
12 | public int[] Archives { get; set; }
13 | public int[] SubArchives { get; set; }
14 | public string[] Filenames { get; set; }
15 | public string[] FileExtensions { get; set; }
16 |
17 | [Description("Sets the editor classifications to work with every file.")]
18 | public EditorClassifications()
19 | {
20 | Archives = new int[0];
21 | SubArchives = new int[0];
22 | Filenames = new string[0];
23 | FileExtensions = new string[0];
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Cache Editor API/FastPixel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing.Imaging;
3 | using System.Drawing;
4 |
5 | namespace Cache_Editor_API
6 | {
7 | public class FastPixel
8 | {
9 | public byte[] rgbValues = new byte[4];
10 | private BitmapData bmpData;
11 | private IntPtr bmpPtr;
12 | private bool locked = false;
13 |
14 | private bool _isAlpha = false;
15 | private Bitmap _bitmap;
16 | private int _width;
17 | private int _height;
18 | public int Width
19 | {
20 | get { return this._width; }
21 | }
22 | public int Height
23 | {
24 | get { return this._height; }
25 | }
26 | public bool IsAlphaBitmap
27 | {
28 | get { return this._isAlpha; }
29 | }
30 | public Bitmap Bitmap
31 | {
32 | get { return this._bitmap; }
33 | }
34 |
35 | public FastPixel(Bitmap bitmap)
36 | {
37 | if ((bitmap.PixelFormat == (bitmap.PixelFormat | PixelFormat.Indexed)))
38 | {
39 | throw new Exception("Cannot lock an Indexed image.");
40 | }
41 | this._bitmap = bitmap;
42 | this._isAlpha = (this.Bitmap.PixelFormat == (this.Bitmap.PixelFormat | PixelFormat.Alpha));
43 | this._width = bitmap.Width;
44 | this._height = bitmap.Height;
45 | }
46 |
47 | public void Lock()
48 | {
49 | if (this.locked)
50 | {
51 | throw new Exception("Bitmap already locked.");
52 | }
53 |
54 | Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
55 | this.bmpData = this.Bitmap.LockBits(rect, ImageLockMode.ReadWrite, this.Bitmap.PixelFormat);
56 | this.bmpPtr = this.bmpData.Scan0;
57 |
58 | if (this.IsAlphaBitmap)
59 | {
60 | int bytes = (this.Width * this.Height) * 4;
61 | this.rgbValues = new byte[bytes];
62 |
63 | System.Runtime.InteropServices.Marshal.Copy(this.bmpPtr, rgbValues, 0, this.rgbValues.Length);
64 | }
65 | else
66 | {
67 | int bytes = (this.Width * this.Height) * 3;
68 | this.rgbValues = new byte[bytes];
69 |
70 | System.Runtime.InteropServices.Marshal.Copy(this.bmpPtr, rgbValues, 0, this.rgbValues.Length);
71 | }
72 |
73 | this.locked = true;
74 | }
75 | public void Unlock(bool setPixels)
76 | {
77 | if (!this.locked)
78 | {
79 | throw new Exception("Bitmap not locked.");
80 | }
81 | // Copy the RGB values back to the bitmap
82 | if (setPixels) System.Runtime.InteropServices.Marshal.Copy(this.rgbValues, 0, this.bmpPtr, this.rgbValues.Length);
83 | // Unlock the bits.
84 | this.Bitmap.UnlockBits(bmpData);
85 | this.locked = false;
86 | }
87 |
88 | public void Clear(Color colour)
89 | {
90 | if (!this.locked)
91 | {
92 | throw new Exception("Bitmap not locked.");
93 | }
94 |
95 | if (this.IsAlphaBitmap)
96 | {
97 | for (int index = 0; index <= this.rgbValues.Length - 1; index += 4)
98 | {
99 | this.rgbValues[index] = colour.B;
100 | this.rgbValues[index + 1] = colour.G;
101 | this.rgbValues[index + 2] = colour.R;
102 | this.rgbValues[index + 3] = colour.A;
103 | }
104 | }
105 | else
106 | {
107 | for (int index = 0; index <= this.rgbValues.Length - 1; index += 3)
108 | {
109 | this.rgbValues[index] = colour.B;
110 | this.rgbValues[index + 1] = colour.G;
111 | this.rgbValues[index + 2] = colour.R;
112 | }
113 | }
114 | }
115 | public void SetPixel(Point location, Color colour)
116 | {
117 | this.SetPixel(location.X, location.Y, colour);
118 | }
119 | public void SetPixel(int x, int y, Color colour)
120 | {
121 | if (!this.locked)
122 | {
123 | throw new Exception("Bitmap not locked.");
124 | }
125 |
126 | if (this.IsAlphaBitmap)
127 | {
128 | int index = ((y * this.Width + x) * 4);
129 | this.rgbValues[index] = colour.B;
130 | this.rgbValues[index + 1] = colour.G;
131 | this.rgbValues[index + 2] = colour.R;
132 | this.rgbValues[index + 3] = colour.A;
133 | }
134 | else
135 | {
136 | int index = ((y * this.Width + x) * 3);
137 | this.rgbValues[index] = colour.B;
138 | this.rgbValues[index + 1] = colour.G;
139 | this.rgbValues[index + 2] = colour.R;
140 | }
141 | }
142 | public Color GetPixel(Point location)
143 | {
144 | return this.GetPixel(location.X, location.Y);
145 | }
146 | public Color GetPixel(int x, int y)
147 | {
148 | if (!this.locked)
149 | {
150 | throw new Exception("Bitmap not locked.");
151 | }
152 |
153 | if (this.IsAlphaBitmap)
154 | {
155 | int index = ((y * this.Width + x) * 4);
156 | int b = this.rgbValues[index];
157 | int g = this.rgbValues[index + 1];
158 | int r = this.rgbValues[index + 2];
159 | int a = this.rgbValues[index + 3];
160 | return Color.FromArgb(a, r, g, b);
161 | }
162 | else
163 | {
164 | int index = ((y * this.Width + x) * 3);
165 | int b = this.rgbValues[index];
166 | int g = this.rgbValues[index + 1];
167 | int r = this.rgbValues[index + 2];
168 | return Color.FromArgb(r, g, b);
169 | }
170 | }
171 | }
172 | }
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Animable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Animable
10 | {
11 | public virtual void Render(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2)
12 | {
13 | Model model = getRotatedModel();
14 | if (model != null)
15 | {
16 | modelHeight = model.modelHeight;
17 | model.Render(i, j, k, l, i1, j1, k1, l1, i2);
18 | }
19 | }
20 |
21 | public virtual Model getRotatedModel()
22 | {
23 | return null;
24 | }
25 |
26 | public Animable()
27 | {
28 | modelHeight = 1000;
29 | }
30 |
31 | public VertexNormal[] aVertexNormalArray1425;
32 | public int modelHeight;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Class43.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Class43
10 | {
11 | public Class43(int i, int j, int k, int l, int i1, int j1, bool flag)
12 | {
13 | aBoolean721 = true;
14 | anInt716 = i;
15 | anInt717 = j;
16 | anInt718 = k;
17 | anInt719 = l;
18 | anInt720 = i1;
19 | anInt722 = j1;
20 | aBoolean721 = flag;
21 | }
22 |
23 | public int anInt716;
24 | public int anInt717;
25 | public int anInt718;
26 | public int anInt719;
27 | public int anInt720;
28 | public bool aBoolean721;
29 | public int anInt722;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Class47.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Class47
10 | {
11 |
12 | public Class47()
13 | {
14 | }
15 |
16 | public int anInt787;
17 | public int anInt788;
18 | public int anInt789;
19 | public int anInt790;
20 | public int anInt791;
21 | public int anInt792;
22 | public int anInt793;
23 | public int anInt794;
24 | public int anInt795;
25 | public int anInt796;
26 | public int anInt797;
27 | public int anInt798;
28 | public int anInt799;
29 | public int anInt800;
30 | public int anInt801;
31 | public int anInt802;
32 | public int anInt803;
33 | public int anInt804;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Ground.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Ground
10 | {
11 |
12 | public Ground(int i, int j, int k)
13 | {
14 | obj5Array = new Object5[5];
15 | anIntArray1319 = new int[5];
16 | anInt1310 = anInt1307 = i;
17 | anInt1308 = j;
18 | anInt1309 = k;
19 | }
20 |
21 | public int anInt1307;
22 | public int anInt1308;
23 | public int anInt1309;
24 | public int anInt1310;
25 | public Class43 aClass43_1311;
26 | public Class40 aClass40_1312;
27 | public Object1 obj1;
28 | public Object2 obj2;
29 | public Object3 obj3;
30 | public Object4 obj4;
31 | public int anInt1317;
32 | public Object5[] obj5Array;
33 | public int[] anIntArray1319;
34 | public int anInt1320;
35 | public int anInt1321;
36 | public bool aBoolean1322;
37 | public bool aBoolean1323;
38 | public bool aBoolean1324;
39 | public int anInt1325;
40 | public int anInt1326;
41 | public int anInt1327;
42 | public int anInt1328;
43 | public Ground aClass30_Sub3_1329;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/ModelHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class ModelHeader
10 | {
11 | public ModelHeader()
12 | {
13 | }
14 |
15 | public byte[] aByteArray368;
16 | public int anInt369;
17 | public int anInt370;
18 | public int anInt371;
19 | public int anInt372;
20 | public int anInt373;
21 | public int anInt374;
22 | public int anInt375;
23 | public int anInt376;
24 | public int anInt377;
25 | public int anInt378;
26 | public int anInt379;
27 | public int anInt380;
28 | public int anInt381;
29 | public int anInt382;
30 | public int anInt383;
31 | public int anInt384;
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/ModelTransform.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class ModelTransform
10 | {
11 | public ModelTransform(DataBuffer stream)
12 | {
13 | int anInt341 = stream.ReadByte();
14 | anIntArray342 = new int[anInt341];
15 | anIntArrayArray343 = new int[anInt341][];
16 | for (int j = 0; j < anInt341; j++)
17 | anIntArray342[j] = stream.ReadByte();
18 |
19 | for (int k = 0; k < anInt341; k++)
20 | {
21 | int l = stream.ReadByte();
22 | anIntArrayArray343[k] = new int[l];
23 | for (int i1 = 0; i1 < l; i1++)
24 | anIntArrayArray343[k][i1] = stream.ReadByte();
25 |
26 | }
27 |
28 | }
29 |
30 | public int[] anIntArray342;
31 | public int[][] anIntArrayArray343;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/NetDrawingTools.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class NetDrawingTools
10 | {
11 | public static T[][] Create2DArray(int x, int y)
12 | {
13 | T[][] array = new T[x][];
14 | for (int i = 0; i < x; i++)
15 | array[i] = new T[y];
16 |
17 | return array;
18 | }
19 |
20 | public static T[][][] Create3DArray(int x, int y, int z)
21 | {
22 | T[][][] array = new T[x][][];
23 | for (int i = 0; i < x; i++)
24 | {
25 | array[i] = new T[y][];
26 | for (int k = 0; k < y; k++)
27 | array[i][k] = new T[z];
28 | }
29 |
30 | return array;
31 | }
32 |
33 | public static T[][][][] Create4DArray(int x, int y, int z, int w)
34 | {
35 | T[][][][] array = new T[x][][][];
36 | for (int i = 0; i < x; i++)
37 | {
38 | array[i] = new T[y][][];
39 | for (int k = 0; k < y; k++)
40 | {
41 | array[i][k] = new T[z][];
42 | for (int j = 0; j < z; j++)
43 | array[i][k][z] = new T[w];
44 | }
45 | }
46 |
47 | return array;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Object1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Object1
10 | {
11 | public Object1()
12 | {
13 | }
14 |
15 | public int anInt273;
16 | public int anInt274;
17 | public int anInt275;
18 | public int orientation;
19 | public int orientation1;
20 | public Animable aClass30_Sub2_Sub4_278;
21 | public Animable aClass30_Sub2_Sub4_279;
22 | public int uid;
23 | public sbyte aByte281;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Object2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Object2
10 | {
11 | public Object2()
12 | {
13 | }
14 |
15 | public int anInt499;
16 | public int anInt500;
17 | public int anInt501;
18 | public int anInt502;
19 | public int anInt503;
20 | public Animable aClass30_Sub2_Sub4_504;
21 | public int uid;
22 | public sbyte aByte506;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Object3.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Object3
10 | {
11 |
12 | public Object3()
13 | {
14 | }
15 |
16 | public int anInt811;
17 | public int anInt812;
18 | public int anInt813;
19 | public Animable aClass30_Sub2_Sub4_814;
20 | public int uid;
21 | public sbyte aByte816;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Object4.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Object4
10 | {
11 |
12 | public Object4()
13 | {
14 | }
15 |
16 | public int anInt45;
17 | public int anInt46;
18 | public int anInt47;
19 | public Animable aClass30_Sub2_Sub4_48;
20 | public Animable aClass30_Sub2_Sub4_49;
21 | public Animable aClass30_Sub2_Sub4_50;
22 | public int uid;
23 | public int anInt52;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/Object5.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class Object5
10 | {
11 |
12 | public Object5()
13 | {
14 | }
15 |
16 | public int anInt517;
17 | public int anInt518;
18 | public int anInt519;
19 | public int anInt520;
20 | public Animable aClass30_Sub2_Sub4_521;
21 | public int anInt522;
22 | public int anInt523;
23 | public int anInt524;
24 | public int anInt525;
25 | public int anInt526;
26 | public int anInt527;
27 | public int anInt528;
28 | public int uid;
29 | public sbyte aByte530;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Cache Editor API/Graphics3D/VertexNormal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API.Graphics3D
8 | {
9 | public class VertexNormal
10 | {
11 | public VertexNormal()
12 | {
13 | }
14 |
15 | public int anInt602;
16 | public int anInt603;
17 | public int anInt604;
18 | public int anInt605;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Cache Editor API/IPlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace Cache_Editor_API
9 | {
10 | public interface IPlugin
11 | {
12 | //basic
13 | string Name { get; }
14 | string Author { get; }
15 | string Version { get; }
16 | string Description { get; }
17 | EditorClassifications Classifications { get; set; } //what triggers this editor to be used
18 | bool Dominant { get; } //determines where the plugin gets added on the tabs
19 |
20 | //properties to be filled in by the shell
21 | CacheItemNode Node { get; set; }
22 | DataBuffer Data { get; set; }
23 | Cache Cache { get; set; }
24 |
25 | //optional
26 | Control[] Controls { get; set; }
27 | Control[] ToolControls { get; set; }
28 | string StaticFileExtensions { get; set; }
29 | string FileExtensions { get; set; }
30 | Form ConfigureForm { get; set; }
31 |
32 | void PluginSelected();
33 | bool OnImport(string filename);
34 | void OnExport(string filename);
35 | void OnConfigure();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Cache Editor API/ImageArchive.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Cache_Editor_API
8 | {
9 | public class ImageArchive
10 | {
11 | public DataBuffer IndexFile { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Cache Editor API/Map.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace Cache_Editor_API
9 | {
10 | public class Map
11 | {
12 | private static int[] map_indices1;
13 | private static int[] map_indices2;
14 | private static int[] map_indices3;
15 | private static int[] map_indices4;
16 |
17 | public static Point GetCoordinates(SubArchive archive, int index)
18 | {
19 | if (map_indices1 == null)
20 | {
21 | DataBuffer data = archive.ExtractFile("map_index");
22 | if (data == null)
23 | return new Point(-1, -1);
24 | map_indices1 = new int[data.Buffer.Length / 7];
25 | map_indices2 = new int[data.Buffer.Length / 7];
26 | map_indices3 = new int[data.Buffer.Length / 7];
27 | map_indices4 = new int[data.Buffer.Length / 7];
28 |
29 | for (int i = 0; i < data.Buffer.Length / 7; i++)
30 | {
31 | map_indices1[i] = data.ReadShort();
32 | map_indices2[i] = data.ReadShort();
33 | map_indices3[i] = data.ReadShort();
34 | map_indices4[i] = data.ReadByte();
35 | }
36 | }
37 |
38 | if (index < map_indices1.Length)
39 | {
40 | int value = map_indices1[index];
41 | return new Point((value >> 8) & 0xFF, value & 0xFF);
42 | }
43 |
44 | return new Point(-1, -1);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Cache Editor API/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Cache Editor API")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Cache Editor API")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("da55ed0a-824e-4ced-b74e-bcc20041bafb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.3.0.0")]
36 | [assembly: AssemblyFileVersion("1.3.0.0")]
37 |
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/Box.cs:
--------------------------------------------------------------------------------
1 | namespace nQuant
2 | {
3 | public struct Box
4 | {
5 | public byte AlphaMinimum;
6 | public byte AlphaMaximum;
7 | public byte RedMinimum;
8 | public byte RedMaximum;
9 | public byte GreenMinimum;
10 | public byte GreenMaximum;
11 | public byte BlueMinimum;
12 | public byte BlueMaximum;
13 | public int Size;
14 | }
15 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/ColorData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace nQuant
5 | {
6 | public class ColorData
7 | {
8 | public ColorData(int dataGranularity, int bitmapWidth, int bitmapHeight)
9 | {
10 | dataGranularity++;
11 | Weights = new long[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
12 | MomentsAlpha = new long[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
13 | MomentsRed = new long[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
14 | MomentsGreen = new long[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
15 | MomentsBlue = new long[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
16 | Moments = new float[dataGranularity, dataGranularity, dataGranularity, dataGranularity];
17 |
18 | pixelsCount = bitmapWidth*bitmapHeight;
19 | pixels = new Pixel[pixelsCount];
20 | quantizedPixels = new int[pixelsCount];
21 | }
22 |
23 | public long[, , ,] Weights { get; private set; }
24 | public long[, , ,] MomentsAlpha { get; private set; }
25 | public long[, , ,] MomentsRed { get; private set; }
26 | public long[, , ,] MomentsGreen { get; private set; }
27 | public long[, , ,] MomentsBlue { get; private set; }
28 | public float[, , ,] Moments { get; private set; }
29 |
30 | public IList QuantizedPixels { get { return quantizedPixels; } }
31 | public IList Pixels { get { return pixels; } }
32 |
33 | public int PixelsCount { get { return pixels.Length; } }
34 | public void AddPixel(Pixel pixel, int quantizedPixel)
35 | {
36 | pixels[pixelFillingCounter] = pixel;
37 | quantizedPixels[pixelFillingCounter++] = quantizedPixel;
38 | }
39 |
40 | private Pixel[] pixels;
41 | private int[] quantizedPixels;
42 | private int pixelsCount;
43 | private int pixelFillingCounter;
44 | }
45 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/CubeCut.cs:
--------------------------------------------------------------------------------
1 | namespace nQuant
2 | {
3 | internal struct CubeCut
4 | {
5 | public readonly byte? Position;
6 | public readonly float Value;
7 |
8 | public CubeCut(byte? cutPoint, float result)
9 | {
10 | Position = cutPoint;
11 | Value = result;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/IWuQuantizer.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace nQuant
4 | {
5 | public interface IWuQuantizer
6 | {
7 | Image QuantizeImage(Bitmap image, int alphaThreshold, int alphaFader);
8 | }
9 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/Lookup.cs:
--------------------------------------------------------------------------------
1 | namespace nQuant
2 | {
3 | public class Lookup
4 | {
5 | public int Alpha;
6 | public int Red;
7 | public int Green;
8 | public int Blue;
9 | }
10 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/LookupData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace nQuant
4 | {
5 | public class LookupData
6 | {
7 | public LookupData(int granularity)
8 | {
9 | Lookups = new List();
10 | Tags = new int[granularity, granularity, granularity, granularity];
11 | }
12 |
13 | public IList Lookups { get; private set; }
14 | public int[, , ,] Tags { get; private set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/Nuget/nQuant.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | nQuant
5 | $version$
6 | Matt Wrock
7 | Matt Wrock
8 | http://www.apache.org/licenses/LICENSE-2.0
9 | http://nquant.codeplex.com/
10 | http://download-codeplex.sec.s-msft.com/Download?ProjectName=nquant&DownloadId=609205&Build=20006
11 | false
12 |
13 | nQuant is a .net color quantizer that can dramatically reduce the size of images with little to no perceptible quality loss.
14 |
15 | nQuant is a .net color quantizer which produces high quality 256 color 8 bit PNG images. nQuant uses an algorithm adapted from Xiaolin Wu's fast optimal color quantizer. nQuant often reduces the size of a 32 bit image to a size 3 times smaller than its original with quality surpassing what the standard C command line utilities produce.
16 | PNG Image Optimization Quantization
17 |
18 |
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/Pixel.cs:
--------------------------------------------------------------------------------
1 | namespace nQuant
2 | {
3 | public struct Pixel
4 | {
5 | public Pixel(byte alpha, byte red, byte green, byte blue) : this()
6 | {
7 | Alpha = alpha;
8 | Red = red;
9 | Green = green;
10 | Blue = blue;
11 |
12 | Argb = alpha << 24 | red << 16 | green << 8 | blue;
13 | }
14 |
15 | public byte Alpha;
16 | public byte Red;
17 | public byte Green;
18 | public byte Blue;
19 | public int Argb;
20 | }
21 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/QuantizationException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace nQuant
7 | {
8 | public class QuantizationException : ApplicationException
9 | {
10 | public QuantizationException(string message) : base(message)
11 | {
12 |
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/QuantizedPalette.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 |
4 | namespace nQuant
5 | {
6 | public class QuantizedPalette
7 | {
8 | public QuantizedPalette(int size)
9 | {
10 | Colors = new List();
11 | PixelIndex = new int[size];
12 | }
13 | public IList Colors { get; private set; }
14 | public int[] PixelIndex { get; private set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/WuQuantizer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 |
5 | namespace nQuant
6 | {
7 | public class WuQuantizer : WuQuantizerBase, IWuQuantizer
8 | {
9 | protected override QuantizedPalette GetQuantizedPalette(int colorCount, ColorData data, IEnumerable cubes, int alphaThreshold)
10 | {
11 | int imageSize = data.PixelsCount;
12 | LookupData lookups = BuildLookups(cubes, data);
13 |
14 | IList quantizedPixels = data.QuantizedPixels;
15 | for (var index = 0; index < imageSize; ++index)
16 | {
17 | var indexParts = BitConverter.GetBytes(quantizedPixels[index]);
18 | quantizedPixels[index] = lookups.Tags[indexParts[Alpha], indexParts[Red], indexParts[Green], indexParts[Blue]];
19 | }
20 |
21 | var alphas = new int[colorCount + 1];
22 | var reds = new int[colorCount + 1];
23 | var greens = new int[colorCount + 1];
24 | var blues = new int[colorCount + 1];
25 | var sums = new int[colorCount + 1];
26 | var palette = new QuantizedPalette(imageSize);
27 |
28 | IList pixels = data.Pixels;
29 | int pixelsCount = data.PixelsCount;
30 | IList lookupsList = lookups.Lookups;
31 | int lookupsCount = lookupsList.Count;
32 |
33 | Dictionary cachedMaches = new Dictionary();
34 |
35 | for (int pixelIndex = 0; pixelIndex < pixelsCount; pixelIndex++)
36 | {
37 | Pixel pixel = pixels[pixelIndex];
38 | palette.PixelIndex[pixelIndex] = -1;
39 | if (pixel.Alpha <= alphaThreshold)
40 | continue;
41 |
42 | int bestMatch;
43 | int argb = pixel.Argb;
44 |
45 | if (!cachedMaches.TryGetValue(argb, out bestMatch))
46 | {
47 | int match = quantizedPixels[pixelIndex];
48 | bestMatch = match;
49 | int bestDistance = int.MaxValue;
50 |
51 | for (int lookupIndex = 0; lookupIndex < lookupsCount; lookupIndex++)
52 | {
53 | Lookup lookup = lookupsList[lookupIndex];
54 | var deltaAlpha = pixel.Alpha - lookup.Alpha;
55 | var deltaRed = pixel.Red - lookup.Red;
56 | var deltaGreen = pixel.Green - lookup.Green;
57 | var deltaBlue = pixel.Blue - lookup.Blue;
58 |
59 | int distance = deltaAlpha*deltaAlpha + deltaRed*deltaRed + deltaGreen*deltaGreen + deltaBlue*deltaBlue;
60 |
61 | if (distance >= bestDistance)
62 | continue;
63 |
64 | bestDistance = distance;
65 | bestMatch = lookupIndex;
66 | }
67 |
68 | cachedMaches[argb] = bestMatch;
69 | }
70 |
71 | alphas[bestMatch] += pixel.Alpha;
72 | reds[bestMatch] += pixel.Red;
73 | greens[bestMatch] += pixel.Green;
74 | blues[bestMatch] += pixel.Blue;
75 | sums[bestMatch]++;
76 |
77 | palette.PixelIndex[pixelIndex] = bestMatch;
78 | }
79 |
80 | for (var paletteIndex = 0; paletteIndex < colorCount; paletteIndex++)
81 | {
82 | if (sums[paletteIndex] > 0)
83 | {
84 | alphas[paletteIndex] /= sums[paletteIndex];
85 | reds[paletteIndex] /= sums[paletteIndex];
86 | greens[paletteIndex] /= sums[paletteIndex];
87 | blues[paletteIndex] /= sums[paletteIndex];
88 | }
89 |
90 | var color = Color.FromArgb(alphas[paletteIndex], reds[paletteIndex], greens[paletteIndex], blues[paletteIndex]);
91 | palette.Colors.Add(color);
92 | }
93 |
94 | palette.Colors.Add(Color.FromArgb(0, 0, 0, 0));
95 |
96 | return palette;
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Cache Editor API/nQuant/nQuant.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {A59307EA-FCB0-4110-BC42-0417871C24C4}
9 | Library
10 | Properties
11 | nQuant
12 | nQuant.Core
13 | v4.0
14 | 512
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\v4.0\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | v4.0
26 |
27 |
28 | pdbonly
29 | true
30 | bin\v4.0\Release\
31 | TRACE
32 | prompt
33 | 4
34 | v4.0
35 |
36 |
37 | true
38 | full
39 | false
40 | bin\v3.5\Debug\
41 | DEBUG;TRACE
42 | prompt
43 | 4
44 | v3.5
45 |
46 |
47 | pdbonly
48 | true
49 | bin\v3.5\Release\
50 | TRACE
51 | prompt
52 | 4
53 | v3.5
54 |
55 |
56 | false
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
100 |
--------------------------------------------------------------------------------
/Cache Editor/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Cache Editor/ExtensionManager_vsix_OSReg_256x.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lin20/cachesuite/e1ab4bce6e4ad2dfa829868f17663a0377a98bca/Cache Editor/ExtensionManager_vsix_OSReg_256x.ico
--------------------------------------------------------------------------------
/Cache Editor/FilesLoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 |
7 | namespace Cache_Editor
8 | {
9 | public class FilesLoader
10 | {
11 | public static Dictionary Files { get; set; }
12 |
13 | public static bool Load()
14 | {
15 | Files = new Dictionary();
16 | try
17 | {
18 | StreamReader sr = new StreamReader(File.OpenRead("files.txt"));
19 | string[] lines = sr.ReadToEnd().Replace("\r", "").Split('\n');
20 | for (int i = 0; i < lines.Length; i++)
21 | {
22 | if (lines[i].Length == 0)
23 | continue;
24 | string file = lines[i].ToUpper();
25 | int file_int = 0;
26 | for (int j = 0; j < file.Length; j++)
27 | file_int = (file_int * 61 + file[j]) - 32;
28 | if (!Files.ContainsKey(file_int))
29 | Files.Add(file_int, lines[i]);
30 | }
31 |
32 | return true;
33 | }
34 | catch (Exception)
35 | {
36 | return false;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Cache Editor/InputBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace Cache_Editor
9 | {
10 | public class InputBox : Form
11 | {
12 | public InputBox(string title, int textboxes, params string[] labels)
13 | {
14 | this.KeyPreview = true;
15 | this.KeyPress += InputBox_KeyPress;
16 |
17 | this.Text = title;
18 | this.Width = 300;
19 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
20 | this.MinimizeBox = false;
21 | this.MaximizeBox = false;
22 | this.ShowInTaskbar = false;
23 | this.StartPosition = FormStartPosition.CenterParent;
24 | this.Height = textboxes * 28 + 100;
25 | for (int i = 0; i < textboxes; i++)
26 | {
27 | TextBox t = new TextBox();
28 | t.Width = 118;
29 | t.Location = new System.Drawing.Point(150, 16 + i * 28);
30 | t.KeyPress += Pressed_Enter;
31 | this.Controls.Add(t);
32 | }
33 |
34 | for (int i = 0; i < labels.Length; i++)
35 | {
36 | Label l = new Label();
37 | l.Text = labels[i];
38 | l.Location = new System.Drawing.Point(16, 20 + i * 28);
39 | l.AutoSize = true;
40 | this.Controls.Add(l);
41 | }
42 |
43 | Button ok = new Button();
44 | ok.Text = "OK";
45 | ok.Location = new System.Drawing.Point(this.Width / 2 - ok.Width - 16, this.ClientSize.Height - ok.Height - 16);
46 | ok.Click += OK_Clicked;
47 | this.Controls.Add(ok);
48 |
49 | Button cancel = new Button();
50 | cancel.Text = "Cancel";
51 | cancel.Location = new System.Drawing.Point(this.Width / 2, this.ClientSize.Height - cancel.Height - 16);
52 | cancel.Click += delegate(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); };
53 | this.Controls.Add(cancel);
54 | }
55 |
56 | private void InputBox_KeyPress(object sender, KeyPressEventArgs e)
57 | {
58 | if (e.KeyChar == (char)Keys.Escape)
59 | {
60 | e.Handled = true;
61 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
62 | this.Close();
63 | }
64 | }
65 |
66 | private void Pressed_Enter(object sender, KeyPressEventArgs e)
67 | {
68 | if (e.KeyChar == (char)Keys.Enter)
69 | {
70 | e.Handled = true;
71 | OK_Clicked(this, null);
72 | }
73 | }
74 |
75 | private void OK_Clicked(object sender, EventArgs e)
76 | {
77 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
78 | this.Close();
79 | }
80 |
81 | public string GetText(int index)
82 | {
83 | return this.Controls[index].Text;
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Cache Editor/PluginContainer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Cache_Editor_API;
7 | using System.Reflection;
8 | using System.IO;
9 | using System.Windows.Forms;
10 |
11 | namespace Cache_Editor
12 | {
13 | public class PluginContainer
14 | {
15 | public List Plugins { get; set; }
16 |
17 | public void LoadPlugins()
18 | {
19 | Plugins = new List();
20 |
21 | if (!Directory.Exists("./Plugins"))
22 | Directory.CreateDirectory("./Plugins");
23 | else
24 | {
25 | DirectoryInfo di = new DirectoryInfo("./Plugins");
26 | foreach (FileInfo s in di.GetFiles("*.dll"))
27 | {
28 | try
29 | {
30 | LoadPlugin(s);
31 | }
32 | catch (Exception e)
33 | {
34 | MessageBox.Show("Failed to load plugin " + s + "\nThe cause of this is most likely Windows security. If this is a valid plugin, right click on it -> click properties -> click \"Unblock\" at the bottom.\n\n" + e.Message + "\n\n" + e.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
35 | }
36 | }
37 | }
38 | }
39 |
40 | private void LoadPlugin(string s)
41 | {
42 | LoadPlugin(new FileInfo(s));
43 | }
44 |
45 | private void LoadPlugin(FileInfo s)
46 | {
47 | Assembly assembly = Assembly.LoadFrom(s.FullName);
48 | if (assembly != null)
49 | {
50 | Type pt = typeof(IPlugin);
51 | foreach (Type t in assembly.GetTypes())
52 | {
53 | if (t.GetInterface(pt.FullName) != null)
54 | {
55 | IPlugin p = (IPlugin)Activator.CreateInstance(t);
56 | Plugins.Add(p);
57 | }
58 | }
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Cache Editor/PluginDescription.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using Cache_Editor_API;
11 |
12 | namespace Cache_Editor
13 | {
14 | public partial class PluginDescription : UserControl
15 | {
16 | IPlugin Plugin { get; set; }
17 |
18 | public PluginDescription()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | private void lblDescription_Click(object sender, EventArgs e)
24 | {
25 |
26 | }
27 |
28 | public void SetPlugin(IPlugin p)
29 | {
30 | Plugin = p;
31 | lblName.Text = p.Name;
32 | lblAuthor.Text = p.Author;
33 | lblVersion.Text = p.Version;
34 | lblDescription.Text = p.Description;
35 | lblFiles.Text = p.StaticFileExtensions;
36 |
37 | StringBuilder cond = new StringBuilder();
38 | if (p.Classifications.Archives.Length == 0)
39 | cond.AppendLine("Archives: Any");
40 | else
41 | {
42 | cond.Append("Archives: ");
43 | for (int i = 0; i < p.Classifications.Archives.Length - 1; i++)
44 | cond.Append(p.Classifications.Archives[i] + ", ");
45 | cond.AppendLine(p.Classifications.Archives[p.Classifications.Archives.Length - 1].ToString());
46 | }
47 |
48 | if (p.Classifications.SubArchives.Length == 0)
49 | cond.AppendLine("Sub-Archives: Any");
50 | else
51 | {
52 | cond.Append("Sub-Archives: ");
53 | for (int i = 0; i < p.Classifications.SubArchives.Length - 1; i++)
54 | cond.Append(p.Classifications.SubArchives[i] + ", ");
55 | cond.AppendLine(p.Classifications.SubArchives[p.Classifications.SubArchives.Length - 1].ToString());
56 | }
57 |
58 | if (p.Classifications.Filenames.Length == 0)
59 | cond.AppendLine("Files: Any");
60 | else
61 | {
62 | cond.Append("Files: ");
63 | for (int i = 0; i < p.Classifications.Filenames.Length - 1; i++)
64 | {
65 | cond.Append("\"");
66 | cond.Append(p.Classifications.Filenames[i]);
67 | cond.Append("\", ");
68 | }
69 | cond.Append("\"");
70 | cond.Append(p.Classifications.Filenames[p.Classifications.Filenames.Length - 1]);
71 | cond.AppendLine("\"");
72 | }
73 |
74 | if (p.Classifications.FileExtensions.Length == 0)
75 | cond.AppendLine("Extensions: Any");
76 | else
77 | {
78 | cond.Append("Extensions: ");
79 | for (int i = 0; i < p.Classifications.FileExtensions.Length - 1; i++)
80 | {
81 | cond.Append("\"");
82 | cond.Append(p.Classifications.FileExtensions[i]);
83 | cond.Append("\", ");
84 | }
85 | cond.Append("\"");
86 | cond.Append(p.Classifications.FileExtensions[p.Classifications.FileExtensions.Length - 1]);
87 | cond.AppendLine("\"");
88 | }
89 |
90 | lblConditions.Text = cond.ToString();
91 | btnConfigure.Enabled = p.ConfigureForm != null;
92 | }
93 |
94 | private void btnConfigure_Click(object sender, EventArgs e)
95 | {
96 | if (Plugin.ConfigureForm != null)
97 | {
98 | if (Plugin.ConfigureForm.ShowDialog() == DialogResult.OK)
99 | {
100 | Plugin.OnConfigure();
101 | }
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/Cache Editor/PluginSummary.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Cache_Editor
2 | {
3 | partial class PluginSummary
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PluginSummary));
32 | this.Tabs = new System.Windows.Forms.TabControl();
33 | this.panel1 = new System.Windows.Forms.Panel();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.panel1.SuspendLayout();
36 | this.SuspendLayout();
37 | //
38 | // Tabs
39 | //
40 | this.Tabs.Dock = System.Windows.Forms.DockStyle.Fill;
41 | this.Tabs.Location = new System.Drawing.Point(0, 0);
42 | this.Tabs.Name = "Tabs";
43 | this.Tabs.SelectedIndex = 0;
44 | this.Tabs.Size = new System.Drawing.Size(452, 252);
45 | this.Tabs.TabIndex = 0;
46 | //
47 | // panel1
48 | //
49 | this.panel1.Controls.Add(this.button1);
50 | this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
51 | this.panel1.Location = new System.Drawing.Point(0, 252);
52 | this.panel1.Name = "panel1";
53 | this.panel1.Size = new System.Drawing.Size(452, 38);
54 | this.panel1.TabIndex = 1;
55 | //
56 | // button1
57 | //
58 | this.button1.Location = new System.Drawing.Point(164, 6);
59 | this.button1.Name = "button1";
60 | this.button1.Size = new System.Drawing.Size(124, 23);
61 | this.button1.TabIndex = 0;
62 | this.button1.Text = "OK";
63 | this.button1.UseVisualStyleBackColor = true;
64 | this.button1.Click += new System.EventHandler(this.button1_Click);
65 | //
66 | // PluginSummary
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(452, 290);
71 | this.Controls.Add(this.Tabs);
72 | this.Controls.Add(this.panel1);
73 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
74 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
75 | this.MaximizeBox = false;
76 | this.MinimizeBox = false;
77 | this.Name = "PluginSummary";
78 | this.ShowInTaskbar = false;
79 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
80 | this.Text = "Plugins Summary";
81 | this.panel1.ResumeLayout(false);
82 | this.ResumeLayout(false);
83 |
84 | }
85 |
86 | #endregion
87 |
88 | public System.Windows.Forms.TabControl Tabs;
89 | private System.Windows.Forms.Panel panel1;
90 | private System.Windows.Forms.Button button1;
91 |
92 | }
93 | }
--------------------------------------------------------------------------------
/Cache Editor/PluginSummary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Cache_Editor
12 | {
13 | public partial class PluginSummary : Form
14 | {
15 | public PluginSummary()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void button1_Click(object sender, EventArgs e)
21 | {
22 | this.Close();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Cache Editor/PluginTabPage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using Cache_Editor_API;
8 |
9 | namespace Cache_Editor
10 | {
11 | public class PluginTabPage : TabPage
12 | {
13 | public IPlugin Plugin { get; set; }
14 |
15 | public PluginTabPage(string text, IPlugin p) : base(text)
16 | {
17 | Plugin = p;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Cache Editor/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Cache_Editor
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Cache Editor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Lin's Cache Suite")]
9 | [assembly: AssemblyDescription("317 Plugin-based cache editor")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Lin's Cache Suite")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0f073997-9aa4-4c1c-ac2c-849705076cd7")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.2.0.0")]
36 | [assembly: AssemblyFileVersion("1.2.0.0")]
37 |
--------------------------------------------------------------------------------
/Cache Editor/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Cache_Editor.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Cache_Editor.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Cache Editor/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Cache Editor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18444
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Cache_Editor.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Cache Editor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Cache Editor/files.txt:
--------------------------------------------------------------------------------
1 | title.dat
2 | logo.dat
3 | sounds.dat
4 | titlebox.dat
5 | titlebutton.dat
6 | runes.dat
7 | index.dat
8 | invback.dat
9 | chatback.dat
10 | mapback.dat
11 | backbase1.dat
12 | backbase2.dat
13 | backhmid1.dat
14 | sideicons.dat
15 | compass.dat
16 | mapedge.dat
17 | mapscene.dat
18 | mapfunction.dat
19 | hitmarks.dat
20 | headicons.dat
21 | mapmarker.dat
22 | cross.dat
23 | mapdots.dat
24 | scrollbar.dat
25 | redstone1.dat
26 | redstone2.dat
27 | redstone3.dat
28 | mod_icons.dat
29 | backleft1.dat
30 | backleft2.dat
31 | backright1.dat
32 | backright2.dat
33 | backtop1.dat
34 | backvmid1.dat
35 | backvmid2.dat
36 | backvmid3.dat
37 | backhmid2.dat
38 |
39 | model_version
40 | anim_version
41 | midi_version
42 | map_version
43 | model_crc
44 | anim_crc
45 | midi_crc
46 | map_crc
47 | model_index
48 | map_index
49 | anim_index
50 | midi_index
51 |
52 | idk.dat
53 | flo.dat
54 | seq.dat
55 |
56 | fragmentsenc.txt
57 | badenc.txt
58 | domainenc.txt
59 | tldlist.txt
60 |
61 | npc.dat
62 | npc.idx
63 | obj.dat
64 | obj.idx
65 | loc.dat
66 | loc.idx
67 |
68 | data
69 | spotanim.dat
70 | varbit.dat
71 | varp.dat
72 |
73 | p11_full.dat
74 | p12_full.dat
75 | b12_full.dat
76 | q8_full.dat
77 |
78 | 0.dat
79 | 1.dat
80 | 2.dat
81 | 3.dat
82 | 4.dat
83 | 5.dat
84 | 6.dat
85 | 7.dat
86 | 8.dat
87 | 9.dat
88 | 10.dat
89 | 11.dat
90 | 12.dat
91 | 13.dat
92 | 14.dat
93 | 15.dat
94 | 16.dat
95 | 17.dat
96 | 18.dat
97 | 19.dat
98 | 20.dat
99 | 21.dat
100 | 22.dat
101 | 23.dat
102 | 24.dat
103 | 25.dat
104 | 26.dat
105 | 27.dat
106 | 28.dat
107 | 29.dat
108 | 30.dat
109 | 31.dat
110 | 32.dat
111 | 33.dat
112 | 34.dat
113 | 35.dat
114 | 36.dat
115 | 37.dat
116 | 38.dat
117 | 39.dat
118 | 40.dat
119 | 41.dat
120 | 42.dat
121 | 43.dat
122 | 44.dat
123 | 45.dat
124 | 46.dat
125 | 47.dat
126 | 48.dat
127 | 49.dat
128 | 50.dat
129 |
130 | wornicons.dat
131 | magicon.dat
132 | magicoff.dat
133 | magicon2.dat
134 | magicoff2.dat
135 | miscgraphics.dat
136 | sworddecor.dat
137 | headicons_pk.dat
138 | rightarrow.dat
139 | leftarrow.dat
140 | steelborder.dat
141 | tradebacking.dat
142 | combatboxes.dat
143 | combaticons.dat
144 | combaticons2.dat
145 | combaticons3.dat
146 | staticons.dat
147 | overlay_multiway.dat
148 | number_button.dat
149 | tex_brown.dat
150 | prayeron.dat
151 | prayeroff.dat
152 | headicons.dat
153 | staticons2.dat
154 | steelborder2.dat
155 | miscgraphics2.dat
156 | miscgraphics3.dat
157 | key.dat
158 | keys.dat
159 | chest.dat
160 | coins.dat
161 | letter.dat
162 | headicons_prayer.dat
--------------------------------------------------------------------------------
/HexEditor/HexEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using Cache_Editor_API;
8 | using System.IO;
9 |
10 | namespace HexEditor
11 | {
12 | public class HexEditor : IPlugin
13 | {
14 | //basic
15 | public string Name { get { return "Hex Editor"; } }
16 | public string Author { get { return "Lin"; } }
17 | public string Version { get { return "1.2"; } }
18 | public string Description { get { return "A basic hex editor."; } }
19 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
20 | public bool Dominant { get { return false; } }
21 |
22 | //properties to be filled in by the shell
23 | public CacheItemNode Node { get; set; }
24 | public DataBuffer Data { get; set; }
25 | public Cache Cache { get; set; }
26 |
27 | //optional
28 | public Control[] Controls { get; set; }
29 | public Control[] ToolControls { get; set; }
30 | public string FileExtensions { get; set; }
31 | public string StaticFileExtensions { get; set; }
32 | public Form ConfigureForm { get; set; }
33 |
34 | public HexEditor()
35 | {
36 | Classifications = new EditorClassifications();
37 | FileExtensions = "Data file (*.dat)|*.dat";
38 | StaticFileExtensions = "Data file (*.dat)|*.dat";
39 |
40 | Controls = new Control[1];
41 | Be.Windows.Forms.HexBox box = new Be.Windows.Forms.HexBox();
42 | box.StringViewVisible = true;
43 | box.UseFixedBytesPerLine = true;
44 | box.LineInfoVisible = true;
45 | box.VScrollBarVisible = true;
46 | box.Dock = DockStyle.Fill;
47 | Controls[0] = box;
48 |
49 | ToolControls = new Control[0];
50 | }
51 |
52 | public void PluginSelected()
53 | {
54 | Be.Windows.Forms.HexBox box = (Be.Windows.Forms.HexBox)Controls[0];
55 | Be.Windows.Forms.ByteCollection c = new Be.Windows.Forms.ByteCollection(Data.Buffer);
56 | Be.Windows.Forms.DynamicByteProvider d = new Be.Windows.Forms.DynamicByteProvider(Data.Buffer);
57 | ((Be.Windows.Forms.HexBox)Controls[0]).ByteProvider = d;
58 | }
59 |
60 | public bool OnImport(string filename)
61 | {
62 | try
63 | {
64 | BinaryReader br = new BinaryReader(File.OpenRead(filename));
65 | byte[] data = br.ReadBytes((int)br.BaseStream.Length);
66 | br.Close();
67 |
68 | if (Data != null)
69 | {
70 | Data.Buffer = data;
71 | Data.Location = 0;
72 | PluginSelected();
73 | }
74 | else
75 | Data = new DataBuffer(data);
76 | Cache.WriteFile(Node, data);
77 | return true;
78 | }
79 | catch(Exception ex)
80 | {
81 | MessageBox.Show("Error importing file.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Importing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
82 | return false;
83 | }
84 | }
85 |
86 | public void OnExport(string filename)
87 | {
88 | try
89 | {
90 | if (File.Exists(filename))
91 | File.Delete(filename);
92 | BinaryWriter bw = new BinaryWriter(File.Open(filename, FileMode.OpenOrCreate));
93 | bw.Write(Data.Buffer);
94 | bw.Close();
95 | }
96 | catch (Exception ex)
97 | {
98 | MessageBox.Show("Error exporting file.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Exporting File", MessageBoxButtons.OK, MessageBoxIcon.Error);
99 | }
100 | }
101 |
102 | public void OnConfigure()
103 | {
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/HexEditor/HexEditor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {39D8E526-1538-4767-AAB6-8195219ACB00}
8 | Library
9 | Properties
10 | HexEditor
11 | HexEditor
12 | v4.5
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | ..\Cache Editor\bin\Debug\Plugins\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | Off
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | ..\Cache Editor\bin\Release\Plugins\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 |
38 | False
39 | E:\Libraries\Be.Windows.Forms.HexBox.dll
40 | False
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | {18b60f83-9129-474e-a55a-e30ac544b900}
58 | Cache Editor API
59 | False
60 |
61 |
62 |
63 |
70 |
--------------------------------------------------------------------------------
/HexEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("HexEditor")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("HexEditor")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3ed4483f-1bae-4dfd-a210-ac34a04857b2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ImageViewer/ImageViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 | using System.Windows.Forms;
8 | using Cache_Editor_API;
9 |
10 | namespace ImageViewer
11 | {
12 | public class ImageViewer : IPlugin
13 | {
14 | //basic
15 | public string Name { get { return "Image Viewer"; } }
16 | public string Author { get { return "Lin"; } }
17 | public string Version { get { return "1.2"; } }
18 | public string Description { get { return "Views and allows the basic importing and exporting of 317-format images."; } }
19 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
20 | public bool Dominant { get { return true; } }
21 |
22 | //properties to be filled in by the shell
23 | public CacheItemNode Node { get; set; }
24 | public DataBuffer Data { get; set; }
25 | public Cache Cache { get; set; }
26 |
27 | //optional
28 | public Control[] Controls { get; set; }
29 | public Control[] ToolControls { get; set; }
30 | public string StaticFileExtensions { get; set; }
31 | public string FileExtensions { get; set; }
32 | public Form ConfigureForm { get; set; }
33 |
34 | private Bitmap checkerboard;
35 |
36 | public ImageViewer()
37 | {
38 | Classifications = new EditorClassifications();
39 | Classifications.SubArchives = new int[] { 1, 4, 6 };
40 | FileExtensions = "";
41 | StaticFileExtensions = "PNG Image|*.png";
42 |
43 | Controls = new Control[2];
44 | Label not = new Label();
45 | not.AutoSize = false;
46 | not.Text = "Not an image";
47 | not.Dock = DockStyle.Fill;
48 | not.TextAlign = ContentAlignment.MiddleCenter;
49 | not.Visible = false;
50 | Controls[1] = not;
51 |
52 | PictureBox image = new PictureBox();
53 | image.SizeMode = PictureBoxSizeMode.CenterImage;
54 | image.Dock = DockStyle.Fill;
55 | Controls[0] = image;
56 |
57 | ToolControls = new Control[2];
58 | Label l = new Label();
59 | l.BackColor = Color.Transparent;
60 | l.AutoSize = false;
61 | l.Text = "Sub-index:";
62 | l.Top = 20;
63 | l.Left = 4;
64 | l.Width = 80;
65 | ToolControls[0] = l;
66 |
67 | NumericUpDown n = new NumericUpDown();
68 | n.Maximum = 256;
69 | n.Width = 80;
70 | n.Left = 88;
71 | n.Top = l.Top - 3;
72 | n.ValueChanged += delegate(object sender, EventArgs e) { PluginSelected(); };
73 | ToolControls[1] = n;
74 |
75 | checkerboard = new Bitmap(32, 32);
76 | Graphics g = Graphics.FromImage(checkerboard);
77 | g.Clear(Color.White);
78 | g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
79 | g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);
80 | image.BackgroundImage = checkerboard;
81 | image.BackgroundImageLayout = ImageLayout.Tile;
82 | }
83 |
84 | public void PluginSelected()
85 | {
86 | RSImage image = new RSImage(Cache, Node, Data, (int)((NumericUpDown)ToolControls[1]).Value);
87 | ((PictureBox)Controls[0]).Image = image.GenerateBitmap();
88 | if (((PictureBox)Controls[0]).Image == null)
89 | {
90 | Controls[0].Visible = false;
91 | Controls[1].Visible = true;
92 | FileExtensions = "";
93 | }
94 | else
95 | {
96 | Controls[0].Visible = true;
97 | Controls[1].Visible = false;
98 | FileExtensions = "PNG Image (*.png)|*.png";
99 | }
100 | }
101 |
102 | public bool OnImport(string filename)
103 | {
104 | try
105 | {
106 | Exception e = null;
107 | RSImage new_image = new RSImage(filename, out e);
108 | if (e != null)
109 | throw e;
110 | new_image.Write(Cache, Node, Data);
111 | Data = Cache.SubArchives[Node.SubArchive].ExtractFile(Node.FileIndex);
112 | ((PictureBox)Controls[0]).Image = new_image.GenerateBitmap();
113 | return true;
114 |
115 | }
116 | catch (Exception ex)
117 | {
118 | MessageBox.Show("Error importing image.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Importing Image", MessageBoxButtons.OK, MessageBoxIcon.Error);
119 | return false;
120 | }
121 | }
122 |
123 | public void OnExport(string filename)
124 | {
125 | try
126 | {
127 | PictureBox p = (PictureBox)Controls[0];
128 | PluginSelected();
129 | if (p.Image != null)
130 | p.Image.Save(filename);
131 | }
132 | catch (Exception ex)
133 | {
134 | MessageBox.Show("Error exporting image.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Exporting Image", MessageBoxButtons.OK, MessageBoxIcon.Error);
135 | }
136 | }
137 |
138 | public void OnConfigure()
139 | {
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/ImageViewer/ImageViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DB1B224D-6B18-4090-A360-1150184397F7}
8 | Library
9 | Properties
10 | ImageViewer
11 | ImageViewer
12 | v4.5
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | ..\Cache Editor\bin\Debug\Plugins\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | Off
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | ..\Cache Editor\bin\Release\Plugins\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | {18b60f83-9129-474e-a55a-e30ac544b900}
54 | Cache Editor API
55 | False
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/ImageViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ImageViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ImageViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("662fc540-8c72-4ce8-9117-30b74bdc6ea5")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ItemViewer/Configure.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ItemViewer
2 | {
3 | partial class Configure
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.checkBox1 = new System.Windows.Forms.CheckBox();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.button2 = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // checkBox1
37 | //
38 | this.checkBox1.AutoSize = true;
39 | this.checkBox1.Location = new System.Drawing.Point(12, 12);
40 | this.checkBox1.Name = "checkBox1";
41 | this.checkBox1.Size = new System.Drawing.Size(262, 17);
42 | this.checkBox1.TabIndex = 0;
43 | this.checkBox1.Text = "Use Software Rendering (only use if OpenGL fails)";
44 | this.checkBox1.UseVisualStyleBackColor = true;
45 | //
46 | // button1
47 | //
48 | this.button1.Location = new System.Drawing.Point(65, 41);
49 | this.button1.Name = "button1";
50 | this.button1.Size = new System.Drawing.Size(75, 23);
51 | this.button1.TabIndex = 1;
52 | this.button1.Text = "OK";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // button2
57 | //
58 | this.button2.Location = new System.Drawing.Point(146, 41);
59 | this.button2.Name = "button2";
60 | this.button2.Size = new System.Drawing.Size(75, 23);
61 | this.button2.TabIndex = 2;
62 | this.button2.Text = "Cancel";
63 | this.button2.UseVisualStyleBackColor = true;
64 | this.button2.Click += new System.EventHandler(this.button2_Click);
65 | //
66 | // Configure
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(286, 76);
71 | this.Controls.Add(this.button2);
72 | this.Controls.Add(this.button1);
73 | this.Controls.Add(this.checkBox1);
74 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
75 | this.MaximizeBox = false;
76 | this.MinimizeBox = false;
77 | this.Name = "Configure";
78 | this.ShowIcon = false;
79 | this.ShowInTaskbar = false;
80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
81 | this.Text = "Configure Model Viewer";
82 | this.Load += new System.EventHandler(this.Configure_Load);
83 | this.ResumeLayout(false);
84 | this.PerformLayout();
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.Button button1;
91 | private System.Windows.Forms.Button button2;
92 | public System.Windows.Forms.CheckBox checkBox1;
93 | }
94 | }
--------------------------------------------------------------------------------
/ItemViewer/Configure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ItemViewer
12 | {
13 | public partial class Configure : Form
14 | {
15 | public Configure()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Configure_Load(object sender, EventArgs e)
21 | {
22 |
23 | }
24 |
25 | private void button1_Click(object sender, EventArgs e)
26 | {
27 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
28 | this.Close();
29 | }
30 |
31 | private void button2_Click(object sender, EventArgs e)
32 | {
33 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
34 | this.Close();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ItemViewer/ItemToolbox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ItemViewer
2 | {
3 | partial class ItemToolbox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.nItem = new System.Windows.Forms.NumericUpDown();
33 | this.nAmount = new System.Windows.Forms.NumericUpDown();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.chkModelSprite = new System.Windows.Forms.CheckBox();
36 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).BeginInit();
37 | ((System.ComponentModel.ISupportInitialize)(this.nAmount)).BeginInit();
38 | this.SuspendLayout();
39 | //
40 | // label1
41 | //
42 | this.label1.AutoSize = true;
43 | this.label1.Location = new System.Drawing.Point(19, 21);
44 | this.label1.Name = "label1";
45 | this.label1.Size = new System.Drawing.Size(30, 13);
46 | this.label1.TabIndex = 0;
47 | this.label1.Text = "Item:";
48 | //
49 | // nItem
50 | //
51 | this.nItem.Location = new System.Drawing.Point(55, 19);
52 | this.nItem.Maximum = new decimal(new int[] {
53 | 10000,
54 | 0,
55 | 0,
56 | 0});
57 | this.nItem.Name = "nItem";
58 | this.nItem.Size = new System.Drawing.Size(109, 20);
59 | this.nItem.TabIndex = 1;
60 | //
61 | // nAmount
62 | //
63 | this.nAmount.Location = new System.Drawing.Point(55, 45);
64 | this.nAmount.Maximum = new decimal(new int[] {
65 | 2147483647,
66 | 0,
67 | 0,
68 | 0});
69 | this.nAmount.Name = "nAmount";
70 | this.nAmount.Size = new System.Drawing.Size(109, 20);
71 | this.nAmount.TabIndex = 3;
72 | this.nAmount.Value = new decimal(new int[] {
73 | 1,
74 | 0,
75 | 0,
76 | 0});
77 | //
78 | // label2
79 | //
80 | this.label2.AutoSize = true;
81 | this.label2.Location = new System.Drawing.Point(3, 47);
82 | this.label2.Name = "label2";
83 | this.label2.Size = new System.Drawing.Size(46, 13);
84 | this.label2.TabIndex = 2;
85 | this.label2.Text = "Amount:";
86 | //
87 | // chkModelSprite
88 | //
89 | this.chkModelSprite.AutoSize = true;
90 | this.chkModelSprite.Location = new System.Drawing.Point(6, 71);
91 | this.chkModelSprite.Name = "chkModelSprite";
92 | this.chkModelSprite.Size = new System.Drawing.Size(147, 17);
93 | this.chkModelSprite.TabIndex = 4;
94 | this.chkModelSprite.Text = "Lock Item Sprite to Model";
95 | this.chkModelSprite.UseVisualStyleBackColor = true;
96 | //
97 | // ItemToolbox
98 | //
99 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
100 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
101 | this.Controls.Add(this.chkModelSprite);
102 | this.Controls.Add(this.nAmount);
103 | this.Controls.Add(this.label2);
104 | this.Controls.Add(this.nItem);
105 | this.Controls.Add(this.label1);
106 | this.Name = "ItemToolbox";
107 | this.Size = new System.Drawing.Size(167, 150);
108 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).EndInit();
109 | ((System.ComponentModel.ISupportInitialize)(this.nAmount)).EndInit();
110 | this.ResumeLayout(false);
111 | this.PerformLayout();
112 |
113 | }
114 |
115 | #endregion
116 |
117 | private System.Windows.Forms.Label label1;
118 | private System.Windows.Forms.NumericUpDown nItem;
119 | private System.Windows.Forms.NumericUpDown nAmount;
120 | private System.Windows.Forms.Label label2;
121 | private System.Windows.Forms.CheckBox chkModelSprite;
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/ItemViewer/ItemToolbox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ItemViewer
12 | {
13 | public partial class ItemToolbox : UserControl
14 | {
15 | public ItemToolbox()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ItemViewer/ItemViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {26EA5541-1F08-4254-A387-5BFD283DDC51}
8 | Library
9 | Properties
10 | ItemViewer
11 | ItemViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | ..\Cache Editor\bin\Release\Plugins\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | Form
46 |
47 |
48 | Configure.cs
49 |
50 |
51 | UserControl
52 |
53 |
54 | ItemToolbox.cs
55 |
56 |
57 |
58 |
59 | True
60 | True
61 | Resources.resx
62 |
63 |
64 | Form
65 |
66 |
67 | Window.cs
68 |
69 |
70 |
71 |
72 | {18b60f83-9129-474e-a55a-e30ac544b900}
73 | Cache Editor API
74 | False
75 |
76 |
77 |
78 |
79 | Configure.cs
80 |
81 |
82 | ItemToolbox.cs
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 |
88 |
89 | Window.cs
90 |
91 |
92 |
93 |
100 |
--------------------------------------------------------------------------------
/ItemViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ItemViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ItemViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("289bec41-b16c-408e-999d-a7431a0774b7")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ItemViewer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.0
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ItemViewer.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ItemViewer.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ItemViewer/Window.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ItemViewer
12 | {
13 | public partial class Window : Form
14 | {
15 | public Window()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ModelViewer/Configure.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ModelViewer
2 | {
3 | partial class Configure
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.checkBox1 = new System.Windows.Forms.CheckBox();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.button2 = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // checkBox1
37 | //
38 | this.checkBox1.AutoSize = true;
39 | this.checkBox1.Location = new System.Drawing.Point(12, 12);
40 | this.checkBox1.Name = "checkBox1";
41 | this.checkBox1.Size = new System.Drawing.Size(262, 17);
42 | this.checkBox1.TabIndex = 0;
43 | this.checkBox1.Text = "Use Software Rendering (only use if OpenGL fails)";
44 | this.checkBox1.UseVisualStyleBackColor = true;
45 | //
46 | // button1
47 | //
48 | this.button1.Location = new System.Drawing.Point(65, 41);
49 | this.button1.Name = "button1";
50 | this.button1.Size = new System.Drawing.Size(75, 23);
51 | this.button1.TabIndex = 1;
52 | this.button1.Text = "OK";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // button2
57 | //
58 | this.button2.Location = new System.Drawing.Point(146, 41);
59 | this.button2.Name = "button2";
60 | this.button2.Size = new System.Drawing.Size(75, 23);
61 | this.button2.TabIndex = 2;
62 | this.button2.Text = "Cancel";
63 | this.button2.UseVisualStyleBackColor = true;
64 | this.button2.Click += new System.EventHandler(this.button2_Click);
65 | //
66 | // Configure
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(286, 76);
71 | this.Controls.Add(this.button2);
72 | this.Controls.Add(this.button1);
73 | this.Controls.Add(this.checkBox1);
74 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
75 | this.MaximizeBox = false;
76 | this.MinimizeBox = false;
77 | this.Name = "Configure";
78 | this.ShowIcon = false;
79 | this.ShowInTaskbar = false;
80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
81 | this.Text = "Configure Model Viewer";
82 | this.Load += new System.EventHandler(this.Configure_Load);
83 | this.ResumeLayout(false);
84 | this.PerformLayout();
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.Button button1;
91 | private System.Windows.Forms.Button button2;
92 | public System.Windows.Forms.CheckBox checkBox1;
93 | }
94 | }
--------------------------------------------------------------------------------
/ModelViewer/Configure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ModelViewer
12 | {
13 | public partial class Configure : Form
14 | {
15 | public Configure()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Configure_Load(object sender, EventArgs e)
21 | {
22 |
23 | }
24 |
25 | private void button1_Click(object sender, EventArgs e)
26 | {
27 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
28 | this.Close();
29 | }
30 |
31 | private void button2_Click(object sender, EventArgs e)
32 | {
33 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
34 | this.Close();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ModelViewer/ModelViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 | using System.Windows.Forms;
8 | using Cache_Editor_API;
9 | using Cache_Editor_API.Graphics3D;
10 |
11 | namespace ModelViewer
12 | {
13 | public class ModelViewer : IPlugin
14 | {
15 | //basic
16 | public string Name { get { return "Model Viewer"; } }
17 | public string Author { get { return "Lin"; } }
18 | public string Version { get { return "1.1"; } }
19 | public string Description { get { return "Views and allows the basic importing and exporting of 317-format models."; } }
20 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
21 | public bool Dominant { get { return true; } }
22 |
23 | //properties to be filled in by the shell
24 | public CacheItemNode Node { get; set; }
25 | public DataBuffer Data { get; set; }
26 | public Cache Cache { get; set; }
27 |
28 | //optional
29 | public Control[] Controls { get; set; }
30 | public Control[] ToolControls { get; set; }
31 | public string StaticFileExtensions { get; set; }
32 | public string FileExtensions { get; set; }
33 | public Form ConfigureForm { get; set; }
34 |
35 | private static bool initialized;
36 | private Cache_Editor_API.Controls.ModelViewer model_viewer;
37 |
38 | public ModelViewer()
39 | {
40 | Classifications = new EditorClassifications();
41 | Classifications.Archives = new int[] { 1 };
42 | StaticFileExtensions = "";
43 | FileExtensions = "";
44 | ConfigureForm = new Configure();
45 |
46 | Controls = new Control[1];
47 | model_viewer = new Cache_Editor_API.Controls.ModelViewer();
48 | model_viewer.Dock = DockStyle.Fill;
49 | Controls[0] = model_viewer;
50 | initialized = false;
51 |
52 | ToolControls = new Control[0];
53 | /*ToolboxControls t = new ToolboxControls();
54 | ToolControls = new Control[t.Controls[0].Controls.Count];
55 | for (int i = 0; i < t.Controls[0].Controls.Count; i++)
56 | ToolControls[i] = t.Controls[0].Controls[i];*/
57 |
58 | }
59 |
60 | public void PluginSelected()
61 | {
62 | if (!initialized)
63 | {
64 | initialized = true;
65 | Rasterizer.LoadTextures(Cache);
66 | Rasterizer.ApplyBrightness(0.59999999999999998D);
67 | Rasterizer.ResetTextures();
68 | }
69 |
70 | model_viewer.UpdateBuffer();
71 |
72 | try
73 | {
74 | Model.LoadModel(Data.Buffer, Node.FileIndex);
75 | Model model = new Model(Node.FileIndex);
76 | model.Light(64, 768, -50, -10, -50, true);
77 | model_viewer.SelectedModel = model;
78 | }
79 | catch (Exception)
80 | {
81 | model_viewer.SelectedModel = null;
82 | }
83 | }
84 |
85 | public bool OnImport(string filename)
86 | {
87 | try
88 | {
89 | Model.LoadModel(Data.Buffer, Node.FileIndex);
90 | Model model = new Model(Node.FileIndex);
91 | model.Light(64, 768, -50, -10, -50, true);
92 | model_viewer.SelectedModel = model;
93 | }
94 | catch (Exception)
95 | {
96 | return false;
97 | }
98 |
99 | return true;
100 | }
101 |
102 | public void OnExport(string filename)
103 | {
104 | }
105 |
106 | public void OnConfigure()
107 | {
108 | Cache_Editor_API.Controls.ModelViewer.SoftwareRendering = ((Configure)ConfigureForm).checkBox1.Checked;
109 | if (Cache_Editor_API.Controls.ModelViewer.SoftwareRendering)
110 | {
111 | model_viewer.Controls[1].Visible = false;
112 | model_viewer.Controls[2].Visible = true;
113 | }
114 | else
115 | {
116 | model_viewer.Controls[1].Visible = true;
117 | model_viewer.Controls[2].Visible = false;
118 | }
119 | model_viewer.DrawModel();
120 | }
121 | }
122 | }
--------------------------------------------------------------------------------
/ModelViewer/ModelViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {005AE4E7-F112-4588-943D-F7BAAFCDD126}
8 | Library
9 | Properties
10 | ModelViewer
11 | ModelViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | Off
24 |
25 |
26 | pdbonly
27 | true
28 | ..\Cache Editor\bin\Release\Plugins\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | Form
47 |
48 |
49 | Configure.cs
50 |
51 |
52 |
53 |
54 | Component
55 |
56 |
57 | UserControl
58 |
59 |
60 | ToolboxControls.cs
61 |
62 |
63 |
64 |
65 | {18b60f83-9129-474e-a55a-e30ac544b900}
66 | Cache Editor API
67 | False
68 |
69 |
70 |
71 |
72 | Configure.cs
73 |
74 |
75 | ToolboxControls.cs
76 |
77 |
78 |
79 |
86 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ModelViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ModelViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("964b30ce-2aaa-43e8-8cdc-214e6bceeca0")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ModelViewer/SelectablePictureBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ModelViewer
6 | {
7 | class SelectablePictureBox : PictureBox
8 | {
9 | public SelectablePictureBox()
10 | {
11 | this.SetStyle(ControlStyles.Selectable, true);
12 | this.TabStop = true;
13 | }
14 | protected override void OnMouseDown(MouseEventArgs e)
15 | {
16 | this.Focus();
17 | base.OnMouseDown(e);
18 | }
19 | protected override void OnEnter(EventArgs e)
20 | {
21 | this.Invalidate();
22 | base.OnEnter(e);
23 | }
24 | protected override void OnLeave(EventArgs e)
25 | {
26 | this.Invalidate();
27 | base.OnLeave(e);
28 | }
29 | protected override void OnPaint(PaintEventArgs pe)
30 | {
31 | base.OnPaint(pe);
32 | if (this.Focused)
33 | {
34 | var rc = this.ClientRectangle;
35 | rc.Inflate(-2, -2);
36 | ControlPaint.DrawFocusRectangle(pe.Graphics, rc);
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/ModelViewer/ToolboxControls.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ModelViewer
2 | {
3 | partial class ToolboxControls
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupToolbox = new System.Windows.Forms.GroupBox();
32 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
33 | this.checkBox1 = new System.Windows.Forms.CheckBox();
34 | this.groupToolbox.SuspendLayout();
35 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
36 | this.SuspendLayout();
37 | //
38 | // groupToolbox
39 | //
40 | this.groupToolbox.Controls.Add(this.numericUpDown1);
41 | this.groupToolbox.Controls.Add(this.checkBox1);
42 | this.groupToolbox.Dock = System.Windows.Forms.DockStyle.Top;
43 | this.groupToolbox.Location = new System.Drawing.Point(0, 0);
44 | this.groupToolbox.Name = "groupToolbox";
45 | this.groupToolbox.Size = new System.Drawing.Size(184, 249);
46 | this.groupToolbox.TabIndex = 3;
47 | this.groupToolbox.TabStop = false;
48 | this.groupToolbox.Text = "Plugin Toolbox";
49 | //
50 | // numericUpDown1
51 | //
52 | this.numericUpDown1.Location = new System.Drawing.Point(93, 18);
53 | this.numericUpDown1.Name = "numericUpDown1";
54 | this.numericUpDown1.Size = new System.Drawing.Size(85, 20);
55 | this.numericUpDown1.TabIndex = 5;
56 | //
57 | // checkBox1
58 | //
59 | this.checkBox1.AutoSize = true;
60 | this.checkBox1.Location = new System.Drawing.Point(12, 19);
61 | this.checkBox1.Name = "checkBox1";
62 | this.checkBox1.Size = new System.Drawing.Size(75, 17);
63 | this.checkBox1.TabIndex = 4;
64 | this.checkBox1.Text = "Animation:";
65 | this.checkBox1.UseVisualStyleBackColor = true;
66 | //
67 | // ToolboxControls
68 | //
69 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
70 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
71 | this.Controls.Add(this.groupToolbox);
72 | this.Name = "ToolboxControls";
73 | this.Size = new System.Drawing.Size(184, 249);
74 | this.groupToolbox.ResumeLayout(false);
75 | this.groupToolbox.PerformLayout();
76 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
77 | this.ResumeLayout(false);
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private System.Windows.Forms.GroupBox groupToolbox;
84 | private System.Windows.Forms.NumericUpDown numericUpDown1;
85 | private System.Windows.Forms.CheckBox checkBox1;
86 |
87 |
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/ModelViewer/ToolboxControls.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ModelViewer
12 | {
13 | public partial class ToolboxControls : UserControl
14 | {
15 | public ToolboxControls()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/NPCViewer/Configure.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace NPCViewer
2 | {
3 | partial class Configure
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.checkBox1 = new System.Windows.Forms.CheckBox();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.button2 = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // checkBox1
37 | //
38 | this.checkBox1.AutoSize = true;
39 | this.checkBox1.Location = new System.Drawing.Point(12, 12);
40 | this.checkBox1.Name = "checkBox1";
41 | this.checkBox1.Size = new System.Drawing.Size(262, 17);
42 | this.checkBox1.TabIndex = 0;
43 | this.checkBox1.Text = "Use Software Rendering (only use if OpenGL fails)";
44 | this.checkBox1.UseVisualStyleBackColor = true;
45 | //
46 | // button1
47 | //
48 | this.button1.Location = new System.Drawing.Point(65, 41);
49 | this.button1.Name = "button1";
50 | this.button1.Size = new System.Drawing.Size(75, 23);
51 | this.button1.TabIndex = 1;
52 | this.button1.Text = "OK";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // button2
57 | //
58 | this.button2.Location = new System.Drawing.Point(146, 41);
59 | this.button2.Name = "button2";
60 | this.button2.Size = new System.Drawing.Size(75, 23);
61 | this.button2.TabIndex = 2;
62 | this.button2.Text = "Cancel";
63 | this.button2.UseVisualStyleBackColor = true;
64 | this.button2.Click += new System.EventHandler(this.button2_Click);
65 | //
66 | // Configure
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(286, 76);
71 | this.Controls.Add(this.button2);
72 | this.Controls.Add(this.button1);
73 | this.Controls.Add(this.checkBox1);
74 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
75 | this.MaximizeBox = false;
76 | this.MinimizeBox = false;
77 | this.Name = "Configure";
78 | this.ShowIcon = false;
79 | this.ShowInTaskbar = false;
80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
81 | this.Text = "Configure Model Viewer";
82 | this.Load += new System.EventHandler(this.Configure_Load);
83 | this.ResumeLayout(false);
84 | this.PerformLayout();
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.Button button1;
91 | private System.Windows.Forms.Button button2;
92 | public System.Windows.Forms.CheckBox checkBox1;
93 | }
94 | }
--------------------------------------------------------------------------------
/NPCViewer/Configure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NPCViewer
12 | {
13 | public partial class Configure : Form
14 | {
15 | public Configure()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Configure_Load(object sender, EventArgs e)
21 | {
22 |
23 | }
24 |
25 | private void button1_Click(object sender, EventArgs e)
26 | {
27 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
28 | this.Close();
29 | }
30 |
31 | private void button2_Click(object sender, EventArgs e)
32 | {
33 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
34 | this.Close();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/NPCViewer/NPCViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 | using System.Windows.Forms;
8 | using Cache_Editor_API;
9 | using Cache_Editor_API.Config;
10 | using Cache_Editor_API.Graphics3D;
11 | using Cache_Editor_API.Controls;
12 |
13 | namespace NPCViewer
14 | {
15 | public class NPCViewer : IPlugin
16 | {
17 | //basic
18 | public string Name { get { return "NPC Viewer"; } }
19 | public string Author { get { return "Lin"; } }
20 | public string Version { get { return "1.0"; } }
21 | public string Description { get { return "Views 317-format NPCs."; } }
22 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
23 | public bool Dominant { get { return true; } }
24 |
25 | //properties to be filled in by the shell
26 | public CacheItemNode Node { get; set; }
27 | public DataBuffer Data { get; set; }
28 | public Cache Cache { get; set; }
29 |
30 | //optional
31 | public Control[] Controls { get; set; }
32 | public Control[] ToolControls { get; set; }
33 | public string StaticFileExtensions { get; set; }
34 | public string FileExtensions { get; set; }
35 | public Form ConfigureForm { get; set; }
36 |
37 | private Bitmap checkerboard;
38 | private Label name_label;
39 | private PropertyGrid properties;
40 | private ModelViewer model_viewer;
41 |
42 | private int last_npc = -1;
43 | private bool initialized;
44 |
45 | public NPCViewer()
46 | {
47 | Classifications = new EditorClassifications();
48 | Classifications.Filenames = new string[] { "npc.dat" };
49 | FileExtensions = "";
50 | StaticFileExtensions = "";
51 | ConfigureForm = new Configure();
52 |
53 | Window window = new Window();
54 | this.Controls = new Control[window.Controls.Count];
55 | for (int i = 0; i < window.Controls.Count; i++)
56 | this.Controls[i] = window.Controls[i];
57 | name_label = (Label)window.Controls.Find("lblName", true)[0];
58 | properties = (PropertyGrid)window.Controls.Find("prop_item", true)[0];
59 | model_viewer = (ModelViewer)window.Controls.Find("modelViewer", true)[0];
60 | properties.PropertyValueChanged += properties_PropertyValueChanged;
61 |
62 | name_label.Text = "Select an NPC";
63 |
64 | ItemToolbox toolbox = new ItemToolbox();
65 | ToolControls = new Control[toolbox.Controls.Count];
66 | for (int i = 0; i < ToolControls.Length; i++)
67 | ToolControls[i] = toolbox.Controls[i];
68 | NumericUpDown n_item = (NumericUpDown)toolbox.Controls.Find("nItem", true)[0];
69 |
70 | n_item.ValueChanged += delegate(object sender, EventArgs e) { SelectNPC((int)n_item.Value, true); };
71 |
72 | checkerboard = new Bitmap(32, 32);
73 | Graphics g = Graphics.FromImage(checkerboard);
74 | g.Clear(Color.White);
75 | g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
76 | g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);
77 |
78 | last_npc = 0;
79 | initialized = false;
80 | }
81 |
82 | public void PluginSelected()
83 | {
84 | if (!initialized)
85 | {
86 | Cache_Editor_API.Graphics3D.Rasterizer.LoadTextures(Cache);
87 | Cache_Editor_API.Graphics3D.Rasterizer.ApplyBrightness(0.59999999999999998D);
88 | Cache_Editor_API.Graphics3D.Rasterizer.ResetTextures();
89 | Cache_Editor_API.Config.NPCDefinition.UnpackNPCs(Cache, Data, Cache.SubArchives[2].ExtractFile("npc.idx"));
90 | initialized = true;
91 | }
92 | model_viewer.UpdateBuffer();
93 |
94 | SelectNPC(last_npc, true, true);
95 | }
96 |
97 | public bool OnImport(string filename)
98 | {
99 | return true;
100 | }
101 |
102 | public void OnExport(string filename)
103 | {
104 | }
105 |
106 | public void OnConfigure()
107 | {
108 | ModelViewer.SoftwareRendering = ((Configure)ConfigureForm).checkBox1.Checked;
109 | if (ModelViewer.SoftwareRendering)
110 | {
111 | model_viewer.Controls[1].Visible = false;
112 | model_viewer.Controls[2].Visible = true;
113 | }
114 | else
115 | {
116 | model_viewer.Controls[1].Visible = true;
117 | model_viewer.Controls[2].Visible = false;
118 | }
119 | model_viewer.DrawModel();
120 | }
121 |
122 | public void SelectNPC(int index, bool update_rotation = false, bool force = false)
123 | {
124 | NPCDefinition item = NPCDefinition.GetNPC(index);
125 | properties.SelectedObject = item;
126 | name_label.Text = item.Name + " (" + item.ID + ")";
127 |
128 | if (force || last_npc != index)
129 | {
130 | model_viewer.SelectedModel = item.GetModel(0, 0, null);
131 |
132 | }
133 | else
134 | {
135 | model_viewer.SetModel(item.GetModel(0, 0, null), false);
136 | }
137 | last_npc = index;
138 | }
139 |
140 | private void properties_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
141 | {
142 | ChangesModel changes_model = (ChangesModel)e.ChangedItem.PropertyDescriptor.Attributes[typeof(ChangesModel)];
143 | if (changes_model != null)
144 | {
145 | if (changes_model.Changes)
146 | {
147 | SelectNPC(last_npc);
148 | }
149 | }
150 | }
151 | }
152 | }
--------------------------------------------------------------------------------
/NPCViewer/NPCViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EE5E0E0C-1A07-423B-B2B5-41CB62F55CB6}
8 | Library
9 | Properties
10 | NPCViewer
11 | NPCViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | Form
47 |
48 |
49 | Configure.cs
50 |
51 |
52 | UserControl
53 |
54 |
55 | ObjectToolbox.cs
56 |
57 |
58 |
59 | Form
60 |
61 |
62 | Window.cs
63 |
64 |
65 |
66 |
67 | Configure.cs
68 |
69 |
70 | ObjectToolbox.cs
71 |
72 |
73 | Window.cs
74 |
75 |
76 |
77 |
78 | {18b60f83-9129-474e-a55a-e30ac544b900}
79 | Cache Editor API
80 | False
81 |
82 |
83 |
84 |
91 |
--------------------------------------------------------------------------------
/NPCViewer/ObjectToolbox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace NPCViewer
2 | {
3 | partial class ItemToolbox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.nItem = new System.Windows.Forms.NumericUpDown();
33 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).BeginInit();
34 | this.SuspendLayout();
35 | //
36 | // label1
37 | //
38 | this.label1.AutoSize = true;
39 | this.label1.Location = new System.Drawing.Point(7, 21);
40 | this.label1.Name = "label1";
41 | this.label1.Size = new System.Drawing.Size(30, 13);
42 | this.label1.TabIndex = 0;
43 | this.label1.Text = "Item:";
44 | //
45 | // nItem
46 | //
47 | this.nItem.Location = new System.Drawing.Point(43, 19);
48 | this.nItem.Maximum = new decimal(new int[] {
49 | 10000,
50 | 0,
51 | 0,
52 | 0});
53 | this.nItem.Name = "nItem";
54 | this.nItem.Size = new System.Drawing.Size(121, 20);
55 | this.nItem.TabIndex = 1;
56 | //
57 | // ItemToolbox
58 | //
59 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
60 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
61 | this.Controls.Add(this.nItem);
62 | this.Controls.Add(this.label1);
63 | this.Name = "ItemToolbox";
64 | this.Size = new System.Drawing.Size(167, 150);
65 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).EndInit();
66 | this.ResumeLayout(false);
67 | this.PerformLayout();
68 |
69 | }
70 |
71 | #endregion
72 |
73 | private System.Windows.Forms.Label label1;
74 | private System.Windows.Forms.NumericUpDown nItem;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/NPCViewer/ObjectToolbox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NPCViewer
12 | {
13 | public partial class ItemToolbox : UserControl
14 | {
15 | public ItemToolbox()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/NPCViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NPCViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NPCViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("203b8050-36c5-4a82-ac81-9d21f4e911e8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NPCViewer/Window.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NPCViewer
12 | {
13 | public partial class Window : Form
14 | {
15 | public Window()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ObjectViewer/Configure.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ObjectViewer
2 | {
3 | partial class Configure
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.checkBox1 = new System.Windows.Forms.CheckBox();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.button2 = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // checkBox1
37 | //
38 | this.checkBox1.AutoSize = true;
39 | this.checkBox1.Location = new System.Drawing.Point(12, 12);
40 | this.checkBox1.Name = "checkBox1";
41 | this.checkBox1.Size = new System.Drawing.Size(262, 17);
42 | this.checkBox1.TabIndex = 0;
43 | this.checkBox1.Text = "Use Software Rendering (only use if OpenGL fails)";
44 | this.checkBox1.UseVisualStyleBackColor = true;
45 | //
46 | // button1
47 | //
48 | this.button1.Location = new System.Drawing.Point(65, 41);
49 | this.button1.Name = "button1";
50 | this.button1.Size = new System.Drawing.Size(75, 23);
51 | this.button1.TabIndex = 1;
52 | this.button1.Text = "OK";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // button2
57 | //
58 | this.button2.Location = new System.Drawing.Point(146, 41);
59 | this.button2.Name = "button2";
60 | this.button2.Size = new System.Drawing.Size(75, 23);
61 | this.button2.TabIndex = 2;
62 | this.button2.Text = "Cancel";
63 | this.button2.UseVisualStyleBackColor = true;
64 | this.button2.Click += new System.EventHandler(this.button2_Click);
65 | //
66 | // Configure
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(286, 76);
71 | this.Controls.Add(this.button2);
72 | this.Controls.Add(this.button1);
73 | this.Controls.Add(this.checkBox1);
74 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
75 | this.MaximizeBox = false;
76 | this.MinimizeBox = false;
77 | this.Name = "Configure";
78 | this.ShowIcon = false;
79 | this.ShowInTaskbar = false;
80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
81 | this.Text = "Configure Model Viewer";
82 | this.Load += new System.EventHandler(this.Configure_Load);
83 | this.ResumeLayout(false);
84 | this.PerformLayout();
85 |
86 | }
87 |
88 | #endregion
89 |
90 | private System.Windows.Forms.Button button1;
91 | private System.Windows.Forms.Button button2;
92 | public System.Windows.Forms.CheckBox checkBox1;
93 | }
94 | }
--------------------------------------------------------------------------------
/ObjectViewer/Configure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ObjectViewer
12 | {
13 | public partial class Configure : Form
14 | {
15 | public Configure()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Configure_Load(object sender, EventArgs e)
21 | {
22 |
23 | }
24 |
25 | private void button1_Click(object sender, EventArgs e)
26 | {
27 | this.DialogResult = System.Windows.Forms.DialogResult.OK;
28 | this.Close();
29 | }
30 |
31 | private void button2_Click(object sender, EventArgs e)
32 | {
33 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
34 | this.Close();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ObjectViewer/ObjectToolbox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ObjectViewer
2 | {
3 | partial class ItemToolbox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.nItem = new System.Windows.Forms.NumericUpDown();
33 | this.label2 = new System.Windows.Forms.Label();
34 | this.nType = new System.Windows.Forms.NumericUpDown();
35 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.nType)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // label1
40 | //
41 | this.label1.AutoSize = true;
42 | this.label1.Location = new System.Drawing.Point(7, 21);
43 | this.label1.Name = "label1";
44 | this.label1.Size = new System.Drawing.Size(30, 13);
45 | this.label1.TabIndex = 0;
46 | this.label1.Text = "Item:";
47 | //
48 | // nItem
49 | //
50 | this.nItem.Location = new System.Drawing.Point(43, 19);
51 | this.nItem.Maximum = new decimal(new int[] {
52 | 10000,
53 | 0,
54 | 0,
55 | 0});
56 | this.nItem.Name = "nItem";
57 | this.nItem.Size = new System.Drawing.Size(121, 20);
58 | this.nItem.TabIndex = 1;
59 | //
60 | // label2
61 | //
62 | this.label2.AutoSize = true;
63 | this.label2.Location = new System.Drawing.Point(3, 47);
64 | this.label2.Name = "label2";
65 | this.label2.Size = new System.Drawing.Size(34, 13);
66 | this.label2.TabIndex = 2;
67 | this.label2.Text = "Type:";
68 | //
69 | // nType
70 | //
71 | this.nType.Location = new System.Drawing.Point(43, 45);
72 | this.nType.Maximum = new decimal(new int[] {
73 | 255,
74 | 0,
75 | 0,
76 | 0});
77 | this.nType.Name = "nType";
78 | this.nType.Size = new System.Drawing.Size(121, 20);
79 | this.nType.TabIndex = 3;
80 | this.nType.Value = new decimal(new int[] {
81 | 1,
82 | 0,
83 | 0,
84 | 0});
85 | //
86 | // ItemToolbox
87 | //
88 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
89 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
90 | this.Controls.Add(this.nType);
91 | this.Controls.Add(this.label2);
92 | this.Controls.Add(this.nItem);
93 | this.Controls.Add(this.label1);
94 | this.Name = "ItemToolbox";
95 | this.Size = new System.Drawing.Size(167, 150);
96 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).EndInit();
97 | ((System.ComponentModel.ISupportInitialize)(this.nType)).EndInit();
98 | this.ResumeLayout(false);
99 | this.PerformLayout();
100 |
101 | }
102 |
103 | #endregion
104 |
105 | private System.Windows.Forms.Label label1;
106 | private System.Windows.Forms.NumericUpDown nItem;
107 | private System.Windows.Forms.Label label2;
108 | private System.Windows.Forms.NumericUpDown nType;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/ObjectViewer/ObjectToolbox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ObjectViewer
12 | {
13 | public partial class ItemToolbox : UserControl
14 | {
15 | public ItemToolbox()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ObjectViewer/ObjectViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 | using System.Windows.Forms;
8 | using Cache_Editor_API;
9 | using Cache_Editor_API.Config;
10 | using Cache_Editor_API.Graphics3D;
11 | using Cache_Editor_API.Controls;
12 |
13 | namespace ObjectViewer
14 | {
15 | public class ObjectViewer : IPlugin
16 | {
17 | //basic
18 | public string Name { get { return "Object Viewer"; } }
19 | public string Author { get { return "Lin"; } }
20 | public string Version { get { return "1.0"; } }
21 | public string Description { get { return "Views 317-format objects."; } }
22 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
23 | public bool Dominant { get { return true; } }
24 |
25 | //properties to be filled in by the shell
26 | public CacheItemNode Node { get; set; }
27 | public DataBuffer Data { get; set; }
28 | public Cache Cache { get; set; }
29 |
30 | //optional
31 | public Control[] Controls { get; set; }
32 | public Control[] ToolControls { get; set; }
33 | public string StaticFileExtensions { get; set; }
34 | public string FileExtensions { get; set; }
35 | public Form ConfigureForm { get; set; }
36 |
37 | private Bitmap checkerboard;
38 | private Label name_label;
39 | private PropertyGrid properties;
40 | private ModelViewer model_viewer;
41 | private NumericUpDown n_type;
42 |
43 | private int last_object = -1;
44 | private int last_type;
45 | private bool initialized;
46 |
47 | public ObjectViewer()
48 | {
49 | Classifications = new EditorClassifications();
50 | Classifications.Filenames = new string[] { "loc.dat" };
51 | FileExtensions = "";
52 | StaticFileExtensions = "";
53 | ConfigureForm = new Configure();
54 |
55 | Window window = new Window();
56 | this.Controls = new Control[window.Controls.Count];
57 | for (int i = 0; i < window.Controls.Count; i++)
58 | this.Controls[i] = window.Controls[i];
59 | name_label = (Label)window.Controls.Find("lblName", true)[0];
60 | properties = (PropertyGrid)window.Controls.Find("prop_item", true)[0];
61 | model_viewer = (ModelViewer)window.Controls.Find("modelViewer", true)[0];
62 | properties.PropertyValueChanged += properties_PropertyValueChanged;
63 |
64 | name_label.Text = "Select an object";
65 |
66 | ItemToolbox toolbox = new ItemToolbox();
67 | ToolControls = new Control[toolbox.Controls.Count];
68 | for (int i = 0; i < ToolControls.Length; i++)
69 | ToolControls[i] = toolbox.Controls[i];
70 | NumericUpDown n_item = (NumericUpDown)toolbox.Controls.Find("nItem", true)[0];
71 | n_type = (NumericUpDown)toolbox.Controls.Find("nType", true)[0];
72 |
73 | n_item.ValueChanged += delegate(object sender, EventArgs e) { SelectObject((int)n_item.Value, true); };
74 | n_type.ValueChanged += delegate(object sender, EventArgs e)
75 | {
76 | if (last_type != (int)n_type.Value)
77 | {
78 | last_type = (int)n_type.Value;
79 | SelectObject((int)n_item.Value, true);
80 | }
81 | };
82 |
83 | checkerboard = new Bitmap(32, 32);
84 | Graphics g = Graphics.FromImage(checkerboard);
85 | g.Clear(Color.White);
86 | g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
87 | g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);
88 |
89 | last_object = 0;
90 | initialized = false;
91 | }
92 |
93 | public void PluginSelected()
94 | {
95 | if (!initialized)
96 | {
97 | Cache_Editor_API.Graphics3D.Rasterizer.LoadTextures(Cache);
98 | Cache_Editor_API.Graphics3D.Rasterizer.ApplyBrightness(0.59999999999999998D);
99 | Cache_Editor_API.Graphics3D.Rasterizer.ResetTextures();
100 | Cache_Editor_API.Config.ObjectDefinition.UnpackObjects(Cache, Data, Cache.SubArchives[2].ExtractFile("loc.idx"));
101 | initialized = true;
102 | }
103 | model_viewer.UpdateBuffer();
104 |
105 | SelectObject(last_object, true, true);
106 | }
107 |
108 | public bool OnImport(string filename)
109 | {
110 | return true;
111 | }
112 |
113 | public void OnExport(string filename)
114 | {
115 | }
116 |
117 | public void OnConfigure()
118 | {
119 | ModelViewer.SoftwareRendering = ((Configure)ConfigureForm).checkBox1.Checked;
120 | if (ModelViewer.SoftwareRendering)
121 | {
122 | model_viewer.Controls[1].Visible = false;
123 | model_viewer.Controls[2].Visible = true;
124 | }
125 | else
126 | {
127 | model_viewer.Controls[1].Visible = true;
128 | model_viewer.Controls[2].Visible = false;
129 | }
130 | model_viewer.DrawModel();
131 | }
132 |
133 | public void SelectObject(int index, bool update_rotation = false, bool force = false)
134 | {
135 | ObjectDefinition item = ObjectDefinition.GetObject(index);
136 | properties.SelectedObject = item;
137 | name_label.Text = item.Name + " (" + item.ID + ")";
138 |
139 | if (force || last_object != index)
140 | {
141 | model_viewer.SelectedModel = item.GuessModel(0, 0, 0, 0, 0, 0);
142 | last_type = item.GuessedType;
143 | n_type.Value = last_type;
144 |
145 | }
146 | else
147 | {
148 | model_viewer.SetModel(item.GetModel(last_type, 0, 0, 0, 0, 0, 0), false);
149 | }
150 | last_object = index;
151 | }
152 |
153 | private void properties_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
154 | {
155 | ChangesModel changes_model = (ChangesModel)e.ChangedItem.PropertyDescriptor.Attributes[typeof(ChangesModel)];
156 | if (changes_model != null)
157 | {
158 | if (changes_model.Changes)
159 | {
160 | SelectObject(last_object);
161 | }
162 | }
163 | }
164 | }
165 | }
--------------------------------------------------------------------------------
/ObjectViewer/ObjectViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {31E0BB8E-2DAE-43DC-9F09-3A9B593C9BAC}
8 | Library
9 | Properties
10 | ObjectViewer
11 | ObjectViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | Form
46 |
47 |
48 | Configure.cs
49 |
50 |
51 | UserControl
52 |
53 |
54 | ObjectToolbox.cs
55 |
56 |
57 |
58 |
59 | Form
60 |
61 |
62 | Window.cs
63 |
64 |
65 |
66 |
67 | Configure.cs
68 |
69 |
70 | ObjectToolbox.cs
71 |
72 |
73 | Window.cs
74 |
75 |
76 |
77 |
78 | {18b60f83-9129-474e-a55a-e30ac544b900}
79 | Cache Editor API
80 | False
81 |
82 |
83 |
84 |
91 |
--------------------------------------------------------------------------------
/ObjectViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ObjectViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ObjectViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fc03e06a-fcca-4795-be81-9c500f35e5bb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ObjectViewer/Window.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ObjectViewer
12 | {
13 | public partial class Window : Form
14 | {
15 | public Window()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/PaletteViewer/PaletteViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 | using System.Windows.Forms;
8 | using Cache_Editor_API;
9 |
10 | namespace PaletteViewer
11 | {
12 | public class PaletteViewer : IPlugin
13 | {
14 | //basic
15 | public string Name { get { return "Palette Viewer"; } }
16 | public string Author { get { return "Lin"; } }
17 | public string Version { get { return "1.2"; } }
18 | public string Description { get { return "Views the palette an image archive uses."; } }
19 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
20 | public bool Dominant { get { return false; } }
21 |
22 | //properties to be filled in by the shell
23 | public CacheItemNode Node { get; set; }
24 | public DataBuffer Data { get; set; }
25 | public Cache Cache { get; set; }
26 |
27 | //optional
28 | public Control[] Controls { get; set; }
29 | public Control[] ToolControls { get; set; }
30 | public string StaticFileExtensions { get; set; }
31 | public string FileExtensions { get; set; }
32 | public Form ConfigureForm { get; set; }
33 |
34 | private Bitmap checkerboard;
35 |
36 | public PaletteViewer()
37 | {
38 | Classifications = new EditorClassifications();
39 | Classifications.SubArchives = new int[] { 1, 4, 6 };
40 | StaticFileExtensions = "";
41 | FileExtensions = "";
42 |
43 | Controls = new Control[2];
44 | Label not = new Label();
45 | not.AutoSize = false;
46 | not.Text = "Not an image";
47 | not.Dock = DockStyle.Fill;
48 | not.TextAlign = ContentAlignment.MiddleCenter;
49 | not.Visible = false;
50 | Controls[1] = not;
51 |
52 | PictureBox image = new PictureBox();
53 | image.SizeMode = PictureBoxSizeMode.CenterImage;
54 | image.Dock = DockStyle.Fill;
55 | Controls[0] = image;
56 |
57 | ToolControls = new Control[0];
58 |
59 | checkerboard = new Bitmap(32, 32);
60 | Graphics g = Graphics.FromImage(checkerboard);
61 | g.Clear(Color.White);
62 | g.FillRectangle(Brushes.LightGray, 0, 0, 16, 16);
63 | g.FillRectangle(Brushes.LightGray, 16, 16, 16, 16);
64 | image.BackgroundImage = checkerboard;
65 | image.BackgroundImageLayout = ImageLayout.Tile;
66 | }
67 |
68 | public void PluginSelected()
69 | {
70 | RSImage image = new RSImage(Cache, Node, Data, 0);
71 | ((PictureBox)Controls[0]).Image = image.GeneratePaletteBitmap();
72 | if (((PictureBox)Controls[0]).Image == null)
73 | {
74 | Controls[0].Visible = false;
75 | Controls[1].Visible = true;
76 | FileExtensions = "";
77 | }
78 | else
79 | {
80 | Controls[0].Visible = true;
81 | Controls[1].Visible = false;
82 | FileExtensions = "";
83 | }
84 | }
85 |
86 | public bool OnImport(string filename)
87 | {
88 | return false;
89 | }
90 |
91 | public void OnExport(string filename)
92 | {
93 | }
94 |
95 | public void OnConfigure()
96 | {
97 | }
98 | }
99 | }
--------------------------------------------------------------------------------
/PaletteViewer/PaletteViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {92E7D995-D042-49C7-841B-171ED2D708D2}
8 | Library
9 | Properties
10 | PaletteViewer
11 | PaletteViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | Off
24 |
25 |
26 | pdbonly
27 | true
28 | ..\Cache Editor\bin\Release\Plugins\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | {18b60f83-9129-474e-a55a-e30ac544b900}
51 | Cache Editor API
52 | False
53 |
54 |
55 |
56 |
63 |
--------------------------------------------------------------------------------
/PaletteViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PaletteViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PaletteViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("62f2d4b6-3c87-4059-8244-a885a719eb31")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cachesuite
2 | 317 Cache Suite
3 |
4 | A plugin-based RuneScape 317 cache editor.
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/VarBitViewer/ItemToolbox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace VarBitViewer
2 | {
3 | partial class ItemToolbox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.nItem = new System.Windows.Forms.NumericUpDown();
33 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).BeginInit();
34 | this.SuspendLayout();
35 | //
36 | // label1
37 | //
38 | this.label1.AutoSize = true;
39 | this.label1.Location = new System.Drawing.Point(7, 21);
40 | this.label1.Name = "label1";
41 | this.label1.Size = new System.Drawing.Size(36, 13);
42 | this.label1.TabIndex = 0;
43 | this.label1.Text = "Index:";
44 | //
45 | // nItem
46 | //
47 | this.nItem.Location = new System.Drawing.Point(49, 19);
48 | this.nItem.Maximum = new decimal(new int[] {
49 | 10000,
50 | 0,
51 | 0,
52 | 0});
53 | this.nItem.Name = "nItem";
54 | this.nItem.Size = new System.Drawing.Size(115, 20);
55 | this.nItem.TabIndex = 1;
56 | //
57 | // ItemToolbox
58 | //
59 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
60 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
61 | this.Controls.Add(this.nItem);
62 | this.Controls.Add(this.label1);
63 | this.Name = "ItemToolbox";
64 | this.Size = new System.Drawing.Size(167, 150);
65 | ((System.ComponentModel.ISupportInitialize)(this.nItem)).EndInit();
66 | this.ResumeLayout(false);
67 | this.PerformLayout();
68 |
69 | }
70 |
71 | #endregion
72 |
73 | private System.Windows.Forms.Label label1;
74 | private System.Windows.Forms.NumericUpDown nItem;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/VarBitViewer/ItemToolbox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace VarBitViewer
12 | {
13 | public partial class ItemToolbox : UserControl
14 | {
15 | public ItemToolbox()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/VarBitViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("VarBitViewer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("VarBitViewer")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ff0852ec-6798-4ad1-b584-f1301a8024f1")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/VarBitViewer/VarBitViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using System.IO;
8 | using Cache_Editor_API;
9 | using Cache_Editor_API.Config;
10 |
11 | namespace VarBitViewer
12 | {
13 | public class VarBitViewer : IPlugin
14 | {
15 | //basic
16 | public string Name { get { return "VarBit Viewer"; } }
17 | public string Author { get { return "Lin"; } }
18 | public string Version { get { return "1.0"; } }
19 | public string Description { get { return "Views 317-format VarBit."; } }
20 | public EditorClassifications Classifications { get; set; } //what triggers this editor to be used
21 | public bool Dominant { get { return true; } }
22 |
23 | //properties to be filled in by the shell
24 | public CacheItemNode Node { get; set; }
25 | public DataBuffer Data { get; set; }
26 | public Cache Cache { get; set; }
27 |
28 | //optional
29 | public Control[] Controls { get; set; }
30 | public Control[] ToolControls { get; set; }
31 | public string FileExtensions { get; set; }
32 | public string StaticFileExtensions { get; set; }
33 | public Form ConfigureForm { get; set; }
34 |
35 | private PropertyGrid properties;
36 | private bool initialized = false;
37 | private int last_var;
38 |
39 | public VarBitViewer()
40 | {
41 | Classifications = new EditorClassifications();
42 | Classifications.Filenames = new string[] { "varbit.dat" };
43 | FileExtensions = "";
44 | StaticFileExtensions = "";
45 |
46 | Controls = new Control[1];
47 | properties = new PropertyGrid();
48 | properties.Dock = DockStyle.Fill;
49 | Controls[0] = properties;
50 |
51 | ItemToolbox toolbox = new ItemToolbox();
52 | ToolControls = new Control[toolbox.Controls.Count];
53 | for (int i = 0; i < ToolControls.Length; i++)
54 | ToolControls[i] = toolbox.Controls[i];
55 | NumericUpDown n_item = (NumericUpDown)toolbox.Controls.Find("nItem", true)[0];
56 |
57 | n_item.ValueChanged += delegate(object sender, EventArgs e) { SelectVarBit((int)n_item.Value); };
58 |
59 | initialized = false;
60 | last_var = 0;
61 | }
62 |
63 | public void PluginSelected()
64 | {
65 | if (!initialized)
66 | {
67 | VarBit.UnpackVariables(Cache, Data);
68 | initialized = true;
69 | }
70 |
71 | SelectVarBit(last_var);
72 | }
73 |
74 | public bool OnImport(string filename)
75 | {
76 | return false;
77 | }
78 |
79 | public void OnExport(string filename)
80 | {
81 | }
82 |
83 | public void OnConfigure()
84 | {
85 | }
86 |
87 | public void SelectVarBit(int index)
88 | {
89 | properties.SelectedObject = VarBit.GetVarBit(index);
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/VarBitViewer/VarBitViewer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {52090942-1303-4193-83B1-F94FD17B087A}
8 | Library
9 | Properties
10 | VarBitViewer
11 | VarBitViewer
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\Cache Editor\bin\Debug\Plugins\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | UserControl
47 |
48 |
49 | ItemToolbox.cs
50 |
51 |
52 |
53 |
54 |
55 | ItemToolbox.cs
56 |
57 |
58 |
59 |
60 | {18b60f83-9129-474e-a55a-e30ac544b900}
61 | Cache Editor API
62 | False
63 |
64 |
65 |
66 |
73 |
--------------------------------------------------------------------------------