From: <je...@us...> - 2007-05-23 16:44:58
|
Revision: 1389 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1389&view=rev Author: jendave Date: 2007-05-23 09:44:53 -0700 (Wed, 23 May 2007) Log Message: ----------- more fxcop fixes Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs trunk/scsharp/src/SCSharpLib/MpqLib/PKLibDecompress.cs trunk/scsharp/src/SCSharpLib/MpqLib/Smk.cs trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs trunk/scsharp/src/SCSharpLib/UI/Game.cs trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/LoadSavedScreen.cs trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs trunk/scsharp/src/SCSharpLib/UI/Painter.cs trunk/scsharp/src/SCSharpLib/UI/Pcx.cs trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs trunk/scsharp/src/SCSharpLib/UI/Sprite.cs trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs trunk/scsharp/src/SCSharpLib/UI/UIElement.cs trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs trunk/scsharp/src/SCSharpLib/UI/Unit.cs trunk/scsharp/src/SCSharpLib/UI/VideoDialog.cs trunk/scsharp/tests/DumpChk.cs trunk/scsharp/tests/DumpIScript.cs Added Paths: ----------- trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs trunk/scsharp/src/SCSharpLib/UI/SCException.cs trunk/scsharp/src/SCSharpLib/UI/SCResources.cs Removed Paths: ------------- trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs trunk/scsharp/src/SCSharpLib/UI/Resources.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -202,7 +202,7 @@ SectionData sec = sections[sectionName]; if (sec == null) { - throw new Exception(String.Format("map file is missing section {0}, cannot load", sectionName)); + throw new SCException(String.Format("map file is missing section {0}, cannot load", sectionName)); } if (sec.Buffer == null) Deleted: trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -1,254 +0,0 @@ -#region LICENSE -// -// Authors: -// Chris Toshok (to...@hu...) -// -// (C) 2006 The Hungry Programmers (http://www.hungry.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -#endregion LICENSE - -using System; -using System.IO; -using System.Collections.Generic; -using System.Text; - -using SCSharp.UI; - -namespace SCSharp.MpqLib -{ - /// <summary> - /// - /// </summary> - public class SCFont : IMpqResource - { - Stream stream; - - /// <summary> - /// - /// </summary> - public SCFont() - { - } - - /// <summary> - /// - /// </summary> - /// <param name="stream"></param> - public void ReadFromStream(Stream stream) - { - this.stream = stream; - ReadFontHeader(); - ReadGlyphOffsets(); - - glyphs = new Dictionary<int, Glyph>(); - } - - void ReadFontHeader() - { - /*uint name =*/ - Utilities.ReadDWord(stream); - - lowIndex = Utilities.ReadByte(stream); - highIndex = Utilities.ReadByte(stream); - - if (lowIndex > highIndex) - { - byte tmp = lowIndex; - lowIndex = highIndex; - highIndex = tmp; - } - maxWidth = Utilities.ReadByte(stream); - maxHeight = Utilities.ReadByte(stream); - /*uint unknown =*/ - Utilities.ReadDWord(stream); - } - - Dictionary<uint, uint> offsets; - - void ReadGlyphOffsets() - { - offsets = new Dictionary<uint, uint>(); - for (uint c = lowIndex; c < highIndex; c++) - { - offsets.Add(c, Utilities.ReadDWord(stream)); - } - } - - Glyph GetGlyph(int glyphID) - { - if (glyphs.ContainsKey(glyphID)) - { - return glyphs[glyphID]; - } - - stream.Position = offsets[(uint)glyphID]; - - byte letterWidth = Utilities.ReadByte(stream); - byte letterHeight = Utilities.ReadByte(stream); - byte letterXOffset = Utilities.ReadByte(stream); - byte letterYOffset = Utilities.ReadByte(stream); - - byte[,] bitmap = new byte[letterHeight, letterWidth]; - - int x, y; - x = letterWidth - 1; - y = letterHeight - 1; - while (true) - { - byte b = Utilities.ReadByte(stream); - int count = (b & 0xF8) >> 3; - byte cmap_entry = (byte)(b & 0x07); - - for (int i = 0; i < count; i++) - { - bitmap[y, x] = 0; - x--; - if (x < 0) - { - x = letterWidth - 1; - y--; - if (y < 0) - { - goto done; - } - } - } - - bitmap[y, x] = (byte)cmap_entry; - x--; - if (x < 0) - { - x = letterWidth - 1; - y--; - if (y < 0) - { - goto done; - } - } - } - done: - glyphs.Add(glyphID, - new Glyph(letterWidth, - letterHeight, - letterXOffset, - letterYOffset, - bitmap)); - - return glyphs[glyphID]; - } - - /// <summary> - /// - /// </summary> - /// <param name="index"></param> - /// <returns></returns> - public Glyph this[int index] - { - get - { - if (index < lowIndex || index > highIndex) - { - throw new ArgumentOutOfRangeException("index", - String.Format("value of {0} out of range of {1}-{2}", index, lowIndex, highIndex)); - } - - return GetGlyph(index); - } - } - - /// <summary> - /// - /// </summary> - public int SpaceSize - { - get { return this[109 - 1].Width; /* 109 = ascii for 'm' */ } - } - - /// <summary> - /// - /// </summary> - public int LineSize - { - get { return maxHeight; } - } - - /// <summary> - /// - /// </summary> - public int MaxWidth - { - get { return maxWidth; } - } - - /// <summary> - /// - /// </summary> - public int MaxHeight - { - get { return maxHeight; } - } - - Dictionary<int, Glyph> glyphs; - byte highIndex; - byte lowIndex; - byte maxWidth; - byte maxHeight; - - /// <summary> - /// - /// </summary> - public void DumpGlyphs() - { - for (int c = lowIndex; c < highIndex; c++) - { - Console.WriteLine("Letter: {0}", c); - DumpGlyph(c); - } - } - - /// <summary> - /// - /// </summary> - /// <param name="glyphID"></param> - public void DumpGlyph(int glyphID) - { - Glyph g = GetGlyph(glyphID); - byte[,] bitmap = g.Bitmap; - for (int y = g.Height - 1; y >= 0; y--) - { - for (int x = g.Width - 1; x >= 0; x--) - { - if (bitmap[y, x] == 0) - { - Console.Write(" "); - } - else - { - Console.Write("#"); - } - } - Console.WriteLine(); - } - Console.WriteLine(); - } - } -} Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -103,7 +103,7 @@ if (frame > frameCount || frame < 0) { - throw new Exception(); + throw new SCException(); } if (frameCache.ContainsKey(frame)) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -33,6 +33,8 @@ using System.Collections; using System.IO; +using SCSharp.UI; + namespace SCSharp.MpqLib { /// <summary> @@ -80,7 +82,7 @@ { if (LocateMpqHeader() == false) { - throw new Exception("Unable to find MPQ header"); + throw new SCException("Unable to find MPQ header"); } BinaryReader br = new BinaryReader(mStream); @@ -324,7 +326,7 @@ /// <returns></returns> public override Stream GetStreamForResource(string path) { - throw new Exception("The method or operation is not implemented."); + throw new SCException("The method or operation is not implemented."); } } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -34,6 +34,8 @@ using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.BZip2; +using SCSharp.UI; + namespace SCSharp.MpqLib { /// <summary> @@ -95,7 +97,7 @@ mSeed1 = MpqArchive.DetectFileSeed(mBlockPositions, blockpossize); if (mSeed1 == 0) { - throw new Exception("Unable to determine encryption seed"); + throw new SCException("Unable to determine encryption seed"); } } MpqArchive.DecryptBlock(mBlockPositions, mSeed1); @@ -131,7 +133,7 @@ { if (mSeed1 == 0) { - throw new Exception("Unable to determine encryption key"); + throw new SCException("Unable to determine encryption key"); } MpqArchive.DecryptBlock(data, (uint)(mSeed1 + blockIndex)); } @@ -404,7 +406,7 @@ } sinput = new MemoryStream(result); } - throw new Exception(String.Format("Unhandled compression flags: 0x{0:X}", comptype)); + throw new SCException(String.Format("Unhandled compression flags: 0x{0:X}", comptype)); } //private static byte[] BZip2Decompress(Stream data, int expectedLength) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/PKLibDecompress.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/PKLibDecompress.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/PKLibDecompress.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -32,6 +32,8 @@ using System; using System.IO; +using SCSharp.UI; + namespace SCSharp.MpqLib { enum CompressionType @@ -106,14 +108,14 @@ mCType = (CompressionType)input.ReadByte(); if (mCType != CompressionType.Binary && mCType != CompressionType.Ascii) { - throw new Exception("Invalid compression type: " + mCType); + throw new SCException("Invalid compression type: " + mCType); } mDSizeBits = input.ReadByte(); // This is 6 in test cases if (4 > mDSizeBits || mDSizeBits > 6) { - throw new Exception("Invalid dictionary size: " + mDSizeBits); + throw new SCException("Invalid dictionary size: " + mDSizeBits); } } Added: trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -0,0 +1,254 @@ +#region LICENSE +// +// Authors: +// Chris Toshok (to...@hu...) +// +// (C) 2006 The Hungry Programmers (http://www.hungry.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#endregion LICENSE + +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; + +using SCSharp.UI; + +namespace SCSharp.MpqLib +{ + /// <summary> + /// + /// </summary> + public class SCFont : IMpqResource + { + Stream stream; + + /// <summary> + /// + /// </summary> + public SCFont() + { + } + + /// <summary> + /// + /// </summary> + /// <param name="stream"></param> + public void ReadFromStream(Stream stream) + { + this.stream = stream; + ReadFontHeader(); + ReadGlyphOffsets(); + + glyphs = new Dictionary<int, Glyph>(); + } + + void ReadFontHeader() + { + /*uint name =*/ + Utilities.ReadDWord(stream); + + lowIndex = Utilities.ReadByte(stream); + highIndex = Utilities.ReadByte(stream); + + if (lowIndex > highIndex) + { + byte tmp = lowIndex; + lowIndex = highIndex; + highIndex = tmp; + } + maxWidth = Utilities.ReadByte(stream); + maxHeight = Utilities.ReadByte(stream); + /*uint unknown =*/ + Utilities.ReadDWord(stream); + } + + Dictionary<uint, uint> offsets; + + void ReadGlyphOffsets() + { + offsets = new Dictionary<uint, uint>(); + for (uint c = lowIndex; c < highIndex; c++) + { + offsets.Add(c, Utilities.ReadDWord(stream)); + } + } + + Glyph GetGlyph(int glyphID) + { + if (glyphs.ContainsKey(glyphID)) + { + return glyphs[glyphID]; + } + + stream.Position = offsets[(uint)glyphID]; + + byte letterWidth = Utilities.ReadByte(stream); + byte letterHeight = Utilities.ReadByte(stream); + byte letterXOffset = Utilities.ReadByte(stream); + byte letterYOffset = Utilities.ReadByte(stream); + + byte[,] bitmap = new byte[letterHeight, letterWidth]; + + int x, y; + x = letterWidth - 1; + y = letterHeight - 1; + while (true) + { + byte b = Utilities.ReadByte(stream); + int count = (b & 0xF8) >> 3; + byte cmap_entry = (byte)(b & 0x07); + + for (int i = 0; i < count; i++) + { + bitmap[y, x] = 0; + x--; + if (x < 0) + { + x = letterWidth - 1; + y--; + if (y < 0) + { + goto done; + } + } + } + + bitmap[y, x] = (byte)cmap_entry; + x--; + if (x < 0) + { + x = letterWidth - 1; + y--; + if (y < 0) + { + goto done; + } + } + } + done: + glyphs.Add(glyphID, + new Glyph(letterWidth, + letterHeight, + letterXOffset, + letterYOffset, + bitmap)); + + return glyphs[glyphID]; + } + + /// <summary> + /// + /// </summary> + /// <param name="index"></param> + /// <returns></returns> + public Glyph this[int index] + { + get + { + if (index < lowIndex || index > highIndex) + { + throw new ArgumentOutOfRangeException("index", + String.Format("value of {0} out of range of {1}-{2}", index, lowIndex, highIndex)); + } + + return GetGlyph(index); + } + } + + /// <summary> + /// + /// </summary> + public int SpaceSize + { + get { return this[109 - 1].Width; /* 109 = ascii for 'm' */ } + } + + /// <summary> + /// + /// </summary> + public int LineSize + { + get { return maxHeight; } + } + + /// <summary> + /// + /// </summary> + public int MaxWidth + { + get { return maxWidth; } + } + + /// <summary> + /// + /// </summary> + public int MaxHeight + { + get { return maxHeight; } + } + + Dictionary<int, Glyph> glyphs; + byte highIndex; + byte lowIndex; + byte maxWidth; + byte maxHeight; + + /// <summary> + /// + /// </summary> + public void DumpGlyphs() + { + for (int c = lowIndex; c < highIndex; c++) + { + Console.WriteLine("Letter: {0}", c); + DumpGlyph(c); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="glyphID"></param> + public void DumpGlyph(int glyphID) + { + Glyph g = GetGlyph(glyphID); + byte[,] bitmap = g.Bitmap; + for (int y = g.Height - 1; y >= 0; y--) + { + for (int x = g.Width - 1; x >= 0; x--) + { + if (bitmap[y, x] == 0) + { + Console.Write(" "); + } + else + { + Console.Write("#"); + } + } + Console.WriteLine(); + } + Console.WriteLine(); + } + } +} Property changes on: trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Smk.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Smk.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Smk.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -119,7 +119,7 @@ signature = Utilities.ReadDWord (stream); if (signature != 0x324b4d53 /* SMK2 */ && signature != 0x344b4d53 /* SMK4 */) - throw new Exception ("invalid file"); + throw new SCException ("invalid file"); width = Utilities.ReadDWord (stream); height = Utilities.ReadDWord (stream); frames = Utilities.ReadDWord (stream); @@ -842,7 +842,7 @@ if (current_bit == 0) { current_bit = 8; if (current_byte_index + 1 > buf.Length) - throw new Exception (String.Format ("about to read off end of {0} byte buffer", buf.Length)); + throw new SCException (String.Format ("about to read off end of {0} byte buffer", buf.Length)); current_byte_index++; current_byte = buf[current_byte_index]; } @@ -892,7 +892,7 @@ AssertAtByteBoundary(); if (current_byte_index + length > buf.Length) - throw new Exception (); + throw new SCException (); Array.Copy (buf, current_byte_index, dest, index, length); @@ -906,7 +906,7 @@ public void AssertAtByteBoundary () { if (current_bit != 8) - throw new Exception ("this operation only works on byte boundaries"); + throw new SCException ("this operation only works on byte boundaries"); } int saved_start; @@ -951,7 +951,7 @@ { currentNode = bs.ReadBit() == 0 ? currentNode.branch_0 : currentNode.branch_1; if (currentNode == null) - throw new Exception ("can't advance to child nodes from a leaf node"); + throw new SCException ("can't advance to child nodes from a leaf node"); } public void Reset () @@ -961,7 +961,7 @@ public uint Value { get { - if (!IsLeaf) throw new Exception ("this node is not a leaf"); + if (!IsLeaf) throw new SCException ("this node is not a leaf"); return tree.ReturnNodeValue (currentNode); } } @@ -1090,7 +1090,7 @@ { if (node.value == -1) { /* it's a marker */ - throw new Exception (); + throw new SCException (); } else return (uint)node.value; Added: trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -0,0 +1,75 @@ +#region LICENSE +// +// Authors: +// David Hudson (je...@ya...) +// +// (C) 2007 David Hudson +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#endregion LICENSE + +using System; + +namespace SCSharp.UI +{ + /// <summary> + /// + /// </summary> + public class BoxSelectionChangedEventArgs : EventArgs + { + #region Private fields + + /// <summary> + /// Corrresponding SDL_Event + /// </summary> + int selectedIndex; + + /// <summary> + /// + /// </summary> + public int SelectedIndex + { + get { return selectedIndex; } + set { selectedIndex = value; } + } + + #endregion + + #region Constructors + + /// <summary> + /// Constructor + /// </summary> + public BoxSelectionChangedEventArgs() + { + } + + /// <summary> + /// Constructor + /// </summary> + public BoxSelectionChangedEventArgs(int selectedIndex) + { + this.selectedIndex = selectedIndex; + } + + #endregion + } +} Property changes on: trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native Modified: trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -106,12 +106,12 @@ /// </summary> public event PlayerEventHandler Finished; - void PlayerFinished() + void PlayerFinished(object sender, EventArgs e) { player = null; if (Finished != null) { - Finished(); + Finished(this, new EventArgs()); } } @@ -130,7 +130,7 @@ || args.Key == Key.Space) { player.Stop(); - PlayerFinished(); + PlayerFinished(this, new EventArgs()); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -211,7 +211,7 @@ cursor = selectedItem; if (SelectionChanged != null) { - SelectionChanged(cursor); + SelectionChanged(this, new BoxSelectionChangedEventArgs(cursor)); } ClearSurface(); } @@ -261,7 +261,7 @@ /// <summary> /// /// </summary> - public event ComboBoxSelectionChangedEventHandler SelectionChanged; + public event EventHandler<BoxSelectionChangedEventArgs> SelectionChanged; #region IDisposable Members @@ -270,15 +270,16 @@ /// </summary> public void Dispose() { - throw new Exception("The method or operation is not implemented."); + throw new SCException("The method or operation is not implemented."); } #endregion } - /// <summary> - /// - /// </summary> - /// <param name="selectedIndex"></param> - public delegate void ComboBoxSelectionChangedEventHandler(int selectedIndex); + ///// <summary> + ///// + ///// </summary> + ///// <param name="e"></param> + ///// <param name="sender"></param> + //public delegate void ComboBoxSelectionChangedEventHandler(object sender, BoxSelectionChangedEventArgs e); } Modified: trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -91,8 +91,8 @@ descriptions[i] = GlobalResources.Instance.GluAllTbl[ description_startidx + i ]; } #else - titles[0] = GlobalResources.Instance.GluAllTbl[titleStartIdx + 3]; - descriptions[0] = GlobalResources.Instance.GluAllTbl[descriptionStartIdx + 3]; + titles[0] = GlobalResources.GluAllTbl[titleStartIdx + 3]; + descriptions[0] = GlobalResources.GluAllTbl[descriptionStartIdx + 3]; #endif listbox = (ListBoxElement)Elements[LISTBOX_ELEMENT_INDEX]; @@ -102,28 +102,28 @@ } listbox.SelectedIndex = 0; - HandleSelectionChanged(0); + HandleSelectionChanged(this, new BoxSelectionChangedEventArgs(0)); listbox.SelectionChanged += HandleSelectionChanged; Elements[OK_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { ShowDialog(new OkDialog(this, this.Mpq, "insert battle.net code here")); }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { Game.Instance.SwitchToScreen(UIScreenType.MainMenu); }; } - void HandleSelectionChanged(int selectedIndex) + void HandleSelectionChanged(object sender, BoxSelectionChangedEventArgs e) { - Elements[TITLE_ELEMENT_INDEX].Text = titles[selectedIndex]; - Elements[DESCRIPTION_ELEMENT_INDEX].Text = descriptions[selectedIndex]; + Elements[TITLE_ELEMENT_INDEX].Text = titles[e.SelectedIndex]; + Elements[DESCRIPTION_ELEMENT_INDEX].Text = descriptions[e.SelectedIndex]; } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -72,35 +72,44 @@ } Elements[QUITMISSION_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { QuitMissionDialog d = new QuitMissionDialog(this, this.Mpq); - d.Cancel += delegate() { DismissDialog(); }; + d.Cancel += delegate(object sender2, EventArgs args2) + { + DismissDialog(); + }; ShowDialog(d); }; Elements[EXITPROGRAM_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { ExitConfirmationDialog d = new ExitConfirmationDialog(this, this.Mpq); - d.Cancel += delegate() { DismissDialog(); }; + d.Cancel += delegate(object sender2, EventArgs args2) + { + DismissDialog(); + }; ShowDialog(d); }; Elements[RESTARTMISSION_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { RestartConfirmationDialog d = new RestartConfirmationDialog(this, this.Mpq); - d.Cancel += delegate() { DismissDialog(); }; + d.Cancel += delegate(object sender2, EventArgs args2) + { + DismissDialog(); + }; ShowDialog(d); }; Elements[PREVIOUS_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Previous != null) { - Previous(); + Previous(this, new EventArgs()); } }; } Modified: trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -77,20 +77,20 @@ Elements[TITLE_ELEMENT_INDEX].Text = title; Elements[OK_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Ok != null) { - Ok(); + Ok(this, new EventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Cancel != null) { - Cancel(); + Cancel(this, new EventArgs()); } }; Modified: trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -70,20 +70,20 @@ } Elements[EXIT_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Exit != null) { - Exit(); + Exit(this, new EventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Cancel != null) { - Cancel(); + Cancel(this, new EventArgs()); } }; } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -130,9 +130,9 @@ broodatMpq = GetMpq(path); Console.WriteLine("found BrooDat.mpq"); } - catch (Exception e) + catch (SCException e) { - throw new Exception(String.Format("Could not read mpq archive {0}", + throw new SCException(String.Format("Could not read mpq archive {0}", path), e); } } @@ -143,9 +143,9 @@ stardatMpq = GetMpq(path); Console.WriteLine("found StarDat.mpq"); } - catch (Exception e) + catch (SCException e) { - throw new Exception(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format("could not read mpq archive {0}", path), e); } } @@ -154,7 +154,7 @@ if (stardatMpq == null) { - throw new Exception("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting"); + throw new SCException("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting"); } if (scCDDir != null) @@ -168,9 +168,9 @@ scInstallExe = GetMpq(path); Console.WriteLine("found SC install.exe"); } - catch (Exception e) + catch (SCException e) { - throw new Exception(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format("could not read mpq archive {0}", path), e); } @@ -189,9 +189,9 @@ bwInstallExe = GetMpq(path); Console.WriteLine("found BW install.exe"); } - catch (Exception e) + catch (SCException e) { - throw new Exception(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format("could not read mpq archive {0}", path), e); } @@ -201,7 +201,7 @@ if (bwInstallExe == null) { - throw new Exception("unable to locate broodwar cd's install.exe, please check your BroodwarCDDirectory configuration setting"); + throw new SCException("unable to locate broodwar cd's install.exe, please check your BroodwarCDDirectory configuration setting"); } if (broodatMpq != null) @@ -265,7 +265,7 @@ { if (bwInstallExe == null) { - throw new Exception("you need the Broodwar CD to play Broodwar games. Please check the BroodwarCDDirectory configuration setting."); + throw new SCException("you need the Broodwar CD to play Broodwar games. Please check the BroodwarCDDirectory configuration setting."); } playingMpq.Add(bwInstallExe); playingMpq.Add(broodatMpq); @@ -275,7 +275,7 @@ { if (scInstallExe == null) { - throw new Exception("you need the Starcraft CD to play original games. Please check the StarcraftCDDirectory configuration setting."); + throw new SCException("you need the Starcraft CD to play original games. Please check the StarcraftCDDirectory configuration setting."); } playingMpq.Add(scInstallExe); playingMpq.Add(stardatMpq); @@ -295,11 +295,11 @@ /// <summary> /// /// </summary> - /// <param name="fullscreen"></param> - public void Startup(bool fullscreen) + /// <param name="fullScreen"></param> + public void Startup(bool fullScreen) { /* create our window and hook up to the events we care about */ - CreateWindow(fullscreen); + CreateWindow(fullScreen); Events.UserEvent += UserEvent; Events.MouseMotion += PointerMotion; @@ -317,7 +317,7 @@ /// <summary> /// /// </summary> - public static void Quit() + public static void Quit(object sender, EventArgs e) { Events.QuitApplication(); } @@ -332,18 +332,18 @@ SwitchToScreen(screen); } - void CreateWindow(bool fullscreen) + void CreateWindow(bool fullScreen) { Video.WindowIcon(); Video.WindowCaption = "SCSharp"; - painter = new Painter(fullscreen, GAME_ANIMATION_TICK); + painter = new Painter(fullScreen, GAME_ANIMATION_TICK); } void UserEvent(object sender, UserEventArgs args) { ReadyEventHandler d = (ReadyEventHandler)args.UserEvent; - d(); + d(this, new EventArgs()); } void PointerMotion(object sender, MouseMotionEventArgs args) @@ -409,11 +409,11 @@ { if (args.Key == Key.Q) { - Quit(); + Quit(this, new EventArgs()); } else if (args.Key == Key.F) { - painter.Fullscreen = !painter.Fullscreen; + painter.FullScreen = !painter.FullScreen; } } #endif @@ -526,7 +526,7 @@ screens[index] = new ConnectionScreen(playingMpq); break; default: - throw new Exception(); + throw new SCException(); } } @@ -549,24 +549,24 @@ get { return installedMpq; } } - void SwitchReady() + void SwitchReady(object sender, EventArgs e) { screenToSwitchTo.Ready -= SwitchReady; SetGameScreen(screenToSwitchTo); screenToSwitchTo = null; } - void GlobalResourcesLoaded() + void GlobalResourcesLoaded(object sender, EventArgs e) { SwitchToScreen(UIScreenType.MainMenu); } - void TitleScreenReady() + void TitleScreenReady(object sender, EventArgs e) { Console.WriteLine("Loading global resources"); - new GlobalResources(stardatMpq, broodatMpq); - GlobalResources.Instance.Ready += GlobalResourcesLoaded; - GlobalResources.Instance.Load(); + GlobalResources.LoadMpq(stardatMpq, broodatMpq); + GlobalResources.Ready += GlobalResourcesLoaded; + GlobalResources.Load(); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -77,27 +77,30 @@ } Elements[RETURNTOGAME_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (ReturnToGame != null) { - ReturnToGame(); + ReturnToGame(this, new EventArgs()); } }; Elements[MISSIONOBJECTIVES_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { ObjectivesDialog d = new ObjectivesDialog(this, this.Mpq); - d.Previous += delegate() { DismissDialog(); }; + d.Previous += delegate(object sender2, EventArgs args2) + { + DismissDialog(); + }; ShowDialog(d); }; Elements[ENDMISSION_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { EndMissionDialog d = new EndMissionDialog(this, this.Mpq); - d.Previous += delegate() + d.Previous += delegate(object sender2, EventArgs args2) { DismissDialog(); }; @@ -111,10 +114,10 @@ }; Elements[OPTIONS_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { OptionsDialog d = new OptionsDialog(this, this.Mpq); - d.Previous += delegate() + d.Previous += delegate(object sender2, EventArgs args2) { DismissDialog(); }; @@ -122,10 +125,10 @@ }; Elements[HELP_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { HelpDialog d = new HelpDialog(this, this.Mpq); - d.Previous += delegate() + d.Previous += delegate(object sender2, EventArgs args2) { DismissDialog(); }; Added: trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -0,0 +1,75 @@ +#region LICENSE +// +// Authors: +// David Hudson (je...@ya...) +// +// (C) 2007 David Hudson +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#endregion LICENSE + +using System; + +namespace SCSharp.UI +{ + /// <summary> + /// + /// </summary> + public class GameModeActivateEventArgs : EventArgs + { + #region Private fields + + /// <summary> + /// + /// </summary> + bool expansion; + + /// <summary> + /// + /// </summary> + public bool Expansion + { + get { return expansion; } + set { expansion = value; } + } + + #endregion + + #region Constructors + + /// <summary> + /// Constructor + /// </summary> + public GameModeActivateEventArgs() + { + } + + /// <summary> + /// Constructor + /// </summary> + public GameModeActivateEventArgs(bool expansion) + { + this.expansion = expansion; + } + + #endregion + } +} Property changes on: trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native Modified: trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -72,27 +72,33 @@ Console.WriteLine("{0}: {1}", i, Elements[i].Text); } - Elements[TITLE_ELEMENT_INDEX].Text = GlobalResources.Instance.BrooDat.GluAllTbl.Strings[172]; + Elements[TITLE_ELEMENT_INDEX].Text = GlobalResources.BrooDat.GluAllTbl.Strings[172]; Elements[ORIGINAL_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Activate != null) - Activate(false); + { + Activate(this, new GameModeActivateEventArgs(false)); + } }; Elements[EXPANSION_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Activate != null) - Activate(true); + { + Activate(this, new GameModeActivateEventArgs(true)); + } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate() + delegate(object sender, EventArgs args) { if (Cancel != null) - Cancel(); + { + Cancel(this, new EventArgs()); + } }; } @@ -103,12 +109,13 @@ /// <summary> /// /// </summary> - public event GameModeActivateEventHandler Activate; + public event EventHandler<GameModeActivateEventArgs> Activate; } - /// <summary> - /// - /// </summary> - /// <param name="expansion"></param> - public delegate void GameModeActivateEventHandler(bool expansion); + ///// <summary> + ///// + ///// </summary> + ///// <param name="e"></param> + ///// <param name="sender"></param> + //public delegate void GameModeActivateEventHandler(object sender, GameModeActivateEventArgs e); } Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -616,7 +616,7 @@ case Key.F10: GameMenuDialog d = new GameMenuDialog(this, this.Mpq); - d.ReturnToGame += delegate() + d.ReturnToGame += delegate(object sender2, EventArgs args2) { DismissDialog(); }; Modified: trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-22 22:14:12 UTC (rev 1388) +++ trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-23 16:44:53 UTC (rev 1389) @@ -39,49 +39,67 @@ /// <summary> /// /// </summary> - public class GlobalResources + public static class GlobalResources { - Mpq stardatMpq; - Mpq broodatMpq; + static Mpq starDataMpq; - SCResources starcraftResources; - SCResources broodwarResources; + /// <summary> + /// + /// </summary> + public static Mpq StarDataMpq + { + get { return GlobalResources.starDataMpq; } + set { GlobalResources.starDataMpq = value; } + } + static Mpq broodDataMpq; - static GlobalResources instance; - /// <summary> /// /// </summary> - public static GlobalResources Instance + public static Mpq BroodDataMpq { - get { return instance; } + get { return GlobalResources.broodDataMpq; } + set { GlobalResources.broodDataMpq = value; } } + static SCResources starcraftResources; + static SCResources broodwarResources; + + //static GlobalResources instance; + + ///// <summary> + ///// + ///// </summary> + //public static GlobalResources Instance + //{ + // get { return instance; } + //} + /// <summary> /// /// </summary> - /// <param name="stardatMpq"></param> - /// <param name="broodatMpq"></param> - public GlobalResources(Mpq stardatMpq, Mpq broodatMpq) + /// <param name="starDataMpq"></param> + /// <param name="broodDataMpq"></param> + public static void LoadMpq(Mpq starDataMpq, Mpq broodDataMpq) { - if (instance != null) - { - throw new Exception("There can only be one GlobalResources"); - } + //if (instance != null) + //{ + // throw new SCException("There can only be one GlobalResources"); + //} - this.stardatMpq = stardatMpq; - this.broodatMpq = broodatMpq; + GlobalResources.starDataMpq = starDataMpq; + GlobalResources.broodDataMpq = broodDataMpq; starcraftResources = new SCResources(); broodwarResources = new SCResources(); - instance = this; + //instance = this; } /// <summary> /// /// </summary> - public void Load() + public static void Load() { ThreadPool.QueueUserWorkItem(ResourceLoader); } @@ -89,7 +107,7 @@ /// <summary> /// /// </summary> - public void LoadSingleThreaded() + public static void LoadSingleThreaded() { ResourceLoader(null); } @@ -97,7 +115,7 @@ /// <summary> /// /// </summary> - SCResources Resources + static SCResources Resources { get { return Game.Instance.PlayingBroodWar ? broodwarResources : starcraftResources; } } @@ -105,7 +123,7 @@ /// <summary> /// /// </summary> - public Tbl ImagesTbl + public static Tbl ImagesTbl { get { return Resources.ImagesTbl; } } @@ -113,7 +131,7 @@ /// <summary> /// /// </summary> - public Tbl SfxDataTbl + public static Tbl SfxDataTbl { get { return Resources.SfxDataTbl; } } @@ -121,7 +139,7 @@ /// <summary> /// /// </summary> - public Tbl SpritesTbl + public static Tbl SpritesTbl { get { return Resources.SpritesTbl; } } @@ -129,7 +147,7 @@ /// <summary> /// /// </summary> - public Tbl GluAllTbl + public static Tbl GluAllTbl { get { return Resources.GluAllTbl; } } @@ -137,7 +155,7 @@ /// <summary> /// /// </summary> - public ImagesDat ImagesDat + public static ImagesDat ImagesDat { get { return Resources.ImagesDat; } } @@ -145,7 +163,7 @@ /// <summary> /// /// </summary> - public SpritesDat SpritesDat + public static SpritesDat SpritesDat { get { return Resources.SpritesDat; } } @@ -153,7 +171,7 @@ /// <summary> /// /// </summary> - public SfxDataDat SfxDataDat + public static SfxDataDat SfxDataDat { get { return Resources.SfxDataDat; } } @@ -161,7 +179,7 @@ /// <summary> /// /// </summary> - public ScriptBin IScriptBin + public static ScriptBin IScriptBin { get { return Resources.ScriptBin; } } @@ -169,7 +187,7 @@ /// <summary> /// /// </summary> - public UnitsDat UnitsDat + public static UnitsDat UnitsDat { get { return Resources.UnitsDat; } } @@ -177,7 +195,7 @@ /// <summary> /// /// </summary> - public FlingyDat FlingyDat + public static FlingyDat FlingyDat { get { return Resources.FlingyDat; } } @@ -185,7 +203,7 @@ /// <summary> /// /// </summary> - public MapDataDat MapDataDat + public static MapDataDat MapDataDat { get { return Resources.MapDataDat; } } @@ -193,7 +211,7 @@ /// <summary> /// /// </summary> - public Tbl MapDataTbl + public static Tbl MapDataTbl { get { return Resources.MapDataTbl; } } @@ -201,7 +219,7 @@ /// <summary> /// /// </summary> - public SCResources StarDat + public static SCResources StarDat { get { return starcraftResources; } } @@ -209,42 +227,42 @@ /// <summary> /// /// </summary> - public SCResources BrooDat + public static SCResources BrooDat { get { return broodwarResources; } } - void ResourceLoader(object state) + static void ResourceLoader(object state) { try { - starcraftResources.ImagesTbl = (Tbl)stardatMpq.GetResource(Builtin... [truncated message content] |