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