Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of KeyDescriptor from the specified attribute during a KeysMeta
        /// initializes itself using reflection.
        /// </summary>
        public KeyDescriptor(KeyInfoAttribute attribute)
        {
            _version = attribute.Version;
            _keyType = attribute.KeyType;
            _fixedValue = attribute.FixedValue;
            _objectType = attribute.ObjectType;

            if (_version == "")
                _version = "1.0";
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Initializes a new instance of KeyDescriptor from the specified attribute during a KeysMeta
    /// initializes itself using reflection.
    /// </summary>
    public KeyDescriptor(KeyInfoAttribute attribute)
    {
      this.version = attribute.Version;
      this.keyType = attribute.KeyType;
      this.fixedValue = attribute.FixedValue;
      this.objectType = attribute.ObjectType;

      if (this.version == "")
        version = "1.0";
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of KeyDescriptor from the specified attribute during a KeysMeta
        /// initializes itself using reflection.
        /// </summary>
        public KeyDescriptor(KeyInfoAttribute attribute)
        {
            _version = attribute.Version;
            _keyType = attribute.KeyType;
            _fixedValue = attribute.FixedValue;
            _objectType = attribute.ObjectType;

            if (_version == "")
                _version = "1.0";
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of KeyDescriptor from the specified attribute during a KeysMeta
        /// initializes itself using reflection.
        /// </summary>
        public KeyDescriptor(KeyInfoAttribute attribute)
        {
            this.version    = attribute.Version;
            this.keyType    = attribute.KeyType;
            this.fixedValue = attribute.FixedValue;
            this.objectType = attribute.ObjectType;

            if (this.version == "")
            {
                version = "1.0";
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of KeyDescriptor from the specified attribute during a KeysMeta
        /// initializes itself using reflection.
        /// </summary>
        public KeyDescriptor(KeyInfoAttribute attribute)
        {
            version    = attribute.Version;
            keyType    = attribute.KeyType;
            fixedValue = attribute.FixedValue;
            objectType = attribute.ObjectType;

            if (version == "")
            {
                version = "1.0";
            }
        }
Ejemplo n.º 6
0
 public DictionaryMeta(Type type)
 {
     FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
     foreach (FieldInfo field in fields)
     {
         object[] attributes = field.GetCustomAttributes(typeof(KeyInfoAttribute), false);
         if (attributes.Length == 1)
         {
             KeyInfoAttribute attribute  = (KeyInfoAttribute)attributes[0];
             KeyDescriptor    descriptor = new KeyDescriptor(attribute);
             descriptor.KeyValue = (string)field.GetValue(null);
             this.keyDescriptors[descriptor.KeyValue] = descriptor;
         }
     }
 }
Ejemplo n.º 7
0
        public DictionaryMeta(Type type)
        {
            //#if (NETFX_CORE && DEBUG) || CORE
            //            if (type == typeof(PdfPages.Keys))
            //            {
            //                var x = typeof(PdfPages).GetRuntimeFields();
            //                var y = typeof(PdfPages).GetTypeInfo().DeclaredFields;
            //                x.GetType();
            //                y.GetType();
            //                Debug-Break.Break();
            //                Test.It();
            //            }
            //#endif
#if !NETFX_CORE && !UWP
            FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
            foreach (FieldInfo field in fields)
            {
#if NETCORE
                var attributes = field.GetCustomAttributes(typeof(KeyInfoAttribute), false).ToArray();
#else
                object[] attributes = field.GetCustomAttributes(typeof(KeyInfoAttribute), false);
#endif
                if (attributes.Length == 1)
                {
                    KeyInfoAttribute attribute  = (KeyInfoAttribute)attributes[0];
                    KeyDescriptor    descriptor = new KeyDescriptor(attribute);
                    descriptor.KeyValue = (string)field.GetValue(null);
                    _keyDescriptors[descriptor.KeyValue] = descriptor;
                }
            }
#else
            // Rewritten for WinRT.
            CollectKeyDescriptors(type);
            //var fields = type.GetRuntimeFields();  // does not work
            //fields2.GetType();
            //foreach (FieldInfo field in fields)
            //{
            //    var attributes = field.GetCustomAttributes(typeof(KeyInfoAttribute), false);
            //    foreach (var attribute in attributes)
            //    {
            //        KeyDescriptor descriptor = new KeyDescriptor((KeyInfoAttribute)attribute);
            //        descriptor.KeyValue = (string)field.GetValue(null);
            //        _keyDescriptors[descriptor.KeyValue] = descriptor;
            //    }
            //}
#endif
        }