From: <je...@us...> - 2007-05-22 22:14:17
|
Revision: 1388 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1388&view=rev Author: jendave Date: 2007-05-22 15:14:12 -0700 (Tue, 22 May 2007) Log Message: ----------- Many fxcop fixes Modified Paths: -------------- trunk/scsharp/src/SCSharp/Properties/AssemblyInfo.cs trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs trunk/scsharp/src/SCSharpLib/MpqLib/FlingyDat.cs trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs trunk/scsharp/src/SCSharpLib/MpqLib/ImagesDat.cs trunk/scsharp/src/SCSharpLib/MpqLib/LinkedNode.cs trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqBlock.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqHeader.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqWavCompression.cs trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxLayer.cs trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxObject.cs trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs trunk/scsharp/src/SCSharpLib/MpqLib/SpritesDat.cs trunk/scsharp/src/SCSharpLib/MpqLib/Trigger.cs trunk/scsharp/src/SCSharpLib/MpqLib/TriggerData.cs trunk/scsharp/src/SCSharpLib/MpqLib/UnitInfo.cs trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs trunk/scsharp/src/SCSharpLib/UI/ButtonElement.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/CursorAnimator.cs trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs trunk/scsharp/src/SCSharpLib/UI/Game.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/ImageElement.cs trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs trunk/scsharp/src/SCSharpLib/UI/MarkupScreen.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/RaceSelectionScreen.cs trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs trunk/scsharp/src/SCSharpLib/UI/Resources.cs trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs trunk/scsharp/src/SCSharpLib/UI/Sprite.cs trunk/scsharp/src/SCSharpLib/UI/SpriteManager.cs trunk/scsharp/src/SCSharpLib/UI/SwooshPainter.cs trunk/scsharp/src/SCSharpLib/UI/TextBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs trunk/scsharp/src/SCSharpLib/UI/UIElement.cs trunk/scsharp/src/SCSharpLib/UI/UIPainter.cs trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs trunk/scsharp/src/SCSharpLib/UI/Unit.cs trunk/scsharp/src/SCSharpLib/UI/Utilities.cs trunk/scsharp/tests/FontFoo.cs Modified: trunk/scsharp/src/SCSharp/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharp/Properties/AssemblyInfo.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharp/Properties/AssemblyInfo.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -2,6 +2,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Diagnostics.CodeAnalysis; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -33,3 +34,4 @@ // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] + Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -39,7 +39,7 @@ /// /// </summary> [Flags] - public enum ElementFlags + public enum SCElement { /// <summary> /// @@ -72,7 +72,7 @@ /// <summary> /// /// </summary> - NoSoundOnMouseOvr = 0x00000080, + NoSoundOnMouseOver = 0x00000080, /// <summary> /// /// </summary> @@ -128,7 +128,7 @@ /// <summary> /// /// </summary> - CenterTextHoriz = 0x00200000, + CenterTextHorizontally = 0x00200000, /// <summary> /// /// </summary> @@ -136,7 +136,7 @@ /// <summary> /// /// </summary> - CenterTextVert = 0x00800000, + CenterTextVertically = 0x00800000, /// <summary> /// /// </summary> @@ -335,12 +335,12 @@ set { textOffset = value; } } - private ElementFlags flags; + private SCElement flags; /// <summary> /// /// </summary> - public ElementFlags Flags + public SCElement Flags { get { return flags; } set { flags = value; } @@ -370,38 +370,38 @@ /// <summary> /// /// </summary> - /// <param name="buf"></param> + /// <param name="buffer"></param> /// <param name="position"></param> /// <param name="streamLength"></param> [CLSCompliant(false)] - public BinElement(byte[] buf, int position, uint streamLength) + public BinElement(byte[] buffer, int position, uint streamLength) { - if (buf == null) + if (buffer == null) { - throw new ArgumentException("buf"); + throw new ArgumentNullException("buf"); } - x1 = Utilities.ReadWord(buf, position + 4); - y1 = Utilities.ReadWord(buf, position + 6); - x2 = Utilities.ReadWord(buf, position + 8); - y2 = Utilities.ReadWord(buf, position + 10); - width = Utilities.ReadWord(buf, position + 12); - height = Utilities.ReadWord(buf, position + 14); - textOffset = Utilities.ReadDWord(buf, position + 20); + x1 = Utilities.ReadWord(buffer, position + 4); + y1 = Utilities.ReadWord(buffer, position + 6); + x2 = Utilities.ReadWord(buffer, position + 8); + y2 = Utilities.ReadWord(buffer, position + 10); + width = Utilities.ReadWord(buffer, position + 12); + height = Utilities.ReadWord(buffer, position + 14); + textOffset = Utilities.ReadDWord(buffer, position + 20); - flags = (ElementFlags)Utilities.ReadDWord(buf, position + 24); - type = (ElementType)buf[position + 34]; + flags = (SCElement)Utilities.ReadDWord(buffer, position + 24); + type = (ElementType)buffer[position + 34]; if (textOffset < streamLength) { uint textLength = 0; - while (buf[textOffset + textLength] != 0) + while (buffer[textOffset + textLength] != 0) { textLength++; } - text = Encoding.ASCII.GetString(buf, (int)textOffset, (int)textLength); + text = Encoding.ASCII.GetString(buffer, (int)textOffset, (int)textLength); - if ((flags & ElementFlags.HasHotkey) == ElementFlags.HasHotkey) + if ((flags & SCElement.HasHotkey) == SCElement.HasHotkey) { hotkey = Encoding.ASCII.GetBytes(new char[] { text[0] })[0]; text = text.Substring(1); @@ -419,7 +419,7 @@ public void DumpFlags() { Console.Write("Flags: "); - foreach (ElementFlags f in Enum.GetValues(typeof(ElementFlags))) + foreach (SCElement f in Enum.GetValues(typeof(SCElement))) { if ((flags & f) == f) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -30,6 +30,7 @@ using System.IO; using System.Text; using System.Collections.Generic; +using System.Collections.ObjectModel; using SCSharp.UI; @@ -134,24 +135,24 @@ { this.stream = stream; - long stream_length = stream.Length; - byte[] section_name_buf = new byte[4]; - string section_name; + //long stream_length = stream.Length; + byte[] sectionNameBuf = new byte[4]; + string sectionName; sections = new Dictionary<string, SectionData>(); while (true) { - stream.Read(section_name_buf, 0, 4); + stream.Read(sectionNameBuf, 0, 4); SectionData sec_data = new SectionData(); sec_data.DataLength = Utilities.ReadDWord(stream); sec_data.DataPosition = stream.Position; - section_name = Encoding.ASCII.GetString(section_name_buf, 0, 4); + sectionName = Encoding.ASCII.GetString(sectionNameBuf, 0, 4); - sections.Add(section_name, sec_data); + sections.Add(sectionName, sec_data); if (stream.Position + sec_data.DataLength >= stream.Length) { @@ -211,20 +212,20 @@ stream.Read(sec.Buffer, 0, (int)sec.DataLength); } - byte[] section_data = sec.Buffer; + byte[] sectionData = sec.Buffer; if (sectionName == "TYPE") { - scenarioType = Utilities.ReadWord(section_data, 0); + scenarioType = Utilities.ReadWord(sectionData, 0); } else if (sectionName == "ERA ") { - tileSet = (Tileset)Utilities.ReadWord(section_data, 0); + tileSet = (Tileset)Utilities.ReadWord(sectionData, 0); } else if (sectionName == "DIM ") { - width = Utilities.ReadWord(section_data, 0); - height = Utilities.ReadWord(section_data, 2); + width = Utilities.ReadWord(sectionData, 0); + height = Utilities.ReadWord(sectionData, 2); } else if (sectionName == "MTXM") { @@ -234,7 +235,7 @@ { for (x = 0; x < width; x++) { - mapTiles[x, y] = Utilities.ReadWord(section_data, (y * width + x) * 2); + mapTiles[x, y] = Utilities.ReadWord(sectionData, (y * width + x) * 2); } } } @@ -248,14 +249,14 @@ { for (x = 0; x < width; x++) { - mapMask[x, y] = section_data[i++]; + mapMask[x, y] = sectionData[i++]; } } } else if (sectionName == "SPRP") { - int nameStringIndex = Utilities.ReadWord(section_data, 0); - int descriptionStringIndex = Utilities.ReadWord(section_data, 2); + int nameStringIndex = Utilities.ReadWord(sectionData, 0); + int descriptionStringIndex = Utilities.ReadWord(sectionData, 2); Console.WriteLine("mapName = {0}", nameStringIndex); Console.WriteLine("mapDescription = {0}", descriptionStringIndex); @@ -264,7 +265,7 @@ } else if (sectionName == "STR ") { - ReadStrings(section_data); + ReadStrings(sectionData); } else if (sectionName == "OWNR") { @@ -278,11 +279,11 @@ 06 - Human 07 - Neutral */ - if (section_data[i] == 0x05) + if (sectionData[i] == 0x05) { numComputerSlots++; } - else if (section_data[i] == 0x06) + else if (sectionData[i] == 0x06) { numHumanSlots++; } @@ -303,7 +304,7 @@ numPlayers = 0; for (int i = 0; i < 12; i++) { - if (section_data[i] == 0x05) /* user select */ + if (sectionData[i] == 0x05) /* user select */ { numPlayers++; } @@ -311,21 +312,21 @@ } else if (sectionName == "UNIT") { - ReadUnits(section_data); + ReadUnits(sectionData); } else if (sectionName == "MBRF") { briefingData = new TriggerData(); - briefingData.Parse(section_data, true); + briefingData.Parse(sectionData); } //else //Console.WriteLine ("Unhandled Chk section type {0}, length {1}", section_name, section_data.Length); } - List<UnitInfo> units; + Collection<UnitInfo> units; void ReadUnits(byte[] data) { - units = new List<UnitInfo>(); + units = new Collection<UnitInfo>(); MemoryStream stream = new MemoryStream(data); Console.WriteLine("unit section data = {0} bytes long", data.Length); @@ -361,8 +362,8 @@ UnitInfo info = new UnitInfo(); info.UnitId = type; - info.X = x; - info.Y = y; + info.PositionX = x; + info.PositionY = y; info.Player = player; units.Add(info); @@ -566,7 +567,7 @@ /// <summary> /// /// </summary> - public List<UnitInfo> Units + public Collection<UnitInfo> Units { get { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/FlingyDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/FlingyDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/FlingyDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -64,6 +64,11 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentNullException("stream"); + } + buf = new byte[(int)stream.Length]; stream.Read(buf, 0, buf.Length); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Fnt.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -38,14 +38,14 @@ /// <summary> /// /// </summary> - public class Fnt : IMpqResource + public class SCFont : IMpqResource { Stream stream; /// <summary> /// /// </summary> - public Fnt() + public SCFont() { } @@ -93,14 +93,14 @@ } } - Glyph GetGlyph(int c) + Glyph GetGlyph(int glyphID) { - if (glyphs.ContainsKey(c)) + if (glyphs.ContainsKey(glyphID)) { - return glyphs[c]; + return glyphs[glyphID]; } - stream.Position = offsets[(uint)c]; + stream.Position = offsets[(uint)glyphID]; byte letterWidth = Utilities.ReadByte(stream); byte letterHeight = Utilities.ReadByte(stream); @@ -146,14 +146,14 @@ } } done: - glyphs.Add(c, + glyphs.Add(glyphID, new Glyph(letterWidth, letterHeight, letterXOffset, letterYOffset, bitmap)); - return glyphs[c]; + return glyphs[glyphID]; } /// <summary> @@ -228,10 +228,10 @@ /// <summary> /// /// </summary> - /// <param name="c"></param> - public void DumpGlyph(int c) + /// <param name="glyphID"></param> + public void DumpGlyph(int glyphID) { - Glyph g = GetGlyph(c); + Glyph g = GetGlyph(glyphID); byte[,] bitmap = g.Bitmap; for (int y = g.Height - 1; y >= 0; y--) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -93,7 +93,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } contents = new byte[stream.Length]; stream.Read(contents, 0, (int)stream.Length); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/ImagesDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/ImagesDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/ImagesDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -63,7 +63,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } buf = new byte[NUM_RECORDS * NUM_FIELDS * 4]; stream.Read(buf, 0, buf.Length); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/LinkedNode.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/LinkedNode.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/LinkedNode.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -86,7 +86,7 @@ /// /// </summary> public LinkedNode Child1 - { get { return child0.prev; } } + { get { return child0.previous; } } private LinkedNode next; @@ -99,25 +99,25 @@ set { next = value; } } - private LinkedNode prev; + private LinkedNode previous; /// <summary> /// /// </summary> - public LinkedNode Prev + public LinkedNode Previous { - get { return prev; } - set { prev = value; } + get { return previous; } + set { previous = value; } } /// <summary> /// /// </summary> - /// <param name="decompVal"></param> + /// <param name="decompressedValue"></param> /// <param name="weight"></param> - public LinkedNode(int decompVal, int weight) + public LinkedNode(int decompressedValue, int weight) { - decompressedValue = decompVal; + this.decompressedValue = decompressedValue; this.weight = weight; } @@ -132,7 +132,7 @@ { if (other == null) { - throw new ArgumentException("other"); + throw new ArgumentNullException("other"); } // 'Next' should have a lower weight // we should return the lower weight @@ -141,25 +141,25 @@ // insert before if (next != null) { - next.prev = other; + next.previous = other; other.next = next; } next = other; - other.prev = this; + other.previous = this; return other; } else { - if (prev == null) + if (previous == null) { // Insert after - other.prev = null; - prev = other; + other.previous = null; + previous = other; other.next = this; } else { - prev.Insert(other); + previous.Insert(other); } } return this; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -57,7 +57,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } buf = new byte[stream.Length]; stream.Read(buf, 0, buf.Length); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -66,32 +66,33 @@ { if (path == null) { - throw new ArgumentException("path"); + throw new ArgumentNullException("path"); } - string ext = Path.GetExtension(path); - if (ext.ToLower() == ".tbl") + string pathLower = path.ToLower(); + string ext = Path.GetExtension(path).ToLower(); + if (ext == ".tbl") { return typeof(Tbl); } - else if (ext.ToLower() == ".fnt") + else if (ext == ".fnt") { - return typeof(Fnt); + return typeof(SCFont); } - else if (ext.ToLower() == ".got") + else if (ext == ".got") { return typeof(Got); } - else if (ext.ToLower() == ".grp") + else if (ext == ".grp") { return typeof(Grp); } - else if (ext.ToLower() == ".bin") + else if (ext == ".bin") { - if (path.ToLower().EndsWith("aiscript.bin")) /* must come before iscript.bin */ + if (pathLower.EndsWith("aiscript.bin")) /* must come before iscript.bin */ { return null; } - else if (path.ToLower().EndsWith("iscript.bin")) + else if (pathLower.EndsWith("iscript.bin")) { return typeof(ScriptBin); } @@ -100,38 +101,38 @@ return typeof(Bin); } } - else if (ext.ToLower() == ".chk") + else if (ext == ".chk") { return typeof(Chk); } - else if (ext.ToLower() == ".dat") + else if (ext == ".dat") { - if (path.ToLower().EndsWith("flingy.dat")) + if (pathLower.EndsWith("flingy.dat")) { return typeof(FlingyDat); } - else if (path.ToLower().EndsWith("images.dat")) + else if (pathLower.EndsWith("images.dat")) { return typeof(ImagesDat); } - else if (path.ToLower().EndsWith("sfxdata.dat")) + else if (pathLower.EndsWith("sfxdata.dat")) { return typeof(SfxDataDat); } - else if (path.ToLower().EndsWith("sprites.dat")) + else if (pathLower.EndsWith("sprites.dat")) { return typeof(SpritesDat); } - else if (path.ToLower().EndsWith("units.dat")) + else if (pathLower.EndsWith("units.dat")) { return typeof(UnitsDat); } - else if (path.ToLower().EndsWith("mapdata.dat")) + else if (pathLower.EndsWith("mapdata.dat")) { return typeof(MapDataDat); } } - else if (ext.ToLower() == ".spk") + else if (ext == ".spk") { return typeof(Spk); } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqBlock.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqBlock.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqBlock.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -53,7 +53,7 @@ public uint FileSize; public MpqFileFlags Flags; - public static readonly uint Size = 16; + public const uint Size = 16; public MpqBlock(BinaryReader br, uint HeaderOffset) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -40,7 +40,7 @@ public uint Locale; public uint BlockIndex; - public static readonly uint Size = 16; + public const uint Size = 16; public MpqHash(BinaryReader br) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqHeader.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqHeader.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqHeader.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -45,8 +45,8 @@ public uint HashTableSize; public uint BlockTableSize; - public static readonly uint MpqId = 0x1a51504d; - public static readonly uint Size = 32; + public const uint MpqId = 0x1a51504d; + public const uint Size = 32; public MpqHeader(BinaryReader br) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -38,12 +38,8 @@ /// <summary> /// A decompressor for MPQ's huffman compression /// </summary> - public class MpqHuffman + public static class MpqHuffman { - private MpqHuffman() - { - } - private static readonly byte[][] sPrime = { // Compression type 0 @@ -181,7 +177,7 @@ { if (data == null) { - throw new ArgumentException("data"); + throw new ArgumentNullException("data"); } int comptype = data.ReadByte(); @@ -255,12 +251,12 @@ private static LinkedNode BuildTree(LinkedNode tail) { LinkedNode current = tail; - LinkedNode head = null; + //LinkedNode head = null; while (current != null) { LinkedNode child0 = current; - LinkedNode child1 = current.Prev; + LinkedNode child1 = current.Previous; if (child1 == null) { break; @@ -272,8 +268,8 @@ child1.Parent = parent; current.Insert(parent); - head = current; - current = current.Prev.Prev; + //head = current; + current = current.Previous.Previous; } return current; } @@ -281,7 +277,7 @@ private static LinkedNode InsertNode(LinkedNode tail, int decomp) { LinkedNode parent = tail; - LinkedNode result = tail.Prev; // This will be the new tail after the tree is updated + LinkedNode result = tail.Previous; // This will be the new tail after the tree is updated LinkedNode temp = new LinkedNode(parent.DecompressedValue, parent.Weight); temp.Parent = parent; @@ -292,8 +288,8 @@ parent.Child0 = newnode; tail.Next = temp; - temp.Prev = tail; - newnode.Prev = temp; + temp.Previous = tail; + newnode.Previous = temp; temp.Next = newnode; AdjustTree(newnode); @@ -318,7 +314,7 @@ insertpoint = current; while (true) { - prev = insertpoint.Prev; + prev = insertpoint.Previous; if (prev == null) break; if (prev.Weight >= current.Weight) break; insertpoint = prev; @@ -334,30 +330,30 @@ // The following code basicly swaps insertpoint with current // remove insert point - if (insertpoint.Prev != null) + if (insertpoint.Previous != null) { - insertpoint.Prev.Next = insertpoint.Next; + insertpoint.Previous.Next = insertpoint.Next; } - insertpoint.Next.Prev = insertpoint.Prev; + insertpoint.Next.Previous = insertpoint.Previous; // Insert insertpoint after current insertpoint.Next = current.Next; - insertpoint.Prev = current; + insertpoint.Previous = current; if (current.Next != null) { - current.Next.Prev = insertpoint; + current.Next.Previous = insertpoint; } current.Next = insertpoint; // remove current - current.Prev.Next = current.Next; - current.Next.Prev = current.Prev; + current.Previous.Next = current.Next; + current.Next.Previous = current.Previous; // insert current after prev LinkedNode temp = prev.Next; current.Next = temp; - current.Prev = prev; - temp.Prev = current; + current.Previous = prev; + temp.Previous = current; prev.Next = current; // Set up parent/child links Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -95,7 +95,7 @@ mSeed1 = MpqArchive.DetectFileSeed(mBlockPositions, blockpossize); if (mSeed1 == 0) { - throw new Exception("Unable to determine encyption seed"); + throw new Exception("Unable to determine encryption seed"); } } MpqArchive.DecryptBlock(mBlockPositions, mSeed1); @@ -103,20 +103,20 @@ } } - private byte[] LoadBlock(int BlockIndex, int ExpectedLength) + private byte[] LoadBlock(int blockIndex, int expectedLength) { uint offset; int toread; if (mBlock.IsCompressed) { - offset = mBlockPositions[BlockIndex]; - toread = (int)(mBlockPositions[BlockIndex + 1] - offset); + offset = mBlockPositions[blockIndex]; + toread = (int)(mBlockPositions[blockIndex + 1] - offset); } else { - offset = (uint)(BlockIndex * mBlockSize); - toread = ExpectedLength; + offset = (uint)(blockIndex * mBlockSize); + toread = expectedLength; } offset += mBlock.FilePos; @@ -133,18 +133,18 @@ { throw new Exception("Unable to determine encryption key"); } - MpqArchive.DecryptBlock(data, (uint)(mSeed1 + BlockIndex)); + MpqArchive.DecryptBlock(data, (uint)(mSeed1 + blockIndex)); } - if (mBlock.IsCompressed && data.Length != ExpectedLength) + if (mBlock.IsCompressed && data.Length != expectedLength) { if ((mBlock.Flags & MpqFileFlags.CompressedMulti) != 0) { - data = DecompressMulti(data, ExpectedLength); + data = DecompressMulti(data, expectedLength); } else { - data = PKDecompress(new MemoryStream(data), ExpectedLength); + data = PKDecompress(new MemoryStream(data), expectedLength); } } @@ -202,26 +202,26 @@ /// <summary> /// /// </summary> - /// <param name="Offset"></param> - /// <param name="Origin"></param> + /// <param name="offset"></param> + /// <param name="origin"></param> /// <returns></returns> - public override long Seek(long Offset, SeekOrigin Origin) + public override long Seek(long offset, SeekOrigin origin) { long target; - switch (Origin) + switch (origin) { case SeekOrigin.Begin: - target = Offset; + target = offset; break; case SeekOrigin.Current: - target = Position + Offset; + target = Position + offset; break; case SeekOrigin.End: - target = Length + Offset; + target = Length + offset; break; default: - throw new ArgumentException("Origin", "Invalid SeekOrigin"); + throw new ArgumentNullException("Origin", "Invalid SeekOrigin"); } if (target < 0) @@ -241,8 +241,8 @@ /// <summary> /// /// </summary> - /// <param name="Value"></param> - public override void SetLength(long Value) + /// <param name="value"></param> + public override void SetLength(long value) { throw new NotSupportedException("SetLength is not supported"); } @@ -250,35 +250,35 @@ /// <summary> /// /// </summary> - /// <param name="Buffer"></param> - /// <param name="Offset"></param> - /// <param name="Count"></param> + /// <param name="buffer"></param> + /// <param name="offset"></param> + /// <param name="count"></param> /// <returns></returns> - public override int Read(byte[] Buffer, int Offset, int Count) + public override int Read(byte[] buffer, int offset, int count) { - int toread = Count; + int toread = count; int readtotal = 0; while (toread > 0) { - int read = ReadInternal(Buffer, Offset, toread); + int read = ReadInternal(buffer, offset, toread); if (read == 0) break; readtotal += read; - Offset += read; + offset += read; toread -= read; } return readtotal; } - private int ReadInternal(byte[] Buffer, int Offset, int Count) + private int ReadInternal(byte[] buffer, int offset, int count) { BufferData(); int localposition = (int)(mPosition % mBlockSize); - int bytestocopy = Math.Min(mCurrentData.Length - localposition, Count); + int bytestocopy = Math.Min(mCurrentData.Length - localposition, count); if (bytestocopy <= 0) return 0; - Array.Copy(mCurrentData, localposition, Buffer, Offset, bytestocopy); + Array.Copy(mCurrentData, localposition, buffer, offset, bytestocopy); mPosition += bytestocopy; return bytestocopy; @@ -313,10 +313,10 @@ /// <summary> /// /// </summary> - /// <param name="Buffer"></param> - /// <param name="Offset"></param> - /// <param name="Count"></param> - public override void Write(byte[] Buffer, int Offset, int Count) + /// <param name="buffer"></param> + /// <param name="offset"></param> + /// <param name="count"></param> + public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException("Writing is not supported"); } @@ -330,16 +330,16 @@ * 80 = IMA ADPCM Stereo * 40 = IMA ADPCM Mono */ - private static byte[] DecompressMulti(byte[] Input, int OutputLength) + private static byte[] DecompressMulti(byte[] input, int outputLength) { - Stream sinput = new MemoryStream(Input); + Stream sinput = new MemoryStream(input); byte comptype = (byte)sinput.ReadByte(); // BZip2 if ((comptype & 0x10) != 0) { - byte[] result = BZip2Decompress(sinput, OutputLength); + byte[] result = BZip2Decompress(sinput); comptype &= 0xEF; if (comptype == 0) { @@ -351,7 +351,7 @@ // PKLib if ((comptype & 8) != 0) { - byte[] result = PKDecompress(sinput, OutputLength); + byte[] result = PKDecompress(sinput, outputLength); comptype &= 0xF7; if (comptype == 0) { @@ -363,7 +363,7 @@ // ZLib if ((comptype & 2) != 0) { - byte[] result = ZlibDecompress(sinput, OutputLength); + byte[] result = ZlibDecompress(sinput, outputLength); comptype &= 0xFD; if (comptype == 0) { @@ -407,28 +407,30 @@ throw new Exception(String.Format("Unhandled compression flags: 0x{0:X}", comptype)); } - private static byte[] BZip2Decompress(Stream Data, int ExpectedLength) + //private static byte[] BZip2Decompress(Stream data, int expectedLength) + + private static byte[] BZip2Decompress(Stream data) { MemoryStream output = new MemoryStream(); - BZip2.Decompress(Data, output); + BZip2.Decompress(data, output); return output.ToArray(); } - private static byte[] PKDecompress(Stream Data, int ExpectedLength) + private static byte[] PKDecompress(Stream data, int expectedLength) { - PKLibDecompress pk = new PKLibDecompress(Data); - return pk.Explode(ExpectedLength); + PKLibDecompress pk = new PKLibDecompress(data); + return pk.Explode(expectedLength); } - private static byte[] ZlibDecompress(Stream Data, int ExpectedLength) + private static byte[] ZlibDecompress(Stream data, int expectedLength) { // This assumes that Zlib won't be used in combination with another compression type - byte[] Output = new byte[ExpectedLength]; - Stream s = new InflaterInputStream(Data); + byte[] Output = new byte[expectedLength]; + Stream s = new InflaterInputStream(data); int Offset = 0; while (true) { - int size = s.Read(Output, Offset, ExpectedLength); + int size = s.Read(Output, Offset, expectedLength); if (size == 0) { break; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqWavCompression.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqWavCompression.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqWavCompression.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -37,11 +37,8 @@ /// <summary> /// An IMA ADPCM decompress for Mpq files /// </summary> - public class MpqWavCompression + public static class MpqWavCompression { - private MpqWavCompression() - { } - private static readonly int[] sLookup = { 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, @@ -74,6 +71,10 @@ /// <returns></returns> public static byte[] Decompress(Stream data, int channelCount) { + if (data == null) + { + throw new ArgumentNullException("data"); + } int[] Array1 = new int[] { 0x2c, 0x2c }; int[] Array2 = new int[channelCount]; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxLayer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxLayer.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxLayer.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -45,10 +45,10 @@ /// <summary> /// /// </summary> - /// <param name="num_objects"></param> - public ParallaxLayer(int num_objects) + /// <param name="numberOfObjects"></param> + public ParallaxLayer(int numberOfObjects) { - objects = new ParallaxObject[num_objects]; + objects = new ParallaxObject[numberOfObjects]; } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxObject.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxObject.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/ParallaxObject.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -38,36 +38,47 @@ /// </summary> public class ParallaxObject { - private readonly int x; + private readonly int positionX; /// <summary> /// /// </summary> - public int X + public int PositionX { - get { return x; } + get { return positionX; } } - private readonly int y; + private readonly int positionY; /// <summary> /// /// </summary> - public int Y + public int PositionY { - get { return y; } + get { return positionY; } } + private readonly int offset; + /// <summary> /// /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> + public int Offset + { + get { return offset; } + } + + /// <summary> + /// + /// </summary> + /// <param name="positionX"></param> + /// <param name="positionY"></param> /// <param name="offset"></param> - public ParallaxObject(int x, int y, int offset) + public ParallaxObject(int positionX, int positionY, int offset) { - this.x = x; - this.y = y; + this.positionX = positionX; + this.positionY = positionY; + this.offset = offset; } } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -62,7 +62,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } buf = new byte[NUM_RECORDS * NUM_FIELDS * 4]; stream.Read(buf, 0, buf.Length); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/SpritesDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SpritesDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SpritesDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -84,7 +84,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } int size = 0; for (int i = 0; i < NUM_FIELDS; i++) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Trigger.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Trigger.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Trigger.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -52,7 +52,7 @@ { if (data == null) { - throw new ArgumentException("data"); + throw new ArgumentNullException("data"); } int i; for (i = 0; i < conditions.Length; i++) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/TriggerData.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/TriggerData.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/TriggerData.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -30,9 +30,8 @@ using System.IO; using System.Text; using System.Collections.Generic; +using System.Collections.ObjectModel; - - namespace SCSharp.MpqLib { /// <summary> @@ -45,34 +44,33 @@ /// </summary> public TriggerData() { - triggers = new List<Trigger>(); + triggers = new Collection<Trigger>(); } + //public void Parse(byte[] data, bool briefing) + /// <summary> /// /// </summary> /// <param name="data"></param> - /// <param name="briefing"></param> - public void Parse(byte[] data, bool briefing) + public void Parse(byte[] data) { int offset = 0; while (offset < data.Length) { Trigger t = new Trigger(); - t.Parse(data, ref offset); - triggers.Add(t); } } - List<Trigger> triggers; + Collection<Trigger> triggers; /// <summary> /// /// </summary> - public List<Trigger> Triggers + public Collection<Trigger> Triggers { get { return triggers; } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/UnitInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/UnitInfo.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/UnitInfo.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -50,25 +50,25 @@ get { return unitId; } set { unitId = value; } } - private int x; + private int positionX; /// <summary> /// /// </summary> - public int X + public int PositionX { - get { return x; } - set { x = value; } + get { return positionX; } + set { positionX = value; } } - private int y; + private int positionY; /// <summary> /// /// </summary> - public int Y + public int PositionY { - get { return y; } - set { y = value; } + get { return positionY; } + set { positionY = value; } } private int player; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -90,7 +90,7 @@ { if (stream == null) { - throw new ArgumentException("stream"); + throw new ArgumentNullException("stream"); } buf = new byte[(int)stream.Length]; @@ -178,7 +178,7 @@ /// <param name="unitId"></param> /// <returns></returns> [CLSCompliant(false)] - public uint GetHitpoints(int unitId) + public uint GetHitPoints(int unitId) { return Utilities.ReadWord(buf, hitpoint_offset + unitId * 2); } Modified: trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -2,6 +2,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Diagnostics.CodeAnalysis; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -33,3 +34,9 @@ // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Toshok")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Ladislav")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Zezula")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Starcraft")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Modding")] +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "SCSharp.UI.Credits.txt", MessageId = "Olbrantz")] Modified: trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -63,6 +63,10 @@ public BriefingRunner(ReadyRoomScreen screen, Chk scenario, string scenarioPrefix) { + if (scenario == null) + { + throw new ArgumentNullException("scenario"); + } this.screen = screen; this.scenario = scenario; this.prefix = scenarioPrefix; Modified: trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -89,6 +89,10 @@ /// <param name="args"></param> public override void MouseButtonUp(MouseButtonEventArgs args) { + if (args == null) + { + throw new ArgumentNullException("args"); + } if (PointInside(args.X, args.Y)) { OnActivate(); @@ -100,7 +104,7 @@ /// </summary> public override void MouseEnter() { - if (Sensitive && (Flags & ElementFlags.RespondToMouse) == ElementFlags.RespondToMouse) + if (Sensitive && (Flags & SCElement.RespondToMouse) == SCElement.RespondToMouse) { /* highlight the text */ GuiUtil.PlaySound(Mpq, Builtins.MouseoverWav); Modified: trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -63,6 +63,10 @@ /// <param name="painter"></param> public override void AddToPainter(Painter painter) { + if (painter == null) + { + throw new ArgumentNullException("painter"); + } /* XXX this should be abstracted into Game with the other mouse settings */ Mouse.ShowCursor = false; @@ -75,6 +79,10 @@ /// <param name="painter"></param> public override void RemoveFromPainter(Painter painter) { + if (painter == null) + { + throw new ArgumentNullException("painter"); + } painter.Remove(Layer.Background, VideoPainter); } @@ -113,6 +121,10 @@ /// <param name="args"></param> public override void KeyboardDown(KeyboardEventArgs args) { + if (args == null) + { + throw new ArgumentNullException("args"); + } if (args.Key == Key.Escape || args.Key == Key.Return || args.Key == Key.Space) Modified: trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -42,7 +42,7 @@ /// <summary> /// /// </summary> - public class ComboBoxElement : UIElement + public class ComboBoxElement : UIElement, IDisposable { List<string> items; int cursor = -1; @@ -165,6 +165,10 @@ /// <param name="args"></param> public override void PointerMotion(MouseMotionEventArgs args) { + if (args == null) + { + throw new ArgumentNullException("args"); + } /* if the dropdown is visible, see if we're inside it */ if (!dropdownVisible) { @@ -258,6 +262,18 @@ /// /// </summary> public event ComboBoxSelectionChangedEventHandler SelectionChanged; + + #region IDisposable Members + + /// <summary> + /// + /// </summary> + public void Dispose() + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -60,10 +60,10 @@ #if INCLUDE_ALL_NETWORK_OPTIONS const int num_choices = 4; #else - const int num_choices = 1; + const int numChoices = 1; #endif - const int title_startidx = 95; - const int description_startidx = 99; + const int titleStartIdx = 95; + const int descriptionStartIdx = 99; string[] titles; string[] descriptions; @@ -82,8 +82,8 @@ Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text); } - titles = new string[num_choices]; - descriptions = new string[num_choices]; + titles = new string[numChoices]; + descriptions = new string[numChoices]; #if INCLUDE_ALL_NETWORK_OPTIONS for (int i = 0; i < num_choices; i ++) { @@ -91,8 +91,8 @@ descriptions[i] = GlobalResources.Instance.GluAllTbl[ description_startidx + i ]; } #else - titles[0] = GlobalResources.Instance.GluAllTbl[title_startidx + 3]; - descriptions[0] = GlobalResources.Instance.GluAllTbl[description_startidx + 3]; + titles[0] = GlobalResources.Instance.GluAllTbl[titleStartIdx + 3]; + descriptions[0] = GlobalResources.Instance.GluAllTbl[descriptionStartIdx + 3]; #endif listbox = (ListBoxElement)Elements[LISTBOX_ELEMENT_INDEX]; @@ -132,6 +132,10 @@ /// <param name="args"></param> public override void KeyboardDown(KeyboardEventArgs args) { + if (args == null) + { + throw new ArgumentNullException("args"); + } if (args.Key == Key.DownArrow || args.Key == Key.UpArrow) { Modified: trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -63,6 +63,11 @@ /// <param name="palette"></param> public CursorAnimator(Grp grp, byte[] palette) { + if (grp == null) + { + throw new ArgumentNullException("grp"); + } + this.grp = grp; this.x = 100; this.y = 100; @@ -137,6 +142,11 @@ /// <param name="now"></param> public void Paint(Surface surf, DateTime now) { + if (surf == null) + { + throw new ArgumentNullException("surf"); + } + deltaToChange -= now - last; if (deltaToChange < TimeSpan.Zero) { @@ -145,8 +155,8 @@ } last = now; - int draw_x = (int)(x - hotX); - int draw_y = (int)(y - hotY); + int drawX = (int)(x - hotX); + int drawY = (int)(y - hotY); if (currentFrame == grp.FrameCount) { @@ -161,7 +171,7 @@ true); } - surf.Blit(surfaces[currentFrame], new Point(draw_x, draw_y)); + surf.Blit(surfaces[currentFrame], new Point(drawX, drawY)); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs 2007-05-22 16:28:33 UTC (rev 1387) +++ trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs 2007-05-22 22:14:12 UTC (rev 1388) @@ -41,41 +41,41 @@ /// </summary> public class FFmpeg { - static bool initSucceeded; + //static bool initSucceeded; static FFmpeg() { try { - ffmpeg_init(); - initSucceeded = true; + //... [truncated message content] |