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. |