[gbrainy] Small code clean ups
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Small code clean ups
- Date: Sat, 5 Mar 2011 08:18:21 +0000 (UTC)
commit b239d967ad20ef135e09cd8c2559fd88fcab69a7
Author: Jordi Mas <jmas softcatala org>
Date: Sat Mar 5 09:20:00 2011 +0100
Small code clean ups
src/Clients/WebForms/LanguageSupport.cs | 3 +--
src/Clients/WebForms/Status.aspx.cs | 12 +++++++-----
src/Clients/WebForms/WebSession.cs | 1 -
src/Core/Main/GameAnswer.cs | 6 +++---
src/Games/Logic/PuzzleClocks.cs | 5 -----
src/Games/Logic/PuzzlePencil.cs | 5 -----
6 files changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/src/Clients/WebForms/LanguageSupport.cs b/src/Clients/WebForms/LanguageSupport.cs
index d9faa75..de3dbee 100644
--- a/src/Clients/WebForms/LanguageSupport.cs
+++ b/src/Clients/WebForms/LanguageSupport.cs
@@ -49,12 +49,11 @@ namespace gbrainy.Clients.WebForms
langmap = new Dictionary <string, Language> ();
foreach (Language language in languages)
{
- idx = language.LocaleLanguage.IndexOf (".");
+ idx = language.LocaleLanguage.IndexOf ('.');
code = language.LocaleLanguage.Substring (0, idx);
language.LangCode = code;
langmap.Add (code, language);
}
-
}
// List of exposed locales
diff --git a/src/Clients/WebForms/Status.aspx.cs b/src/Clients/WebForms/Status.aspx.cs
index 8996bce..604f571 100644
--- a/src/Clients/WebForms/Status.aspx.cs
+++ b/src/Clients/WebForms/Status.aspx.cs
@@ -29,8 +29,6 @@ namespace gbrainy.Clients.WebForms
{
public partial class Status : System.Web.UI.Page
{
- //protected System.Web.UI.WebControls.ListView ListView1;
-
public class PerfCounter
{
public string Category { get; set; }
@@ -170,9 +168,13 @@ namespace gbrainy.Clients.WebForms
string ReadCounter (string category, string counter)
{
- PerformanceCounter pc = new PerformanceCounter (category, counter);
- pc.NextValue ();
- return pc.NextValue ().ToString ();
+ string rslt;
+ using (PerformanceCounter pc = new PerformanceCounter (category, counter))
+ {
+ pc.NextValue ();
+ rslt = pc.NextValue ().ToString ();
+ }
+ return rslt;
}
}
}
diff --git a/src/Clients/WebForms/WebSession.cs b/src/Clients/WebForms/WebSession.cs
index 4cf2cc9..a1dbf8f 100644
--- a/src/Clients/WebForms/WebSession.cs
+++ b/src/Clients/WebForms/WebSession.cs
@@ -16,7 +16,6 @@ namespace gbrainy.Clients.WebForms
{
Session = session;
Started = DateTime.Now;
- NextGame = false;
}
}
}
diff --git a/src/Core/Main/GameAnswer.cs b/src/Core/Main/GameAnswer.cs
index bb52a7c..eb6e9d4 100644
--- a/src/Core/Main/GameAnswer.cs
+++ b/src/Core/Main/GameAnswer.cs
@@ -184,13 +184,13 @@ namespace gbrainy.Core.Main
static string RemoveWhiteSpace (string source)
{
- string str = string.Empty;
+ StringBuilder str = new StringBuilder ();
for (int n = 0; n < source.Length; n++)
{
if (char.IsWhiteSpace (source [n]) == false)
- str += source [n];
+ str.Append (source[n]);
}
- return str;
+ return str.ToString ();
}
}
}
diff --git a/src/Games/Logic/PuzzleClocks.cs b/src/Games/Logic/PuzzleClocks.cs
index 1639b1a..3e5ac70 100644
--- a/src/Games/Logic/PuzzleClocks.cs
+++ b/src/Games/Logic/PuzzleClocks.cs
@@ -202,10 +202,5 @@ namespace gbrainy.Games.Logic
gr.LineTo (x + x0 * 0.4, y + y0 * 0.4);
gr.Stroke ();
}
-
- public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
- {
- base.Draw (gr, area_width, area_height, rtl);
- }
}
}
diff --git a/src/Games/Logic/PuzzlePencil.cs b/src/Games/Logic/PuzzlePencil.cs
index cca0389..9dc81c3 100644
--- a/src/Games/Logic/PuzzlePencil.cs
+++ b/src/Games/Logic/PuzzlePencil.cs
@@ -201,10 +201,5 @@ namespace gbrainy.Games.Logic
gr.LineTo (x, y + figure_size);
gr.Stroke ();
}
-
- public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
- {
- base.Draw (gr, area_width, area_height, rtl);
- }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]