Permalink
Browse files

Rewrite of JSON parser

  • Loading branch information...
1 parent 7dc99bf commit cef98c6be2e35466b8005bd14021407c2cd46dc9 @activa activa committed Nov 23, 2013
Showing with 11,785 additions and 2,492 deletions.
  1. +9 −6 Library/CoreExtensions.cs
  2. +53 −49 Library/{CompatibilityLayer.cs → FileIO.cs}
  3. +52 −34 Library/Json/JSONParser.cs
  4. +2 −2 Library/Json/Json.cs
  5. +95 −0 Library/Json/JsonObject.cs
  6. +1 −9 Library/Parser/ExpressionParser/Expression/CallExpression.cs
  7. +4 −8 Library/Parser/TemplateParser/TemplateConfigs/Xml/Xml.cs
  8. +2 −6 Library/Parser/TemplateParser/TemplateParser.cs
  9. +3 −11 Library/Parser/TemplateParser/TemplateParserConfig.cs
  10. +4 −2 Library/Reflection/AutoMapper.cs
  11. +0 −178 Library/Reflection/FieldOrProperty.cs
  12. +2 −10 Library/Reflection/FieldOrPropertyInfo.cs
  13. +0 −47 Library/Reflection/FieldOrPropertyInfoExtensions.cs
  14. +70 −62 Library/{TypeHelper.cs → Reflection/Inspectors/AssemblyInspector.cs}
  15. +112 −0 Library/Reflection/Inspectors/MemberInspector.cs
  16. +25 −0 Library/Reflection/Inspectors/PropertyInspector.cs
  17. +24 −63 Library/Reflection/{ → Inspectors}/TypeInspector.cs
  18. +2 −1 Library/Reflection/LazyBinder.cs
  19. +12 −73 Library/Reflection/ReflectionExtensions.cs
  20. +5 −6 Library/SmartConverter/ObjectConverter.cs
  21. +1 −1 Library/StringExtensions.cs
  22. +0 −66 Library/Tuple.cs
  23. +0 −256 Library/Vici.Core.Android.csproj
  24. +0 −305 Library/Vici.Core.Metro.csproj
  25. +9 −3 Library/Vici.Core.PCL.csproj
  26. +0 −251 Library/Vici.Core.WP7.csproj
  27. +0 −284 Library/Vici.Core.WP8.csproj
  28. +14 −9 Library/Vici.Core.csproj
  29. +0 −266 Library/Vici.Core.iOS.csproj
  30. +4 −4 Test/App.config
  31. +5 −7 Test/Tests/BinaryExtensionsTest.cs
  32. +7 −8 Test/Tests/ConfigTest.cs
  33. +12 −13 Test/Tests/DynamicObjectTest.cs
  34. +34 −39 Test/Tests/Json/JSONParserFixture.cs
  35. +16 −18 Test/Tests/Json/JsonSeralizerTestFixture.cs
  36. +5 −6 Test/Tests/NotifierTest.cs
  37. +19 −22 Test/Tests/ObjectConverter/ObjectConverterTest.cs
  38. +65 −65 Test/Tests/Parser/CSharpParserFixture.cs
  39. +0 −40 Test/Tests/Parser/ScriptParser_Fixture.cs
  40. +29 −30 Test/Tests/Parser/TemplateParser_Fixture.cs
  41. +8 −9 Test/Tests/SchedulerTest.cs
  42. +8 −9 Test/Tests/SmartCache_Fixture.cs
  43. +8 −9 Test/Tests/StringConverter/StringConverterPluginTest.cs
  44. +22 −23 Test/Tests/StringConverter/StringConverterTest.cs
  45. +5 −5 Test/Tests/StringExtensionsTest.cs
  46. +9 −10 Test/Tests/Tokenizer_Fixture.cs
  47. +8 −9 Test/Tests/TypeExtensionsTest.cs
  48. +8 −6 Test/Vici.Core.Test.csproj
  49. +4 −0 Test/packages.config
  50. +0 −23 Vici.Core.Android.sln
  51. +0 −64 Vici.Core.Metro.sln
  52. +0 −38 Vici.Core.MonoTouch.sln
  53. +0 −20 Vici.Core.WP7.sln
  54. +1 −1 Vici.Core.nuspec
  55. +0 −6 Vici.Core.sln
  56. BIN packages/NUnit.2.6.3/NUnit.2.6.3.nupkg
  57. +28 −0 packages/NUnit.2.6.3/NUnit.2.6.3.nuspec
  58. BIN packages/NUnit.2.6.3/lib/nunit.framework.dll
  59. +10,960 −0 packages/NUnit.2.6.3/lib/nunit.framework.xml
  60. +15 −0 packages/NUnit.2.6.3/license.txt
  61. +4 −0 packages/repositories.config
View
15 Library/CoreExtensions.cs
@@ -36,17 +36,20 @@ namespace Vici.Core
#if PCL
public delegate TOutput Converter<TInput, TOutput>(TInput value);
#endif
+
public static class CoreExtensions
{
public static TOutput[] ConvertAll<TInput, TOutput>(this TInput[] array, Converter<TInput, TOutput> converter)
{
if (array == null)
- throw new ArgumentException();
-#if PCL
- return array.Select(item => converter(item)).ToArray();
-#else
- return Array.ConvertAll(array,converter);
-#endif
+ throw new ArgumentNullException("array");
+
+ var newArray = new TOutput[array.Length];
+
+ for (int i = 0; i < array.Length; i++)
+ newArray[i] = converter(array[i]);
+
+ return newArray;
}
#if PCL
View
102 Library/CompatibilityLayer.cs → Library/FileIO.cs
@@ -1,49 +1,53 @@
-#region License
-//=============================================================================
-// Vici Core - Productivity Library for .NET 3.5
-//
-// Copyright (c) 2008-2012 Philippe Leybaert
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//=============================================================================
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace Vici.Core.CompatibilityLayer
-{
-#if !PCL
- public static class File
- {
- public static string ReadAllText(string filename)
- {
- return System.IO.File.ReadAllText(filename);
- }
-
- public static void AppendAllText(string filename, string text)
- {
- System.IO.File.AppendAllText(filename,text);
- }
-
- }
-#endif
-}
+#region License
+//=============================================================================
+// Vici Core - Productivity Library for .NET 3.5
+//
+// Copyright (c) 2008-2012 Philippe Leybaert
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//=============================================================================
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace Vici.Core
+{
+ public static class FileIO
+ {
+ public class FileIODelegates
+ {
+ public Func<string,string> ReadAllText;
+ public Func<string, string> BuildFullPath;
+ }
+
+ public static FileIODelegates Delegates = new FileIODelegates()
+#if PCL
+ ;
+#else
+ {
+ ReadAllText = path => File.ReadAllText(path),
+ BuildFullPath = path => Path.GetFullPath(path)
+ };
+#endif
+
+ }
+}
View
86 Library/Json/JSONParser.cs
@@ -35,25 +35,35 @@ namespace Vici.Core.Json
{
public class JsonParser
{
+ public static JsonObject Parse(string json)
+ {
+ return new JsonParser()._Parse(json);
+ }
+
+ public static T Parse<T>(string json) where T : class,new()
+ {
+ return new JsonParser()._Parse<T>(json);
+ }
+
private Token[] _tokens;
private int _currentToken;
- public T Parse<T>(string json) where T:class, new()
+ private T _Parse<T>(string json) where T:class, new()
{
Tokenize(json);
_currentToken = 0;
- return (T) ParseObject(typeof(T));
+ return ParseObject(typeof(T)).As<T>();
}
- public object Parse(string json)
+ private JsonObject _Parse(string json)
{
Tokenize(json);
_currentToken = 0;
- return ParseObject(typeof (object));
+ return ParseValue();
}
private void Tokenize(string json)
@@ -77,7 +87,7 @@ private void NextToken()
_currentToken++;
}
- private object ParseObject(Type objectType)
+ private JsonObject ParseObject(Type objectType = null)
{
if (CurrentToken().TokenMatcher is NullTokenMatcher)
{
@@ -92,9 +102,9 @@ private object ParseObject(Type objectType)
object obj;
bool isDictionary = false;
- if (objectType == typeof(object))
+ if (objectType == null)
{
- obj = new Dictionary<string, object>();
+ obj = new Dictionary<string, JsonObject>();
isDictionary = true;
}
@@ -126,7 +136,7 @@ private object ParseObject(Type objectType)
{
Type fieldType = (property != null) ? property.PropertyType : field.FieldType;
- object fieldvalue = ParseValue(fieldType);
+ object fieldvalue = ParseValue(fieldType).As(fieldType);
if (property != null)
property.SetValue(obj, fieldvalue, null);
@@ -140,7 +150,7 @@ private object ParseObject(Type objectType)
}
else
{
- ((Dictionary<string, object>) obj)[propName] = ParseValue(typeof (object));
+ ((Dictionary<string, JsonObject>) obj)[propName] = ParseValue();
}
if (!(CurrentToken().TokenMatcher is CommaTokenMatcher))
@@ -154,19 +164,22 @@ private object ParseObject(Type objectType)
NextToken();
- return obj;
+ return new JsonObject(obj);
}
private static bool IsArray(Type type)
{
- return type.Inspector().ImplementsOrInherits<IList>()
+ return type != null && (
+ type.Inspector().ImplementsOrInherits<IList>()
||
- type.Inspector().ImplementsOrInherits(typeof (IList<>));
+ type.Inspector().ImplementsOrInherits(typeof (IList<>)));
}
- private object ParseValue(Type type)
+ private JsonObject ParseValue(Type type = null)
{
- if (type == typeof(object))
+ bool isArray = false;
+
+ if (type == null)
{
if (CurrentToken().TokenMatcher is StringTokenMatcher)
type = typeof(string);
@@ -177,13 +190,20 @@ private object ParseValue(Type type)
else if (CurrentToken().TokenMatcher is TrueTokenMatcher || CurrentToken().TokenMatcher is FalseTokenMatcher)
type = typeof(bool);
else if (CurrentToken().TokenMatcher is ArrayStartTokenMatcher)
- type = typeof(object[]);
- else if (CurrentToken().TokenMatcher is ObjectStartTokenMatcher || CurrentToken().TokenMatcher is NullTokenMatcher)
- type = typeof (object);
+ isArray = true;
+ else if (CurrentToken().TokenMatcher is ObjectStartTokenMatcher ||
+ CurrentToken().TokenMatcher is NullTokenMatcher)
+ {}
else
throw new Exception("Unexpected token " + CurrentToken());
}
+ if (isArray || IsArray(type))
+ return ParseArray(type);
+
+ if (type == null)
+ return ParseObject();
+
if (type == typeof(string))
return ParseString();
@@ -193,19 +213,16 @@ private object ParseValue(Type type)
NextToken();
- return value;
+ return new JsonObject(value);
}
if (type == typeof(int) || type == typeof(short) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(decimal))
return ParseNumber(type);
-
- if (IsArray(type))
- return ParseArray(type);
-
+
return ParseObject(type);
}
- private object ParseNumber(Type type)
+ private JsonObject ParseNumber(Type type)
{
if (!(CurrentToken().TokenMatcher is IntegerTokenMatcher) && !(CurrentToken().TokenMatcher is FloatTokenMatcher))
throw new Exception("Number expected");
@@ -223,12 +240,12 @@ private object ParseNumber(Type type)
_currentToken++;
- return Convert.ChangeType(n, type, null);
+ return new JsonObject(Convert.ChangeType(n, type, null));
}
- private object ParseString()
+ private JsonObject ParseString()
{
if (!(CurrentToken().TokenMatcher is StringTokenMatcher))
throw new Exception("Expected string");
@@ -239,31 +256,32 @@ private object ParseString()
_currentToken++;
- return s;
+ return new JsonObject(s);
}
- private object ParseArray(Type type)
+ private JsonObject ParseArray(Type type)
{
Type elementType = null;
- if (type.IsArray)
- {
+ if (type != null && type.IsArray)
elementType = type.GetElementType();
- }
if (!(CurrentToken().TokenMatcher is ArrayStartTokenMatcher))
throw new Exception("Expected [");
_currentToken++;
- List<object> list = new List<object>();
+ var list = new List<object>();
for(;;)
{
if (CurrentToken().TokenMatcher is ArrayEndTokenMatcher)
break;
- list.Add(ParseValue(elementType));
+ if (elementType == null)
+ list.Add(ParseValue());
+ else
+ list.Add(ParseValue().As(elementType));
if (!(CurrentToken().TokenMatcher is CommaTokenMatcher))
break;
@@ -276,12 +294,12 @@ private object ParseArray(Type type)
_currentToken++;
- Array array = Array.CreateInstance(elementType, list.Count);
+ Array array = Array.CreateInstance(elementType ?? typeof(JsonObject), list.Count);
for (int i = 0; i < array.Length; i++ )
array.SetValue(list[i],i);
- return array;
+ return new JsonObject(array);
}
}
}
View
4 Library/Json/Json.cs
@@ -29,9 +29,9 @@
namespace Vici.Core.Json
{
- public static class Json
+ public partial class JsonParser
{
- public static object Parse(string json)
+ public static JsonObject Parse(string json)
{
return new JsonParser().Parse(json);
}
View
95 Library/Json/JsonObject.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Vici.Core.StringExtensions;
+
+namespace Vici.Core.Json
+{
+ public class JsonObject
+ {
+ private readonly object _value;
+ private readonly bool _empty;
+
+ internal JsonObject(object value = null, bool empty = false)
+ {
+ _value = value;
+ _empty = empty;
+ }
+
+ public bool IsObject { get { return _value is Dictionary<string, JsonObject>; }}
+ public bool IsArray { get { return _value is object[]; } }
+ public bool IsValue { get { return !IsObject && !IsArray; }}
+ public bool IsEmpty { get { return _empty; }}
+
+ public object As(Type type) { return _value.Convert(type); }
+ public T As<T>() { return _value.Convert<T>(); }
+ public T[] AsArray<T>() { return _value.Convert<T[]>(); }
+
+ public Dictionary<string,JsonObject> AsDictionary() { return _value as Dictionary<string,JsonObject>; }
+
+ public string[] Keys
+ {
+ get { return IsObject ? AsDictionary().Keys.ToArray() : new string[0]; }
+ }
+
+ private JsonObject Get(string key)
+ {
+ return IsObject ? ValueForExpression(this,key) : null;
+ }
+
+ public JsonObject this[string key]
+ {
+ get
+ {
+ var value = Get(key);
+
+ return value ?? new JsonObject(empty:true);
+ }
+ }
+
+ private static IEnumerable<string> AllKeyParts(string key)
+ {
+ int index = 0;
+
+ for (; ; )
+ {
+ int dotIndex = key.IndexOf('.', index);
+
+ if (dotIndex < 0)
+ {
+ yield return key;
+ break;
+ }
+
+ yield return key.Substring(0, dotIndex);
+
+ index = dotIndex + 1;
+ }
+ }
+
+ private static JsonObject ValueForExpression(JsonObject obj, string key)
+ {
+ foreach (var keyPart in AllKeyParts(key).Reverse().ToArray())
+ {
+ var dic = obj.AsDictionary();
+
+ if (dic.ContainsKey(keyPart))
+ {
+ var value = dic[keyPart];
+
+ if (keyPart.Length == key.Length)
+ return value;
+
+ string key2 = key.Substring(keyPart.Length + 1);
+
+ return ValueForExpression(value,key2);
+ }
+
+ }
+
+ return null;
+ }
+
+
+ }
+}
View
10 Library/Parser/ExpressionParser/Expression/CallExpression.cs
@@ -85,11 +85,7 @@ public override ValueExpression Evaluate(IParserContext context)
if (methodObject is Delegate[])
{
Delegate[] delegates = (Delegate[]) methodObject;
-#if PCL
- MethodBase[] methods = delegates.ConvertAll<Delegate, MethodBase>(d => d.GetMethodInfo());
-#else
- MethodBase[] methods = delegates.ConvertAll<Delegate, MethodBase>(d => d.Method);
-#endif
+ MethodBase[] methods = delegates.ConvertAll<Delegate, MethodBase>(d => d.GetMethodInfo());
MethodBase method = LazyBinder.SelectBestMethod(methods, parameterTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
@@ -104,11 +100,7 @@ public override ValueExpression Evaluate(IParserContext context)
if (methodObject is Delegate)
{
Delegate method = (Delegate) methodObject;
-#if PCL
MethodInfo methodInfo = method.GetMethodInfo();
-#else
- MethodInfo methodInfo = method.Method;
-#endif
object value = methodInfo.Invoke(method.Target, parameterValues);
View
12 Library/Parser/TemplateParser/TemplateConfigs/Xml/Xml.cs
@@ -41,14 +41,10 @@ internal static string ReplaceEscapes(string text)
settings.ConformanceLevel = ConformanceLevel.Fragment;
- XmlWriter xmlWriter = XmlWriter.Create(writer, settings);
-
- xmlWriter.WriteString(text);
-#if PCL
- xmlWriter.Dispose();
-#else
- xmlWriter.Close();
-#endif
+ using (XmlWriter xmlWriter = XmlWriter.Create(writer, settings))
+ {
+ xmlWriter.WriteString(text);
+ }
return writer.ToString();
}
View
8 Library/Parser/TemplateParser/TemplateParser.cs
@@ -27,7 +27,6 @@
using System;
using System.Collections.Generic;
using System.Collections;
-using System.IO;
using System.Text;
using System.Text.RegularExpressions;
@@ -70,16 +69,15 @@ public TemplateParserConfig Config
get { return _config; }
}
-#if !PCL
public CompiledTemplate ParseFile(string fileName)
{
- CompiledTemplate template = Parse(File.ReadAllText(fileName));
+ CompiledTemplate template = Parse(FileIO.Delegates.ReadAllText(fileName));
template.FileName = fileName;
return template;
}
-#endif
+
public CompiledTemplate Parse(string inputString)
{
try
@@ -244,12 +242,10 @@ private static string CheckEmptyLine(TextTemplateNode lastTextNode, string text)
return text;
}
-#if !PCL
public string RenderFile(string fileName, IParserContext context)
{
return Render(ParseFile(fileName), context);
}
-#endif
public string Render(CompiledTemplate compiledTemplate, IParserContext context)
{
View
14 Library/Parser/TemplateParser/TemplateParserConfig.cs
@@ -161,13 +161,9 @@ protected virtual CompiledTemplate OnEvalParseFile(ExpressionParser parser, Temp
parameters[var.Key] = parser.Evaluate(var.Value, context);
}
-#if PCL
- return null; // TODO: use isolated storage
-#else
- string includeFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(pExpr.MainExpression), fileName));
+ string includeFile = FileIO.Delegates.BuildFullPath(Path.Combine(Path.GetDirectoryName(pExpr.MainExpression), fileName));
return templateParser.ParseFile(includeFile);
-#endif
}
internal string EvalIncludeFile(ExpressionParser parser, string fileName, TemplateToken token, IParserContext context)
@@ -177,13 +173,9 @@ internal string EvalIncludeFile(ExpressionParser parser, string fileName, Templa
protected virtual string OnEvalIncludeFile(ExpressionParser parser, string fileName, TemplateToken token, IParserContext context)
{
-#if PCL
- return ""; // TODO: use isolated storage
-#else
- string includeFile = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(fileName), fileName));
+ string includeFile = FileIO.Delegates.BuildFullPath(Path.Combine(Path.GetDirectoryName(fileName), fileName));
- return File.ReadAllText(includeFile);
-#endif
+ return FileIO.Delegates.ReadAllText(includeFile);
}
}
}
View
6 Library/Reflection/AutoMapper.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq;
-using System.Collections;
using System.Collections.Generic;
+using System.Reflection;
namespace Vici.Core
{
@@ -42,8 +42,10 @@ public bool IgnoreCase
public void FillObject<T>(Func<string,Tuple<object,bool>> valueProvider)
{
FillObject(typeof(T), valueProvider);
- }
+ Converter<string, int> x;
+ }
+
public void FillObject(object o, Func<string,Tuple<object,bool>> valueProvider)
{
Type type = o.GetType();
View
178 Library/Reflection/FieldOrProperty.cs
@@ -1,178 +0,0 @@
-//=============================================================================
-// Vici Parser - Generic expression and template parser for .NET
-//
-// Copyright (c) 2008-2009 Philippe Leybaert
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//=============================================================================
-
-using System;
-using System.Diagnostics;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-namespace Vici.Core
-{
- public delegate object Getter();
- public delegate T Getter<T>();
- public delegate void Setter(object o);
- public delegate void Setter<T>(T o);
-
- public class FieldOrProperty
- {
- private readonly MemberInfo _memberInfo;
- private readonly object _targetObject = null;
-
- public FieldOrProperty(Type type, string name, bool includePrivate, object targetObject)
- : this(type, name, includePrivate)
- {
- _targetObject = targetObject;
- }
-
- public FieldOrProperty(Type type, string name, bool includePrivate)
- {
- MemberInfo[] members;
-
- //members = from member in type.GetTypeInfo().DeclaredMembers where member.
-
-
-
- if (includePrivate)
- members = type.GetMember(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
- else
- members = type.GetMember(name);
-
- if (members.Length > 0 && !(members[0] is FieldInfo) && !(members[0] is PropertyInfo))
- {
- throw new AmbiguousMatchException();
- }
-
- MemberInfo member = null;
-
- if (members.Length > 1) // Can happen with types created by Reflection.Emit
- {
- for (int i = 0; i < members.Length; i++)
- if (members[i].DeclaringType == type)
- {
- member = members[i];
- break;
- }
-
- if (member == null)
- member = members[0];
- }
- else
- {
- member = members[0];
- }
-
- _memberInfo = member;
- }
-
- public FieldOrProperty(MemberInfo memberInfo)
- {
- _memberInfo = memberInfo;
- }
-
- public FieldOrProperty(MemberInfo memberInfo, object targetObject)
- : this(memberInfo)
- {
- _targetObject = targetObject;
- }
-
- public FieldOrProperty OfInstance(object targetObject)
- {
- return new FieldOrProperty(_memberInfo, targetObject);
- }
-
- public object Value
- {
- get { return GetValue(_targetObject); }
- set { SetValue(_targetObject, value); }
- }
-
- public string Name
- {
- get { return _memberInfo.Name; }
- }
-
- public Type Type
- {
- get
- {
- return (_memberInfo is FieldInfo) ? ((FieldInfo)_memberInfo).FieldType :
- (_memberInfo is PropertyInfo) ? ((PropertyInfo)_memberInfo).PropertyType :
- null;
- }
- }
-
- public bool IsField { get { return _memberInfo is FieldInfo; } }
- public bool IsProperty { get { return _memberInfo is PropertyInfo; } }
-
- private FieldInfo AsField { get { return _memberInfo as FieldInfo; } }
- private PropertyInfo AsProperty { get { return _memberInfo as PropertyInfo; } }
-
- public Setter SetterDelegate()
- {
- return delegate(object value) { Value = value; };
- }
-
- public Setter<T> SetterDelegate<T>()
- {
- return delegate(T value) { Value = value; };
- }
-
- public Getter GetterDelegate()
- {
- return delegate { return Value; };
- }
-
- public Getter<T> GetterDelegate<T>()
- {
- return delegate { return (T)Value; };
- }
-
- public object GetValue(object targetObject)
- {
- if (IsField)
- return AsField.GetValue(targetObject);
-
- return AsProperty.GetValue(targetObject, null);
- }
-
- public void SetValue(object targetObject, object value)
- {
- if (IsField)
- AsField.SetValue(targetObject, value);
- else
- AsProperty.SetValue(targetObject, value, null);
- }
-
- public bool IsStatic
- {
- get
- {
- if (IsField)
- return AsField.IsStatic;
-
- return (AsProperty.CanRead && AsProperty.GetGetMethod(true).IsStatic) || (AsProperty.CanWrite && AsProperty.GetSetMethod(true).IsStatic);
- }
- }
- }
-}
View
12 Library/Reflection/FieldOrPropertyInfo.cs
@@ -134,20 +134,12 @@ public bool IsStatic
public Attribute[] GetCustomAttributes(Type type, bool inherit)
{
-#if PCL
- return _memberInfo.GetCustomAttributes(type, inherit).ToArray();
-#else
- return (Attribute[]) _memberInfo.GetCustomAttributes(type, inherit);
-#endif
+ return _memberInfo.Inspector().GetAttributes(type, inherit);
}
public T[] GetCustomAttributes<T>(bool inherit) where T:Attribute
{
-#if PCL
- return _memberInfo.GetCustomAttributes<T>(inherit).ToArray();
-#else
- return (T[]) _memberInfo.GetCustomAttributes(typeof(T), inherit);
-#endif
+ return _memberInfo.Inspector().GetAttributes<T>(inherit);
}
public bool IsDefined(Type type, bool b)
View
47 Library/Reflection/FieldOrPropertyInfoExtensions.cs
@@ -1,47 +0,0 @@
-#region License
-//=============================================================================
-// Vici Core - Productivity Library for .NET 3.5
-//
-// Copyright (c) 2008-2012 Philippe Leybaert
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//=============================================================================
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Vici.Core
-{
- public static class FieldOrPropertyInfoExtensions
- {
- public static FieldOrPropertyInfo[] GetFieldsAndProperties(this Type type, BindingFlags bindingFlags)
- {
- List<MemberInfo> members = new List<MemberInfo>();
-
- members.AddRange(type.Inspector().GetFields(bindingFlags));
- members.AddRange(type.Inspector().GetProperties(bindingFlags));
-
- return members.Select(m => new FieldOrPropertyInfo(m)).ToArray();
- }
-
- }
-}
View
132 Library/TypeHelper.cs → ...eflection/Inspectors/AssemblyInspector.cs
@@ -1,63 +1,71 @@
-#region License
-//=============================================================================
-// Vici Core - Productivity Library for .NET 3.5
-//
-// Copyright (c) 2008-2012 Philippe Leybaert
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//=============================================================================
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Vici.Core
-{
- public static class TypeHelper
- {
-
- #region Method description
- /// <summary>
- /// Finds all types derived from the given type, limiting the search to the given assembly
- /// </summary>
- /// <param name="baseType">The base type or interface to use for finding types</param>
- /// <param name="assembly">The assembly to look into</param>
- /// <returns>An array of all types found in the given assembly which are either derived from the given type, or implement the given interface</returns>
- #endregion
- public static Type[] FindCompatibleTypes(this Assembly assembly, Type baseType)
- {
- return assembly.GetTypes().Where(type => type != baseType && baseType.IsAssignableFrom(type)).ToArray();
- }
-
- #region Method description
- /// <summary>
- /// Finds all types derived from the given type, limiting the search to the given assembly
- /// </summary>
- /// <param name="assembly">The assembly to look into</param>
- /// <returns>An array of all types found in the given assembly which are either derived from the given type, or implement the given interface</returns>
- #endregion
- public static Type[] FindCompatibleTypes<T>(this Assembly assembly)
- {
- return FindCompatibleTypes(assembly, typeof(T));
- }
-
- }
+#region License
+//=============================================================================
+// Vici Core - Productivity Library for .NET 3.5
+//
+// Copyright (c) 2008-2012 Philippe Leybaert
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//=============================================================================
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Vici.Core
+{
+ public class AssemblyInspector
+ {
+ private Assembly _assembly;
+
+ public AssemblyInspector(Assembly assembly)
+ {
+ _assembly = assembly;
+ }
+
+ #region Method description
+ /// <summary>
+ /// Finds all types derived from the given type, limiting the search to the given assembly
+ /// </summary>
+ /// <param name="baseType">The base type or interface to use for finding types</param>
+ /// <param name="assembly">The assembly to look into</param>
+ /// <returns>An array of all types found in the given assembly which are either derived from the given type, or implement the given interface</returns>
+ #endregion
+ public Type[] FindCompatibleTypes(Type baseType)
+ {
+ TypeInfo baseTypeInfo = baseType.GetTypeInfo();
+
+ return _assembly.DefinedTypes.Where(type => type != baseTypeInfo && baseTypeInfo.IsAssignableFrom(type)).ToArray().ConvertAll(typeInfo => typeInfo.AsType());
+ }
+
+ #region Method description
+ /// <summary>
+ /// Finds all types derived from the given type, limiting the search to the given assembly
+ /// </summary>
+ /// <param name="assembly">The assembly to look into</param>
+ /// <returns>An array of all types found in the given assembly which are either derived from the given type, or implement the given interface</returns>
+ #endregion
+ public Type[] FindCompatibleTypes<T>()
+ {
+ return FindCompatibleTypes(typeof(T));
+ }
+
+ }
}
View
112 Library/Reflection/Inspectors/MemberInspector.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Linq;
+using System.Reflection;
+
+namespace Vici.Core
+{
+ public class MemberInspector
+ {
+ private MemberInfo _memberInfo;
+
+ public MemberInspector(MemberInfo memberInfo)
+ {
+ _memberInfo = memberInfo;
+ }
+
+ public bool HasAttribute(Type attributeType, bool inherit)
+ {
+ return _memberInfo.IsDefined(attributeType, inherit);
+ }
+
+ public bool HasAttribute<T>(bool inherit) where T : Attribute
+ {
+ return _memberInfo.IsDefined(typeof(T), inherit);
+ }
+
+ public Attribute[] GetAttributes(Type attributeType, bool inherit)
+ {
+ return (Attribute[]) _memberInfo.GetCustomAttributes(attributeType, inherit);
+ }
+
+ public Attribute GetAttribute(Type attributeType, bool inherit)
+ {
+ return GetAttributes(attributeType, inherit).FirstOrDefault();
+ }
+
+ public T GetAttribute<T>(bool inherit) where T : Attribute
+ {
+ return (T) GetAttribute(typeof (T), inherit);
+ }
+
+ public T[] GetAttributes<T>(bool inherit) where T : Attribute
+ {
+ return (T[])GetAttributes(typeof(T), inherit);
+ }
+
+ public bool IsStatic
+ {
+ get
+ {
+ if (_memberInfo is PropertyInfo)
+ return (_memberInfo as PropertyInfo).GetMethod.IsStatic;
+ if (_memberInfo is FieldInfo)
+ return (_memberInfo as FieldInfo).IsStatic;
+ if (_memberInfo is MethodBase)
+ return (_memberInfo as MethodBase).IsStatic;
+ return false;
+ }
+ }
+
+ public bool IsPublic
+ {
+ get
+ {
+ if (_memberInfo is PropertyInfo)
+ return (_memberInfo as PropertyInfo).GetMethod.IsPublic;
+ if (_memberInfo is FieldInfo)
+ return (_memberInfo as FieldInfo).IsPublic;
+ if (_memberInfo is MethodBase)
+ return (_memberInfo as MethodBase).IsPublic;
+ return false;
+ }
+ }
+
+ public bool IsWritePublic
+ {
+ get
+ {
+ if (_memberInfo is PropertyInfo)
+ {
+ var propertyInfo = (_memberInfo as PropertyInfo);
+
+ return propertyInfo.SetMethod != null && propertyInfo.SetMethod.IsPublic;
+ }
+
+ return IsPublic;
+ }
+
+ }
+
+ internal bool MatchBindingFlags(BindingFlags flags)
+ {
+ if (flags == BindingFlags.Default)
+ return true;
+
+ if ((flags & BindingFlags.Static) == 0 && IsStatic)
+ return false;
+
+ if ((flags & BindingFlags.Instance) == 0 && !IsStatic)
+ return false;
+
+ if ((flags & BindingFlags.Public) != 0 && !IsPublic)
+ return false;
+
+ if ((flags & BindingFlags.NonPublic) != 0 && IsPublic)
+ return false;
+
+ return true;
+ }
+
+
+ }
+}
View
25 Library/Reflection/Inspectors/PropertyInspector.cs
@@ -0,0 +1,25 @@
+using System.Reflection;
+
+namespace Vici.Core
+{
+ public class PropertyInspector : MemberInspector
+ {
+ private PropertyInfo _propertyInfo;
+
+ public PropertyInspector(PropertyInfo propertyInfo) : base(propertyInfo)
+ {
+ _propertyInfo = propertyInfo;
+ }
+
+ public bool CanRead
+ {
+ get { return _propertyInfo.CanRead; }
+ }
+
+ public bool CanWrite
+ {
+ get { return _propertyInfo.CanWrite; }
+ }
+
+ }
+}
View
87 Library/Reflection/TypeInspector.cs → ...ry/Reflection/Inspectors/TypeInspector.cs
@@ -16,7 +16,7 @@ public TypeInspector(Type type)
_typeInfo = type.GetTypeInfo();
}
- private T WalkAndFindSingle<T>(Func<Type,T> f) where T:class
+ private T WalkAndFindSingle<T>(Func<Type,T> f)
{
Type t = _t;
@@ -30,12 +30,12 @@ public TypeInspector(Type type)
t = t.GetTypeInfo().BaseType;
}
- return null;
+ return default(T);
}
private T[] WalkAndFindMultiple<T>(Func<Type, IEnumerable<T>> f) where T : class
{
- List<T> array = new List<T>();
+ var list = new List<T>();
Type t = _t;
@@ -44,12 +44,12 @@ public TypeInspector(Type type)
IEnumerable<T> result = f(t);
if (result != null)
- array.AddRange(result);
+ list.AddRange(result);
t = t.GetTypeInfo().BaseType;
}
- return array.ToArray();
+ return list.ToArray();
}
public bool IsGenericType
@@ -92,6 +92,11 @@ public bool IsEnum
get { return _typeInfo.IsEnum; }
}
+ public bool IsSubclassOf(Type type)
+ {
+ return WalkAndFindSingle(t => t.GetTypeInfo().BaseType == type);
+ }
+
public object DefaultValue()
{
if (CanBeNull)
@@ -102,11 +107,12 @@ public object DefaultValue()
public MethodInfo GetMethod(string name, Type[] types)
{
-#if PCL
return WalkAndFindSingle(t => t.GetTypeInfo().GetDeclaredMethods(name).FirstOrDefault(mi => types.SequenceEqual(mi.GetParameters().Select(p => p.ParameterType))));
-#else
- return _t.GetMethod(name, types);
-#endif
+ }
+
+ public MethodInfo GetMethod(string name, BindingFlags bindingFlags)
+ {
+ return WalkAndFindSingle(t => t.GetTypeInfo().GetDeclaredMethods(name).FirstOrDefault(mi => mi.Inspector().MatchBindingFlags(bindingFlags)));
}
public bool HasAttribute<T>(bool inherit) where T : Attribute
@@ -116,11 +122,7 @@ public MethodInfo GetMethod(string name, Type[] types)
public T GetAttribute<T>(bool inherit) where T : Attribute
{
-#if PCL
return _typeInfo.GetCustomAttributes<T>(inherit).FirstOrDefault();
-#else
- return (T) _t.GetCustomAttributes(typeof(T),inherit).FirstOrDefault();
-#endif
}
public T[] GetAttributes<T>(bool inherit) where T : Attribute
@@ -135,38 +137,22 @@ public bool IsAssignableFrom(Type type)
public ConstructorInfo[] GetConstructors()
{
-#if PCL
return _typeInfo.DeclaredConstructors.ToArray();
-#else
- return _t.GetConstructors();
-#endif
}
public MemberInfo[] GetMember(string propertyName)
{
-#if PCL
return WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredMembers.Where(m => m.Name == propertyName));
-#else
- return _t.GetMember(propertyName);
-#endif
}
public PropertyInfo GetIndexer(Type[] types)
{
-#if PCL
return WalkAndFindSingle(t => t.GetTypeInfo().DeclaredProperties.FirstOrDefault(pi => pi.Name == "Item" && LazyBinder.MatchParameters(types, pi.GetIndexParameters())));
-#else
- return _t.GetProperty("Item", null, types);
-#endif
}
public T[] GetCustomAttributes<T>(bool inherit) where T:Attribute
{
-#if PCL
return _typeInfo.GetCustomAttributes<T>(inherit).ToArray();
-#else
- return (T[]) _t.GetCustomAttributes(typeof(T), inherit);
-#endif
}
public MethodInfo GetPropertyGetter(string propertyName, Type[] parameterTypes)
@@ -176,32 +162,19 @@ public MethodInfo GetPropertyGetter(string propertyName, Type[] parameterTypes)
public PropertyInfo GetProperty(string propName)
{
-#if PCL
return WalkAndFindSingle(t => t.GetTypeInfo().GetDeclaredProperty(propName));
-#else
- return _t.GetProperty(propName);
-#endif
}
public FieldInfo GetField(string fieldName)
{
-#if PCL
return WalkAndFindSingle(t => t.GetTypeInfo().GetDeclaredField(fieldName));
-#else
- return _t.GetField(fieldName);
-#endif
}
public bool ImplementsOrInherits(Type type)
{
if (type.GetTypeInfo().IsGenericTypeDefinition && type.GetTypeInfo().IsInterface)
{
-#if PCL
return _typeInfo.ImplementedInterfaces.Any(t => (t.GetTypeInfo().IsGenericType && t.GetTypeInfo().GetGenericTypeDefinition() == type));
-#else
- return _t.FindInterfaces((t, criteria) => (t.GetTypeInfo().IsGenericType && t.GetTypeInfo().GetGenericTypeDefinition() == type), null).Any();
-#endif
-
}
return type.GetTypeInfo().IsAssignableFrom(_typeInfo);
@@ -214,41 +187,29 @@ public bool ImplementsOrInherits<T>()
public MethodInfo GetMethod(string methodName, BindingFlags bindingFlags, Type[] parameterTypes)
{
- return (MethodInfo) WalkAndFindSingle(t => LazyBinder.SelectBestMethod(t.GetTypeInfo().GetDeclaredMethods(methodName),parameterTypes,bindingFlags));
+ return WalkAndFindSingle(t => LazyBinder.SelectBestMethod(t.GetTypeInfo().GetDeclaredMethods(methodName),parameterTypes,bindingFlags));
}
public Type[] GetGenericArguments()
{
-#if PCL
return _t.GenericTypeArguments;
-#else
- return _t.GetGenericArguments();
-#endif
}
public FieldInfo[] GetFields(BindingFlags bindingFlags)
{
-#if PCL
if ((bindingFlags & BindingFlags.DeclaredOnly) != 0)
- return _typeInfo.DeclaredFields.Where(fi => fi.MatchBindingFlags(bindingFlags)).ToArray();
- else
- return WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredFields.Where(fi => fi.MatchBindingFlags(bindingFlags)));
-#else
- return _t.GetFields(bindingFlags);
-#endif
+ return _typeInfo.DeclaredFields.Where(fi => fi.Inspector().MatchBindingFlags(bindingFlags)).ToArray();
+
+ return WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredFields.Where(fi => fi.Inspector().MatchBindingFlags(bindingFlags)));
}
public PropertyInfo[] GetProperties(BindingFlags bindingFlags)
{
-#if PCL
if ((bindingFlags & BindingFlags.DeclaredOnly) != 0)
- return _typeInfo.DeclaredProperties.Where(pi => pi.MatchBindingFlags(bindingFlags)).ToArray();
- else
- return WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredProperties.Where(pi => pi.MatchBindingFlags(bindingFlags)));
-#else
- return _t.GetProperties(bindingFlags);
-#endif
+ return _typeInfo.DeclaredProperties.Where(pi => pi.Inspector().MatchBindingFlags(bindingFlags)).ToArray();
+
+ return WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredProperties.Where(pi => pi.Inspector().MatchBindingFlags(bindingFlags)));
}
public Type[] GetInterfaces()
@@ -261,9 +222,9 @@ public FieldOrPropertyInfo[] GetFieldsAndProperties(BindingFlags bindingFlags)
MemberInfo[] members;
if ((bindingFlags & BindingFlags.DeclaredOnly) != 0)
- members = _typeInfo.DeclaredFields.Where(fi => fi.MatchBindingFlags(bindingFlags)).Union<MemberInfo>(_typeInfo.DeclaredProperties.Where(pi => pi.MatchBindingFlags(bindingFlags))).ToArray();
+ members = _typeInfo.DeclaredFields.Where(fi => fi.Inspector().MatchBindingFlags(bindingFlags)).Union<MemberInfo>(_typeInfo.DeclaredProperties.Where(pi => pi.Inspector().MatchBindingFlags(bindingFlags))).ToArray();
else
- members = WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredFields.Where(fi => fi.MatchBindingFlags(bindingFlags)).Union<MemberInfo>(t.GetTypeInfo().DeclaredProperties.Where(pi => pi.MatchBindingFlags(bindingFlags))));
+ members = WalkAndFindMultiple(t => t.GetTypeInfo().DeclaredFields.Where(fi => fi.Inspector().MatchBindingFlags(bindingFlags)).Union<MemberInfo>(t.GetTypeInfo().DeclaredProperties.Where(pi => pi.Inspector().MatchBindingFlags(bindingFlags))));
return members.Select(m => new FieldOrPropertyInfo(m)).ToArray();
}
View
3 Library/Reflection/LazyBinder.cs
@@ -38,6 +38,7 @@ namespace Vici.Core
[Flags]
public enum BindingFlags
{
+ FlattenHierarchy = 32,
Public = 16,
NonPublic = 32,
Static = 8,
@@ -125,7 +126,7 @@ private static bool MatchParameters(Type[] parameterTypes, ParameterInfo[] param
var compareTypes = new[] { ParameterCompareType.Exact, ParameterCompareType.Assignable, ParameterCompareType.Implicit };
return compareTypes
- .Select(compareType => methods.FirstOrDefault(m => MatchParameters(parameterTypes, m.GetParameters(), compareType) && m.MatchBindingFlags(bindingFlags) ))
+ .Select(compareType => methods.FirstOrDefault(m => MatchParameters(parameterTypes, m.GetParameters(), compareType) && m.Inspector().MatchBindingFlags(bindingFlags) ))
.FirstOrDefault(match => match != null);
}
View
85 Library/Reflection/ReflectionExtensions.cs
@@ -1,4 +1,3 @@
-using System.Linq;
using System.Collections.Generic;
using System;
using System.Reflection;
@@ -7,88 +6,28 @@ namespace Vici.Core
{
public static class ReflectionExtensions
{
- public class MemberWrapper
- {
- MemberInfo _memberInfo;
-
- public MemberWrapper(MemberInfo memberInfo)
- {
- _memberInfo = memberInfo;
- }
-
- public bool IsStatic
- {
- get
- {
- if (_memberInfo is PropertyInfo)
- return (_memberInfo as PropertyInfo).GetMethod.IsStatic;
- if (_memberInfo is FieldInfo)
- return (_memberInfo as FieldInfo).IsStatic;
- if (_memberInfo is MethodInfo)
- return (_memberInfo as MethodInfo).IsStatic;
- return false;
- }
- }
-
- public bool IsPublic
- {
- get
- {
- if (_memberInfo is PropertyInfo)
- return (_memberInfo as PropertyInfo).GetMethod.IsPublic;
- if (_memberInfo is FieldInfo)
- return (_memberInfo as FieldInfo).IsPublic;
- if (_memberInfo is MethodInfo)
- return (_memberInfo as MethodInfo).IsPublic;
- return false;
- }
- }
- }
-
public static TypeInspector Inspector(this Type type)
{
return new TypeInspector(type);
}
- internal static bool MatchBindingFlags(this MemberInfo memberInfo, BindingFlags flags)
- {
- MemberWrapper member = new MemberWrapper(memberInfo);
-
- if (flags == BindingFlags.Default)
- return true;
+ public static MemberInspector Inspector(this MemberInfo memberInfo)
+ {
+ return new MemberInspector(memberInfo);
+ }
- if ((flags & BindingFlags.Static) == 0 && member.IsStatic)
- return false;
+ public static PropertyInspector Inspector(this PropertyInfo propertyInfo)
+ {
+ return new PropertyInspector(propertyInfo);
+ }
- if ((flags & BindingFlags.Instance) == 0 && !member.IsStatic)
- return false;
+ public static AssemblyInspector Inspector(this Assembly assembly)
+ {
+ return new AssemblyInspector(assembly);
+ }
- if ((flags & BindingFlags.Public) != 0 && !member.IsPublic)
- return false;
- if ((flags & BindingFlags.NonPublic) != 0 && member.IsPublic)
- return false;
- return true;
- }
-
- public static bool HasAttribute<T>(this MemberInfo type, bool inherit) where T : Attribute
- {
- return type.IsDefined(typeof(T), inherit);
- }
-
- public static T GetAttribute<T>(this MemberInfo type, bool inherit) where T : Attribute
- {
- T[] attributes = (T[])type.GetCustomAttributes(typeof(T), inherit);
-
- return attributes.Length > 0 ? attributes[0] : null;
- }
-
- public static T[] GetAttributes<T>(this MemberInfo type, bool inherit) where T : Attribute
- {
- return (T[])type.GetCustomAttributes(typeof(T), inherit);
- }
}
-
}
View
11 Library/SmartConverter/ObjectConverter.cs
@@ -44,9 +44,6 @@ public static object Convert(this object value, Type targetType)
if (value == null)
return defaultReturnValue;
- if (value is string)
- return StringConverter.Convert((string) value, targetType);
-
targetType = targetType.Inspector().RealType;
Type sourceType = value.GetType();
@@ -56,8 +53,10 @@ public static object Convert(this object value, Type targetType)
var implicitOperator = targetType.Inspector().GetMethod("op_Implicit", new [] {sourceType});
if (implicitOperator != null)
- return implicitOperator.Invoke(null, new object[] {value});
-
+ return implicitOperator.Invoke(null, new [] {value});
+
+ if (value is string)
+ return StringConverter.Convert((string)value, targetType);
if (targetType == typeof(string))
{
@@ -106,7 +105,7 @@ public static object Convert(this object value, Type targetType)
Type targetArrayType = targetType.GetElementType();
Array sourceArray = value as Array;
- Array array = Array.CreateInstance(targetArrayType, new int[1] { sourceArray.Length }, new int[1] { 0 });
+ Array array = Array.CreateInstance(targetArrayType, new [] { sourceArray.Length }, new [] { 0 });
for (int i = 0; i < sourceArray.Length; i++)
{
View
2 Library/StringExtensions.cs
@@ -25,7 +25,7 @@
#endregion
using System;
-using System.Collections.Generic;
+using System.Collections;
using System.Linq;
namespace Vici.Core.StringExtensions
View
66 Library/Tuple.cs
@@ -1,66 +0,0 @@
-#region License
-//=============================================================================
-// Vici Core - Productivity Library for .NET 3.5
-//
-// Copyright (c) 2008-2012 Philippe Leybaert
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//=============================================================================
-#endregion
-
-using System;
-
-namespace Vici.Core
-{
- /*
- public class Tuple<T1, T2>
- {
- public Tuple()
- {
- }
-
- public Tuple(T1 value1, T2 value2)
- {
- Value1 = value1;
- Value2 = value2;
- }
-
- public T1 Value1;
- public T2 Value2;
- }
-
- public class Tuple<T1, T2, T3>
- {
- public Tuple()
- {
- }
-
- public Tuple(T1 value1, T2 value2, T3 value3)
- {
- Value1 = value1;
- Value2 = value2;
- Value3 = value3;
- }
-
- public T1 Value1;
- public T2 Value2;
- public T3 Value3;
- }
-*/
-}
View
256 Library/Vici.Core.Android.csproj
@@ -1,256 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{FD6AF977-EFB0-49B3-B402-F3546918BF97}</ProjectGuid>
- <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Vici.Core.Mono4Android</RootNamespace>
- <AssemblyName>Vici.Core.Android</AssemblyName>
- <FileAlignment>512</FileAlignment>
- <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
- <AndroidSupportedAbis>armeabi</AndroidSupportedAbis>
- <AndroidStoreUncompressedFileExtensions />
- <MandroidI18n />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>TRACE;DEBUG;MONO4ANDROID</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <AndroidLinkMode>None</AndroidLinkMode>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE;MONO4ANDROID</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <AndroidLinkMode>SdkOnly</AndroidLinkMode>
- <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AttributeHelper.cs" />
- <Compile Include="Base64Serializer.cs" />
- <Compile Include="BinaryHelper.cs" />
- <Compile Include="BinarySerializer.cs" />
- <Compile Include="Cache\SmartCache.cs" />
- <Compile Include="CompatibilityLayer.cs" />
- <Compile Include="CoreExtensions.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigIgnoreAttribute.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigKeyAttribute.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigObjectAttribute.cs" />
- <Compile Include="EasyConfig\ConfigManager.cs" />
- <Compile Include="EasyConfig\FieldOrPropertyInfo.cs" />
- <Compile Include="EasyConfig\FieldOrPropertyInfoExtensions.cs" />
- <Compile Include="EasyConfig\IConfigObject.cs" />
- <Compile Include="EasyConfig\IConfigurationProvider.cs" />
- <Compile Include="EasyConfig\Providers\ConfigurationProviderAppConfig.cs" />
- <Compile Include="EasyConfig\Providers\ConfigurationProviderXmlConfig.cs" />
- <Compile Include="Json\Json.cs" />
- <Compile Include="Json\JSONParser.cs" />
- <Compile Include="Json\JsonSerializer.cs" />
- <Compile Include="Json\Tokenizer\JSONTokenizer.cs" />
- <Compile Include="Json\Tokenizer\Tokens\ArrayEndTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\ArrayStartTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\ColonTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\CommaTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\FalseTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\FloatTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\IntegerTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\JSONStringTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\NullTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\ObjectEndTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\ObjectStartTokenMatcher.cs" />
- <Compile Include="Json\Tokenizer\Tokens\TrueTokenMatcher.cs" />
- <Compile Include="Logger\Logger.cs" />
- <Compile Include="Logger\LoggingProvider.cs" />
- <Compile Include="Logger\LogLevel.cs" />
- <Compile Include="Logger\Providers\LoggingProviderConsole.cs" />
- <Compile Include="Logger\Providers\LoggingProviderFile.cs" />
- <Compile Include="Mocking\ITimeProvider.cs" />
- <Compile Include="Mocking\RealTimeProvider.cs" />
- <Compile Include="Notifier\ISubscription.cs" />
- <Compile Include="Notifier\Notification.cs" />
- <Compile Include="Notifier\Notifier.cs" />
- <Compile Include="Parser\Context\ContextFactory.cs" />
- <Compile Include="Parser\Context\DynamicObject.cs" />
- <Compile Include="Parser\Context\IDynamicObject.cs" />
- <Compile Include="Parser\Context\IParserContext.cs" />
- <Compile Include="Parser\Context\ParserContext.cs" />
- <Compile Include="Parser\Context\ParserContextBehavior.cs" />
- <Compile Include="Parser\Context\PropertyHelper.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\BadArgumentException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\ExpressionEvaluationException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\IllegalAssignmentException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\IllegalOperandsException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\LexerException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\LiteralException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\ParserException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\UnknownPropertyException.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Abstract\Expression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Abstract\ExpressionWithContext.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AddExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AndAlsoExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AsExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AssignmentExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BinaryArithmicExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BinaryExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BitwiseComplementExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\CallExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\CoalesceExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ConditionalExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ConstructorExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\ClassName.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\IMethodDefinition.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\InstanceMethod.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\MethodDefinition.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\StaticMethod.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\DefaultValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\DivideExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ExpressionHelper\BinaryExpressionHelper.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\FieldExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\IndexExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Interfaces\IExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Interfaces\IExpressionWithContext.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\IsExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\MultiplyExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\NegationExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\OrElseExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\RangeExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\SubtractExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\TypeCastExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\TypeOfExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\UnaryMinusExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\VariableExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\ExpressionParser.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\IValueWithType.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\OperatorAssociativity.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\RPNExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\TokenEvaluator.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\TokenType.cs" />
- <Compile Include="Parser\ExpressionParser\Parser\ValueWithType.cs" />
- <Compile Include="Parser\ExpressionParser\Tokenizer\ExpressionToken.cs" />
- <Compile Include="Parser\ExpressionParser\Tokenizer\ExpressionTokenizer.cs" />
- <Compile Include="Parser\ExpressionParser\Tokenizer\ExpressionTokenMatcher.cs" />
- <Compile Include="Parser\ExpressionParser\Tokenizer\FunctionCallToken.cs" />
- <Compile Include="Parser\FieldOrProperty.cs" />
- <Compile Include="Parser\Parsers\CSharp\CSharpContext.cs" />
- <Compile Include="Parser\Parsers\CSharp\FlexContext.cs" />
- <Compile Include="Parser\Parsers\CSharp\Parser\CSharpEvaluator.cs" />
- <Compile Include="Parser\Parsers\CSharp\Parser\CSharpParser.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\CSharpTokenizer.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\CharLiteralMatcher.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\DecimalLiteralMatcher.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\IntegerLiteralMatcher.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\StringLiteralMatcher.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\TypeCastMatcher.cs" />
- <Compile Include="Parser\Parsers\CSharp\Tokenizer\Tokens\VariableMatcher.cs" />
- <Compile Include="Parser\TemplateParser\CompiledTemplate.cs" />
- <Compile Include="Parser\TemplateParser\Exceptions\TemplateParserException.cs" />
- <Compile Include="Parser\TemplateParser\Exceptions\TemplateParsingException.cs" />
- <Compile Include="Parser\TemplateParser\Exceptions\TemplateRenderingException.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\DoubleCurly\DoubleCurly.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\DoubleCurly\DoubleCurlyTokenizer.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\ProMesh\ProMesh.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\ProMesh\ProMeshTokenizer.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\SmartExpressionMatcher.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\Velocity\Velocity.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\Velocity\VelocityTokenizer.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\WrappedExpressionMatcher.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\Xml\Xml.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\Xml\XmlTokenizer.cs" />
- <Compile Include="Parser\TemplateParser\TemplateParser.cs" />
- <Compile Include="Parser\TemplateParser\TemplateParserConfig.cs" />
- <Compile Include="Parser\TemplateParser\Tokenizer\ForeachTemplateToken.cs" />
- <Compile Include="Parser\TemplateParser\Tokenizer\TemplateToken.cs" />
- <Compile Include="Parser\TemplateParser\Tokenizer\TemplateTokenizer.cs" />
- <Compile Include="Parser\TemplateParser\Tokenizer\TemplateTokenMatcher.cs" />
- <Compile Include="Parser\TemplateParser\Tokenizer\TemplateTokenType.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\AnyCharMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\AnyOfMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\AnyOfStringMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\CharMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\CompositeMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\RegexMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\SequenceOfAnyCharMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\SequenceOfCharRangeMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\StartsAndEndsWithMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\StringMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\WhiteSpaceMatcher.cs" />
- <Compile Include="Parser\Tokenizer\BaseMatchers\WhiteSpacePaddedMatcher.cs" />
- <Compile Include="Parser\Tokenizer\CharHelper.cs" />
- <Compile Include="Parser\Tokenizer\Exceptions\TokenizerException.cs" />
- <Compile Include="Parser\Tokenizer\Exceptions\UnknownTokenException.cs" />
- <Compile Include="Parser\Tokenizer\ITokenMatcher.cs" />
- <Compile Include="Parser\Tokenizer\ITokenProcessor.cs" />
- <Compile Include="Parser\Tokenizer\Token.cs" />
- <Compile Include="Parser\Tokenizer\Tokenizer.cs" />
- <Compile Include="Parser\Tokenizer\TokenizerState.cs" />
- <Compile Include="Parser\Tokenizer\TokenMatcher.cs" />
- <Compile Include="Parser\Tokenizer\TokenPosition.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Properties\VersionInfo.cs" />
- <Compile Include="Reflection\LazyBinder.cs" />
- <Compile Include="Scheduler\CyclicScheduler.cs" />
- <Compile Include="Scheduler\MonthlyScheduler.cs" />
- <Compile Include="Scheduler\ScheduleHistory\DefaultHistoryStore.cs" />
- <Compile Include="Scheduler\ScheduleHistory\FileHistoryStore.cs" />
- <Compile Include="Scheduler\ScheduleHistory\IScheduleHistoryStore.cs" />
- <Compile Include="Scheduler\Scheduler.cs" />
- <Compile Include="Scheduler\TimeOfDayScheduler.cs" />
- <Compile Include="SmartConverter\EnumConverter.cs" />
- <Compile Include="SmartConverter\IStringConverter.cs" />
- <Compile Include="SmartConverter\ObjectConverter.cs" />
- <Compile Include="SmartConverter\StringConverter.cs" />
- <Compile Include="StringHelper.cs" />
- <Compile Include="Tuple.cs" />
- <Compile Include="TypedWeakReference.cs" />
- <Compile Include="TypeHelper.cs" />
- <Compile Include="TypeInspector.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ExpressionTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ForEachTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\IfTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\IncludeFileTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\MacroCallTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\MacroDefinitionTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ParseFileTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\TemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\TextTemplateNode.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\FunctionValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ReturnExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ReturnValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\SequenceExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\ForEachExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\FunctionDefinitionExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\IfExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\InExpression.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ItemGroup>
- <Folder Include="Parser\TemplateParser\Nodes\" />
- </ItemGroup>
-</Project>
View
305 Library/Vici.Core.Metro.csproj
@@ -1,305 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{D53A5A75-E129-437E-BD1C-F300F621978B}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Vici.Core.Metro</RootNamespace>
- <AssemblyName>Vici.Core.Metro</AssemblyName>
- <DefaultLanguage>en-US</DefaultLanguage>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\ARM\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
- <NoWarn>;2008</NoWarn>
- <DebugType>full</DebugType>
- <PlatformTarget>ARM</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
- <OutputPath>bin\ARM\Release\</OutputPath>
- <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
- <Optimize>true</Optimize>
- <NoWarn>;2008</NoWarn>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>ARM</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x64\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
- <NoWarn>;2008</NoWarn>
- <DebugType>full</DebugType>
- <PlatformTarget>x64</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <OutputPath>bin\x64\Release\</OutputPath>
- <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
- <Optimize>true</Optimize>
- <NoWarn>;2008</NoWarn>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x64</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
- <NoWarn>;2008</NoWarn>
- <DebugType>full</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\x86\Release\</OutputPath>
- <DefineConstants>TRACE;NETFX_CORE</DefineConstants>
- <Optimize>true</Optimize>
- <NoWarn>;2008</NoWarn>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- <ErrorReport>prompt</ErrorReport>
- <Prefer32Bit>true</Prefer32Bit>
- </PropertyGroup>
- <ItemGroup>
- <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
- <Folder Include="Logger\Providers\" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AttributeHelper.cs" />
- <Compile Include="BinaryHelper.cs" />
- <Compile Include="CompatibilityLayer.cs" />
- <Compile Include="CoreExtensions.cs" />
- <Compile Include="EasyConfig\FieldOrPropertyInfo.cs" />
- <Compile Include="EasyConfig\FieldOrPropertyInfoExtensions.cs" />
- <Compile Include="EasyConfig\Providers\ConfigurationProviderXmlConfig.cs" />
- <Compile Include="Json\JsonSerializer.cs" />
- <Compile Include="Json\Json.cs" />
- <Compile Include="Notifier\ISubscription.cs" />
- <Compile Include="Notifier\Notification.cs" />
- <Compile Include="Notifier\Notifier.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\FunctionValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\ForEachExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\FunctionDefinitionExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\IfExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Logic\InExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ReturnExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ReturnValueExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\SequenceExpression.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ExpressionTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ForEachTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\IfTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\IncludeFileTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\MacroCallTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\MacroDefinitionTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\ParseFileTemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\TemplateNode.cs" />
- <Compile Include="Parser\TemplateParser\Nodes\TextTemplateNode.cs" />
- <Compile Include="Reflection\LazyBinder.cs" />
- <Compile Include="TypedWeakReference.cs" />
- <Compile Include="Parser\Context\ParserContextBehavior.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\IMethodDefinition.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\DefaultValueExpression.cs" />
- <Compile Include="Parser\Parsers\CSharp\FlexContext.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\ProMesh\ProMesh.cs" />
- <Compile Include="Parser\TemplateParser\TemplateConfigs\ProMesh\ProMeshTokenizer.cs" />
- <Compile Include="Scheduler\CyclicScheduler.cs" />
- <Compile Include="Scheduler\MonthlyScheduler.cs" />
- <Compile Include="Scheduler\ScheduleHistory\DefaultHistoryStore.cs" />
- <Compile Include="Scheduler\ScheduleHistory\IScheduleHistoryStore.cs" />
- <Compile Include="Scheduler\Scheduler.cs" />
- <Compile Include="Scheduler\TimeOfDayScheduler.cs" />
- <Compile Include="SmartConverter\EnumConverter.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigIgnoreAttribute.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigKeyAttribute.cs" />
- <Compile Include="EasyConfig\Attributes\ConfigObjectAttribute.cs" />
- <Compile Include="EasyConfig\IConfigObject.cs" />
- <Compile Include="EasyConfig\IConfigurationProvider.cs" />
- <Compile Include="EasyConfig\ConfigManager.cs" />
- <Compile Include="Logger\Logger.cs" />
- <Compile Include="Logger\LoggingProvider.cs" />
- <Compile Include="Logger\LogLevel.cs" />
- <Compile Include="Mocking\ITimeProvider.cs" />
- <Compile Include="Mocking\RealTimeProvider.cs" />
- <Compile Include="Cache\SmartCache.cs" />
- <Compile Include="Parser\Context\ContextFactory.cs" />
- <Compile Include="Parser\Context\DynamicObject.cs" />
- <Compile Include="Parser\Context\IDynamicObject.cs" />
- <Compile Include="Parser\Context\IParserContext.cs" />
- <Compile Include="Parser\Context\ParserContext.cs" />
- <Compile Include="Parser\Context\PropertyHelper.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\BadArgumentException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\ExpressionEvaluationException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\IllegalAssignmentException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\IllegalOperandsException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\LexerException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\LiteralException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\ParserException.cs" />
- <Compile Include="Parser\ExpressionParser\Exceptions\UnknownPropertyException.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Abstract\Expression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Abstract\ExpressionWithContext.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AddExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AndAlsoExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AsExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\AssignmentExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BinaryArithmicExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BinaryExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\BitwiseComplementExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\CallExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\CoalesceExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ConditionalExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ConstructorExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\ClassName.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\InstanceMethod.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\MethodDefinition.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ContainerClasses\StaticMethod.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\DivideExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ExpressionHelper\BinaryExpressionHelper.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\FieldExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\IndexExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Interfaces\IExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\Interfaces\IExpressionWithContext.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\IsExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\MultiplyExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\NegationExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\OrElseExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\RangeExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\SubtractExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\TypeCastExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\TypeOfExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\UnaryMinusExpression.cs" />
- <Compile Include="Parser\ExpressionParser\Expression\ValueExpression.cs" />
-