Code cleanup
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace VAR.Focus.Web.Code
|
||||
@@ -8,7 +7,7 @@ namespace VAR.Focus.Web.Code
|
||||
{
|
||||
public static string GetSHA1(string str)
|
||||
{
|
||||
SHA1 sha1 = SHA1Managed.Create();
|
||||
SHA1 sha1 = SHA1.Create();
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
byte[] stream = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -29,12 +28,12 @@ namespace VAR.Focus.Web.Code
|
||||
|
||||
public static string GetCryptoToken()
|
||||
{
|
||||
return CryptoUtils.GetSHA1(CryptoUtils.GetRandString(10));
|
||||
return GetSHA1(GetRandString(10));
|
||||
}
|
||||
|
||||
public static string GetHashedPassword(string password, string passwordSalt)
|
||||
{
|
||||
return CryptoUtils.GetSHA1(String.Format("{1}{0}{1}", password, passwordSalt));
|
||||
return GetSHA1(string.Format("{1}{0}{1}", password, passwordSalt));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace VAR.Focus.Web.Code.Entities
|
||||
public string Description { get; set; }
|
||||
|
||||
private bool _active = true;
|
||||
public bool Active { get { return _active} set { _active = value; } }
|
||||
public bool Active { get { return _active; } set { _active = value; } }
|
||||
public string CreatedBy { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string ModifiedBy { get; set; }
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace VAR.Focus.Web.Code.Entities
|
||||
public int Y { get; set; }
|
||||
|
||||
private bool _active = true;
|
||||
public bool Active { get { return _active} set { _active = value; } }
|
||||
public bool Active { get { return _active; } set { _active = value; } }
|
||||
public string CreatedBy { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string ModifiedBy { get; set; }
|
||||
|
||||
@@ -78,5 +78,4 @@ namespace VAR.Focus.Web.Code.Entities
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private ParserContext ctx;
|
||||
private bool tainted = false;
|
||||
private ParserContext _ctx;
|
||||
private bool _tainted = false;
|
||||
|
||||
private List<Type> _knownTypes = new List<Type>();
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
public bool Tainted
|
||||
{
|
||||
get { return tainted; }
|
||||
get { return _tainted; }
|
||||
}
|
||||
|
||||
public List<Type> KnownTypes
|
||||
@@ -64,7 +64,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return ((float)count / (float)typeProperties.Length);
|
||||
return ((float)count / typeProperties.Length);
|
||||
}
|
||||
|
||||
private object ConvertToType(Dictionary<string, object> obj, Type type)
|
||||
@@ -106,14 +106,14 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
int value = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
char c = ctx.Next();
|
||||
if (Char.IsDigit(c))
|
||||
char c = _ctx.Next();
|
||||
if (char.IsDigit(c))
|
||||
{
|
||||
value = (value << 4) | (c - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
c = Char.ToLower(c);
|
||||
c = char.ToLower(c);
|
||||
if (c >= 'a' && c <= 'f')
|
||||
{
|
||||
value = (value << 4) | ((c - 'a') + 10);
|
||||
@@ -123,19 +123,19 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
return value;
|
||||
}
|
||||
|
||||
private String ParseQuotedString()
|
||||
private string ParseQuotedString()
|
||||
{
|
||||
StringBuilder scratch = new StringBuilder();
|
||||
char c = ctx.SkipWhite();
|
||||
char c = _ctx.SkipWhite();
|
||||
if (c == '"')
|
||||
{
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
}
|
||||
do
|
||||
{
|
||||
if (c == '\\')
|
||||
{
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
if (c == '"')
|
||||
{
|
||||
scratch.Append('"');
|
||||
@@ -172,7 +172,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
scratch.Append((char)ParseHexShort());
|
||||
}
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
}
|
||||
else if (c == '"')
|
||||
{
|
||||
@@ -181,55 +181,55 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
else
|
||||
{
|
||||
scratch.Append(c);
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
}
|
||||
} while (!ctx.AtEnd());
|
||||
} while (!_ctx.AtEnd());
|
||||
if (c == '"')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
}
|
||||
return scratch.ToString();
|
||||
}
|
||||
|
||||
private String ParseString()
|
||||
private string ParseString()
|
||||
{
|
||||
char c = ctx.SkipWhite();
|
||||
char c = _ctx.SkipWhite();
|
||||
if (c == '"')
|
||||
{
|
||||
return ParseQuotedString();
|
||||
}
|
||||
StringBuilder scratch = new StringBuilder();
|
||||
|
||||
while (!ctx.AtEnd()
|
||||
&& (Char.IsLetter(c) || Char.IsDigit(c) || c == '_'))
|
||||
while (!_ctx.AtEnd()
|
||||
&& (char.IsLetter(c) || char.IsDigit(c) || c == '_'))
|
||||
{
|
||||
scratch.Append(c);
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
}
|
||||
|
||||
return scratch.ToString();
|
||||
}
|
||||
|
||||
private Object ParseNumber()
|
||||
private object ParseNumber()
|
||||
{
|
||||
StringBuilder scratch = new StringBuilder();
|
||||
bool isFloat = false;
|
||||
int numberLenght = 0;
|
||||
char c;
|
||||
c = ctx.SkipWhite();
|
||||
c = _ctx.SkipWhite();
|
||||
|
||||
// Sign
|
||||
if (c == '-')
|
||||
{
|
||||
scratch.Append('-');
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
}
|
||||
|
||||
// Integer part
|
||||
while (Char.IsDigit(c))
|
||||
while (char.IsDigit(c))
|
||||
{
|
||||
scratch.Append(c);
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
numberLenght++;
|
||||
}
|
||||
|
||||
@@ -238,18 +238,18 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
isFloat = true;
|
||||
scratch.Append('.');
|
||||
c = ctx.Next();
|
||||
while (Char.IsDigit(c))
|
||||
c = _ctx.Next();
|
||||
while (char.IsDigit(c))
|
||||
{
|
||||
scratch.Append(c);
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
numberLenght++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberLenght == 0)
|
||||
{
|
||||
tainted = true;
|
||||
_tainted = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -258,72 +258,72 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
isFloat = true;
|
||||
scratch.Append('E');
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
if (c == '+' || c == '-')
|
||||
{
|
||||
scratch.Append(c);
|
||||
}
|
||||
while (Char.IsDigit(c))
|
||||
while (char.IsDigit(c))
|
||||
{
|
||||
scratch.Append(c);
|
||||
c = ctx.Next();
|
||||
c = _ctx.Next();
|
||||
numberLenght++;
|
||||
}
|
||||
}
|
||||
|
||||
// Build number object from the parsed string
|
||||
String s = scratch.ToString();
|
||||
return isFloat ? (numberLenght < 17) ? (Object)Double.Parse(s)
|
||||
: Decimal.Parse(s) : (numberLenght < 19) ? (Object)System.Int32.Parse(s)
|
||||
: (Object)System.Int32.Parse(s);
|
||||
string s = scratch.ToString();
|
||||
return isFloat ? (numberLenght < 17) ? (object)double.Parse(s)
|
||||
: decimal.Parse(s) : (numberLenght < 19) ? int.Parse(s)
|
||||
: (object)int.Parse(s);
|
||||
}
|
||||
|
||||
private List<object> ParseArray()
|
||||
{
|
||||
char c = ctx.SkipWhite();
|
||||
char c = _ctx.SkipWhite();
|
||||
List<object> array = new List<object>();
|
||||
if (c == '[')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
}
|
||||
do
|
||||
{
|
||||
c = ctx.SkipWhite();
|
||||
c = _ctx.SkipWhite();
|
||||
if (c == ']')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
break;
|
||||
}
|
||||
else if (c == ',')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
}
|
||||
else
|
||||
{
|
||||
array.Add(ParseValue());
|
||||
}
|
||||
} while (!ctx.AtEnd());
|
||||
} while (!_ctx.AtEnd());
|
||||
return array;
|
||||
}
|
||||
|
||||
private Dictionary<string, object> ParseObject()
|
||||
{
|
||||
char c = ctx.SkipWhite();
|
||||
char c = _ctx.SkipWhite();
|
||||
Dictionary<string, object> obj = new Dictionary<string, object>();
|
||||
if (c == '{')
|
||||
{
|
||||
ctx.Next();
|
||||
c = ctx.SkipWhite();
|
||||
_ctx.Next();
|
||||
c = _ctx.SkipWhite();
|
||||
}
|
||||
String attributeName;
|
||||
Object attributeValue;
|
||||
string attributeName;
|
||||
object attributeValue;
|
||||
do
|
||||
{
|
||||
attributeName = ParseString();
|
||||
c = ctx.SkipWhite();
|
||||
c = _ctx.SkipWhite();
|
||||
if (c == ':')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
attributeValue = ParseValue();
|
||||
if (attributeName.Length > 0)
|
||||
{
|
||||
@@ -332,21 +332,21 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
}
|
||||
else if (c == ',')
|
||||
{
|
||||
ctx.Next();
|
||||
c = ctx.SkipWhite();
|
||||
_ctx.Next();
|
||||
c = _ctx.SkipWhite();
|
||||
}
|
||||
else if (c == '}')
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unexpected character
|
||||
tainted = true;
|
||||
_tainted = true;
|
||||
break;
|
||||
}
|
||||
} while (!ctx.AtEnd());
|
||||
} while (!_ctx.AtEnd());
|
||||
if (obj.Count == 0)
|
||||
{
|
||||
return null;
|
||||
@@ -355,10 +355,10 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
return obj;
|
||||
}
|
||||
|
||||
private Object ParseValue()
|
||||
private object ParseValue()
|
||||
{
|
||||
Object token = null;
|
||||
char c = ctx.SkipWhite();
|
||||
object token = null;
|
||||
char c = _ctx.SkipWhite();
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
@@ -372,13 +372,13 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
token = ParseArray();
|
||||
break;
|
||||
default:
|
||||
if (Char.IsDigit(c) || c == '-')
|
||||
if (char.IsDigit(c) || c == '-')
|
||||
{
|
||||
token = ParseNumber();
|
||||
}
|
||||
else
|
||||
{
|
||||
String aux = ParseString();
|
||||
string aux = ParseString();
|
||||
if (aux.CompareTo("true") == 0)
|
||||
{
|
||||
token = true;
|
||||
@@ -396,9 +396,9 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
// Unexpected string
|
||||
if (aux.Length == 0)
|
||||
{
|
||||
ctx.Next();
|
||||
_ctx.Next();
|
||||
}
|
||||
tainted = true;
|
||||
_tainted = true;
|
||||
token = null;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +407,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
return token;
|
||||
}
|
||||
|
||||
private String CleanIdentifier(String input)
|
||||
private string CleanIdentifier(string input)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
@@ -417,7 +417,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
return input;
|
||||
}
|
||||
c = input[i];
|
||||
while (Char.IsLetter(c) || Char.IsDigit(c) || c == '_')
|
||||
while (char.IsLetter(c) || char.IsDigit(c) || c == '_')
|
||||
{
|
||||
i--;
|
||||
if (i < 0)
|
||||
@@ -433,31 +433,31 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
#region Public methods
|
||||
|
||||
public Object Parse(String text)
|
||||
public object Parse(string text)
|
||||
{
|
||||
// Get the first object
|
||||
ctx = new ParserContext(text);
|
||||
tainted = false;
|
||||
ctx.Mark();
|
||||
Object obj = ParseValue();
|
||||
if (ctx.AtEnd())
|
||||
_ctx = new ParserContext(text);
|
||||
_tainted = false;
|
||||
_ctx.Mark();
|
||||
object obj = ParseValue();
|
||||
if (_ctx.AtEnd())
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
|
||||
// "But wait, there is more!"
|
||||
int idx = 0;
|
||||
String name = "";
|
||||
String strInvalidPrev = "";
|
||||
string name = "";
|
||||
string strInvalidPrev = "";
|
||||
Dictionary<string, object> superObject = new Dictionary<string, object>();
|
||||
do
|
||||
{
|
||||
// Add the object to the superObject
|
||||
if (!tainted && name.Length > 0 && obj != null)
|
||||
if (!_tainted && name.Length > 0 && obj != null)
|
||||
{
|
||||
if (name.Length == 0)
|
||||
{
|
||||
name = String.Format("{0:D2}", idx);
|
||||
name = string.Format("{0:D2}", idx);
|
||||
}
|
||||
superObject.Add(name, obj);
|
||||
idx++;
|
||||
@@ -465,7 +465,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
}
|
||||
else
|
||||
{
|
||||
String strInvalid = ctx.GetMarked();
|
||||
string strInvalid = _ctx.GetMarked();
|
||||
strInvalid = strInvalid.Trim();
|
||||
if (strInvalidPrev.Length > 0
|
||||
&& "=".CompareTo(strInvalid) == 0)
|
||||
@@ -480,14 +480,14 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
}
|
||||
|
||||
// Check end
|
||||
if (ctx.AtEnd())
|
||||
if (_ctx.AtEnd())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Get next object
|
||||
tainted = false;
|
||||
ctx.Mark();
|
||||
_tainted = false;
|
||||
_ctx.Mark();
|
||||
obj = ParseValue();
|
||||
|
||||
} while (true);
|
||||
|
||||
@@ -10,10 +10,10 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private bool indent = false;
|
||||
private bool useTabForIndent = false;
|
||||
private int indentChars = 4;
|
||||
private int indentThresold = 3;
|
||||
private bool _indent = false;
|
||||
private bool _useTabForIndent = false;
|
||||
private int _indentChars = 4;
|
||||
private int _indentThresold = 3;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -23,30 +23,30 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
public JSONWriter(int indentChars)
|
||||
{
|
||||
this.indent = true;
|
||||
this.indentChars = indentChars;
|
||||
this.useTabForIndent = false;
|
||||
_indent = true;
|
||||
_indentChars = indentChars;
|
||||
_useTabForIndent = false;
|
||||
}
|
||||
|
||||
public JSONWriter(bool useTabForIndent)
|
||||
{
|
||||
this.indent = true;
|
||||
this.useTabForIndent = useTabForIndent;
|
||||
_indent = true;
|
||||
_useTabForIndent = useTabForIndent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
private bool IsValue(Object obj)
|
||||
private bool IsValue(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ((obj is float) || (obj is double) ||
|
||||
(obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64)
|
||||
|| (obj is String) || (obj is Boolean))
|
||||
(obj is short) || (obj is int) || (obj is long)
|
||||
|| (obj is string) || (obj is bool))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -55,23 +55,23 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
private void WriteIndent(StringBuilder sbOutput, int level)
|
||||
{
|
||||
if (!indent)
|
||||
if (!_indent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sbOutput.Append('\n');
|
||||
if (useTabForIndent)
|
||||
if (_useTabForIndent)
|
||||
{
|
||||
for (int i = 0; i < level; i++) { sbOutput.Append('\t'); }
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = level * indentChars;
|
||||
int n = level * _indentChars;
|
||||
for (int i = 0; i < n; i++) { sbOutput.Append(' '); }
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteString(StringBuilder sbOutput, String str)
|
||||
private void WriteString(StringBuilder sbOutput, string str)
|
||||
{
|
||||
sbOutput.Append('"');
|
||||
char c;
|
||||
@@ -101,20 +101,20 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
sbOutput.Append("null");
|
||||
}
|
||||
else if ((obj is float) || (obj is double) ||
|
||||
(obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64))
|
||||
(obj is short) || (obj is int) || (obj is long))
|
||||
{
|
||||
// Numbers
|
||||
sbOutput.Append(obj.ToString());
|
||||
}
|
||||
else if (obj is String)
|
||||
else if (obj is string)
|
||||
{
|
||||
// Strings
|
||||
WriteString(sbOutput, (String)obj);
|
||||
WriteString(sbOutput, (string)obj);
|
||||
}
|
||||
else if (obj is Boolean)
|
||||
else if (obj is bool)
|
||||
{
|
||||
// Booleans
|
||||
sbOutput.Append(((Boolean)obj) ? "true" : "false");
|
||||
sbOutput.Append(((bool)obj) ? "true" : "false");
|
||||
}
|
||||
else if (obj is DateTime)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteList(StringBuilder sbOutput, Object obj, int level)
|
||||
private void WriteList(StringBuilder sbOutput, object obj, int level)
|
||||
{
|
||||
IEnumerable list = (IEnumerable)obj;
|
||||
int n = 0;
|
||||
@@ -173,7 +173,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
// Write array
|
||||
bool first = true;
|
||||
sbOutput.Append("[ ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
if (!first)
|
||||
{
|
||||
sbOutput.Append(", ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -190,14 +190,14 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
first = false;
|
||||
WriteValue(sbOutput, childObj, level + 1, true);
|
||||
}
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level);
|
||||
}
|
||||
sbOutput.Append(" ]");
|
||||
}
|
||||
|
||||
private void WriteObject(StringBuilder sbOutput, Object obj, int level)
|
||||
private void WriteObject(StringBuilder sbOutput, object obj, int level)
|
||||
{
|
||||
IDictionary map = (IDictionary)obj;
|
||||
int n = map.Count;
|
||||
@@ -223,7 +223,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
// Write object
|
||||
bool first = true;
|
||||
sbOutput.Append("{ ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
if (!first)
|
||||
{
|
||||
sbOutput.Append(", ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -243,14 +243,14 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
sbOutput.Append(": ");
|
||||
WriteValue(sbOutput, value, level + 1, true);
|
||||
}
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level);
|
||||
}
|
||||
sbOutput.Append(" }");
|
||||
}
|
||||
|
||||
private void WriteReflectedObject(StringBuilder sbOutput, Object obj, int level)
|
||||
private void WriteReflectedObject(StringBuilder sbOutput, object obj, int level)
|
||||
{
|
||||
Type type = obj.GetType();
|
||||
PropertyInfo[] rawProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
@@ -286,7 +286,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
// Write object
|
||||
bool first = true;
|
||||
sbOutput.Append("{ ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -302,7 +302,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
if (!first)
|
||||
{
|
||||
sbOutput.Append(", ");
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level + 1);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
sbOutput.Append(": ");
|
||||
WriteValue(sbOutput, value, level + 1, false);
|
||||
}
|
||||
if (!isLeaf || n > indentThresold)
|
||||
if (!isLeaf || n > _indentThresold)
|
||||
{
|
||||
WriteIndent(sbOutput, level);
|
||||
}
|
||||
@@ -323,7 +323,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
#region Public methods
|
||||
|
||||
public String Write(Object obj)
|
||||
public string Write(object obj)
|
||||
{
|
||||
StringBuilder sbOutput = new StringBuilder();
|
||||
WriteValue(sbOutput, obj, 0, true);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private String text;
|
||||
private string text;
|
||||
private int length;
|
||||
private int i;
|
||||
private int markStart;
|
||||
@@ -15,12 +15,12 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
#region Creator
|
||||
|
||||
public ParserContext(String text)
|
||||
public ParserContext(string text)
|
||||
{
|
||||
this.text = text;
|
||||
this.length = text.Length;
|
||||
this.i = 0;
|
||||
this.markStart = 0;
|
||||
length = text.Length;
|
||||
i = 0;
|
||||
markStart = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -29,7 +29,7 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
public char SkipWhite()
|
||||
{
|
||||
while (i < length && Char.IsWhiteSpace(text[i]))
|
||||
while (i < length && char.IsWhiteSpace(text[i]))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
@@ -57,10 +57,10 @@ namespace VAR.Focus.Web.Code.JSON
|
||||
|
||||
public void Mark()
|
||||
{
|
||||
markStart = this.i;
|
||||
markStart = i;
|
||||
}
|
||||
|
||||
public String GetMarked()
|
||||
public string GetMarked()
|
||||
{
|
||||
if (i < length && markStart < length)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user