Browse Source

FxCop

reports
Peter Forstmeier 12 years ago
parent
commit
6d84ea5c35
  1. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs
  2. 5
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionDataSource.cs
  3. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionHelper.cs
  4. 7
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/TypeNormalizer.cs
  5. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StandardFormatter.cs

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.Reporting
throw new ArgumentNullException("columnName"); throw new ArgumentNullException("columnName");
} }
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,StringComparison.OrdinalIgnoreCase));
} }
@ -54,7 +54,7 @@ namespace ICSharpCode.Reporting
throw new ArgumentNullException("columnName"); throw new ArgumentNullException("columnName");
} }
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,StringComparison.OrdinalIgnoreCase));
} }
} }
@ -71,7 +71,7 @@ namespace ICSharpCode.Reporting
if (String.IsNullOrEmpty(parameterName)) { if (String.IsNullOrEmpty(parameterName)) {
throw new ArgumentNullException("parameterName"); throw new ArgumentNullException("parameterName");
} }
return this.FirstOrDefault(x => 0 == String.Compare(x.ParameterName,parameterName,true,CultureInfo.InvariantCulture)); return this.FirstOrDefault(x => 0 == String.Compare(x.ParameterName,parameterName,StringComparison.OrdinalIgnoreCase));
} }

5
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionDataSource.cs

@ -257,14 +257,14 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
throw new NotImplementedException(); throw new NotImplementedException();
} }
DataCollection<object> CreateBaseList(IEnumerable source, Type elementType) static DataCollection<object> CreateBaseList(IEnumerable source, Type elementType)
{ {
var list = new DataCollection<object>(elementType); var list = new DataCollection<object>(elementType);
list.AddRange(source); list.AddRange(source);
return list; return list;
} }
/*
PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors){ PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors){
if (listAccessors != null && listAccessors.Length > 0){ if (listAccessors != null && listAccessors.Length > 0){
var t = this.elementType; var t = this.elementType;
@ -277,5 +277,6 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
} }
return ExtendedTypeDescriptor.GetProperties(elementType); return ExtendedTypeDescriptor.GetProperties(elementType);
} }
*/
} }
} }

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionHelper.cs

@ -22,7 +22,7 @@ namespace ICSharpCode.Reporting.Expressions
public static bool CanEvaluate (string expression) public static bool CanEvaluate (string expression)
{ {
if ((!String.IsNullOrEmpty(expression)) && (expression.StartsWith("=",StringComparison.InvariantCultureIgnoreCase))) { if ((!String.IsNullOrEmpty(expression)) && (expression.StartsWith("=",StringComparison.OrdinalIgnoreCase))) {
return true; return true;
} }
return false; return false;

7
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/TypeNormalizer.cs

@ -1,6 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Globalization;
namespace ICSharpCode.Reporting.Expressions namespace ICSharpCode.Reporting.Expressions
{ {
@ -27,13 +28,13 @@ namespace ICSharpCode.Reporting.Expressions
try try
{ {
right = Convert.ChangeType(right,left.GetType()); right = Convert.ChangeType(right,left.GetType(),CultureInfo.CurrentCulture);
} }
catch catch
{ {
try try
{ {
left = Convert.ChangeType(left, right.GetType()); left = Convert.ChangeType(left, right.GetType(),CultureInfo.CurrentCulture);
} }
catch catch
{ {
@ -92,7 +93,7 @@ namespace ICSharpCode.Reporting.Expressions
return value; return value;
try { try {
return Convert.ChangeType(value, targetType); return Convert.ChangeType(value, targetType,CultureInfo.CurrentCulture);
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("TypeNormalizer {0} - {1}",value.ToString(),e.Message); Console.WriteLine("TypeNormalizer {0} - {1}",value.ToString(),e.Message);

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StandardFormatter.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.Reporting.Globals
retValue = FormatDate(valueToFormat,format); retValue = FormatDate(valueToFormat,format);
break; break;
case TypeCode.Boolean: case TypeCode.Boolean:
retValue = FormatBool (valueToFormat,format); retValue = FormatBool (valueToFormat);
break; break;
case TypeCode.Decimal: case TypeCode.Decimal:
retValue = FormatDecimal (valueToFormat,format); retValue = FormatDecimal (valueToFormat,format);
@ -74,7 +74,7 @@ namespace ICSharpCode.Reporting.Globals
} }
private static string FormatBool (string toFormat, string format) private static string FormatBool (string toFormat)
{ {
if (CheckValue(toFormat)) { if (CheckValue(toFormat)) {
bool b = bool.Parse (toFormat); bool b = bool.Parse (toFormat);
@ -142,7 +142,7 @@ namespace ICSharpCode.Reporting.Globals
CultureInfo.CurrentCulture, CultureInfo.CurrentCulture,
out time); out time);
if (valid) { if (valid) {
return time.ToString("g"); return time.ToString("g",DateTimeFormatInfo.CurrentInfo);
} }
return toFormat; return toFormat;
} }

Loading…
Cancel
Save