From: <je...@us...> - 2007-05-21 06:53:24
|
Revision: 1385 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1385&view=rev Author: jendave Date: 2007-05-20 23:53:22 -0700 (Sun, 20 May 2007) Log Message: ----------- Some fxcop changes Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.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/MpqArchive.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.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/UnitsDat.cs trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.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/MainMenu.cs trunk/scsharp/src/SCSharpLib/UI/MapRenderer.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/PlayCustomScreen.cs trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.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/TitleScreen.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/VideoDialog.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -376,6 +376,10 @@ [CLSCompliant(false)] public BinElement(byte[] buf, int position, uint streamLength) { + if (buf == null) + { + throw new ArgumentException("buf"); + } x1 = Utilities.ReadWord(buf, position + 4); y1 = Utilities.ReadWord(buf, position + 6); x2 = Utilities.ReadWord(buf, position + 8); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -52,16 +52,16 @@ mStream = sourceStream; } - /// <summary> - /// - /// </summary> - public Stream BaseStream - { - get - { - return mStream; - } - } + ///// <summary> + ///// + ///// </summary> + //public Stream BaseStream + //{ + // get + // { + // return mStream; + // } + //} /// <summary> /// Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,6 +91,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("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-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/ImagesDat.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -61,6 +61,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("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-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/LinkedNode.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -130,6 +130,10 @@ /// <returns></returns> public LinkedNode Insert(LinkedNode other) { + if (other == null) + { + throw new ArgumentException("other"); + } // 'Next' should have a lower weight // we should return the lower weight if (other.weight <= weight) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MapDataDat.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -55,6 +55,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("stream"); + } buf = new byte[stream.Length]; stream.Read(buf, 0, buf.Length); } @@ -73,7 +77,7 @@ /// <summary> /// /// </summary> - public int NumIndices + public int NumIndexes { get { return buf.Length / 4; } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -62,8 +62,12 @@ /// </summary> /// <param name="path"></param> /// <returns></returns> - protected Type GetTypeFromResourcePath(string path) + protected static Type GetTypeFromResourcePath(string path) { + if (path == null) + { + throw new ArgumentException("path"); + } string ext = Path.GetExtension(path); if (ext.ToLower() == ".tbl") { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -58,11 +58,11 @@ /// <summary> /// /// </summary> - /// <param name="filename"></param> - public MpqArchive(string filename) + /// <param name="fileName"></param> + public MpqArchive(string fileName) { //mFilename = filename; - mStream = File.Open(filename, FileMode.Open, FileAccess.Read); + mStream = File.Open(fileName, FileMode.Open, FileAccess.Read); Init(); } @@ -144,19 +144,19 @@ /// <summary> /// /// </summary> - /// <param name="filename"></param> + /// <param name="fileName"></param> /// <returns></returns> - public MpqStream OpenFile(string filename) + public MpqStream OpenFile(string fileName) { MpqHash hash; MpqBlock block; - hash = GetHashEntry(filename); + hash = GetHashEntry(fileName); uint blockindex = hash.BlockIndex; if (blockindex == uint.MaxValue) { - throw new FileNotFoundException("File not found: " + filename); + throw new FileNotFoundException("File not found: " + fileName); } block = mBlocks[blockindex]; @@ -167,11 +167,11 @@ /// <summary> /// /// </summary> - /// <param name="filename"></param> + /// <param name="fileName"></param> /// <returns></returns> - public bool FileExists(string filename) + public bool FileExists(string fileName) { - MpqHash hash = GetHashEntry(filename); + MpqHash hash = GetHashEntry(fileName); return (hash.BlockIndex != uint.MaxValue); } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -54,7 +54,7 @@ RecurseDirectoryTree(mpqDirPath); } - string ConvertBackSlashes(string path) + static string ConvertBackSlashes(string path) { while (path.IndexOf('\\') != -1) path = path.Replace('\\', Path.DirectorySeparatorChar); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqHash.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -50,12 +50,12 @@ BlockIndex = br.ReadUInt32(); } - public bool IsValid - { - get - { - return Name1 != uint.MaxValue && Name2 != uint.MaxValue; - } - } + //public bool IsValid + //{ + // get + // { + // return Name1 != uint.MaxValue && Name2 != uint.MaxValue; + // } + //} } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqHuffman.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -179,6 +179,10 @@ /// <returns></returns> public static byte[] Decompress(Stream data) { + if (data == null) + { + throw new ArgumentException("data"); + } int comptype = data.ReadByte(); if (comptype == 0) @@ -223,7 +227,7 @@ int bit = input.ReadBits(1); if (bit == -1) { - throw new Exception("Unexpected end of file"); + throw new EndOfStreamException("Unexpected end of file"); } node = bit == 0 ? node.Child0 : node.Child1; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SfxDataDat.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -60,6 +60,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("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-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SpritesDat.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -82,6 +82,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("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-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Trigger.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -50,6 +50,10 @@ /// <param name="offset"></param> public void Parse(byte[] data, ref int offset) { + if (data == null) + { + throw new ArgumentException("data"); + } int i; for (i = 0; i < conditions.Length; i++) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/MpqLib/UnitsDat.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -88,6 +88,10 @@ /// <param name="stream"></param> public void ReadFromStream(Stream stream) { + if (stream == null) + { + throw new ArgumentException("stream"); + } buf = new byte[(int)stream.Length]; stream.Read(buf, 0, buf.Length); Modified: trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -96,7 +96,7 @@ /// <summary> /// /// </summary> - public event PlayerEvent Finished; + public event PlayerEventHandler Finished; void PlayerFinished() { Modified: trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -257,12 +257,12 @@ /// <summary> /// /// </summary> - public event ComboBoxSelectionChanged SelectionChanged; + public event ComboBoxSelectionChangedEventHandler SelectionChanged; } /// <summary> /// /// </summary> /// <param name="selectedIndex"></param> - public delegate void ComboBoxSelectionChanged(int selectedIndex); + public delegate void ComboBoxSelectionChangedEventHandler(int selectedIndex); } Modified: trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/CursorAnimator.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -76,7 +76,7 @@ /// <param name="hotX"></param> /// <param name="hotY"></param> [CLSCompliant(false)] - public void SetHotSpot(uint hotX, uint hotY) + public void SetHotspot(uint hotX, uint hotY) { this.hotX = hotX; this.hotY = hotY; Modified: trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -68,7 +68,7 @@ const int TILE_B = 7; const int TILE_BL = 6; - void TileRow(Surface surf, Grp grp, byte[] pal, int l, int c, int r, int y) + static void TileRow(Surface surf, Grp grp, byte[] pal, int l, int c, int r, int y) { Surface lsurf = GuiUtil.CreateSurfaceFromBitmap(grp.GetFrame(l), grp.Width, grp.Height, Modified: trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -108,6 +108,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Previous; + public event DialogEventHandler Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -130,11 +130,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,10 +91,10 @@ /// <summary> /// /// </summary> - public event DialogEvent Exit; + public event DialogEventHandler Exit; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -227,7 +227,7 @@ this.rootDir = starcraftDir; } - Mpq GetMpq(string path) + static Mpq GetMpq(string path) { if (Directory.Exists(path)) { @@ -317,7 +317,7 @@ /// <summary> /// /// </summary> - public void Quit() + public static void Quit() { Events.QuitApplication(); } @@ -342,7 +342,7 @@ void UserEvent(object sender, UserEventArgs args) { - ReadyDelegate d = (ReadyDelegate)args.UserEvent; + ReadyEventHandler d = (ReadyEventHandler)args.UserEvent; d(); } Modified: trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -136,6 +136,6 @@ /// <summary> /// /// </summary> - public event DialogEvent ReturnToGame; + public event DialogEventHandler ReturnToGame; } } Modified: trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -99,16 +99,16 @@ /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; /// <summary> /// /// </summary> - public event GameModeActivateDelegate Activate; + public event GameModeActivateEventHandler Activate; } /// <summary> /// /// </summary> /// <param name="expansion"></param> - public delegate void GameModeActivateDelegate(bool expansion); + public delegate void GameModeActivateEventHandler(bool expansion); } Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -332,7 +332,7 @@ { ScrollCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(cursornames[i]), Effectpal.Palette); - ScrollCursors[i].SetHotSpot(60, 60); + ScrollCursors[i].SetHotspot(60, 60); } // load the mag cursors @@ -346,7 +346,7 @@ { MagCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(magcursornames[i]), Effectpal.Palette); - MagCursors[i].SetHotSpot(60, 60); + MagCursors[i].SetHotspot(60, 60); } // load the targeting cursors @@ -360,7 +360,7 @@ { TargetCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(targetcursornames[i]), Effectpal.Palette); - TargetCursors[i].SetHotSpot(60, 60); + TargetCursors[i].SetHotspot(60, 60); } PlaceInitialUnits(); Modified: trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -248,12 +248,12 @@ } // notify we're ready to roll - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(FinishedLoading))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(FinishedLoading))); } catch (SdlException e) { Console.WriteLine("Global Resource loader failed: {0}", e); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(Events.QuitApplication))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(Events.QuitApplication))); } } @@ -268,6 +268,6 @@ /// <summary> /// /// </summary> - public event ReadyDelegate Ready; + public event ReadyEventHandler Ready; } } Modified: trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -49,7 +49,7 @@ /// <summary> /// /// </summary> - public delegate void ReadyDelegate(); + public delegate void ReadyEventHandler(); /// <summary> /// @@ -133,7 +133,7 @@ } } - return CreateSurfaceFromRGBAData(buf, (ushort)g.Width, (ushort)g.Height, 32, g.Width * 4); + return CreateSurfaceFromRgbaData(buf, (ushort)g.Width, (ushort)g.Height, 32, g.Width * 4); } /// <summary> @@ -369,7 +369,7 @@ /// <param name="stride"></param> /// <returns></returns> [CLSCompliant(false)] - public static Surface CreateSurfaceFromRGBAData(byte[] data, ushort width, ushort height, int depth, int stride) + public static Surface CreateSurfaceFromRgbaData(byte[] data, ushort width, ushort height, int depth, int stride) { return CreateSurface(data, width, height, depth, stride, /* XXX this needs addressing in Tao.Sdl - these arguments should be uints */ @@ -389,7 +389,7 @@ /// <param name="stride"></param> /// <returns></returns> [CLSCompliant(false)] - public static Surface CreateSurfaceFromRGBData(byte[] data, ushort width, ushort height, int depth, int stride) + public static Surface CreateSurfaceFromRgbData(byte[] data, ushort width, ushort height, int depth, int stride) { return CreateSurface(data, width, height, depth, stride, (int)0x00ff0000, @@ -455,7 +455,7 @@ { byte[] buf = GetBitmapData(grid, width, height, palette, withAlpha); - return CreateSurfaceFromRGBAData(buf, width, height, withAlpha ? 32 : 24, width * (3 + (withAlpha ? 1 : 0))); + return CreateSurfaceFromRgbaData(buf, width, height, withAlpha ? 32 : 24, width * (3 + (withAlpha ? 1 : 0))); } /// <summary> @@ -473,7 +473,7 @@ { byte[] buf = GetBitmapData(grid, width, height, palette, translucentIndex, transparentIndex); - return CreateSurfaceFromRGBAData(buf, width, height, 32, width * 4); + return CreateSurfaceFromRgbaData(buf, width, height, 32, width * 4); } /// <summary> @@ -506,7 +506,7 @@ { Pcx pcx = new Pcx(); pcx.ReadFromStream(stream, translucentIndex, transparentIndex); - return CreateSurfaceFromRGBAData(pcx.RgbaData, pcx.Width, pcx.Height, pcx.Depth, pcx.Stride); + return CreateSurfaceFromRgbaData(pcx.RgbaData, pcx.Width, pcx.Height, pcx.Depth, pcx.Stride); } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -92,6 +92,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Previous; + public event DialogEventHandler Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -90,6 +90,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -326,12 +326,12 @@ /// <summary> /// /// </summary> - public event ListBoxSelectionChanged SelectionChanged; + public event ListBoxSelectionChangedEventHandler SelectionChanged; } /// <summary> /// /// </summary> /// <param name="selectedIndex"></param> - public delegate void ListBoxSelectionChanged(int selectedIndex); + public delegate void ListBoxSelectionChangedEventHandler(int selectedIndex); } Modified: trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -151,7 +151,7 @@ Elements[EXIT_ELEMENT_INDEX].Activate += delegate() { - Game.Instance.Quit(); + Game.Quit(); }; } } Modified: trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -53,7 +53,7 @@ byte[] bitmap = RenderToBitmap(mpq, chk, out pixel_width, out pixel_height); - return GuiUtil.CreateSurfaceFromRGBAData(bitmap, pixel_width, pixel_height, 32, pixel_width * 4); + return GuiUtil.CreateSurfaceFromRgbaData(bitmap, pixel_width, pixel_height, 32, pixel_width * 4); } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -80,6 +80,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Previous; + public event DialogEventHandler Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -89,11 +89,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -83,6 +83,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -124,6 +124,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Previous; + public event DialogEventHandler Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,7 +91,7 @@ ListBoxElement file_listbox; ComboBoxElement gametype_combo; - void InitializeRaceCombo(ComboBoxElement combo) + static void InitializeRaceCombo(ComboBoxElement combo) { combo.AddItem("Zerg"); /* XXX these should all come from some string constant table someplace */ combo.AddItem("Terran"); @@ -99,7 +99,7 @@ combo.AddItem("Random", true); } - void InitializePlayerCombo(ComboBoxElement combo) + static void InitializePlayerCombo(ComboBoxElement combo) { combo.AddItem(GlobalResources.Instance.GluAllTbl.Strings[130]); /* Closed */ combo.AddItem(GlobalResources.Instance.GluAllTbl.Strings[128], true); /* Computer */ Modified: trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -86,6 +86,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -78,6 +78,6 @@ /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -62,15 +62,15 @@ /// <summary> /// /// </summary> - /// <param name="filename"></param> + /// <param name="fileName"></param> /// <param name="smkStream"></param> /// <param name="width"></param> /// <param name="height"></param> - public SmackerPlayer(string filename, + public SmackerPlayer(string fileName, Stream smkStream, int width, int height) { - this.filename = filename; + this.filename = fileName; this.width = width; this.height = height; @@ -204,7 +204,7 @@ } finally { - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(EmitFinished))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(EmitFinished))); } } @@ -212,7 +212,7 @@ /// <summary> /// /// </summary> - public event PlayerEvent Finished; + public event PlayerEventHandler Finished; void EmitFinished() { @@ -226,5 +226,5 @@ /// <summary> /// /// </summary> - public delegate void PlayerEvent(); + public delegate void PlayerEventHandler(); } Modified: trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/Sprite.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Sprite.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/Sprite.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -713,7 +713,7 @@ /// <summary> /// /// </summary> - LiftOff, + Liftoff, /// <summary> /// /// </summary> Modified: trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -60,7 +60,7 @@ base.ResourceLoader(); Cursor = null; /* clear out the cursor */ - Elements[1].Text = "Copyright © 2006 Chris Toshok. All rights reserved."; + Elements[1].Text = "Copyright © 2006-2007 Chris Toshok, David Hudson. All rights reserved."; Elements[2].Text = "Game assets Copyright © 1998 Blizzard Entertainment. All rights reserved."; Elements[3].Text = ""; Modified: trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -226,5 +226,5 @@ /// /// </summary> //public delegate void DialogEvent(object sender, EventArgs args); - public delegate void DialogEvent(); + public delegate void DialogEventHandler(); } Modified: trunk/scsharp/src/SCSharpLib/UI/UIElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -270,7 +270,7 @@ /// <summary> /// /// </summary> - public event ElementEvent Activate; + public event ElementEventHandler Activate; /// <summary> /// @@ -286,7 +286,7 @@ /// <summary> /// /// </summary> - public event ElementEvent MouseEnterEvent; + public event ElementEventHandler MouseEnterEvent; /// <summary> /// @@ -300,7 +300,7 @@ /// <summary> /// /// </summary> - public event ElementEvent MouseLeaveEvent; + public event ElementEventHandler MouseLeaveEvent; /// <summary> /// @@ -436,5 +436,5 @@ /// <summary> /// /// </summary> - public delegate void ElementEvent(); + public delegate void ElementEventHandler(); } Modified: trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -294,12 +294,12 @@ try { Console.WriteLine("swooshing in"); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(RaiseDoneSwooshing))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(RaiseDoneSwooshing))); } catch (SdlException e) { Console.WriteLine("failed pushing UIScreen.RiseDoneSwooshing: {0}", e); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(Events.QuitApplication))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(Events.QuitApplication))); } } @@ -311,12 +311,12 @@ try { Console.WriteLine("swooshing out"); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(RaiseDoneSwooshing))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(RaiseDoneSwooshing))); } catch (SdlException e) { Console.WriteLine("failed pushing UIScreen.RiseDoneSwooshing: {0}", e); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(Events.QuitApplication))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(Events.QuitApplication))); } } @@ -690,17 +690,17 @@ /// <summary> /// /// </summary> - public event ReadyDelegate FirstPainted; + public event ReadyEventHandler FirstPainted; /// <summary> /// /// </summary> - public event ReadyDelegate DoneSwooshing; + public event ReadyEventHandler DoneSwooshing; /// <summary> /// /// </summary> - public event ReadyDelegate Ready; + public event ReadyEventHandler Ready; bool loaded; @@ -790,7 +790,7 @@ if (arrowgrp != null) { cursor = new CursorAnimator(arrowgrp, effectpal.Palette); - cursor.SetHotSpot(64, 64); + cursor.SetHotspot(64, 64); } } } @@ -868,7 +868,7 @@ void LoadResources() { ResourceLoader(); - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(FinishedLoading))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(FinishedLoading))); } /// <summary> @@ -878,14 +878,14 @@ { if (loaded) { - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(RaiseReadyEvent))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(RaiseReadyEvent))); } else { #if MULTI_THREADED ThreadPool.QueueUserWorkItem (delegate (object state) { LoadResources (); }) #else - Events.PushUserEvent(new UserEventArgs(new ReadyDelegate(LoadResources))); + Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(LoadResources))); #endif } } Modified: trunk/scsharp/src/SCSharpLib/UI/VideoDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/VideoDialog.cs 2007-05-21 06:21:34 UTC (rev 1384) +++ trunk/scsharp/src/SCSharpLib/UI/VideoDialog.cs 2007-05-21 06:53:22 UTC (rev 1385) @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEvent Ok; + public event DialogEventHandler Ok; /// <summary> /// /// </summary> - public event DialogEvent Cancel; + public event DialogEventHandler Cancel; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-22 16:28:35
|
Revision: 1387 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1387&view=rev Author: jendave Date: 2007-05-22 09:28:33 -0700 (Tue, 22 May 2007) Log Message: ----------- Remove unused files. Fix obselete warning Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs Removed Paths: ------------- trunk/scsharp/src/SCSharpLib/Properties/Settings.Designer.cs trunk/scsharp/src/SCSharpLib/Properties/Settings.settings Deleted: trunk/scsharp/src/SCSharpLib/Properties/Settings.Designer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/Settings.Designer.cs 2007-05-22 15:06:40 UTC (rev 1386) +++ trunk/scsharp/src/SCSharpLib/Properties/Settings.Designer.cs 2007-05-22 16:28:33 UTC (rev 1387) @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace SCSharp.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} Deleted: trunk/scsharp/src/SCSharpLib/Properties/Settings.settings =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/Settings.settings 2007-05-22 15:06:40 UTC (rev 1386) +++ trunk/scsharp/src/SCSharpLib/Properties/Settings.settings 2007-05-22 16:28:33 UTC (rev 1387) @@ -1,7 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> - <Profiles> - <Profile Name="(Default)" /> - </Profiles> - <Settings /> -</SettingsFile> Modified: trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-22 15:06:40 UTC (rev 1386) +++ trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-22 16:28:33 UTC (rev 1387) @@ -85,7 +85,8 @@ if (state == State.PAUSED) { state = State.PLAYING; - decoderThread.Resume(); + // TODO This is obselete + //decoderThread.Resume(); } else if (state == State.STOPPED) { @@ -125,7 +126,8 @@ } state = State.PAUSED; - decoderThread.Suspend(); + //TODO this is obselete + //decoderThread.Suspend(); } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-23 17:45:14
|
Revision: 1391 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1391&view=rev Author: jendave Date: 2007-05-23 10:45:10 -0700 (Wed, 23 May 2007) Log Message: ----------- More FXCop fixes. Fixed event handling Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs trunk/scsharp/src/SCSharpLib/UI/Cinematic.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/GameModeActivateEventArgs.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/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/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/UIDialog.cs trunk/scsharp/src/SCSharpLib/UI/UIElement.cs trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs trunk/scsharp/src/SCSharpLib/UI/VideoDialog.cs Added Paths: ----------- trunk/scsharp/src/SCSharpLib/UI/SCEventArgs.cs Modified: trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -40,3 +40,34 @@ [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")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "SCSharp.MpqLib", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.MpqContainer", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.MpqLib.MpqContainer.Add(SCSharp.MpqLib.Mpq):System.Void", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.MpqLib.MpqContainer.Remove(SCSharp.MpqLib.Mpq):System.Void", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.MpqHuffman", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.MpqStream", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.Mpq", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.MpqArchiveContainer", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.MpqLib.IMpqResource", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.EntryDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq,System.String)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GameMenuDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.UIDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq,System.String,System.String)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GameModeDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.MainMenu..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game.PlayingMpq", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game.InstalledMpq", MessageId = "Mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.OkDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq,System.String)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.SoundDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.ZergReadyRoomScreen..ctor(SCSharp.MpqLib.Mpq,System.String)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.RaceSelectionScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.LoadSavedScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.HelpDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.LogOnScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.EstablishingShot..ctor(System.String,System.String,SCSharp.MpqLib.Mpq)", MessageId = "2#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.KeystrokeDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.OkCancelDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq,System.String)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GameScreen..ctor(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk,SCSharp.MpqLib.Got)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GameScreen..ctor(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk,SCSharp.MpqLib.Got)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GameScreen..ctor(SCSharp.MpqLib.Mpq,System.String,SCSharp.MpqLib.Chk)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.CreditsScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.EndMissionDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] Modified: trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/BoxSelectionChangedEventArgs.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -33,7 +33,7 @@ /// <summary> /// /// </summary> - public class BoxSelectionChangedEventArgs : EventArgs + public class BoxSelectionChangedEventArgs : SCEventArgs { #region Private fields @@ -58,7 +58,7 @@ /// <summary> /// Constructor /// </summary> - public BoxSelectionChangedEventArgs() + public BoxSelectionChangedEventArgs() : base() { } Modified: trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/Cinematic.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -104,14 +104,14 @@ /// <summary> /// /// </summary> - public event PlayerEventHandler Finished; + public event EventHandler<SCEventArgs> Finished; void PlayerFinished(object sender, EventArgs e) { player = null; if (Finished != null) { - Finished(this, new EventArgs()); + Finished(this, new SCEventArgs()); } } @@ -130,7 +130,7 @@ || args.Key == Key.Space) { player.Stop(); - PlayerFinished(this, new EventArgs()); + PlayerFinished(this, new SCEventArgs()); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -107,14 +107,14 @@ listbox.SelectionChanged += HandleSelectionChanged; Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { ShowDialog(new OkDialog(this, this.Mpq, "insert battle.net code here")); }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(UIScreenType.MainMenu); }; Modified: trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -72,10 +72,10 @@ } Elements[QUITMISSION_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { QuitMissionDialog d = new QuitMissionDialog(this, this.Mpq); - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -83,10 +83,10 @@ }; Elements[EXITPROGRAM_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { ExitConfirmationDialog d = new ExitConfirmationDialog(this, this.Mpq); - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -94,10 +94,10 @@ }; Elements[RESTARTMISSION_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { RestartConfirmationDialog d = new RestartConfirmationDialog(this, this.Mpq); - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -105,11 +105,11 @@ }; Elements[PREVIOUS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Previous != null) { - Previous(this, new EventArgs()); + Previous(this, new SCEventArgs()); } }; } @@ -117,6 +117,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Previous; + public event EventHandler<SCEventArgs> Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/EntryDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -77,20 +77,20 @@ Elements[TITLE_ELEMENT_INDEX].Text = title; Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { - Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; @@ -130,11 +130,11 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/ExitConfirmationDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -70,20 +70,20 @@ } Elements[EXIT_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Exit != null) { - Exit(this, new EventArgs()); + Exit(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -91,10 +91,10 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Exit; + public event EventHandler<SCEventArgs> Exit; /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -342,8 +342,8 @@ void UserEvent(object sender, UserEventArgs args) { - ReadyEventHandler d = (ReadyEventHandler)args.UserEvent; - d(this, new EventArgs()); + EventHandler<SCEventArgs> d = (EventHandler<SCEventArgs>)args.UserEvent; + d(this, new SCEventArgs()); } void PointerMotion(object sender, MouseMotionEventArgs args) @@ -409,7 +409,7 @@ { if (args.Key == Key.Q) { - Quit(this, new EventArgs()); + Quit(this, new SCEventArgs()); } else if (args.Key == Key.F) { Modified: trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GameMenuDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -77,19 +77,19 @@ } Elements[RETURNTOGAME_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (ReturnToGame != null) { - ReturnToGame(this, new EventArgs()); + ReturnToGame(this, new SCEventArgs()); } }; Elements[MISSIONOBJECTIVES_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { ObjectivesDialog d = new ObjectivesDialog(this, this.Mpq); - d.Previous += delegate(object sender2, EventArgs args2) + d.Previous += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -97,10 +97,10 @@ }; Elements[ENDMISSION_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { EndMissionDialog d = new EndMissionDialog(this, this.Mpq); - d.Previous += delegate(object sender2, EventArgs args2) + d.Previous += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -114,10 +114,10 @@ }; Elements[OPTIONS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { OptionsDialog d = new OptionsDialog(this, this.Mpq); - d.Previous += delegate(object sender2, EventArgs args2) + d.Previous += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -125,10 +125,10 @@ }; Elements[HELP_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { HelpDialog d = new HelpDialog(this, this.Mpq); - d.Previous += delegate(object sender2, EventArgs args2) + d.Previous += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -139,6 +139,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler ReturnToGame; + public event EventHandler<SCEventArgs> ReturnToGame; } } Modified: trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GameModeActivateEventArgs.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -33,7 +33,7 @@ /// <summary> /// /// </summary> - public class GameModeActivateEventArgs : EventArgs + public class GameModeActivateEventArgs : SCEventArgs { #region Private fields @@ -58,7 +58,7 @@ /// <summary> /// Constructor /// </summary> - public GameModeActivateEventArgs() + public GameModeActivateEventArgs() : base() { } Modified: trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GameModeDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -75,7 +75,7 @@ Elements[TITLE_ELEMENT_INDEX].Text = GlobalResources.BrooDat.GluAllTbl.Strings[172]; Elements[ORIGINAL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Activate != null) { @@ -84,7 +84,7 @@ }; Elements[EXPANSION_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Activate != null) { @@ -93,11 +93,11 @@ }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -105,7 +105,7 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; /// <summary> /// /// </summary> Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -616,7 +616,7 @@ case Key.F10: GameMenuDialog d = new GameMenuDialog(this, this.Mpq); - d.ReturnToGame += delegate(object sender2, EventArgs args2) + d.ReturnToGame += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; Modified: trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GlobalResources.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -266,12 +266,12 @@ } // notify we're ready to roll - Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(FinishedLoading))); + Events.PushUserEvent(new UserEventArgs(new EventHandler<SCEventArgs>(FinishedLoading))); } catch (SdlException e) { Console.WriteLine("Global Resource loader failed: {0}", e); - Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(Game.Quit))); + Events.PushUserEvent(new UserEventArgs(new EventHandler<SCEventArgs>(Game.Quit))); } } @@ -279,13 +279,13 @@ { if (Ready != null) { - Ready(new EventArgs(), new EventArgs()); + Ready(new SCEventArgs(), new SCEventArgs()); } } /// <summary> /// /// </summary> - public static event ReadyEventHandler Ready; + public static event EventHandler<SCEventArgs> Ready; } } Modified: trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -46,10 +46,10 @@ namespace SCSharp.UI { - /// <summary> - /// - /// </summary> - public delegate void ReadyEventHandler(object sender, EventArgs e); + ///// <summary> + ///// + ///// </summary> + //public delegate void ReadyEventHandler(object sender, EventArgs e); /// <summary> /// Modified: trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/HelpDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -71,19 +71,19 @@ } Elements[PREVIOUS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Previous != null) { - Previous(this, new EventArgs()); + Previous(this, new SCEventArgs()); } }; Elements[KEYSTROKE_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { KeystrokeDialog d = new KeystrokeDialog(this, this.Mpq); - d.Ok += delegate(object sender2, EventArgs args2) + d.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -94,6 +94,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Previous; + public event EventHandler<SCEventArgs> Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/KeystrokeDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -70,11 +70,11 @@ } Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { - Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); } }; @@ -90,6 +90,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/LoadSavedScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/LoadSavedScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/LoadSavedScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -69,7 +69,7 @@ } Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(new RaceSelectionScreen(this.Mpq)); }; Modified: trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -90,7 +90,7 @@ } Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (listbox.SelectedIndex == -1) { @@ -101,21 +101,21 @@ }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(UIScreenType.MainMenu); }; Elements[NEW_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { EntryDialog d = new EntryDialog(this, this.Mpq, GlobalResources.GluAllTbl.Strings[22]); - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - d.Ok += delegate(object sender2, EventArgs args2) + d.Ok += delegate(object sender2, SCEventArgs args2) { if (listbox.Contains(d.Value)) { @@ -131,15 +131,15 @@ }; Elements[DELETE_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { OkCancelDialog okd = new OkCancelDialog(this, this.Mpq, GlobalResources.GluAllTbl.Strings[23]); - okd.Cancel += delegate(object sender2, EventArgs args2) + okd.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - okd.Ok += delegate(object sender2, EventArgs args2) + okd.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); /* actually delete the file */ Modified: trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -62,7 +62,7 @@ void ShowGameModeDialog(UIScreenType nextScreen) { GameModeDialog d = new GameModeDialog(this, this.Mpq); - d.Cancel += delegate(object sender, EventArgs args) + d.Cancel += delegate(object sender, SCEventArgs args) { DismissDialog(); }; @@ -93,7 +93,7 @@ Elements[VERSION_ELEMENT_INDEX].Text = "v0.0000004"; Elements[SINGLEPLAYER_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Game.Instance.IsBroodWar) { @@ -107,7 +107,7 @@ }; Elements[MULTIPLAYER_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Game.Instance.IsBroodWar) { @@ -121,7 +121,7 @@ }; Elements[CAMPAIGNEDITOR_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { OkDialog d = new OkDialog(this, this.Mpq, "The campaign editor functionality is not available in SCSharp"); @@ -129,14 +129,14 @@ }; Elements[INTRO_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Cinematic introScreen = new Cinematic(this.Mpq, Game.Instance.IsBroodWar ? "smk\\starXIntr.smk" : "smk\\starintr.smk"); introScreen.Finished += - delegate(object sender2, EventArgs e2) + delegate(object sender2, SCEventArgs e2) { Game.Instance.SwitchToScreen(this); }; @@ -144,15 +144,15 @@ }; Elements[CREDITS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(new CreditsScreen(this.Mpq)); }; Elements[EXIT_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { - Game.Quit(this, new EventArgs()); + Game.Quit(this, new SCEventArgs()); }; } } Modified: trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -70,22 +70,22 @@ } Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { //Ok(); - Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { //Cancel(); - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -93,11 +93,11 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -67,11 +67,11 @@ Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text); Elements[PREVIOUS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Previous != null) { - Previous(this, new EventArgs()); + Previous(this, new SCEventArgs()); } }; } @@ -79,6 +79,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Previous; + public event EventHandler<SCEventArgs> Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/OkCancelDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -72,20 +72,20 @@ Elements[MESSAGE_ELEMENT_INDEX].Text = message; Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { - Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -93,11 +93,11 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/OkDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -71,7 +71,7 @@ Elements[MESSAGE_ELEMENT_INDEX].Text = message; Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok == null) { @@ -79,7 +79,7 @@ } else { - Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); } }; } @@ -87,6 +87,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; } } Modified: trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/OptionsDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -68,15 +68,15 @@ base.ResourceLoader(); Elements[SOUND_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { SoundDialog d = new SoundDialog(this, this.Mpq); - //d.Ok += delegate() { DismissDialog(this, new EventArgs()); }; - d.Ok += delegate(object sender2, EventArgs args2) + //d.Ok += delegate() { DismissDialog(this, new SCEventArgs()); }; + d.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -84,14 +84,14 @@ }; Elements[SPEED_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { SpeedDialog d = new SpeedDialog(this, this.Mpq); - d.Ok += delegate(object sender2, EventArgs args2) + d.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -99,14 +99,14 @@ }; Elements[VIDEO_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { VideoDialog d = new VideoDialog(this, this.Mpq); - d.Ok += delegate(object sender2, EventArgs args2) + d.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -114,14 +114,14 @@ }; Elements[NETWORK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { NetworkDialog d = new NetworkDialog(this, this.Mpq); - d.Ok += delegate(object sender2, EventArgs args2) + d.Ok += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; - d.Cancel += delegate(object sender2, EventArgs args2) + d.Cancel += delegate(object sender2, SCEventArgs args2) { DismissDialog(); }; @@ -129,11 +129,11 @@ }; Elements[PREVIOUS_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Previous != null) { - Previous(this, new EventArgs()); + Previous(this, new SCEventArgs()); } }; @@ -144,6 +144,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Previous; + public event EventHandler<SCEventArgs> Previous; } } Modified: trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -237,7 +237,7 @@ gametypeCombo.SelectionChanged += GameTypeSelectionChanged; Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (selectedScenario == null) { @@ -270,7 +270,7 @@ }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(new RaceSelectionScreen(this.Mpq)); }; Modified: trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -71,18 +71,18 @@ } Elements[QUIT_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { //QuitConfirmationDialog d = new QuitConfirmationDialog(this, mpq); //ShowDialog(d); }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -90,6 +90,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -100,7 +100,7 @@ Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text); Elements[THIRD_CAMPAIGN_ELEMENT_INDEX].MouseEnterEvent += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Console.WriteLine("over third campaign element"); if (true /* XXX this should come from the player's file */) @@ -110,7 +110,7 @@ }; Elements[THIRD_CAMPAIGN_ELEMENT_INDEX].MouseLeaveEvent += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (true /* XXX this should come from the player's file */) { @@ -119,7 +119,7 @@ }; Elements[SECOND_CAMPAIGN_ELEMENT_INDEX].MouseEnterEvent += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Console.WriteLine("over second campaign element"); if (true /* XXX this should come from the player's file */) @@ -129,7 +129,7 @@ }; Elements[SECOND_CAMPAIGN_ELEMENT_INDEX].MouseLeaveEvent += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (true /* XXX this should come from the player's file */) { @@ -138,38 +138,38 @@ }; Elements[FIRST_CAMPAIGN_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { SelectCampaign(0); }; Elements[SECOND_CAMPAIGN_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { SelectCampaign(1); }; Elements[THIRD_CAMPAIGN_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { SelectCampaign(2); }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(UIScreenType.LogOn); }; Elements[LOADSAVED_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(new LoadSavedScreen(this.Mpq)); }; Elements[PLAYCUSTOM_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { Game.Instance.SwitchToScreen(new PlayCustomScreen(this.Mpq)); }; Modified: trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -121,21 +121,21 @@ } Elements[cancelElementIndex].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { StopBriefing(); Game.Instance.SwitchToScreen(UIScreenType.LogOn); }; Elements[replayElementIndex].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { StopBriefing(); PlayBriefing(); }; Elements[startElementIndex].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { StopBriefing(); Game.Instance.SwitchToScreen(new GameScreen(this.Mpq, scenario_prefix, scenario)); Modified: trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/RestartConfirmationDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -70,11 +70,11 @@ } Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -82,6 +82,6 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Added: trunk/scsharp/src/SCSharpLib/UI/SCEventArgs.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SCEventArgs.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/UI/SCEventArgs.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -0,0 +1,49 @@ +#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 SCEventArgs : EventArgs + { + #region Constructors + + /// <summary> + /// Constructor + /// </summary> + public SCEventArgs() : base() + { + } + + #endregion + } +} Property changes on: trunk/scsharp/src/SCSharpLib/UI/SCEventArgs.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native Modified: trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/SmackerPlayer.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -210,7 +210,7 @@ } finally { - Events.PushUserEvent(new UserEventArgs(new ReadyEventHandler(EmitFinished))); + Events.PushUserEvent(new UserEventArgs(new EventHandler<SCEventArgs>(EmitFinished))); } } @@ -218,19 +218,19 @@ /// <summary> /// /// </summary> - public event PlayerEventHandler Finished; + public event EventHandler<SCEventArgs> Finished; void EmitFinished(object sender, EventArgs e) { if (Finished != null) { - Finished(this, new EventArgs()); + Finished(this, new SCEventArgs()); } } } - /// <summary> - /// - /// </summary> - public delegate void PlayerEventHandler(object sender, EventArgs e); + ///// <summary> + ///// + ///// </summary> + //public delegate void PlayerEventHandler(object sender, EventArgs e); } Modified: trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -68,22 +68,22 @@ Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text); Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { - //Ok(this, new EventArgs()); - Ok(this, new EventArgs()); + //Ok(this, new SCEventArgs()); + Ok(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - //Cancel(this, new EventArgs()); - Cancel(this, new EventArgs()); + //Cancel(this, new SCEventArgs()); + Cancel(this, new SCEventArgs()); } }; } @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-23 16:47:31 UTC (rev 1390) +++ trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-23 17:45:10 UTC (rev 1391) @@ -68,22 +68,22 @@ Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text); Elements[OK_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Ok != null) { - Ok(this, new EventArgs()); - //Ok(this, new EventArgs()); + Ok(this, new SCEventArgs()); + //Ok(this, new SCEventArgs()); } }; Elements[CANCEL_ELEMENT_INDEX].Activate += - delegate(object sender, EventArgs args) + delegate(object sender, SCEventArgs args) { if (Cancel != null) { - Cancel(this, new EventArgs()); - //Cancel(this, new EventArgs()); + Cancel(this, new SCEventArgs()); + //Cancel(this, new SCEventArgs()); } }; } @@ -91,11 +91,11 @@ /// <summary> /// /// </summary> - public event DialogEventHandler Ok; + public event EventHandler<SCEventArgs> Ok; /// <summary> /// /// </summary> - public event DialogEventHandler Cancel; + public event EventHandler<SCEventArgs> Cancel; } } Modified: trunk/scsharp/src/SCSharpLib/UI/UIDialog.cs ========================... [truncated message content] |
From: <je...@us...> - 2007-05-24 19:40:29
|
Revision: 1397 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1397&view=rev Author: jendave Date: 2007-05-24 12:40:26 -0700 (Thu, 24 May 2007) Log Message: ----------- more fxcop fixes Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs trunk/scsharp/src/SCSharpLib/UI/CreditsScreen.cs trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs trunk/scsharp/src/SCSharpLib/UI/GuiUtility.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/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/SoundDialog.cs trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -378,7 +378,7 @@ { if (buffer == null) { - throw new ArgumentNullException("buf"); + throw new ArgumentNullException("buffer"); } x1 = Utilities.ReadWord(buffer, position + 4); y1 = Utilities.ReadWord(buffer, position + 6); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BitStream.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -72,7 +72,7 @@ { if (bitCount > 16) { - throw new ArgumentOutOfRangeException("BitCount", "Maximum BitCount is 16"); + throw new ArgumentOutOfRangeException("bitCount", "Maximum BitCount is 16"); } if (EnsureBits(bitCount) == false) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Got.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -55,7 +55,7 @@ ///0x54 (unsigned short) - Game type's variable (actual setting rather than just the label as in 0x45) ///0x58 (unsigned long) - Starting mineral ammount /// </summary> - public enum InitialUnits + public enum InitialUnitsSetting { /// <summary> /// @@ -150,9 +150,9 @@ /// <summary> /// /// </summary> - public InitialUnits InitialUnits + public InitialUnitsSetting InitialUnits { - get { return (InitialUnits)contents[0x4d]; } + get { return (InitialUnitsSetting)contents[0x4d]; } } } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Grp.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -210,7 +210,7 @@ } catch (IndexOutOfRangeException e) { - Console.WriteLine("EXCEPTION on line {0}, x = {2}, i = {3}, line length = {2} (line data length = {4}):", line, x, lineLength, i, line_data.Length); + Console.WriteLine("EXCEPTION on line {0}, x = {1}, i = {2}, line length = {3} (line data length = {4}):", line, x, lineLength, i, line_data.Length); Console.WriteLine(e.StackTrace); } } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -223,16 +223,16 @@ target = Length + offset; break; default: - throw new ArgumentNullException("Origin", "Invalid SeekOrigin"); + throw new ArgumentNullException("origin", "Invalid SeekOrigin"); } if (target < 0) { - throw new ArgumentOutOfRangeException("Attmpted to Seek before the beginning of the stream"); + throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek before the beginning of the stream"); } if (target >= Length) { - throw new ArgumentOutOfRangeException("Attmpted to Seek beyond the end of the stream"); + throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek beyond the end of the stream"); } mPosition = target; Modified: trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -228,10 +228,10 @@ /// <summary> /// /// </summary> - /// <param name="glyphID"></param> - public void DumpGlyph(int glyphID) + /// <param name="glyphId"></param> + public void DumpGlyph(int glyphId) { - Glyph g = GetGlyph(glyphID); + Glyph g = GetGlyph(glyphId); byte[,] bitmap = g.Bitmap; for (int y = g.Height - 1; y >= 0; y--) { Modified: trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -159,3 +159,43 @@ [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.RestartConfirmationDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.SpeedDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.PlayCustomScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.SpritesTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.OrdersTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluCampaignBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.WeaponsTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluPEditBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.ScoreDPMainPcx", MessageId = "Pcx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GameConsolePcx", MessageId = "Pcx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluLoginBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluConnectionBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluAllTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluAllTbl", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluExpCampaignBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.RezCreditListTxt", MessageId = "Rez")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluLoadBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluScoreBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluReadyBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluMainBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.HelpTxtTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.ImagesTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluPOkCancelBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.FlingyTbl", MessageId = "Flingy")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.FlingyTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.SfxDataDat", MessageId = "Sfx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.TitlePcx", MessageId = "Pcx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluGameModeBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluCreateBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.ScoreVPMainPcx", MessageId = "Pcx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.MapDataTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.UnitsTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluPOkBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.TechDataTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.RezCreditExpTxt", MessageId = "Rez")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluCustomBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.UpgradesTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.SfxDataTbl", MessageId = "Sfx")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.SfxDataTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.PortDataTbl", MessageId = "Tbl")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.FlingyDat", MessageId = "Flingy")] +[module: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", Scope = "type", Target = "SCSharp.UI.LogOnScreen", MessageId = "OnScreen")] + Modified: trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -37,7 +37,7 @@ /// <summary> /// /// </summary> - public const string TitleDlgBin = "rez\\titledlg.bin"; + public const string TitleDialogBin = "rez\\titledlg.bin"; #if RELEASE public const string TitlePcx = "glue\\title\\title.pcx"; #else @@ -68,22 +68,22 @@ /// <summary> /// /// </summary> - public const string GluCmpgnBin = "rez\\glucmpgn.bin"; // original + public const string GluCampaignBin = "rez\\glucmpgn.bin"; // original /// <summary> /// /// </summary> - public const string GluExpcmpgnBin = "rez\\gluexpcmpgn.bin"; // broodwar + public const string GluExpCampaignBin = "rez\\gluexpcmpgn.bin"; // broodwar /* Play custom screen */ /// <summary> /// /// </summary> - public const string GluCustmBin = "rez\\gluCustm.bin"; + public const string GluCustomBin = "rez\\gluCustm.bin"; /// <summary> /// /// </summary> - public const string GluCreatBin = "rez\\gluCreat.bin"; + public const string GluCreateBin = "rez\\gluCreat.bin"; /* load saved screen */ /// <summary> @@ -113,13 +113,13 @@ /// <summary> /// /// </summary> - public const string GluRdyBin = "rez\\glurdy{0}.bin"; + public const string GluReadyBin = "rez\\glurdy{0}.bin"; /* Connection screen */ /// <summary> /// /// </summary> - public const string GluConnBin = "rez\\gluConn.bin"; + public const string GluConnectionBin = "rez\\gluConn.bin"; /* Score screen */ /// <summary> @@ -189,11 +189,11 @@ /// <summary> /// /// </summary> - public const string PortdataDat = "arr\\portdata.dat"; + public const string PortDataDat = "arr\\portdata.dat"; /// <summary> /// /// </summary> - public const string PortdataTbl = "arr\\portdata.tbl"; + public const string PortDataTbl = "arr\\portdata.tbl"; /// <summary> /// /// </summary> @@ -247,29 +247,29 @@ /// <summary> /// /// </summary> - public const string MouseoverWav = "sound\\glue\\mouseover.wav"; + public const string MouseOverWav = "sound\\glue\\mouseover.wav"; /// <summary> /// /// </summary> - public const string Mousedown2Wav = "sound\\glue\\mousedown2.wav"; + public const string MouseDown2Wav = "sound\\glue\\mousedown2.wav"; /// <summary> /// /// </summary> - public const string SwishinWav = "sound\\glue\\swishin.wav"; + public const string SwishInWav = "sound\\glue\\swishin.wav"; /// <summary> /// /// </summary> - public const string SwishoutWav = "sound\\glue\\swishout.wav"; + public const string SwishOutWav = "sound\\glue\\swishout.wav"; /* credits */ /// <summary> /// /// </summary> - public const string RezCrdtexpTxt = "rez\\crdt_exp.txt"; + public const string RezCreditExpTxt = "rez\\crdt_exp.txt"; /// <summary> /// /// </summary> - public const string RezCrdtlistTxt = "rez\\crdt_lst.txt"; + public const string RezCreditListTxt = "rez\\crdt_lst.txt"; /* music */ /// <summary> @@ -289,11 +289,11 @@ /// <summary> /// /// </summary> - public const string SndDlgBin = "rez\\snd_dlg.bin"; + public const string SoundDialogBin = "rez\\snd_dlg.bin"; /// <summary> /// /// </summary> - public const string SpdDlgBin = "rez\\spd_dlg.bin"; + public const string SpeedDialogBin = "rez\\spd_dlg.bin"; /// <summary> /// /// </summary> @@ -301,15 +301,15 @@ /// <summary> /// /// </summary> - public const string NetDlgBin = "rez\\netdlg.bin"; + public const string NetDialogBin = "rez\\netdlg.bin"; /// <summary> /// /// </summary> - public const string ObjctDlgBin = "rez\\objctdlg.bin"; + public const string ObjectDialogBin = "rez\\objctdlg.bin"; /// <summary> /// /// </summary> - public const string AbrtMenuBin = "rez\\abrtmenu.bin"; + public const string AbortMenuBin = "rez\\abrtmenu.bin"; /// <summary> /// /// </summary> @@ -321,7 +321,7 @@ /// <summary> /// /// </summary> - public const string Quit2MnuBin = "rez\\quit2mnu.bin"; + public const string Quit2MenuBin = "rez\\quit2mnu.bin"; /// <summary> /// /// </summary> @@ -339,6 +339,6 @@ /// <summary> /// /// </summary> - public const string MinimapBin = "rez\\minimap.bin"; + public const string MiniMapBin = "rez\\minimap.bin"; } } Modified: trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -107,7 +107,7 @@ if (Sensitive && (Flags & SCElement.RespondToMouse) == SCElement.RespondToMouse) { /* highlight the text */ - GuiUtility.PlaySound(Mpq, BuiltIns.MouseoverWav); + GuiUtility.PlaySound(Mpq, BuiltIns.MouseOverWav); } base.MouseEnter(); } Modified: trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/ConnectionScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -47,7 +47,7 @@ /// </summary> /// <param name="mpq"></param> public ConnectionScreen(Mpq mpq) - : base(mpq, "glue\\PalNl", BuiltIns.GluConnBin) + : base(mpq, "glue\\PalNl", BuiltIns.GluConnectionBin) { } Modified: trunk/scsharp/src/SCSharpLib/UI/CreditsScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/CreditsScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/CreditsScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -64,11 +64,11 @@ /* broodwar credits */ if (Game.Instance.IsBroodWar) { - AddMarkup((Stream)this.Mpq.GetResource(BuiltIns.RezCrdtexpTxt)); + AddMarkup((Stream)this.Mpq.GetResource(BuiltIns.RezCreditExpTxt)); } /* starcraft credits */ - AddMarkup((Stream)this.Mpq.GetResource(BuiltIns.RezCrdtlistTxt)); + AddMarkup((Stream)this.Mpq.GetResource(BuiltIns.RezCreditListTxt)); } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/EndMissionDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public EndMissionDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.AbrtMenuBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.AbortMenuBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -668,7 +668,7 @@ units.Add(unit); } - if (template != null && (template.InitialUnits != InitialUnits.UseMapSettings)) + if (template != null && (template.InitialUnits != InitialUnitsSetting.UseMapSettings)) { foreach (Unit sl in startLocations) { Modified: trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -103,7 +103,7 @@ { if (glyph == null) { - throw new ArgumentNullException("g"); + throw new ArgumentNullException("glyph"); } if (palette == null) { Modified: trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/LoginScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -183,16 +183,55 @@ d.ShowDialog(okd); } - #region IDisposable Members + #region IDisposable Members + bool disposed; /// <summary> - /// + /// Destroy sprite /// </summary> + /// <param name="disposing">If true, remove all unamanged resources</param> + protected virtual void Dispose(bool disposing) + { + if (!this.disposed) + { + if (disposing) + { + //if (this.d != null) + //{ + // this.dropDownSurface.Dispose(); + // this.dropDownSurface = null; + //} + } + this.disposed = true; + } + } + + /// <summary> + /// Destroy object + /// </summary> public void Dispose() { - throw new SCException("The method or operation is not implemented."); + this.Dispose(true); + GC.SuppressFinalize(this); } + /// <summary> + /// Destroy object + /// </summary> + public void Close() + { + Dispose(); + } + + /// <summary> + /// Destroy object + /// </summary> + ~LogOnScreen() + { + Dispose(false); + } + + #endregion } } Modified: trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/MainMenu.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -72,7 +72,7 @@ try { Game.Instance.PlayingBroodWar = args.Expansion; - GuiUtility.PlaySound(this.Mpq, BuiltIns.Mousedown2Wav); + GuiUtility.PlaySound(this.Mpq, BuiltIns.MouseDown2Wav); Game.Instance.SwitchToScreen(nextScreen); } catch (Exception e) @@ -101,7 +101,7 @@ } else { - GuiUtility.PlaySound(this.Mpq, BuiltIns.Mousedown2Wav); + GuiUtility.PlaySound(this.Mpq, BuiltIns.MouseDown2Wav); Game.Instance.SwitchToScreen(UIScreenType.LogOn); } }; @@ -115,7 +115,7 @@ } else { - GuiUtility.PlaySound(this.Mpq, BuiltIns.Mousedown2Wav); + GuiUtility.PlaySound(this.Mpq, BuiltIns.MouseDown2Wav); Game.Instance.SwitchToScreen(UIScreenType.Connection); } }; Modified: trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/NetworkDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public NetworkDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.NetDlgBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.NetDialogBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/ObjectivesDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public ObjectivesDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.ObjctDlgBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.ObjectDialogBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -48,7 +48,7 @@ /// </summary> /// <param name="mpq"></param> public PlayCustomScreen(Mpq mpq) - : base(mpq, "glue\\PalNl", BuiltIns.GluCustmBin) + : base(mpq, "glue\\PalNl", BuiltIns.GluCustomBin) { } Modified: trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/QuitMissionDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public QuitMissionDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.Quit2MnuBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.Quit2MenuBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -50,7 +50,7 @@ /// <param name="mpq"></param> public RaceSelectionScreen(Mpq mpq) : base(mpq, "glue\\PalNl", - Game.Instance.PlayingBroodWar ? BuiltIns.GluExpcmpgnBin : BuiltIns.GluCmpgnBin) + Game.Instance.PlayingBroodWar ? BuiltIns.GluExpCampaignBin : BuiltIns.GluCampaignBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -68,7 +68,7 @@ int firstPortraitElementIndex) : base(mpq, String.Format("glue\\Ready{0}", Utilities.RaceChar[(int)Game.Instance.Race]), - String.Format(BuiltIns.GluRdyBin, Utilities.RaceCharLower[(int)Game.Instance.Race])) + String.Format(BuiltIns.GluReadyBin, Utilities.RaceCharLower[(int)Game.Instance.Race])) { if (mpq == null) { Modified: trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/SoundDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public SoundDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.SndDlgBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.SoundDialogBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/SpeedDialog.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -49,7 +49,7 @@ /// <param name="parent"></param> /// <param name="mpq"></param> public SpeedDialog(UIScreen parent, Mpq mpq) - : base(parent, mpq, "glue\\Palmm", BuiltIns.SpdDlgBin) + : base(parent, mpq, "glue\\Palmm", BuiltIns.SpeedDialogBin) { BackgroundPath = null; } Modified: trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs 2007-05-24 19:03:55 UTC (rev 1396) +++ trunk/scsharp/src/SCSharpLib/UI/TitleScreen.cs 2007-05-24 19:40:26 UTC (rev 1397) @@ -47,7 +47,7 @@ /// </summary> /// <param name="mpq"></param> public TitleScreen(Mpq mpq) - : base(mpq, "glue\\Palmm", BuiltIns.TitleDlgBin) + : base(mpq, "glue\\Palmm", BuiltIns.TitleDialogBin) { BackgroundPath = BuiltIns.TitlePcx; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-24 18:58:21
|
Revision: 1393 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1393&view=rev Author: jendave Date: 2007-05-24 11:58:18 -0700 (Thu, 24 May 2007) Log Message: ----------- fxcop fixes. renamed a file to comply with fxcop. Add a struct to avoid an out param Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs Added Paths: ----------- trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs Removed Paths: ------------- trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs Modified: trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-24 18:54:29 UTC (rev 1392) +++ trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-24 18:58:18 UTC (rev 1393) @@ -142,3 +142,20 @@ [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.UIScreen.ArrowGrpPath", MessageId = "Grp")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.UIScreen..ctor(SCSharp.MpqLib.Mpq,System.String,System.String)", MessageId = "0#mpq")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.UIScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurfaceFromRgbData(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "Rgb")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.PlayMusic(SCSharp.MpqLib.Mpq,System.String,System.Int32):System.Void", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurface(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "5#rmask")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurface(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "8#amask")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurface(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "7#bmask")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurface(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "6#gmask")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurfaceFromRgbaData(System.Byte[],System.UInt16,System.UInt16,System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "Rgba")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.GetFonts(SCSharp.MpqLib.Mpq):SCSharp.MpqLib.SCFont[]", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.GuiUtility.PlaySound(SCSharp.MpqLib.Mpq,System.String):System.Void", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "type", Target = "SCSharp.UI.MapRenderer", MessageId = "Renderer")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.MapRenderer.RenderToBitmap(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk,System.UInt16,System.UInt16):SCSharp.UI.BitmapImage", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.MapRenderer.RenderToBitmap(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk,System.UInt16,System.UInt16):SCSharp.UI.BitmapImage", MessageId = "1#chk")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.MapRenderer.RenderToSurface(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk):SdlDotNet.Graphics.Surface", MessageId = "0#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.MapRenderer.RenderToSurface(SCSharp.MpqLib.Mpq,SCSharp.MpqLib.Chk):SdlDotNet.Graphics.Surface", MessageId = "1#chk")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.RestartConfirmationDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.SpeedDialog..ctor(SCSharp.UI.UIScreen,SCSharp.MpqLib.Mpq)", MessageId = "1#mpq")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.PlayCustomScreen..ctor(SCSharp.MpqLib.Mpq)", MessageId = "0#mpq")] Added: trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs 2007-05-24 18:58:18 UTC (rev 1393) @@ -0,0 +1,77 @@ +#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 SdlDotNet.Graphics; +using SCSharp; +using SCSharp.MpqLib; + + +namespace SCSharp.UI +{ + /// <summary> + /// + /// </summary> + public struct BitmapImage + { + byte[] image; + + /// <summary> + /// + /// </summary> + public byte[] Image + { + get { return image; } + set { image = value; } + } + ushort pixelWidth; + + /// <summary> + /// + /// </summary> + [CLSCompliant(false)] + public ushort PixelWidth + { + get { return pixelWidth; } + set { pixelWidth = value; } + } + ushort pixelHeight; + + /// <summary> + /// + /// </summary> + [CLSCompliant(false)] + public ushort PixelHeight + { + get { return pixelHeight; } + set { pixelHeight = value; } + } + } +} Property changes on: trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native Deleted: trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-24 18:54:29 UTC (rev 1392) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-24 18:58:18 UTC (rev 1393) @@ -1,608 +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.Collections; -using System.IO; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -using System.Drawing; -using System.Drawing.Imaging; -using SdlDotNet.Graphics; -using SdlDotNet.Audio; -using SCSharp; -using SCSharp.MpqLib; - -/* for the surface creation hack below */ -using System.Reflection; -using Tao.Sdl; - -namespace SCSharp.UI -{ - ///// <summary> - ///// - ///// </summary> - //public delegate void ReadyEventHandler(object sender, EventArgs e); - - /// <summary> - /// - /// </summary> - public static class GuiUtility - { - - static SCFont[] fonts; - - static string[] BroodwarFonts = { -"files\\font\\font8.fnt", -"files\\font\\font10.fnt", -"files\\font\\font14.fnt", -"files\\font\\font16.fnt", -"files\\font\\font16x.fnt" -}; - - /// <summary> - /// - /// </summary> - /// <param name="mpq"></param> - /// <returns></returns> - public static SCFont[] GetFonts(Mpq mpq) - { - if (fonts == null) - { - string[] fontList; - fontList = BroodwarFonts; - - fonts = new SCFont[fontList.Length]; - - for (int i = 0; i < fonts.Length; i++) - { - fonts[i] = (SCFont)mpq.GetResource(fontList[i]); - Console.WriteLine("fonts[{0}] = {1}", i, fonts[i] == null ? "null" : "not null"); - } - } - return fonts; - } - - //public static Surface RenderGlyph(Fnt font, Glyph g, byte[] palette, int offset) - - /// <summary> - /// - /// </summary> - /// <param name="glyph"></param> - /// <param name="palette"></param> - /// <param name="offset"></param> - /// <returns></returns> - public static Surface RenderGlyph(Glyph glyph, byte[] palette, int offset) - { - if (glyph == null) - { - throw new ArgumentNullException("g"); - } - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - byte[] buf = new byte[glyph.Width * glyph.Height * 4]; - int i = 0; - - for (int y = glyph.Height - 1; y >= 0; y--) - { - for (int x = glyph.Width - 1; x >= 0; x--) - { - if (glyph.Bitmap[y, x] == 0) - { - buf[i + 0] = 0; - } - else if (glyph.Bitmap[y, x] == 1) - { - buf[i + 0] = 255; - } - else - { - buf[i + 0] = 128; - } - - buf[i + 1] = palette[(glyph.Bitmap[y, x] + offset) * 3 + 2]; - buf[i + 2] = palette[(glyph.Bitmap[y, x] + offset) * 3 + 1]; - buf[i + 3] = palette[(glyph.Bitmap[y, x] + offset) * 3]; - - if (buf[i + 1] == 252 && buf[i + 2] == 0 && buf[i + 3] == 252) - { - buf[i + 0] = 0; - } - - i += 4; - } - } - - return CreateSurfaceFromRgbaData(buf, (ushort)glyph.Width, (ushort)glyph.Height, 32, glyph.Width * 4); - } - - /// <summary> - /// - /// </summary> - /// <param name="text"></param> - /// <param name="font"></param> - /// <param name="palette"></param> - /// <returns></returns> - public static Surface ComposeText(string text, SCFont font, byte[] palette) - { - return ComposeText(text, font, palette, -1, -1, 4); - } - - /// <summary> - /// - /// </summary> - /// <param name="text"></param> - /// <param name="font"></param> - /// <param name="palette"></param> - /// <param name="offset"></param> - /// <returns></returns> - public static Surface ComposeText(string text, SCFont font, byte[] palette, int offset) - { - return ComposeText(text, font, palette, -1, -1, offset); - } - - /// <summary> - /// - /// </summary> - /// <param name="text"></param> - /// <param name="font"></param> - /// <param name="palette"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="offset"></param> - /// <returns></returns> - public static Surface ComposeText(string text, SCFont font, byte[] palette, int width, int height, - int offset) - { - if (text == null) - { - throw new ArgumentNullException("text"); - } - if (font == null) - { - throw new ArgumentNullException("font"); - } - - int i; - /* create a run of text, for now ignoring any control codes in the string */ - StringBuilder run = new StringBuilder(); - for (i = 0; i < text.Length; i++) - { - if (text[i] == 0x0a /* allow newlines */|| - !Char.IsControl(text[i])) - { - run.Append(text[i]); - } - } - - string rs = run.ToString(); - byte[] r = Encoding.ASCII.GetBytes(rs); - - int x; - int y; - int textHeight; - int textWidth; - - /* measure the text first, optionally wrapping at width */ - textWidth = textHeight = 0; - x = y = 0; - - for (i = 0; i < r.Length; i++) - { - int glyphWidth = 0; - - if (r[i] != 0x0a) /* newline */ - { - if (r[i] == 0x20) /* space */ - { - glyphWidth = font.SpaceSize; - } - else - { - Glyph g = font[r[i] - 1]; - - glyphWidth = g.Width + g.XOffset; - } - } - - if (r[i] == 0x0a || - (width != -1 && x + glyphWidth > width)) - { - if (x > textWidth) - { - textWidth = x; - } - x = 0; - textHeight += font.LineSize; - } - - x += glyphWidth; - } - - if (x > textWidth) - { - textWidth = x; - } - textHeight += font.LineSize; - - Surface surf = new Surface(textWidth, textHeight); - surf.TransparentColor = Color.Black; - surf.Transparent = true; - - /* the draw it */ - x = y = 0; - for (i = 0; i < r.Length; i++) - { - int glyphWidth = 0; - Glyph g = null; - - if (r[i] != 0x0a) /* newline */ - { - if (r[i] == 0x20) /* space */ - { - glyphWidth = font.SpaceSize; - } - else - { - g = font[r[i] - 1]; - glyphWidth = g.Width + g.XOffset; - - Surface gs = RenderGlyph(g, palette, offset); - surf.Blit(gs, new Point(x, y + g.YOffset)); - } - } - - if (r[i] == 0x0a || - x + glyphWidth > textWidth) - { - x = 0; - y += font.LineSize; - } - - x += glyphWidth; - } - - return surf; - } - - /// <summary> - /// - /// </summary> - /// <param name="grid"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="palette"></param> - /// <param name="withAlpha"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static byte[] GetBitmapData(byte[,] grid, ushort width, ushort height, byte[] palette, bool withAlpha) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - byte[] buf = new byte[width * height * (3 + (withAlpha ? 1 : 0))]; - int i = 0; - int x; - int y; - - for (y = height - 1; y >= 0; y--) - { - for (x = width - 1; x >= 0; x--) - { - if (withAlpha) - i++; - buf[i++] = palette[grid[y, x] * 3 + 2]; - buf[i++] = palette[grid[y, x] * 3 + 1]; - buf[i++] = palette[grid[y, x] * 3]; - if (withAlpha) - { - if (buf[i - 3] == 0 - && buf[i - 2] == 0 - && buf[i - 1] == 0) - { - buf[i - 4] = 0x00; - } - else - { - buf[i - 4] = 0xff; - } - } - } - } - - return buf; - } - - /// <summary> - /// - /// </summary> - /// <param name="data"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="depth"></param> - /// <param name="stride"></param> - /// <param name="rmask"></param> - /// <param name="gmask"></param> - /// <param name="bmask"></param> - /// <param name="amask"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static Surface CreateSurface(byte[] data, ushort width, ushort height, int depth, int stride, - int rmask, int gmask, int bmask, int amask) - { - if (data == null) - { - throw new ArgumentNullException("data"); - } - - /* beware, kind of a gross hack below */ - Surface surf; - - IntPtr blob = Marshal.AllocCoTaskMem(data.Length); - Marshal.Copy(data, 0, blob, data.Length); - - IntPtr handle = Sdl.SDL_CreateRGBSurfaceFrom(blob, - width, height, depth, - stride, - rmask, gmask, bmask, amask); - - surf = (Surface)Activator.CreateInstance(typeof(Surface), - BindingFlags.NonPublic | BindingFlags.Instance, - null, - new object[] { handle }, - null); - - return surf; - } - - /// <summary> - /// - /// </summary> - /// <param name="data"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="depth"></param> - /// <param name="stride"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static Surface CreateSurfaceFromRgbaData(byte[] data, ushort width, ushort height, int depth, int stride) - { - return CreateSurface(data, width, height, depth, stride, - /* XXX this needs addressing in Tao.Sdl - these arguments should be uints */ - unchecked((int)0xff000000), - (int)0x00ff0000, - (int)0x0000ff00, - (int)0x000000ff); - } - - /// <summary> - /// - /// </summary> - /// <param name="data"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="depth"></param> - /// <param name="stride"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static Surface CreateSurfaceFromRgbData(byte[] data, ushort width, ushort height, int depth, int stride) - { - return CreateSurface(data, width, height, depth, stride, - (int)0x00ff0000, - (int)0x0000ff00, - (int)0x000000ff, - (int)0x00000000); - } - - /// <summary> - /// - /// </summary> - /// <param name="grid"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="palette"></param> - /// <param name="translucentIndex"></param> - /// <param name="transparentIndex"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static byte[] GetBitmapData(byte[,] grid, ushort width, ushort height, byte[] palette, int translucentIndex, int transparentIndex) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - byte[] buf = new byte[width * height * 4]; - int i = 0; - int x, y; - - for (y = height - 1; y >= 0; y--) - { - for (x = width - 1; x >= 0; x--) - { - if (grid[y, x] == translucentIndex) - { - buf[i + 0] = 0x05; /* keep this in sync with Pcx.cs */ - } - else if (grid[y, x] == transparentIndex) - { - buf[i + 0] = 0x00; - } - else - { - buf[i + 0] = 0xff; - } - buf[i + 1] = palette[grid[y, x] * 3 + 2]; - buf[i + 2] = palette[grid[y, x] * 3 + 1]; - buf[i + 3] = palette[grid[y, x] * 3 + 0]; - i += 4; - } - } - - return buf; - } - - /// <summary> - /// - /// </summary> - /// <param name="grid"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="palette"></param> - /// <param name="withAlpha"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static Surface CreateSurfaceFromBitmap(byte[,] grid, ushort width, ushort height, byte[] palette, bool withAlpha) - { - byte[] buf = GetBitmapData(grid, width, height, palette, withAlpha); - - return CreateSurfaceFromRgbaData(buf, width, height, withAlpha ? 32 : 24, width * (3 + (withAlpha ? 1 : 0))); - } - - /// <summary> - /// - /// </summary> - /// <param name="grid"></param> - /// <param name="width"></param> - /// <param name="height"></param> - /// <param name="palette"></param> - /// <param name="translucentIndex"></param> - /// <param name="transparentIndex"></param> - /// <returns></returns> - [CLSCompliant(false)] - public static Surface CreateSurfaceFromBitmap(byte[,] grid, ushort width, ushort height, byte[] palette, int translucentIndex, int transparentIndex) - { - byte[] buf = GetBitmapData(grid, width, height, palette, translucentIndex, transparentIndex); - - return CreateSurfaceFromRgbaData(buf, width, height, 32, width * 4); - } - - /// <summary> - /// - /// </summary> - /// <param name="stream"></param> - /// <returns></returns> - public static byte[] ReadStream(Stream stream) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (stream is MemoryStream) - { - return ((MemoryStream)stream).ToArray(); - } - else - { - byte[] buf = new byte[stream.Length]; - stream.Read(buf, 0, buf.Length); - return buf; - } - } - - /// <summary> - /// - /// </summary> - /// <param name="stream"></param> - /// <param name="translucentIndex"></param> - /// <param name="transparentIndex"></param> - /// <returns></returns> - public static Surface SurfaceFromStream(Stream stream, int translucentIndex, int transparentIndex) - { - Pcx pcx = new Pcx(); - pcx.ReadFromStream(stream, translucentIndex, transparentIndex); - return CreateSurfaceFromRgbaData(pcx.RgbaData, pcx.Width, pcx.Height, pcx.Depth, pcx.Stride); - } - - /// <summary> - /// - /// </summary> - /// <param name="stream"></param> - /// <returns></returns> - public static Surface SurfaceFromStream(Stream stream) - { - return GuiUtility.SurfaceFromStream(stream, -1, -1); - } - - /// <summary> - /// - /// </summary> - /// <param name="stream"></param> - /// <returns></returns> - public static Sound SoundFromStream(Stream stream) - { - byte[] buf = GuiUtility.ReadStream(stream); - return Mixer.Sound(buf); - } - - /// <summary> - /// - /// </summary> - /// <param name="mpq"></param> - /// <param name="resourcePath"></param> - public static void PlaySound(Mpq mpq, string resourcePath) - { - if (mpq == null) - { - throw new ArgumentNullException("mpq"); - } - Stream stream = (Stream)mpq.GetResource(resourcePath); - if (stream == null) - { - return; - } - Sound s = GuiUtility.SoundFromStream(stream); - s.Play(); - } - - /// <summary> - /// - /// </summary> - /// <param name="mpq"></param> - /// <param name="resourcePath"></param> - /// <param name="numberOfLoops"></param> - public static void PlayMusic(Mpq mpq, string resourcePath, int numberOfLoops) - { - if (mpq == null) - { - throw new ArgumentNullException("mpq"); - } - Stream stream = (Stream)mpq.GetResource(resourcePath); - if (stream == null) - { - return; - } - Sound s = GuiUtility.SoundFromStream(stream); - s.Play(true); - } - } -} Added: trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs (rev 0) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs 2007-05-24 18:58:18 UTC (rev 1393) @@ -0,0 +1,608 @@ +#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.Collections; +using System.IO; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +using System.Drawing; +using System.Drawing.Imaging; +using SdlDotNet.Graphics; +using SdlDotNet.Audio; +using SCSharp; +using SCSharp.MpqLib; + +/* for the surface creation hack below */ +using System.Reflection; +using Tao.Sdl; + +namespace SCSharp.UI +{ + ///// <summary> + ///// + ///// </summary> + //public delegate void ReadyEventHandler(object sender, EventArgs e); + + /// <summary> + /// + /// </summary> + public static class GuiUtility + { + + static SCFont[] fonts; + + static string[] BroodwarFonts = { +"files\\font\\font8.fnt", +"files\\font\\font10.fnt", +"files\\font\\font14.fnt", +"files\\font\\font16.fnt", +"files\\font\\font16x.fnt" +}; + + /// <summary> + /// + /// </summary> + /// <param name="mpq"></param> + /// <returns></returns> + public static SCFont[] GetFonts(Mpq mpq) + { + if (fonts == null) + { + string[] fontList; + fontList = BroodwarFonts; + + fonts = new SCFont[fontList.Length]; + + for (int i = 0; i < fonts.Length; i++) + { + fonts[i] = (SCFont)mpq.GetResource(fontList[i]); + Console.WriteLine("fonts[{0}] = {1}", i, fonts[i] == null ? "null" : "not null"); + } + } + return fonts; + } + + //public static Surface RenderGlyph(Fnt font, Glyph g, byte[] palette, int offset) + + /// <summary> + /// + /// </summary> + /// <param name="glyph"></param> + /// <param name="palette"></param> + /// <param name="offset"></param> + /// <returns></returns> + public static Surface RenderGlyph(Glyph glyph, byte[] palette, int offset) + { + if (glyph == null) + { + throw new ArgumentNullException("g"); + } + if (palette == null) + { + throw new ArgumentNullException("palette"); + } + byte[] buf = new byte[glyph.Width * glyph.Height * 4]; + int i = 0; + + for (int y = glyph.Height - 1; y >= 0; y--) + { + for (int x = glyph.Width - 1; x >= 0; x--) + { + if (glyph.Bitmap[y, x] == 0) + { + buf[i + 0] = 0; + } + else if (glyph.Bitmap[y, x] == 1) + { + buf[i + 0] = 255; + } + else + { + buf[i + 0] = 128; + } + + buf[i + 1] = palette[(glyph.Bitmap[y, x] + offset) * 3 + 2]; + buf[i + 2] = palette[(glyph.Bitmap[y, x] + offset) * 3 + 1]; + buf[i + 3] = palette[(glyph.Bitmap[y, x] + offset) * 3]; + + if (buf[i + 1] == 252 && buf[i + 2] == 0 && buf[i + 3] == 252) + { + buf[i + 0] = 0; + } + + i += 4; + } + } + + return CreateSurfaceFromRgbaData(buf, (ushort)glyph.Width, (ushort)glyph.Height, 32, glyph.Width * 4); + } + + /// <summary> + /// + /// </summary> + /// <param name="text"></param> + /// <param name="font"></param> + /// <param name="palette"></param> + /// <returns></returns> + public static Surface ComposeText(string text, SCFont font, byte[] palette) + { + return ComposeText(text, font, palette, -1, -1, 4); + } + + /// <summary> + /// + /// </summary> + /// <param name="text"></param> + /// <param name="font"></param> + /// <param name="palette"></param> + /// <param name="offset"></param> + /// <returns></returns> + public static Surface ComposeText(string text, SCFont font, byte[] palette, int offset) + { + return ComposeText(text, font, palette, -1, -1, offset); + } + + /// <summary> + /// + /// </summary> + /// <param name="text"></param> + /// <param name="font"></param> + /// <param name="palette"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="offset"></param> + /// <returns></returns> + public static Surface ComposeText(string text, SCFont font, byte[] palette, int width, int height, + int offset) + { + if (text == null) + { + throw new ArgumentNullException("text"); + } + if (font == null) + { + throw new ArgumentNullException("font"); + } + + int i; + /* create a run of text, for now ignoring any control codes in the string */ + StringBuilder run = new StringBuilder(); + for (i = 0; i < text.Length; i++) + { + if (text[i] == 0x0a /* allow newlines */|| + !Char.IsControl(text[i])) + { + run.Append(text[i]); + } + } + + string rs = run.ToString(); + byte[] r = Encoding.ASCII.GetBytes(rs); + + int x; + int y; + int textHeight; + int textWidth; + + /* measure the text first, optionally wrapping at width */ + textWidth = textHeight = 0; + x = y = 0; + + for (i = 0; i < r.Length; i++) + { + int glyphWidth = 0; + + if (r[i] != 0x0a) /* newline */ + { + if (r[i] == 0x20) /* space */ + { + glyphWidth = font.SpaceSize; + } + else + { + Glyph g = font[r[i] - 1]; + + glyphWidth = g.Width + g.XOffset; + } + } + + if (r[i] == 0x0a || + (width != -1 && x + glyphWidth > width)) + { + if (x > textWidth) + { + textWidth = x; + } + x = 0; + textHeight += font.LineSize; + } + + x += glyphWidth; + } + + if (x > textWidth) + { + textWidth = x; + } + textHeight += font.LineSize; + + Surface surf = new Surface(textWidth, textHeight); + surf.TransparentColor = Color.Black; + surf.Transparent = true; + + /* the draw it */ + x = y = 0; + for (i = 0; i < r.Length; i++) + { + int glyphWidth = 0; + Glyph g = null; + + if (r[i] != 0x0a) /* newline */ + { + if (r[i] == 0x20) /* space */ + { + glyphWidth = font.SpaceSize; + } + else + { + g = font[r[i] - 1]; + glyphWidth = g.Width + g.XOffset; + + Surface gs = RenderGlyph(g, palette, offset); + surf.Blit(gs, new Point(x, y + g.YOffset)); + } + } + + if (r[i] == 0x0a || + x + glyphWidth > textWidth) + { + x = 0; + y += font.LineSize; + } + + x += glyphWidth; + } + + return surf; + } + + /// <summary> + /// + /// </summary> + /// <param name="grid"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="palette"></param> + /// <param name="withAlpha"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static byte[] GetBitmapData(byte[,] grid, ushort width, ushort height, byte[] palette, bool withAlpha) + { + if (palette == null) + { + throw new ArgumentNullException("palette"); + } + byte[] buf = new byte[width * height * (3 + (withAlpha ? 1 : 0))]; + int i = 0; + int x; + int y; + + for (y = height - 1; y >= 0; y--) + { + for (x = width - 1; x >= 0; x--) + { + if (withAlpha) + i++; + buf[i++] = palette[grid[y, x] * 3 + 2]; + buf[i++] = palette[grid[y, x] * 3 + 1]; + buf[i++] = palette[grid[y, x] * 3]; + if (withAlpha) + { + if (buf[i - 3] == 0 + && buf[i - 2] == 0 + && buf[i - 1] == 0) + { + buf[i - 4] = 0x00; + } + else + { + buf[i - 4] = 0xff; + } + } + } + } + + return buf; + } + + /// <summary> + /// + /// </summary> + /// <param name="data"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="depth"></param> + /// <param name="stride"></param> + /// <param name="rmask"></param> + /// <param name="gmask"></param> + /// <param name="bmask"></param> + /// <param name="amask"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static Surface CreateSurface(byte[] data, ushort width, ushort height, int depth, int stride, + int rmask, int gmask, int bmask, int amask) + { + if (data == null) + { + throw new ArgumentNullException("data"); + } + + /* beware, kind of a gross hack below */ + Surface surf; + + IntPtr blob = Marshal.AllocCoTaskMem(data.Length); + Marshal.Copy(data, 0, blob, data.Length); + + IntPtr handle = Sdl.SDL_CreateRGBSurfaceFrom(blob, + width, height, depth, + stride, + rmask, gmask, bmask, amask); + + surf = (Surface)Activator.CreateInstance(typeof(Surface), + BindingFlags.NonPublic | BindingFlags.Instance, + null, + new object[] { handle }, + null); + + return surf; + } + + /// <summary> + /// + /// </summary> + /// <param name="data"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="depth"></param> + /// <param name="stride"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static Surface CreateSurfaceFromRgbaData(byte[] data, ushort width, ushort height, int depth, int stride) + { + return CreateSurface(data, width, height, depth, stride, + /* XXX this needs addressing in Tao.Sdl - these arguments should be uints */ + unchecked((int)0xff000000), + (int)0x00ff0000, + (int)0x0000ff00, + (int)0x000000ff); + } + + /// <summary> + /// + /// </summary> + /// <param name="data"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="depth"></param> + /// <param name="stride"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static Surface CreateSurfaceFromRgbData(byte[] data, ushort width, ushort height, int depth, int stride) + { + return CreateSurface(data, width, height, depth, stride, + (int)0x00ff0000, + (int)0x0000ff00, + (int)0x000000ff, + (int)0x00000000); + } + + /// <summary> + /// + /// </summary> + /// <param name="grid"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="palette"></param> + /// <param name="translucentIndex"></param> + /// <param name="transparentIndex"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static byte[] GetBitmapData(byte[,] grid, ushort width, ushort height, byte[] palette, int translucentIndex, int transparentIndex) + { + if (palette == null) + { + throw new ArgumentNullException("palette"); + } + byte[] buf = new byte[width * height * 4]; + int i = 0; + int x, y; + + for (y = height - 1; y >= 0; y--) + { + for (x = width - 1; x >= 0; x--) + { + if (grid[y, x] == translucentIndex) + { + buf[i + 0] = 0x05; /* keep this in sync with Pcx.cs */ + } + else if (grid[y, x] == transparentIndex) + { + buf[i + 0] = 0x00; + } + else + { + buf[i + 0] = 0xff; + } + buf[i + 1] = palette[grid[y, x] * 3 + 2]; + buf[i + 2] = palette[grid[y, x] * 3 + 1]; + buf[i + 3] = palette[grid[y, x] * 3 + 0]; + i += 4; + } + } + + return buf; + } + + /// <summary> + /// + /// </summary> + /// <param name="grid"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="palette"></param> + /// <param name="withAlpha"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static Surface CreateSurfaceFromBitmap(byte[,] grid, ushort width, ushort height, byte[] palette, bool withAlpha) + { + byte[] buf = GetBitmapData(grid, width, height, palette, withAlpha); + + return CreateSurfaceFromRgbaData(buf, width, height, withAlpha ? 32 : 24, width * (3 + (withAlpha ? 1 : 0))); + } + + /// <summary> + /// + /// </summary> + /// <param name="grid"></param> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="palette"></param> + /// <param name="translucentIndex"></param> + /// <param name="transparentIndex"></param> + /// <returns></returns> + [CLSCompliant(false)] + public static Surface CreateSurfaceFromBitmap(byte[,] grid, ushort width, ushort height, byte[] palette, int translucentIndex, int transparentIndex) + { + byte[] buf = GetBitmapData(grid, width, height, palette, translucentIndex, transparentIndex); + + return CreateSurfaceFromRgbaData(buf, width, height, 32, width * 4); + } + + /// <summary> + /// + /// </summary> + /// <param name="stream"></param> + /// <returns></returns> + public static byte[] ReadStream(Stream stream) + { + if (stream == null) + { + throw new ArgumentNullException("stream"); + } + if (stream is MemoryStream) + { + return ((MemoryStream)stream).ToArray(); + } + else + { + byte[] buf = new byte[stream.Length]; + stream.Read(buf, 0, buf.Length); + return buf; + } + } + + /// <summary> + /// + /// </summary> + /// <param name="stream"></param> + /// <param name="translucentIndex"></param> + /// <param name="transparentIndex"></param> + /// <returns></returns> + public static Surface SurfaceFromStream(Stream stream, int translucentIndex, int transparentIndex) + { + Pcx pcx = new Pcx(); + pcx.ReadFromStream(stream, translucentIndex, transparentIndex); + return CreateSurfaceFromRgbaData(pcx.RgbaData, pcx.Width, pcx.Height, pcx.Depth, pcx.Stride); + } + + /// <summary> + /// + /// </summary> + /// <param name="stream"></param> + /// <returns></returns> + public static Surface SurfaceFromStream(Stream stream) + { + return GuiUtility.SurfaceFromStream(stream, -1, -1); + } + + /// <summary> + /// + /// </summary> + /// <param name="stream"></param> + /// <returns></returns> + public static Sound SoundFromStream(Stream stream) + { + byte[] buf = GuiUtility.ReadStream(stream); + return Mixer.Sound(buf); + } + + /// <summary> + /// + /// </summary> + /// <param name="mpq"></param> + /// <param name="resourcePath"></param> + public static void PlaySound(Mpq mpq, string resourcePath) + { + if (mpq == null) + { + throw new ArgumentNullException("mpq"); + } + Stream stream = (Stream)mpq.GetResource(resourcePath); + if (stream == null) + { + return; + } + Sound s = GuiUtility.SoundFromStream(stream); + s.Play(); + } + + /// <summary> + /// + /// </summary> + /// <param name="mpq"></param> + /// <param name="resourcePath"></param> + /// <param name="numberOfLoops"></param> + public static void PlayMusic(Mpq mpq, string resourcePath, int numberOfLoops) + { + if (mpq == null) + { + throw new ArgumentNullException("mpq"); + } + Stream stream = (Stream)mpq.GetResource(resourcePath); + if (stream == null) + { + return; + } + Sound s = GuiUtility.SoundFromStream(stream); + s.Play(true); + } + } +} Property changes on: trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs ___________________________________________________________________ Name: svn:mime-type + text/x-csharp Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-25 18:09:25
|
Revision: 1399 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1399&view=rev Author: jendave Date: 2007-05-25 11:09:24 -0700 (Fri, 25 May 2007) Log Message: ----------- fxcop fixes. Unneccesary string creation and cast Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs trunk/scsharp/src/SCSharpLib/UI/Game.cs trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-24 19:41:20 UTC (rev 1398) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-25 18:09:24 UTC (rev 1399) @@ -69,24 +69,25 @@ throw new ArgumentNullException("path"); } string pathLower = path.ToLower(); - string ext = Path.GetExtension(path).ToLower(); - if (ext == ".tbl") + //string ext = Path.GetExtension(path).ToLower(); + string ext = Path.GetExtension(path); + if (String.Compare(ext, ".tbl", true) == 0) { return typeof(Tbl); } - else if (ext == ".fnt") + else if (String.Compare(ext, ".fnt", true) == 0) { return typeof(SCFont); } - else if (ext == ".got") + else if (String.Compare(ext, ".got", true) == 0) { return typeof(Got); } - else if (ext == ".grp") + else if (String.Compare(ext, ".grp", true) == 0) { return typeof(Grp); } - else if (ext == ".bin") + else if (String.Compare(ext, ".bin", true) == 0) { if (pathLower.EndsWith("aiscript.bin")) /* must come before iscript.bin */ { @@ -101,11 +102,11 @@ return typeof(Bin); } } - else if (ext == ".chk") + else if (String.Compare(ext, ".chk", true) == 0) { return typeof(Chk); } - else if (ext == ".dat") + else if (String.Compare(ext, ".dat", true) == 0) { if (pathLower.EndsWith("flingy.dat")) { @@ -132,7 +133,7 @@ return typeof(MapDataDat); } } - else if (ext == ".spk") + else if (String.Compare(ext, ".spk", true) == 0) { return typeof(Spk); } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-24 19:41:20 UTC (rev 1398) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-25 18:09:24 UTC (rev 1399) @@ -123,7 +123,7 @@ { foreach (string path in Directory.GetFileSystemEntries(scProgramDir)) { - if (Path.GetFileName(path).ToLower() == "broodat.mpq") + if (String.Compare(Path.GetFileName(path), "broodat.mpq", true) == 0) { try { @@ -136,7 +136,7 @@ path), e); } } - else if (Path.GetFileName(path).ToLower() == "stardat.mpq") + else if (String.Compare(Path.GetFileName(path), "stardat.mpq", true) == 0) { try { @@ -161,7 +161,7 @@ { foreach (string path in Directory.GetFileSystemEntries(scCDDir)) { - if (Path.GetFileName(path).ToLower() == "install.exe") + if (String.Compare(Path.GetFileName(path), "install.exe", true) == 0) { try { @@ -182,7 +182,7 @@ { foreach (string path in Directory.GetFileSystemEntries(bwCDDir)) { - if (Path.GetFileName(path).ToLower() == "install.exe") + if (String.Compare(Path.GetFileName(path), "install.exe", true) == 0) { try { @@ -307,6 +307,7 @@ Events.MouseButtonUp += MouseButtonUp; Events.KeyboardUp += KeyboardUp; Events.KeyboardDown += KeyboardDown; + //Events.Quit += Quit; DisplayTitle(); Modified: trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs 2007-05-24 19:41:20 UTC (rev 1398) +++ trunk/scsharp/src/SCSharpLib/UI/GuiUtility.cs 2007-05-25 18:09:24 UTC (rev 1399) @@ -517,9 +517,10 @@ { throw new ArgumentNullException("stream"); } - if (stream is MemoryStream) + MemoryStream newStream = stream as MemoryStream; + if (newStream != null) { - return ((MemoryStream)stream).ToArray(); + return newStream.ToArray(); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-25 18:44:57
|
Revision: 1400 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1400&view=rev Author: jendave Date: 2007-05-25 11:44:54 -0700 (Fri, 25 May 2007) Log Message: ----------- fix some cultureinfo stuff for fxcop Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs trunk/scsharp/src/SCSharpLib/UI/Game.cs trunk/scsharp/src/SCSharpLib/UI/ImageElement.cs trunk/scsharp/src/SCSharpLib/UI/LogOnScreen.cs trunk/scsharp/src/SCSharpLib/UI/Pcx.cs trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs trunk/scsharp/src/SCSharpLib/UI/Sprite.cs trunk/scsharp/src/SCSharpLib/UI/SpriteManager.cs trunk/scsharp/src/SCSharpLib/UI/TextBoxElement.cs trunk/scsharp/src/SCSharpLib/UI/UIElement.cs trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -39,7 +39,7 @@ /// /// </summary> [Flags] - public enum SCElement + public enum SCElements { /// <summary> /// @@ -335,12 +335,12 @@ set { textOffset = value; } } - private SCElement flags; + private SCElements flags; /// <summary> /// /// </summary> - public SCElement Flags + public SCElements Flags { get { return flags; } set { flags = value; } @@ -388,7 +388,7 @@ height = Utilities.ReadWord(buffer, position + 14); textOffset = Utilities.ReadDWord(buffer, position + 20); - flags = (SCElement)Utilities.ReadDWord(buffer, position + 24); + flags = (SCElements)Utilities.ReadDWord(buffer, position + 24); type = (ElementType)buffer[position + 34]; if (textOffset < streamLength) @@ -401,7 +401,7 @@ text = Encoding.ASCII.GetString(buffer, (int)textOffset, (int)textLength); - if ((flags & SCElement.HasHotkey) == SCElement.HasHotkey) + if ((flags & SCElements.HasHotkey) == SCElements.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 (SCElement f in Enum.GetValues(typeof(SCElement))) + foreach (SCElements f in Enum.GetValues(typeof(SCElements))) { if ((flags & f) == f) { Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Mpq.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -31,6 +31,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Collections.Generic; +using System.Globalization; namespace SCSharp.MpqLib { @@ -68,26 +69,26 @@ { throw new ArgumentNullException("path"); } - string pathLower = path.ToLower(); + string pathLower = path.ToLower(CultureInfo.CurrentCulture); //string ext = Path.GetExtension(path).ToLower(); string ext = Path.GetExtension(path); - if (String.Compare(ext, ".tbl", true) == 0) + if (String.Compare(ext, ".tbl", true, CultureInfo.CurrentCulture) == 0) { return typeof(Tbl); } - else if (String.Compare(ext, ".fnt", true) == 0) + else if (String.Compare(ext, ".fnt", true, CultureInfo.CurrentCulture) == 0) { return typeof(SCFont); } - else if (String.Compare(ext, ".got", true) == 0) + else if (String.Compare(ext, ".got", true, CultureInfo.CurrentCulture) == 0) { return typeof(Got); } - else if (String.Compare(ext, ".grp", true) == 0) + else if (String.Compare(ext, ".grp", true, CultureInfo.CurrentCulture) == 0) { return typeof(Grp); } - else if (String.Compare(ext, ".bin", true) == 0) + else if (String.Compare(ext, ".bin", true, CultureInfo.CurrentCulture) == 0) { if (pathLower.EndsWith("aiscript.bin")) /* must come before iscript.bin */ { @@ -102,11 +103,11 @@ return typeof(Bin); } } - else if (String.Compare(ext, ".chk", true) == 0) + else if (String.Compare(ext, ".chk", true, CultureInfo.CurrentCulture) == 0) { return typeof(Chk); } - else if (String.Compare(ext, ".dat", true) == 0) + else if (String.Compare(ext, ".dat", true, CultureInfo.CurrentCulture) == 0) { if (pathLower.EndsWith("flingy.dat")) { @@ -133,7 +134,7 @@ return typeof(MapDataDat); } } - else if (String.Compare(ext, ".spk", true) == 0) + else if (String.Compare(ext, ".spk", true, CultureInfo.CurrentCulture) == 0) { return typeof(Spk); } @@ -175,7 +176,7 @@ res.ReadFromStream(stream); /* don't cache .smk files */ - if (!path.ToLower().EndsWith(".smk")) + if (!path.ToLower(CultureInfo.CurrentCulture).EndsWith(".smk")) { cachedResources[path] = res; } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqArchive.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -32,6 +32,7 @@ using System; using System.Collections; using System.IO; +using System.Globalization; using SCSharp.UI; @@ -50,12 +51,12 @@ private MpqHash[] mHashes; private MpqBlock[] mBlocks; - private static uint[] sStormBuffer; + private static uint[] sStormBuffer = BuildStormBuffer(); - static MpqArchive() - { - sStormBuffer = BuildStormBuffer(); - } + //static MpqArchive() + //{ + // sStormBuffer = BuildStormBuffer(); + //} /// <summary> /// @@ -211,7 +212,7 @@ foreach (char c in input) { - int val = (int)char.ToUpper(c); + int val = (int)char.ToUpper(c, CultureInfo.CurrentCulture); seed1 = sStormBuffer[offset + val] ^ (seed1 + seed2); seed2 = (uint)val + seed1 + seed2 + (seed2 << 5) + 3; } Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqDirectory.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -31,6 +31,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Collections.Generic; +using System.Globalization; namespace SCSharp.MpqLib { @@ -57,7 +58,9 @@ static string ConvertBackSlashes(string path) { while (path.IndexOf('\\') != -1) + { path = path.Replace('\\', Path.DirectorySeparatorChar); + } return path; } @@ -69,15 +72,15 @@ /// <returns></returns> public override Stream GetStreamForResource(string path) { - string rebased_path = ConvertBackSlashes(Path.Combine(mpqDirPath, path)); + string rebasedPath = ConvertBackSlashes(Path.Combine(mpqDirPath, path)); - if (fileHash.ContainsKey(rebased_path.ToLower())) + if (fileHash.ContainsKey(rebasedPath.ToLower(CultureInfo.CurrentCulture))) { - string real_path = fileHash[rebased_path.ToLower()]; - if (real_path != null) + string realPath = fileHash[rebasedPath.ToLower(CultureInfo.CurrentCulture)]; + if (realPath != null) { - Console.WriteLine("using {0}", real_path); - return File.OpenRead(real_path); + Console.WriteLine("using {0}", realPath); + return File.OpenRead(realPath); } } return null; @@ -89,7 +92,7 @@ foreach (string f in files) { string platform_path = ConvertBackSlashes(f); - fileHash.Add(f.ToLower(), platform_path); + fileHash.Add(f.ToLower(CultureInfo.CurrentCulture), platform_path); } string[] directories = Directory.GetDirectories(path); Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -228,11 +228,11 @@ if (target < 0) { - throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek before the beginning of the stream"); + throw new ArgumentOutOfRangeException("offset", "Attempted to Seek before the beginning of the stream"); } if (target >= Length) { - throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek beyond the end of the stream"); + throw new ArgumentOutOfRangeException("offset", "Attempted to Seek beyond the end of the stream"); } mPosition = target; Modified: trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/Properties/AssemblyInfo.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -198,4 +198,26 @@ [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.PortDataTbl", MessageId = "Tbl")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.FlingyDat", MessageId = "Flingy")] [module: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", Scope = "type", Target = "SCSharp.UI.LogOnScreen", MessageId = "OnScreen")] +[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.BuiltIns.GluLogOnBin", MessageId = "Glu")] +[module: SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "SCSharp.MpqLib.ElementType")] +[module: SuppressMessage("Microsoft.Usage", "CA2204:LiteralsShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Pcx.ReadFromStream(System.IO.Stream,System.Int32,System.Int32):System.Void", MessageId = "pcx")] +[module: SuppressMessage("Microsoft.Usage", "CA2204:LiteralsShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game..ctor(System.String,System.String,System.String)", MessageId = "mpq")] +[module: SuppressMessage("Microsoft.Usage", "CA2204:LiteralsShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game..ctor(System.String,System.String,System.String)", MessageId = "Broodwar")] +[module: SuppressMessage("Microsoft.Usage", "CA2204:LiteralsShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game..ctor(System.String,System.String,System.String)", MessageId = "broodwar")] +[module: SuppressMessage("Microsoft.Usage", "CA2204:LiteralsShouldBeSpelledCorrectly", Scope = "member", Target = "SCSharp.UI.Game..ctor(System.String,System.String,System.String)", MessageId = "stardat")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.SCFont.GetGlyph(System.Int32):SCSharp.MpqLib.Glyph", MessageId = "Body")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Glyph.Bitmap", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Glyph.bitmap", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Grp.DecodeLine(System.Byte[,],System.Int32,System.Byte,System.UInt16,System.UInt16):System.Void", MessageId = "0#")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Grp.GetFrame(System.Int32):System.Byte[,]", MessageId = "Body")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Grp.GetFrame(System.Int32):System.Byte[,]", MessageId = "Return")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Chk.MapTiles", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Chk.ParseSection(System.String):System.Void", MessageId = "Body")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Chk.MapMask", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Chk.mapTiles", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.MpqLib.Chk.mapMask", MessageId = "Member")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurfaceFromBitmap(System.Byte[,],System.UInt16,System.UInt16,System.Byte[],System.Int32,System.Int32):SdlDotNet.Graphics.Surface", MessageId = "0#")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.UI.GuiUtility.GetBitmapData(System.Byte[,],System.UInt16,System.UInt16,System.Byte[],System.Boolean):System.Byte[]", MessageId = "0#")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.UI.GuiUtility.GetBitmapData(System.Byte[,],System.UInt16,System.UInt16,System.Byte[],System.Int32,System.Int32):System.Byte[]", MessageId = "0#")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SCSharp.UI.GuiUtility.CreateSurfaceFromBitmap(System.Byte[,],System.UInt16,System.UInt16,System.Byte[],System.Boolean):SdlDotNet.Graphics.Surface", MessageId = "0#")] Modified: trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/BitmapImage.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -28,6 +28,7 @@ using System; using System.IO; +using System.Globalization; using SdlDotNet.Graphics; using SCSharp; @@ -73,5 +74,63 @@ get { return pixelHeight; } set { pixelHeight = value; } } + + /// <summary> + /// String representation of circle + /// </summary> + /// <returns>string representation of circle</returns> + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "({0},{1}, {2})", this.image, this.pixelHeight, this.PixelWidth); + } + + /// <summary> + /// Equals operator + /// </summary> + /// <param name="obj">Circle to compare</param> + /// <returns>true if circles are equal</returns> + public override bool Equals(object obj) + { + if (obj == null) + { + throw new ArgumentNullException("obj"); + } + if (obj.GetType() != typeof(BitmapImage)) + return false; + + BitmapImage c = (BitmapImage)obj; + return ((this.image == c.image) && (this.pixelHeight == c.pixelHeight) && (this.pixelWidth == c.pixelWidth)); + } + + /// <summary> + /// Equals operator + /// </summary> + /// <param name="c1">Circle to compare</param> + /// <param name="c2">Circle to compare</param> + /// <returns>True if circles are equal</returns> + public static bool operator ==(BitmapImage c1, BitmapImage c2) + { + return ((c1.image == c2.image) && (c1.pixelHeight == c2.pixelHeight) && (c1.pixelWidth == c2.pixelWidth)); + } + + /// <summary> + /// Not equals operator + /// </summary> + /// <param name="c1">Circle to compare</param> + /// <param name="c2">Circle to compare</param> + /// <returns>True if circles are not equal</returns> + public static bool operator !=(BitmapImage c1, BitmapImage c2) + { + return !(c1 == c2); + } + + /// <summary> + /// Hash Code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + return image.GetHashCode() ^ pixelWidth ^ pixelHeight; + } } } Modified: trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/BriefingRunner.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -94,7 +94,7 @@ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - public void Tick(object sender, TickEventArgs e) + internal void Tick(object sender, TickEventArgs e) { TriggerAction[] actions = triggerData.Triggers[0].Actions; Modified: trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/BuiltIns.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -95,7 +95,7 @@ /// <summary> /// /// </summary> - public const string GluLoginBin = "rez\\gluLogin.bin"; + public const string GluLogOnBin = "rez\\gluLogin.bin"; /// <summary> /// /// </summary> Modified: trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -104,7 +104,7 @@ /// </summary> public override void MouseEnter() { - if (Sensitive && (Flags & SCElement.RespondToMouse) == SCElement.RespondToMouse) + if (Sensitive && (Flags & SCElements.RespondToMouse) == SCElements.RespondToMouse) { /* highlight the text */ GuiUtility.PlaySound(Mpq, BuiltIns.MouseOverWav); Modified: trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/FFmpeg.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -43,24 +43,25 @@ { //static bool initSucceeded; - static FFmpeg() - { - try - { - //ffmpeg_init(); - //initSucceeded = true; - } - catch (DllNotFoundException) - { - //initSucceeded = false; - } - } + //static FFmpeg() + //{ + // try + // { + // //ffmpeg_init(); + // //initSucceeded = true; + // //initSucceeded = false; + // } + // catch (DllNotFoundException) + // { + // //initSucceeded = false; + // } + //} - //GCHandle handle; + GCHandle handle; //string filename; - //byte[] buf; - //int width; - //int height; + //byte[] buffer; + //int width = 0; + //int height = 0; /// <summary> /// @@ -75,7 +76,7 @@ //} //this.filename = fileName; - //this.buf = buf; + //this.buffer = buffer; } /// <summary> @@ -83,7 +84,7 @@ /// </summary> public void Start() { - //handle = start_decoder(filename, buf, buf.Length); + //handle = start_decoder(filename, buffer, buffer.Length); //get_dimensions(handle, out width, out height); } @@ -92,11 +93,11 @@ /// </summary> public void Stop() { - //if (handle.Target != null) - //{ - // //stop_decoder(handle); - // handle.Target = null; - //} + if (handle.Target != null) + { + //stop_decoder(handle); + handle.Target = null; + } } /// <summary> @@ -106,7 +107,7 @@ /// <returns></returns> public bool GetNextFrame(byte[] buffer) { - return true; //get_next_frame(handle, buf); + return true;// get_next_frame(handle, buffer); } /// <summary> @@ -116,7 +117,7 @@ { get { - return 0;// return width; + return 0; //width; } } @@ -127,7 +128,7 @@ { get { - return 0;// return height; + return 0;// height; } } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -29,6 +29,7 @@ using System; using System.IO; using System.Threading; +using System.Globalization; using SdlDotNet.Input; using SdlDotNet.Core; @@ -123,7 +124,7 @@ { foreach (string path in Directory.GetFileSystemEntries(scProgramDir)) { - if (String.Compare(Path.GetFileName(path), "broodat.mpq", true) == 0) + if (String.Compare(Path.GetFileName(path), "broodat.mpq", true, CultureInfo.CurrentCulture) == 0) { try { @@ -136,7 +137,7 @@ path), e); } } - else if (String.Compare(Path.GetFileName(path), "stardat.mpq", true) == 0) + else if (String.Compare(Path.GetFileName(path), "stardat.mpq", true, CultureInfo.CurrentCulture) == 0) { try { @@ -154,14 +155,14 @@ if (stardatMpq == null) { - throw new SCException("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting"); + throw new SCException("unable to locate stardat.mpq, please check your SCDirectory configuration setting"); } if (scCDDir != null) { foreach (string path in Directory.GetFileSystemEntries(scCDDir)) { - if (String.Compare(Path.GetFileName(path), "install.exe", true) == 0) + if (String.Compare(Path.GetFileName(path), "install.exe", true, CultureInfo.CurrentCulture) == 0) { try { @@ -182,7 +183,7 @@ { foreach (string path in Directory.GetFileSystemEntries(bwCDDir)) { - if (String.Compare(Path.GetFileName(path), "install.exe", true) == 0) + if (String.Compare(Path.GetFileName(path), "install.exe", true, CultureInfo.CurrentCulture) == 0) { try { @@ -318,7 +319,7 @@ /// <summary> /// /// </summary> - public static void Quit(object sender, EventArgs e) + internal static void Quit(object sender, EventArgs e) { Events.QuitApplication(); } Modified: trunk/scsharp/src/SCSharpLib/UI/ImageElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ImageElement.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/ImageElement.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -62,7 +62,7 @@ { Surface surface; - if ((Flags & SCElement.Translucent) == SCElement.Translucent) + if ((Flags & SCElements.Translucent) == SCElements.Translucent) { surface = GuiUtility.SurfaceFromStream((Stream)Mpq.GetResource(Text), 254, 0); Modified: trunk/scsharp/src/SCSharpLib/UI/LogOnScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/LogOnScreen.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/LogOnScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -47,7 +47,7 @@ /// </summary> /// <param name="mpq"></param> public LogOnScreen(Mpq mpq) - : base(mpq, "glue\\PalNl", BuiltIns.GluLoginBin) + : base(mpq, "glue\\PalNl", BuiltIns.GluLogOnBin) { } Modified: trunk/scsharp/src/SCSharpLib/UI/Pcx.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Pcx.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/Pcx.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -69,7 +69,7 @@ byte magic = Utilities.ReadByte(stream); if (magic != 0x0A) { - throw new SCException("stream is not a valid .pcx file"); + throw new SCException("stream is not a valid PCX file"); } /*version =*/ @@ -99,7 +99,7 @@ stream.Position += 54; if (bpp != 8 || numplanes != 1) - throw new SCException("unsupported .pcx image type"); + throw new SCException("unsupported PCX image type"); width = (ushort)(xmax - xmin + 1); height = (ushort)(ymax - ymin + 1); Modified: trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -31,6 +31,7 @@ using System.Threading; using System.Collections.Generic; using System.Drawing; +using System.Globalization; using SdlDotNet.Input; using SCSharp; @@ -121,7 +122,7 @@ } foreach (string d in dir) { - string dl = Path.GetFileName(d).ToLower(); + string dl = Path.GetFileName(d).ToLower(CultureInfo.CurrentCulture); if (curdir == mapdir) { @@ -153,7 +154,7 @@ for (int i = 0; i < files.Length; i++) { - string lower = files[i].ToLower(); + string lower = files[i].ToLower(CultureInfo.CurrentCulture); if (lower.EndsWith(".scm") || lower.EndsWith(".scx")) { fileListbox.AddItem(Path.GetFileName(files[i])); Modified: trunk/scsharp/src/SCSharpLib/UI/Sprite.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Sprite.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/Sprite.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -54,7 +54,7 @@ public class Sprite { static Random rng = new Random(Environment.TickCount); - + //static bool showSpriteBorders = ShowSpriteBorders(); ushort imagesEntry; string grpPath; @@ -94,6 +94,7 @@ { showSpriteBorders = Boolean.Parse(sb); } + //return true; } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/UI/SpriteManager.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/SpriteManager.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/SpriteManager.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -47,7 +47,15 @@ /// <summary> /// /// </summary> - public static Collection<Sprite> sprites = new Collection<Sprite>(); + private static Collection<Sprite> sprites = new Collection<Sprite>(); + + /// <summary> + /// + /// </summary> + public static Collection<Sprite> Sprites + { + get { return SpriteManager.sprites; } + } static Painter painter; static Mpq ourMpq; Modified: trunk/scsharp/src/SCSharpLib/UI/TextBoxElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/TextBoxElement.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/TextBoxElement.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -30,6 +30,7 @@ using System.IO; using System.Text; using System.Threading; +using System.Globalization; using SdlDotNet.Input; using SdlDotNet.Graphics; @@ -116,7 +117,7 @@ char cc; if ((args.Mod & (ModifierKeys.RightShift | ModifierKeys.LeftShift)) != 0) { - cc = Char.ToUpper(c); + cc = Char.ToUpper(c, CultureInfo.CurrentCulture); } else { Modified: trunk/scsharp/src/SCSharpLib/UI/UIElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -72,7 +72,7 @@ this.y1 = el.Y1; this.palette = palette; this.sensitive = true; - this.visible = (el.Flags & SCElement.Visible) != 0; + this.visible = (el.Flags & SCElements.Visible) != 0; } /// <summary> @@ -189,19 +189,19 @@ { int idx = 2; - if ((Flags & SCElement.FontSmallest) != 0) + if ((Flags & SCElements.FontSmallest) != 0) { idx = 0; } - else if ((Flags & SCElement.FontSmaller) != 0) + else if ((Flags & SCElements.FontSmaller) != 0) { idx = 3; } - else if ((Flags & SCElement.FontLarger) != 0) + else if ((Flags & SCElements.FontLarger) != 0) { idx = 3; } - else if ((Flags & SCElement.FontLargest) != 0) + else if ((Flags & SCElements.FontLargest) != 0) { idx = 4; } @@ -225,7 +225,7 @@ /// <summary> /// /// </summary> - public SCElement Flags { get { return el.Flags; } } + public SCElements Flags { get { return el.Flags; } } /// <summary> /// Modified: trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-25 18:09:24 UTC (rev 1399) +++ trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) @@ -679,10 +679,10 @@ if ((args.Key == e.Hotkey) || (args.Key == Key.Return - && (e.Flags & SCElement.DefaultButton) == SCElement.DefaultButton) + && (e.Flags & SCElements.DefaultButton) == SCElements.DefaultButton) || (args.Key == Key.Escape - && (e.Flags & SCElement.CancelButton) == SCElement.CancelButton)) + && (e.Flags & SCElements.CancelButton) == SCElements.CancelButton)) { ActivateElement(e); return; @@ -759,7 +759,7 @@ /// <summary> /// /// </summary> - protected void RaiseReadyEvent(object sender, EventArgs e) + internal void RaiseReadyEvent(object sender, EventArgs e) { if (Ready != null) { @@ -770,7 +770,7 @@ /// <summary> /// /// </summary> - protected void RaiseDoneSwooshing(object sender, EventArgs e) + internal void RaiseDoneSwooshing(object sender, EventArgs e) { if (DoneSwooshing != null) { @@ -856,50 +856,50 @@ /* convert all the BinElements to UIElements for our subclasses to use */ elements = new Collection<UIElement>(); - foreach (BinElement el in bin.Elements) + foreach (BinElement element in bin.Elements) { // Console.WriteLine ("{0}: {1}", el.text, el.flags); - UIElement ui_el = null; - switch (el.Type) + UIElement uiElement = null; + switch (element.Type) { case ElementType.DialogBox: - ui_el = new DialogBoxElement(this, el, fontPalette.RgbData); + uiElement = new DialogBoxElement(this, element, fontPalette.RgbData); break; case ElementType.Image: - ui_el = new ImageElement(this, el, fontPalette.RgbData); + uiElement = new ImageElement(this, element, fontPalette.RgbData); break; case ElementType.TextBox: - ui_el = new TextBoxElement(this, el, fontPalette.RgbData); + uiElement = new TextBoxElement(this, element, fontPalette.RgbData); break; case ElementType.ListBox: - ui_el = new ListBoxElement(this, el, fontPalette.RgbData); + uiElement = new ListBoxElement(this, element, fontPalette.RgbData); break; case ElementType.ComboBox: - ui_el = new ComboBoxElement(this, el, fontPalette.RgbData); + uiElement = new ComboBoxElement(this, element, fontPalette.RgbData); break; case ElementType.LabelLeftAlign: case ElementType.LabelCenterAlign: case ElementType.LabelRightAlign: - ui_el = new LabelElement(this, el, fontPalette.RgbData); + uiElement = new LabelElement(this, element, fontPalette.RgbData); break; case ElementType.Button: case ElementType.DefaultButton: case ElementType.ButtonWithoutBorder: - ui_el = new ButtonElement(this, el, fontPalette.RgbData); + uiElement = new ButtonElement(this, element, fontPalette.RgbData); break; case ElementType.Slider: case ElementType.OptionButton: case ElementType.CheckBox: - ui_el = new UIElement(this, el, fontPalette.RgbData); + uiElement = new UIElement(this, element, fontPalette.RgbData); break; default: - Console.WriteLine("unhandled case {0}", el.Type); - ui_el = new UIElement(this, el, fontPalette.RgbData); + Console.WriteLine("unhandled case {0}", element.Type); + uiElement = new UIElement(this, element, fontPalette.RgbData); break; } - elements.Add(ui_el); + elements.Add(uiElement); } uiPainter = new UIPainter(elements); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <je...@us...> - 2007-05-25 18:57:21
|
Revision: 1401 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1401&view=rev Author: jendave Date: 2007-05-25 11:57:14 -0700 (Fri, 25 May 2007) Log Message: ----------- Specify iformat for fxcop Modified Paths: -------------- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs trunk/scsharp/src/SCSharpLib/MpqLib/TriggerCondition.cs trunk/scsharp/src/SCSharpLib/UI/Game.cs trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs trunk/scsharp/src/SCSharpLib/UI/MapRenderer.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/UIElement.cs trunk/scsharp/src/SCSharpLib/UI/UIPainter.cs trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs Modified: trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/MpqLib/BinElement.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -30,6 +30,7 @@ using System.IO; using System.Text; using System.Collections.Generic; +using System.Globalization; using SCSharp.UI; @@ -436,7 +437,7 @@ /// <returns></returns> public override string ToString() { - return String.Format("{0} ({1})", type, text); + return String.Format(CultureInfo.CurrentCulture, "{0} ({1})", type, text); } /// <summary> Modified: trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/MpqLib/Chk.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -31,6 +31,7 @@ using System.Text; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using SCSharp.UI; @@ -202,7 +203,7 @@ SectionData sec = sections[sectionName]; if (sec == null) { - throw new SCException(String.Format("map file is missing section {0}, cannot load", sectionName)); + throw new SCException(String.Format(CultureInfo.CurrentCulture, "map file is missing section {0}, cannot load", sectionName)); } if (sec.Buffer == null) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/MpqLib/MpqStream.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -31,6 +31,8 @@ using System; using System.IO; +using System.Globalization; + using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.BZip2; @@ -406,7 +408,7 @@ } sinput = new MemoryStream(result); } - throw new SCException(String.Format("Unhandled compression flags: 0x{0:X}", comptype)); + throw new SCException(String.Format(CultureInfo.CurrentCulture, "Unhandled compression flags: 0x{0:X}", comptype)); } //private static byte[] BZip2Decompress(Stream data, int expectedLength) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/MpqLib/SCFont.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -1,7 +1,7 @@ #region LICENSE // // Authors: -// Chris Toshok (to...@hu...) +// Chris Toshok (to...@hu...) // // (C) 2006 The Hungry Programmers (http://www.hungry.com/) // @@ -12,10 +12,10 @@ // 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 @@ -30,27 +30,28 @@ using System.IO; using System.Collections.Generic; using System.Text; +using System.Globalization; 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) @@ -147,17 +148,17 @@ } done: glyphs.Add(glyphID, - new Glyph(letterWidth, - letterHeight, - letterXOffset, - letterYOffset, - bitmap)); + new Glyph(letterWidth, + letterHeight, + letterXOffset, + letterYOffset, + bitmap)); return glyphs[glyphID]; } /// <summary> - /// + /// /// </summary> /// <param name="index"></param> /// <returns></returns> @@ -168,7 +169,7 @@ if (index < lowIndex || index > highIndex) { throw new ArgumentOutOfRangeException("index", - String.Format("value of {0} out of range of {1}-{2}", index, lowIndex, highIndex)); + String.Format(CultureInfo.CurrentCulture, "value of {0} out of range of {1}-{2}", index, lowIndex, highIndex)); } return GetGlyph(index); @@ -176,7 +177,7 @@ } /// <summary> - /// + /// /// </summary> public int SpaceSize { @@ -184,7 +185,7 @@ } /// <summary> - /// + /// /// </summary> public int LineSize { @@ -192,7 +193,7 @@ } /// <summary> - /// + /// /// </summary> public int MaxWidth { @@ -200,7 +201,7 @@ } /// <summary> - /// + /// /// </summary> public int MaxHeight { @@ -214,7 +215,7 @@ byte maxHeight; /// <summary> - /// + /// /// </summary> public void DumpGlyphs() { @@ -226,7 +227,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="glyphId"></param> public void DumpGlyph(int glyphId) Modified: trunk/scsharp/src/SCSharpLib/MpqLib/TriggerCondition.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/MpqLib/TriggerCondition.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/MpqLib/TriggerCondition.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -30,9 +30,8 @@ using System.IO; using System.Text; using System.Collections.Generic; +using System.Globalization; - - namespace SCSharp.MpqLib { /// <summary> @@ -130,7 +129,7 @@ /// <returns></returns> public override string ToString() { - return String.Format("Trigger{{ Condition={0} }}", Condition); + return String.Format(CultureInfo.CurrentCulture, "Trigger{{ Condition={0} }}", Condition); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/Game.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/Game.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -133,7 +133,7 @@ } catch (SCException e) { - throw new SCException(String.Format("Could not read mpq archive {0}", + throw new SCException(String.Format(CultureInfo.CurrentCulture, "Could not read mpq archive {0}", path), e); } } @@ -146,7 +146,7 @@ } catch (SCException e) { - throw new SCException(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format(CultureInfo.CurrentCulture, "could not read mpq archive {0}", path), e); } } @@ -171,7 +171,7 @@ } catch (SCException e) { - throw new SCException(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format(CultureInfo.CurrentCulture, "could not read mpq archive {0}", path), e); } @@ -192,7 +192,7 @@ } catch (SCException e) { - throw new SCException(String.Format("could not read mpq archive {0}", + throw new SCException(String.Format(CultureInfo.CurrentCulture, "could not read mpq archive {0}", path), e); } Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -1,7 +1,7 @@ #region LICENSE // // Authors: -// Chris Toshok (to...@hu...) +// Chris Toshok (to...@hu...) // // (C) 2006 The Hungry Programmers (http://www.hungry.com/) // @@ -12,10 +12,10 @@ // 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 @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; +using System.Globalization; using SdlDotNet.Graphics; using SdlDotNet.Graphics.Primitives; @@ -43,7 +44,7 @@ namespace SCSharp.UI { /// <summary> - /// + /// /// </summary> public class GameScreen : UIScreen { @@ -93,23 +94,23 @@ CursorAnimator[] MagCursors; //byte[] unit_palette; - byte[] tileset_palette; + byte[] tilesetPalette; - // Player[] players; + // Player[] players; List<Unit> units; /// <summary> - /// + /// /// </summary> /// <param name="mpq"></param> /// <param name="scenario_mpq"></param> /// <param name="scenario"></param> /// <param name="template"></param> public GameScreen(Mpq mpq, - Mpq scenario_mpq, - Chk scenario, - Got template) + Mpq scenario_mpq, + Chk scenario, + Got template) : base(mpq) { this.EffectPalettePath = "game\\tblink.pcx"; @@ -122,14 +123,14 @@ } /// <summary> - /// + /// /// </summary> /// <param name="mpq"></param> /// <param name="prefix"></param> /// <param name="scenario"></param> public GameScreen(Mpq mpq, - string prefix, - Chk scenario) + string prefix, + Chk scenario) : base(mpq) { this.EffectPalettePath = "game\\tblink.pcx"; @@ -168,38 +169,38 @@ } surf.Blit(starfieldLayers[i], - new Rectangle(new Point(0, 0), - new Size(Painter.ScreenResX - scroll_x, - Painter.ScreenResY - scroll_y)), - new Rectangle(new Point(scroll_x, scroll_y), - new Size(Painter.ScreenResX - scroll_x, - Painter.ScreenResY - scroll_y))); + new Rectangle(new Point(0, 0), + new Size(Painter.ScreenResX - scroll_x, + Painter.ScreenResY - scroll_y)), + new Rectangle(new Point(scroll_x, scroll_y), + new Size(Painter.ScreenResX - scroll_x, + Painter.ScreenResY - scroll_y))); if (scroll_x != 0) { surf.Blit(starfieldLayers[i], - new Rectangle(new Point(Painter.ScreenResX - scroll_x, 0), - new Size(scroll_x, Painter.ScreenResY - scroll_y)), - new Rectangle(new Point(0, scroll_y), - new Size(scroll_x, Painter.ScreenResY - scroll_y))); + new Rectangle(new Point(Painter.ScreenResX - scroll_x, 0), + new Size(scroll_x, Painter.ScreenResY - scroll_y)), + new Rectangle(new Point(0, scroll_y), + new Size(scroll_x, Painter.ScreenResY - scroll_y))); } if (scroll_y != 0) { surf.Blit(starfieldLayers[i], - new Rectangle(new Point(0, Painter.ScreenResY - scroll_y), - new Size(Painter.ScreenResX - scroll_x, scroll_y)), - new Rectangle(new Point(scroll_x, 0), - new Size(Painter.ScreenResX - scroll_x, scroll_y))); + new Rectangle(new Point(0, Painter.ScreenResY - scroll_y), + new Size(Painter.ScreenResX - scroll_x, scroll_y)), + new Rectangle(new Point(scroll_x, 0), + new Size(Painter.ScreenResX - scroll_x, scroll_y))); } if (scroll_x != 0 || scroll_y != 0) { surf.Blit(starfieldLayers[i], - new Rectangle(new Point(Painter.ScreenResX - scroll_x, Painter.ScreenResY - scroll_y), - new Size(scroll_x, scroll_y)), - new Rectangle(new Point(0, 0), - new Size(scroll_x, scroll_y))); + new Rectangle(new Point(Painter.ScreenResX - scroll_x, Painter.ScreenResY - scroll_y), + new Size(scroll_x, scroll_y)), + new Rectangle(new Point(0, 0), + new Size(scroll_x, scroll_y))); } } } @@ -209,12 +210,12 @@ void PaintMap(Surface surf, DateTime dt) { surf.Blit(map_surf, - new Rectangle(new Point(0, 0), - new Size(Painter.ScreenResX - topleft_x, - Painter.ScreenResY - topleft_y)), - new Rectangle(new Point(topleft_x, topleft_y), - new Size(Painter.ScreenResX, - Painter.ScreenResY))); + new Rectangle(new Point(0, 0), + new Size(Painter.ScreenResX - topleft_x, + Painter.ScreenResY - topleft_y)), + new Rectangle(new Point(topleft_x, topleft_y), + new Size(Painter.ScreenResX, + Painter.ScreenResY))); } void PaintHud(Surface surf, DateTime dt) @@ -225,15 +226,15 @@ void PaintMinimap(Surface surf, DateTime dt) { Rectangle rect = new Rectangle(new Point((int)((float)topleft_x / (float)map_surf.Width * MINIMAP_WIDTH + MINIMAP_X), - (int)((float)topleft_y / (float)map_surf.Height * MINIMAP_HEIGHT + MINIMAP_Y)), - new Size((int)((float)Painter.ScreenResX / (float)map_surf.Width * MINIMAP_WIDTH), - (int)((float)Painter.ScreenResY / (float)map_surf.Height * MINIMAP_HEIGHT))); + (int)((float)topleft_y / (float)map_surf.Height * MINIMAP_HEIGHT + MINIMAP_Y)), + new Size((int)((float)Painter.ScreenResX / (float)map_surf.Width * MINIMAP_WIDTH), + (int)((float)Painter.ScreenResY / (float)map_surf.Height * MINIMAP_HEIGHT))); surf.Draw(new Box(rect.Location, rect.Size), Color.Green); } /// <summary> - /// + /// /// </summary> /// <param name="painter"></param> public override void AddToPainter(Painter painter) @@ -258,7 +259,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="painter"></param> public override void RemoveFromPainter(Painter painter) @@ -283,7 +284,7 @@ } /// <summary> - /// + /// /// </summary> protected override void ResourceLoader() { @@ -295,11 +296,11 @@ pcx = new Pcx(); pcx.ReadFromStream((Stream)this.Mpq.GetResource("tileset\\badlands\\dark.pcx"), 0, 0); - tileset_palette = pcx.Palette; + tilesetPalette = pcx.Palette; - hud = GuiUtility.SurfaceFromStream((Stream)this.Mpq.GetResource(String.Format(BuiltIns.GameConsolePcx, - Utilities.RaceCharLower[(int)Game.Instance.Race])), - 254, 0); + hud = GuiUtility.SurfaceFromStream((Stream)this.Mpq.GetResource(String.Format(CultureInfo.CurrentCulture, BuiltIns.GameConsolePcx, + Utilities.RaceCharLower[(int)Game.Instance.Race])), + 254, 0); if (scenario.TileSet == TileSet.Platform) { @@ -318,7 +319,7 @@ ParallaxObject obj = starfield.Layers[i].Objects[o]; starfieldLayers[i].Fill(new Rectangle(new Point(obj.PositionX, obj.PositionY), new Size(2, 2)), - Color.White); + Color.White); } } } @@ -327,48 +328,48 @@ // load the cursors we'll show when scrolling with the mouse string[] cursornames = new string[] { - "cursor\\ScrollUL.grp", - "cursor\\ScrollU.grp", - "cursor\\ScrollUR.grp", - "cursor\\ScrollR.grp", - "cursor\\ScrollDR.grp", - "cursor\\ScrollD.grp", - "cursor\\ScrollDL.grp", - "cursor\\ScrollL.grp", - }; +"cursor\\ScrollUL.grp", +"cursor\\ScrollU.grp", +"cursor\\ScrollUR.grp", +"cursor\\ScrollR.grp", +"cursor\\ScrollDR.grp", +"cursor\\ScrollD.grp", +"cursor\\ScrollDL.grp", +"cursor\\ScrollL.grp", +}; ScrollCursors = new CursorAnimator[cursornames.Length]; for (int i = 0; i < cursornames.Length; i++) { ScrollCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(cursornames[i]), - EffectPalette.Palette); + EffectPalette.Palette); ScrollCursors[i].SetHotspot(60, 60); } // load the mag cursors string[] magcursornames = new string[] { - "cursor\\MagG.grp", - "cursor\\MagY.grp", - "cursor\\MagR.grp" - }; +"cursor\\MagG.grp", +"cursor\\MagY.grp", +"cursor\\MagR.grp" +}; MagCursors = new CursorAnimator[magcursornames.Length]; for (int i = 0; i < magcursornames.Length; i++) { MagCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(magcursornames[i]), - EffectPalette.Palette); + EffectPalette.Palette); MagCursors[i].SetHotspot(60, 60); } // load the targeting cursors string[] targetcursornames = new string[] { - "cursor\\TargG.grp", - "cursor\\TargY.grp", - "cursor\\TargR.grp" - }; +"cursor\\TargG.grp", +"cursor\\TargY.grp", +"cursor\\TargR.grp" +}; TargetCursors = new CursorAnimator[targetcursornames.Length]; for (int i = 0; i < targetcursornames.Length; i++) { TargetCursors[i] = new CursorAnimator((Grp)this.Mpq.GetResource(targetcursornames[i]), - EffectPalette.Palette); + EffectPalette.Palette); TargetCursors[i].SetHotspot(60, 60); } @@ -386,7 +387,7 @@ void UpdateCursor() { - /* are we over a unit? if so, display the mag cursor */ + /* are we over a unit? if so, display the mag cursor */ unitUnderCursor = null; for (int i = 0; i < units.Count; i++) { @@ -400,7 +401,7 @@ CursorAnimator c = Game.Instance.Cursor; if (c.PositionX + topleft_x > s.TopLeftPosition.X && c.PositionX + topleft_x <= s.TopLeftPosition.X + 100 /* XXX */ - && c.PositionY + topleft_y > s.TopLeftPosition.Y && c.PositionY + topleft_y <= s.TopLeftPosition.Y + 100 /* XXX */) + && c.PositionY + topleft_y > s.TopLeftPosition.Y && c.PositionY + topleft_y <= s.TopLeftPosition.Y + 100 /* XXX */) { Game.Instance.Cursor = MagCursors[MAG_CURSOR_G]; unitUnderCursor = u; @@ -410,7 +411,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="surf"></param> /// <param name="dt"></param> @@ -446,7 +447,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="args"></param> public override void MouseButtonDown(MouseButtonEventArgs args) @@ -456,7 +457,7 @@ throw new ArgumentNullException("args"); } if (args.X > MINIMAP_X && args.X < MINIMAP_X + MINIMAP_WIDTH && - args.Y > MINIMAP_Y && args.Y < MINIMAP_Y + MINIMAP_HEIGHT) + args.Y > MINIMAP_Y && args.Y < MINIMAP_Y + MINIMAP_HEIGHT) { RecenterFromMinimap(args.X, args.Y); buttonDownInMinimap = true; @@ -472,7 +473,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="args"></param> public override void MouseButtonUp(MouseButtonEventArgs args) @@ -488,7 +489,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="args"></param> public override void PointerMotion(MouseMotionEventArgs args) @@ -580,7 +581,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="args"></param> public override void KeyboardUp(KeyboardEventArgs args) @@ -590,19 +591,19 @@ throw new ArgumentNullException("args"); } if (args.Key == Key.RightArrow - || args.Key == Key.LeftArrow) + || args.Key == Key.LeftArrow) { horiz_delta = 0; } else if (args.Key == Key.UpArrow - || args.Key == Key.DownArrow) + || args.Key == Key.DownArrow) { vert_delta = 0; } } /// <summary> - /// + /// /// </summary> /// <param name="args"></param> public override void KeyboardDown(KeyboardEventArgs args) @@ -616,9 +617,9 @@ case Key.F10: GameMenuDialog d = new GameMenuDialog(this, this.Mpq); - d.ReturnToGame += delegate(object sender2, SCEventArgs args2) - { - DismissDialog(); + d.ReturnToGame += delegate(object sender2, SCEventArgs args2) + { + DismissDialog(); }; ShowDialog(d); break; @@ -664,7 +665,7 @@ //players[unitinfo.player].AddUnit (unit); - unit.CreateSprite(this.Mpq, tileset_palette); + unit.CreateSprite(this.Mpq, tilesetPalette); units.Add(unit); } @@ -673,14 +674,14 @@ foreach (Unit sl in startLocations) { /* terran command center = 106, - zerg hatchery = 131, - protoss nexus = 154 */ + zerg hatchery = 131, + protoss nexus = 154 */ Unit unit = new Unit(154); unit.PositionX = sl.PositionX; unit.PositionY = sl.PositionY; - unit.CreateSprite(this.Mpq, tileset_palette); + unit.CreateSprite(this.Mpq, tilesetPalette); units.Add(unit); } } Modified: trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/MapRenderer.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -28,6 +28,7 @@ using System; using System.IO; +using System.Globalization; using SdlDotNet.Graphics; using SCSharp; @@ -86,10 +87,10 @@ bitmapImage.PixelWidth = (ushort)(chk.Width * 32); bitmapImage.PixelHeight = (ushort)(chk.Height * 32); - Stream cv5_fs = (Stream)mpq.GetResource(String.Format("tileset\\{0}.cv5", Utilities.TileSetNames[(int)chk.TileSet])); - Stream vx4_fs = (Stream)mpq.GetResource(String.Format("tileset\\{0}.vx4", Utilities.TileSetNames[(int)chk.TileSet])); - Stream vr4_fs = (Stream)mpq.GetResource(String.Format("tileset\\{0}.vr4", Utilities.TileSetNames[(int)chk.TileSet])); - Stream wpe_fs = (Stream)mpq.GetResource(String.Format("tileset\\{0}.wpe", Utilities.TileSetNames[(int)chk.TileSet])); + Stream cv5_fs = (Stream)mpq.GetResource(String.Format(CultureInfo.CurrentCulture, "tileset\\{0}.cv5", Utilities.TileSetNames[(int)chk.TileSet])); + Stream vx4_fs = (Stream)mpq.GetResource(String.Format(CultureInfo.CurrentCulture, "tileset\\{0}.vx4", Utilities.TileSetNames[(int)chk.TileSet])); + Stream vr4_fs = (Stream)mpq.GetResource(String.Format(CultureInfo.CurrentCulture, "tileset\\{0}.vr4", Utilities.TileSetNames[(int)chk.TileSet])); + Stream wpe_fs = (Stream)mpq.GetResource(String.Format(CultureInfo.CurrentCulture, "tileset\\{0}.wpe", Utilities.TileSetNames[(int)chk.TileSet])); byte[] cv5 = new byte[cv5_fs.Length]; cv5_fs.Read(cv5, 0, (int)cv5_fs.Length); Modified: trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/PlayCustomScreen.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -149,7 +149,7 @@ for (int i = 0; i < directories.Length; i++) { - fileListbox.AddItem(String.Format("[{0}]", Path.GetFileName(directories[i]))); + fileListbox.AddItem(String.Format(CultureInfo.CurrentCulture, "[{0}]", Path.GetFileName(directories[i]))); } for (int i = 0; i < files.Length; i++) @@ -294,7 +294,7 @@ slotString = slotString.Replace("%s", (selectedChk == null ? "" - : String.Format("{0}", + : String.Format(CultureInfo.CurrentCulture, "{0}", selectedChk.NumberOfHumanSlots))); Elements[MAPPLAYERS1_ELEMENT_INDEX].Text = slotString; @@ -305,7 +305,7 @@ slotString = slotString.Replace("%s", (selectedChk == null ? "" - : String.Format("{0}", + : String.Format(CultureInfo.CurrentCulture, "{0}", selectedChk.NumberOfComputerSlots))); Elements[MAPPLAYERS2_ELEMENT_INDEX].Text = slotString; @@ -319,7 +319,7 @@ numPlayersString = numPlayersString.Replace("%s", (selectedChk == null ? "" - : String.Format("{0}", + : String.Format(CultureInfo.CurrentCulture, "{0}", selectedChk.NumberOfPlayers))); Elements[MAPPLAYERS1_ELEMENT_INDEX].Text = numPlayersString; @@ -366,7 +366,7 @@ void FileListSelectionChanged(object sender, BoxSelectionChangedEventArgs e) { - string map_path = Path.Combine(curdir, fileListbox.SelectedItem); + string mapPath = Path.Combine(curdir, fileListbox.SelectedItem); if (e.SelectedIndex < directories.Length) { @@ -375,7 +375,7 @@ } else { - selectedScenario = new MpqArchiveContainer(map_path); + selectedScenario = new MpqArchiveContainer(mapPath); selectedChk = (Chk)selectedScenario.GetResource("staredit\\scenario.chk"); } @@ -391,7 +391,7 @@ mapSizeString = mapSizeString.Replace("%s", (selectedChk == null ? "" - : String.Format("{0}x{1}", + : String.Format(CultureInfo.CurrentCulture, "{0}x{1}", selectedChk.Width, selectedChk.Height))); @@ -399,7 +399,7 @@ tileSetString = tileSetString.Replace("%s", (selectedChk == null ? "" - : String.Format("{0}", + : String.Format(CultureInfo.CurrentCulture, "{0}", selectedChk.TileSet))); Elements[MAPSIZE_ELEMENT_INDEX].Text = mapSizeString; Modified: trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/RaceSelectionScreen.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -28,13 +28,13 @@ using System; using System.IO; +using System.Drawing; using System.Threading; +using System.Globalization; using SdlDotNet; using SCSharp; -using System.Drawing; - using SCSharp.MpqLib; namespace SCSharp.UI @@ -186,7 +186,7 @@ mapdata_index = GlobalResources.MapDataDat.GetFileIndex((uint)(Game.Instance.PlayingBroodWar ? BroodwarCampaigns_MapDataStart : StarcraftCampaigns_MapDataStart)[campaign]); prefix = GlobalResources.MapDataTbl[(int)mapdata_index]; - markup = String.Format("rez\\Est{0}{1}{2}.txt", + markup = String.Format(CultureInfo.CurrentCulture, "rez\\Est{0}{1}{2}.txt", Utilities.RaceChar[(int)Game.Instance.Race], prefix.EndsWith("tutorial") ? "0t" : prefix.Substring(prefix.Length - 2), Game.Instance.PlayingBroodWar ? "x" : ""); Modified: trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/ReadyRoomScreen.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -30,6 +30,7 @@ using System.IO; using System.Threading; using System.Drawing; +using System.Globalization; using SdlDotNet.Graphics; using SdlDotNet.Input; @@ -67,17 +68,17 @@ int objectivesElementIndex, int firstPortraitElementIndex) : base(mpq, - String.Format("glue\\Ready{0}", Utilities.RaceChar[(int)Game.Instance.Race]), - String.Format(BuiltIns.GluReadyBin, Utilities.RaceCharLower[(int)Game.Instance.Race])) + String.Format(CultureInfo.CurrentCulture, "glue\\Ready{0}", Utilities.RaceChar[(int)Game.Instance.Race]), + String.Format(CultureInfo.CurrentCulture, BuiltIns.GluReadyBin, Utilities.RaceCharLower[(int)Game.Instance.Race])) { if (mpq == null) { throw new ArgumentNullException("mpq"); } - BackgroundPath = String.Format("glue\\PalR{0}\\Backgnd.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); - FontPalettePath = String.Format("glue\\PalR{0}\\tFont.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); - EffectPalettePath = String.Format("glue\\PalR{0}\\tEffect.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); - ArrowGrpPath = String.Format("glue\\PalR{0}\\arrow.grp", Utilities.RaceCharLower[(int)Game.Instance.Race]); + BackgroundPath = String.Format(CultureInfo.CurrentCulture, "glue\\PalR{0}\\Backgnd.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); + FontPalettePath = String.Format(CultureInfo.CurrentCulture, "glue\\PalR{0}\\tFont.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); + EffectPalettePath = String.Format(CultureInfo.CurrentCulture, "glue\\PalR{0}\\tEffect.pcx", Utilities.RaceCharLower[(int)Game.Instance.Race]); + ArrowGrpPath = String.Format(CultureInfo.CurrentCulture, "glue\\PalR{0}\\arrow.grp", Utilities.RaceCharLower[(int)Game.Instance.Race]); this.startElementIndex = startElementIndex; this.cancelElementIndex = cancelElementIndex; @@ -212,7 +213,7 @@ EndHighlightPortrait(highlightedPortrait); } - Elements[firstPortraitElementIndex + slot].Background = String.Format("glue\\Ready{0}\\{0}FrameH{1}.pcx", + Elements[firstPortraitElementIndex + slot].Background = String.Format(CultureInfo.CurrentCulture, "glue\\Ready{0}\\{0}FrameH{1}.pcx", Utilities.RaceChar[(int)Game.Instance.Race], slot + 1); highlightedPortrait = slot; @@ -226,7 +227,7 @@ { if (Elements[firstPortraitElementIndex + slot].Visible) { - Elements[firstPortraitElementIndex + slot].Background = String.Format("glue\\Ready{0}\\{0}Frame{1}.pcx", + Elements[firstPortraitElementIndex + slot].Background = String.Format(CultureInfo.CurrentCulture, "glue\\Ready{0}\\{0}Frame{1}.pcx", Utilities.RaceChar[(int)Game.Instance.Race], slot + 1); } @@ -239,7 +240,7 @@ public void ShowPortrait(int slot) { Elements[firstPortraitElementIndex + slot].Visible = true; - Elements[firstPortraitElementIndex + slot].Background = String.Format("glue\\Ready{0}\\{0}Frame{1}.pcx", + Elements[firstPortraitElementIndex + slot].Background = String.Format(CultureInfo.CurrentCulture, "glue\\Ready{0}\\{0}Frame{1}.pcx", Utilities.RaceChar[(int)Game.Instance.Race], slot + 1); } Modified: trunk/scsharp/src/SCSharpLib/UI/UIElement.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/UIElement.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -31,6 +31,7 @@ using System.IO; using System.Text; using System.Collections.Generic; +using System.Globalization; using SdlDotNet.Graphics; using SdlDotNet.Input; @@ -210,7 +211,7 @@ if (fnt == null) { - throw new SCException(String.Format("null font at index {0}.. bad things are afoot", idx)); + throw new SCException(String.Format(CultureInfo.CurrentCulture, "null font at index {0}.. bad things are afoot", idx)); } } return fnt; Modified: trunk/scsharp/src/SCSharpLib/UI/UIPainter.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIPainter.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/UIPainter.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Globalization; using SdlDotNet.Graphics; using SdlDotNet.Graphics.Primitives; @@ -89,7 +90,7 @@ surf.Draw(new Box(new Point(e.X1, e.Y1), new Size(e.Width - 1, e.Height - 1)), e.Visible ? Color.Green : Color.Yellow); if (e.Text.Length != 0) { - e.Text = i.ToString(); + e.Text = i.ToString(CultureInfo.CurrentCulture); } } } Modified: trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs =================================================================== --- trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-25 18:44:54 UTC (rev 1400) +++ trunk/scsharp/src/SCSharpLib/UI/UIScreen.cs 2007-05-25 18:57:14 UTC (rev 1401) @@ -32,6 +32,7 @@ using System.Threading; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using SdlDotNet.Graphics; using SdlDotNet.Input; @@ -850,7 +851,7 @@ if (bin == null) { - throw new SCException(String.Format("specified file '{0}' does not exist", + throw new SCException(String.Format(CultureInfo.CurrentCulture, "specified file '{0}' does not exist", binFile)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |