You've already forked linux-packaging-mono
Imported Upstream version 6.6.0.97
Former-commit-id: 36b6262d38adef7275aee46c9258ae34f9e3fb39
This commit is contained in:
parent
95fdb59ea6
commit
15bdb7a527
@ -972,7 +972,7 @@
|
|||||||
/* struct statvfs.f_fstypename */
|
/* struct statvfs.f_fstypename */
|
||||||
#undef HAVE_STATVFS_FSTYPENAME
|
#undef HAVE_STATVFS_FSTYPENAME
|
||||||
|
|
||||||
/* struct stat.st_birthtime */
|
/* struct stat.st_birthtimespec */
|
||||||
#undef HAVE_STAT_BIRTHTIME
|
#undef HAVE_STAT_BIRTHTIME
|
||||||
|
|
||||||
/* struct stat.st_atimensec */
|
/* struct stat.st_atimensec */
|
||||||
|
@ -1 +1 @@
|
|||||||
7926a792648f1baf888528635a4c8e86e3999cc8
|
c1c4180bcf0d7dbd1d0c854948b7b57e88437d3e
|
@ -1 +1 @@
|
|||||||
6c62eb854febb497f6a00b1d119dc74f32b6152d
|
875e956a9948f7a01d1d037a18e75e92d31b02ed
|
@ -836,6 +836,7 @@ namespace Mono.Debugger.Soft
|
|||||||
public Mono.Debugger.Soft.EnumMirror CreateEnumMirror(Mono.Debugger.Soft.TypeMirror type, Mono.Debugger.Soft.PrimitiveValue value) { throw null; }
|
public Mono.Debugger.Soft.EnumMirror CreateEnumMirror(Mono.Debugger.Soft.TypeMirror type, Mono.Debugger.Soft.PrimitiveValue value) { throw null; }
|
||||||
public Mono.Debugger.Soft.ExceptionEventRequest CreateExceptionRequest(Mono.Debugger.Soft.TypeMirror exc_type) { throw null; }
|
public Mono.Debugger.Soft.ExceptionEventRequest CreateExceptionRequest(Mono.Debugger.Soft.TypeMirror exc_type) { throw null; }
|
||||||
public Mono.Debugger.Soft.ExceptionEventRequest CreateExceptionRequest(Mono.Debugger.Soft.TypeMirror exc_type, bool caught, bool uncaught) { throw null; }
|
public Mono.Debugger.Soft.ExceptionEventRequest CreateExceptionRequest(Mono.Debugger.Soft.TypeMirror exc_type, bool caught, bool uncaught) { throw null; }
|
||||||
|
public Mono.Debugger.Soft.ExceptionEventRequest CreateExceptionRequest(Mono.Debugger.Soft.TypeMirror exc_type, bool caught, bool uncaught, bool everything_else) { throw null; }
|
||||||
public Mono.Debugger.Soft.MethodEntryEventRequest CreateMethodEntryRequest() { throw null; }
|
public Mono.Debugger.Soft.MethodEntryEventRequest CreateMethodEntryRequest() { throw null; }
|
||||||
public Mono.Debugger.Soft.MethodExitEventRequest CreateMethodExitRequest() { throw null; }
|
public Mono.Debugger.Soft.MethodExitEventRequest CreateMethodExitRequest() { throw null; }
|
||||||
public Mono.Debugger.Soft.StepEventRequest CreateStepRequest(Mono.Debugger.Soft.ThreadMirror thread) { throw null; }
|
public Mono.Debugger.Soft.StepEventRequest CreateStepRequest(Mono.Debugger.Soft.ThreadMirror thread) { throw null; }
|
||||||
|
@ -41,7 +41,7 @@ static partial class Consts
|
|||||||
// Use these assembly version constants to make code more maintainable.
|
// Use these assembly version constants to make code more maintainable.
|
||||||
//
|
//
|
||||||
|
|
||||||
public const string MonoVersion = "6.6.0.89";
|
public const string MonoVersion = "6.6.0.97";
|
||||||
public const string MonoCompany = "Mono development team";
|
public const string MonoCompany = "Mono development team";
|
||||||
public const string MonoProduct = "Mono Common Language Infrastructure";
|
public const string MonoProduct = "Mono Common Language Infrastructure";
|
||||||
public const string MonoCopyright = "(c) Various Mono authors";
|
public const string MonoCopyright = "(c) Various Mono authors";
|
||||||
|
@ -307,8 +307,15 @@ namespace Mono.Debugger.Soft
|
|||||||
public bool Subclasses {
|
public bool Subclasses {
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
public bool NotFilteredFeature {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public bool EverythingElse {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AssemblyModifier : Modifier {
|
class AssemblyModifier : Modifier {
|
||||||
public long[] Assemblies {
|
public long[] Assemblies {
|
||||||
get; set;
|
get; set;
|
||||||
@ -429,7 +436,7 @@ namespace Mono.Debugger.Soft
|
|||||||
* with newer runtimes, and vice versa.
|
* with newer runtimes, and vice versa.
|
||||||
*/
|
*/
|
||||||
internal const int MAJOR_VERSION = 2;
|
internal const int MAJOR_VERSION = 2;
|
||||||
internal const int MINOR_VERSION = 53;
|
internal const int MINOR_VERSION = 54;
|
||||||
|
|
||||||
enum WPSuspendPolicy {
|
enum WPSuspendPolicy {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
@ -2632,6 +2639,10 @@ namespace Mono.Debugger.Soft
|
|||||||
} else if (!em.Subclasses) {
|
} else if (!em.Subclasses) {
|
||||||
throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
|
throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
|
||||||
}
|
}
|
||||||
|
if (Version.MajorVersion > 2 || Version.MinorVersion >= 54) {
|
||||||
|
w.WriteBool (em.NotFilteredFeature);
|
||||||
|
w.WriteBool (em.EverythingElse);
|
||||||
|
}
|
||||||
} else if (mod is AssemblyModifier) {
|
} else if (mod is AssemblyModifier) {
|
||||||
w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
|
w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
|
||||||
var amod = (mod as AssemblyModifier);
|
var amod = (mod as AssemblyModifier);
|
||||||
|
@ -6,9 +6,9 @@ namespace Mono.Debugger.Soft
|
|||||||
public sealed class ExceptionEventRequest : EventRequest {
|
public sealed class ExceptionEventRequest : EventRequest {
|
||||||
|
|
||||||
TypeMirror exc_type;
|
TypeMirror exc_type;
|
||||||
bool caught, uncaught, subclasses;
|
bool caught, uncaught, subclasses, not_filtered_feature, everything_else;
|
||||||
|
|
||||||
internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught) : base (vm, EventType.Exception) {
|
internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught, bool not_filtered_feature = false, bool everything_else = false) : base (vm, EventType.Exception) {
|
||||||
if (exc_type != null) {
|
if (exc_type != null) {
|
||||||
CheckMirror (vm, exc_type);
|
CheckMirror (vm, exc_type);
|
||||||
TypeMirror exception_type = vm.RootDomain.Corlib.GetType ("System.Exception", false, false);
|
TypeMirror exception_type = vm.RootDomain.Corlib.GetType ("System.Exception", false, false);
|
||||||
@ -19,6 +19,8 @@ namespace Mono.Debugger.Soft
|
|||||||
this.caught = caught;
|
this.caught = caught;
|
||||||
this.uncaught = uncaught;
|
this.uncaught = uncaught;
|
||||||
this.subclasses = true;
|
this.subclasses = true;
|
||||||
|
this.not_filtered_feature = not_filtered_feature;
|
||||||
|
this.everything_else = everything_else;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeMirror ExceptionType {
|
public TypeMirror ExceptionType {
|
||||||
@ -41,7 +43,7 @@ namespace Mono.Debugger.Soft
|
|||||||
|
|
||||||
public override void Enable () {
|
public override void Enable () {
|
||||||
var mods = new List <Modifier> ();
|
var mods = new List <Modifier> ();
|
||||||
mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses });
|
mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses, NotFilteredFeature = not_filtered_feature, EverythingElse = everything_else });
|
||||||
SendReq (mods);
|
SendReq (mods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,13 @@ namespace Mono.Debugger.Soft
|
|||||||
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
|
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExceptionEventRequest CreateExceptionRequest (TypeMirror exc_type, bool caught, bool uncaught, bool everything_else) {
|
||||||
|
if (Version.AtLeast (2, 54))
|
||||||
|
return new ExceptionEventRequest (this, exc_type, caught, uncaught, true, everything_else);
|
||||||
|
else
|
||||||
|
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
|
||||||
|
}
|
||||||
|
|
||||||
public AssemblyLoadEventRequest CreateAssemblyLoadRequest () {
|
public AssemblyLoadEventRequest CreateAssemblyLoadRequest () {
|
||||||
return new AssemblyLoadEventRequest (this);
|
return new AssemblyLoadEventRequest (this);
|
||||||
}
|
}
|
||||||
|
@ -584,6 +584,7 @@ public class Tests : TestsBase, ITest2
|
|||||||
inspect_enumerator_in_generic_struct();
|
inspect_enumerator_in_generic_struct();
|
||||||
if_property_stepping();
|
if_property_stepping();
|
||||||
fixed_size_array();
|
fixed_size_array();
|
||||||
|
test_new_exception_filter();
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,6 +596,11 @@ public class Tests : TestsBase, ITest2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MyException : Exception {
|
||||||
|
public MyException(string message) : base(message) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void if_property_stepping() {
|
public static void if_property_stepping() {
|
||||||
var test = new TestClass();
|
var test = new TestClass();
|
||||||
if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")
|
if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")
|
||||||
@ -827,6 +833,57 @@ public class Tests : TestsBase, ITest2
|
|||||||
n.Buffer2 = new char4('a', 'b', 'c', 'd');
|
n.Buffer2 = new char4('a', 'b', 'c', 'd');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||||
|
public static void test_new_exception_filter () {
|
||||||
|
test_new_exception_filter1();
|
||||||
|
test_new_exception_filter2();
|
||||||
|
test_new_exception_filter3();
|
||||||
|
test_new_exception_filter4();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void test_new_exception_filter1 () {
|
||||||
|
try {
|
||||||
|
throw new Exception("excp");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test_new_exception_filter2 () {
|
||||||
|
try {
|
||||||
|
throw new MyException("excp");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test_new_exception_filter3 () {
|
||||||
|
try {
|
||||||
|
throw new ArgumentException();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
throw new Exception("excp");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test_new_exception_filter4 () {
|
||||||
|
try {
|
||||||
|
throw new ArgumentException();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
throw new Exception("excp");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||||
public static void inspect_enumerator_in_generic_struct() {
|
public static void inspect_enumerator_in_generic_struct() {
|
||||||
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
|
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
|
||||||
|
@ -1 +1 @@
|
|||||||
75967555e6b2fb9903c055d496b749f56798e897
|
ec003a04c422d9f2b5c359cfde61cd3a6b2f4b9a
|
@ -204,9 +204,11 @@ namespace System.Xml.Serialization
|
|||||||
{
|
{
|
||||||
if (isNullable && ReadNull()) return null;
|
if (isNullable && ReadNull()) return null;
|
||||||
|
|
||||||
if (checkType) {
|
if (checkType)
|
||||||
System.Xml.XmlQualifiedName t = GetXsiType();
|
{
|
||||||
if (t != null) {
|
System.Xml.XmlQualifiedName t = GetXsiType();
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
XmlTypeMapping realMap = typeMap.GetRealElementMap (t.Name, t.Namespace);
|
XmlTypeMapping realMap = typeMap.GetRealElementMap (t.Name, t.Namespace);
|
||||||
if (realMap == null) {
|
if (realMap == null) {
|
||||||
if (typeMap.TypeData.Type == typeof(object))
|
if (typeMap.TypeData.Type == typeof(object))
|
||||||
@ -219,12 +221,7 @@ namespace System.Xml.Serialization
|
|||||||
}
|
}
|
||||||
else if (typeMap.TypeData.Type == typeof(object))
|
else if (typeMap.TypeData.Type == typeof(object))
|
||||||
return ReadTypedPrimitive (AnyType);
|
return ReadTypedPrimitive (AnyType);
|
||||||
else {
|
}
|
||||||
XmlTypeMapping realMap = typeMap.GetRealElementMap (Reader.LocalName, Reader.NamespaceURI);
|
|
||||||
if (realMap != null && realMap != typeMap)
|
|
||||||
return ReadObject(realMap, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object ob = CreateInstance (typeMap.TypeData.Type, true);
|
object ob = CreateInstance (typeMap.TypeData.Type, true);
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ namespace System.Xml.Serialization
|
|||||||
return (XmlTypeMapMemberAttribute)_attributeMembers [BuildKey (name,ns, -1)];
|
return (XmlTypeMapMemberAttribute)_attributeMembers [BuildKey (name,ns, -1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlTypeMapElementInfo GetElement (string name, string ns, int minimalOrder)
|
public XmlTypeMapElementInfo GetElement(string name, string ns, int minimalOrder)
|
||||||
{
|
{
|
||||||
if (_elements == null)
|
if (_elements == null)
|
||||||
return null;
|
return null;
|
||||||
@ -404,38 +404,22 @@ namespace System.Xml.Serialization
|
|||||||
selected = info;
|
selected = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.MappedType != null && info.MappedType.DerivedTypes.Count > 0) {
|
|
||||||
foreach (XmlTypeMapping derrivedInfo in info.MappedType.DerivedTypes) {
|
|
||||||
if (derrivedInfo.ElementName == name && derrivedInfo.Namespace == ns) {
|
|
||||||
if (info.ExplicitOrder < minimalOrder)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (selected == null || selected.ExplicitOrder > info.ExplicitOrder) {
|
|
||||||
selected = info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlTypeMapElementInfo GetElement (string name, string ns)
|
public XmlTypeMapElementInfo GetElement(string name, string ns)
|
||||||
{
|
{
|
||||||
if (_elements == null) return null;
|
if (_elements == null) return null;
|
||||||
|
|
||||||
foreach (XmlTypeMapElementInfo info in _elements.Values)
|
foreach (XmlTypeMapElementInfo info in _elements.Values)
|
||||||
if (info.ElementName == name && info.Namespace == ns)
|
if (info.ElementName == name && info.Namespace == ns)
|
||||||
return info;
|
return info;
|
||||||
else if (info.MappedType != null && info.MappedType.DerivedTypes.Count > 0) {
|
|
||||||
foreach (XmlTypeMapping derrivedInfo in info.MappedType.DerivedTypes)
|
|
||||||
if (derrivedInfo.ElementName == name && derrivedInfo.Namespace == ns)
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlTypeMapElementInfo GetElement (int index)
|
public XmlTypeMapElementInfo GetElement (int index)
|
||||||
{
|
{
|
||||||
if (_elements == null) return null;
|
if (_elements == null) return null;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -1686,28 +1687,40 @@ namespace MonoTests.System.XmlSerialization
|
|||||||
Assert.AreEqual ("b", d.Extra[1]);
|
Assert.AreEqual ("b", d.Extra[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test] // PR #11194
|
// https://github.com/mono/mono/issues/16918
|
||||||
public void TestDerrivedClassProperty ()
|
[Test]
|
||||||
|
public void Bug16918 ()
|
||||||
{
|
{
|
||||||
var data = "<layout width=\".25\" height =\".25\" x=\"0\" y=\"0\" id=\"portrait\" class=\"render\"><background color=\"white\"><div x=\".03\" y=\".05\" width=\".94\" height =\".9\" layout=\"proportional_rows\" paddingX=\".01\" paddingY=\".02\"><background color=\"black\"></background><background color=\"gray\" padding=\".1\"><label color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">Test UI</label></background><br brSize=\"1\" /><background class=\"back,Lab\" color=\"green\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">GREEN</label></background><background color=\"red\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">RED</label></background><background color=\"blue\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">TLUE</label></background><background color=\"blue\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">BLUE</label></background></div></background></layout>";
|
PropertiesWithSameNameAsTheirType testObject = new PropertiesWithSameNameAsTheirType ()
|
||||||
|
{
|
||||||
|
E1 = E1.Two,
|
||||||
|
E2 = E2.Two,
|
||||||
|
E3 = E3.Two,
|
||||||
|
E4 = E4.Two,
|
||||||
|
E5 = E5.Two
|
||||||
|
};
|
||||||
|
|
||||||
XmlAttributeOverrides overrides = PR11194.GenerateLayoutOverrides<PR11194ChildLo>();
|
XmlSerializer serializer = new XmlSerializer (typeof (PropertiesWithSameNameAsTheirType));
|
||||||
|
|
||||||
var result = Deserialize(typeof(PR11194ChildLo), data, overrides) as PR11194ChildLo;
|
// serialize
|
||||||
|
string serializedObject;
|
||||||
|
using (MemoryStream memoryStream = new MemoryStream ())
|
||||||
|
{
|
||||||
|
serializer.Serialize (memoryStream, testObject);
|
||||||
|
serializedObject = Encoding.UTF8.GetString (memoryStream.ToArray ());
|
||||||
|
}
|
||||||
|
|
||||||
PR11194Parent2 child;
|
PropertiesWithSameNameAsTheirType deserializedObject;
|
||||||
Assert.IsNotNull(result, "#11194_1");
|
using (MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (serializedObject)))
|
||||||
Assert.AreEqual(1, result.children.Count, "#11194_2");
|
{
|
||||||
child = result.children[0] as PR11194Parent2;
|
deserializedObject = (PropertiesWithSameNameAsTheirType)serializer.Deserialize (memoryStream);
|
||||||
Assert.IsNotNull(child, "#11194_3");
|
}
|
||||||
Assert.AreEqual(1, child.children.Count, "#11194_4");
|
|
||||||
child = child.children[0] as PR11194Parent2;
|
Assert.AreEqual (testObject.E1, deserializedObject.E1, "#1");
|
||||||
Assert.IsNotNull(child, "#11194_5");
|
Assert.AreEqual (testObject.E2, deserializedObject.E2, "#2");
|
||||||
Assert.AreEqual(7, child.children.Count, "#11194_6");
|
Assert.AreEqual (testObject.E3, deserializedObject.E3, "#3");
|
||||||
child = child.children[1] as PR11194Parent2;
|
Assert.AreEqual (testObject.E4, deserializedObject.E4, "#4");
|
||||||
Assert.IsNotNull(child, "#11194_7");
|
Assert.AreEqual (testObject.E5, deserializedObject.E5, "#5");
|
||||||
Assert.AreEqual(1, child.children.Count, "#11194_8");
|
|
||||||
Assert.AreEqual("PR11194ChildL", child.children[0].GetType().Name, "#11194_9");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -1207,157 +1205,54 @@ namespace MonoTests.System.Xml.TestClasses
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
#region PR_11194
|
public class PropertiesWithSameNameAsTheirType
|
||||||
|
|
||||||
#region PR_11194_GenerateOverrides
|
|
||||||
public static class PR11194
|
|
||||||
{
|
{
|
||||||
public static XmlAttributeOverrides GenerateLayoutOverrides<T>()
|
public PropertiesWithSameNameAsTheirType ()
|
||||||
{
|
{
|
||||||
Type tType = typeof(T);
|
|
||||||
|
|
||||||
TypeInfo tTypeInfo = tType.GetTypeInfo();
|
|
||||||
|
|
||||||
IEnumerable<PropertyInfo> props = tType.GetRuntimeProperties();
|
|
||||||
|
|
||||||
XmlAttributeOverrides overrides = new XmlAttributeOverrides();
|
|
||||||
|
|
||||||
foreach (PropertyInfo prop in props) {
|
|
||||||
XmlDerrivedAttribute attr = prop.GetCustomAttribute<XmlDerrivedAttribute>();
|
|
||||||
|
|
||||||
if (attr == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type dType = prop.DeclaringType;
|
|
||||||
|
|
||||||
Type pType = prop.PropertyType;
|
|
||||||
TypeInfo pTypeInfo = pType.GetTypeInfo();
|
|
||||||
|
|
||||||
Type enumType = typeof(IEnumerable<>);
|
|
||||||
|
|
||||||
if (pTypeInfo.IsGenericType
|
|
||||||
&& pTypeInfo.ImplementedInterfaces.Any(t =>
|
|
||||||
(t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() == enumType))) {
|
|
||||||
pType = pType.GenericTypeArguments[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
XmlAttributes overrideAttributes = GenerateOverrideAttributes(dType, pType, attr);
|
|
||||||
|
|
||||||
overrides.Add(dType, prop.Name, overrideAttributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return overrides;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static XmlAttributes GenerateOverrideAttributes (Type declaringType, Type propertyType, XmlDerrivedAttribute attr)
|
public object obj1 { get; set; }
|
||||||
{
|
public object obj2 { get; set; }
|
||||||
XmlAttributes xAttrs = new XmlAttributes();
|
public object obj3 { get; set; }
|
||||||
|
public object obj4 { get; set; }
|
||||||
|
public object obj5 { get; set; }
|
||||||
|
|
||||||
Assembly a = declaringType.GetTypeInfo().Assembly;
|
public E1 E1 { get; set; }
|
||||||
TypeInfo interfaceType = propertyType.GetTypeInfo();
|
public E2 E2 { get; set; }
|
||||||
IEnumerable<Type> types = a.ExportedTypes.Where(t => interfaceType.IsAssignableFrom(t.GetTypeInfo()) && !t.GetTypeInfo().IsAbstract);
|
public E3 E3 { get; set; }
|
||||||
|
public E4 E4 { get; set; }
|
||||||
foreach (Type t in types) {
|
public E5 E5 { get; set; }
|
||||||
string name = NameBySourceType(t, attr.SrcType);// t.GetTypeInfo().GetCustomAttribute<XmlTypeAttribute>().TypeName;
|
|
||||||
XmlElementAttribute xAttr = new XmlElementAttribute();
|
|
||||||
xAttr.ElementName = name;
|
|
||||||
xAttr.Type = t;
|
|
||||||
xAttrs.XmlElements.Add(xAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return xAttrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string NameBySourceType (Type derrivedType, XmlDerrivedSourceType srcType)
|
|
||||||
{
|
|
||||||
string name = null;
|
|
||||||
switch (srcType)
|
|
||||||
{
|
|
||||||
case XmlDerrivedSourceType.ByXmlType:
|
|
||||||
name = derrivedType.GetTypeInfo().GetCustomAttribute<XmlTypeAttribute>().TypeName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region helperAttribute
|
public enum E1
|
||||||
public enum XmlDerrivedSourceType
|
|
||||||
{
|
{
|
||||||
ByXmlType
|
One,
|
||||||
|
Two,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XmlDerrivedAttribute : Attribute
|
public enum E2
|
||||||
{
|
{
|
||||||
public XmlDerrivedSourceType SrcType { get; set; }
|
One,
|
||||||
|
Two,
|
||||||
public XmlDerrivedAttribute(XmlDerrivedSourceType srcType)
|
|
||||||
{
|
|
||||||
SrcType = srcType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
public abstract class PR11194Parent
|
public enum E5
|
||||||
{
|
{
|
||||||
[XmlIgnore]
|
One,
|
||||||
public PR11194Parent Parent { get; set; }
|
Two,
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class PR11194Parent2 : PR11194Parent
|
public enum E3
|
||||||
{
|
{
|
||||||
[XmlAttribute]
|
One,
|
||||||
public float width { get; set; }
|
Two,
|
||||||
[XmlAttribute]
|
|
||||||
public float height { get; set; }
|
|
||||||
[XmlAttribute]
|
|
||||||
public float x { get; set; }
|
|
||||||
[XmlAttribute]
|
|
||||||
public float y { get; set; }
|
|
||||||
[XmlAttribute]
|
|
||||||
public string id { get; set; }
|
|
||||||
[XmlElement]
|
|
||||||
[XmlDerrived(XmlDerrivedSourceType.ByXmlType)]
|
|
||||||
public List<PR11194Parent> children { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlType("background")]
|
public enum E4
|
||||||
public class PR11194ChildB : PR11194Parent2
|
|
||||||
{
|
{
|
||||||
[XmlAttribute]
|
One,
|
||||||
public string image { get; set; }
|
Two,
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlType("br")]
|
|
||||||
public class PR11194ChildBr : PR11194Parent
|
|
||||||
{
|
|
||||||
[XmlAttribute("brSize")]
|
|
||||||
public int breaks { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[XmlType("div")]
|
|
||||||
public class PR11194ChildD : PR11194ChildLo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[XmlType("label")]
|
|
||||||
public class PR11194ChildL : PR11194Parent2
|
|
||||||
{
|
|
||||||
[XmlAttribute]
|
|
||||||
public string font { get; set; }
|
|
||||||
[XmlAttribute]
|
|
||||||
public int fontSize { get; set; }
|
|
||||||
[XmlText]
|
|
||||||
public string Text { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[XmlType("layout")]
|
|
||||||
public class PR11194ChildLo : PR11194Parent2
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
ad3e9f580ce57dfc6b40093729af53da06f1eae2
|
edc1389c07394c14b27e463871b22b1561937374
|
@ -1 +1 @@
|
|||||||
c2b1ff6d4020e64bf4e4321b012d2e6bd6df851e
|
4ff2e299148bc180e72ad19f5adfddb59f8968ac
|
@ -1 +1 @@
|
|||||||
57346dfa4dfcfd703c2e6439ba239e8abd8f8fdc
|
29a1fbbf19d42d96405d39a21f1513237b134c2f
|
@ -1 +1 @@
|
|||||||
a4d856f22d3b31af4aec91144bc95a8935797dd3
|
59d20293264f996016a6966494e42c88ded3d2f0
|
@ -1 +1 @@
|
|||||||
e824e7d2594502e33b8b81dfae235e687dd2ca0c
|
2407bcaadeea1315459f2dcc9f409c43878239e6
|
@ -1 +1 @@
|
|||||||
a1c4c11b881596a0dc2da00d93455838c01cb2e7
|
02111185a37ca5018aba384763d2dae87428e1bc
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user