/// <summary>
 /// Read ctor
 /// </summary>
 public SimpleEntryInstance(Type parent, string key, Value value)
     : base(parent, EntryFlags.None, key)
 {
     if (value == null)
         throw new ArgumentNullException("value");
     this.value = value;
 }
Beispiel #2
0
 /// <summary>
 /// Read ctor
 /// </summary>
 internal Attribute(ResReader reader, XmlTree tree)
 {
     this.tree = tree;
     Namespace = StringPoolRef.Read(reader, tree.StringPool);
     Name = StringPoolRef.Read(reader, tree.StringPool);
     RawValue = StringPoolRef.Read(reader, tree.StringPool);
     TypedValue = new Value(reader);
 }
Beispiel #3
0
 /// <summary>
 /// Try to load an id for the given attribute name
 /// </summary>
 public bool TryGetId(XName name, out int id, out Value.Types valueType)
 {
     Entry entry;
     id = -1;
     valueType = Value.Types.TYPE_STRING;
     if (idMap.TryGetValue(name, out entry))
     {
         id = entry.Id;
         valueType = entry.ValueType;
         return true;
     }
     return false;
 }
Beispiel #4
0
            /// <summary>
            /// Assign resource ID's to attributes.
            /// </summary>
            internal void AssignResourceIds(ResourceIdMap resourceIdMap)
            {
                if (string.IsNullOrEmpty(Namespace))
                    return;

                int id;
                Value.Types valueType;
                if (resourceIdMap.TryGetId(XName, out id, out valueType))
                {
                    // Set resource id
                    resourceId = id;

                    // Change value type (if needed)
                    switch (valueType)
                    {
                        case Value.Types.TYPE_FIRST_INT:
                            TypedValue = new Value(valueType, int.Parse(RawValue));
                            break;
                    }
                }
            }
 /// <summary>
 /// Read ctor
 /// </summary>
 internal SimpleEntryInstance(Type parent, ResReader reader)
     : base(parent, reader)
 {
     // Read value
     value = new Value(reader);
 }
Beispiel #6
0
 /// <summary>
 /// Reading ctor
 /// </summary>
 internal CData(ResReader reader, XmlTree tree)
     : base(reader, tree, ChunkTypes.RES_XML_CDATA_TYPE)
 {
     Data = StringPoolRef.Read(reader, tree.StringPool);
     TypedData = new Value(reader);
 }
Beispiel #7
0
 /// <summary>
 /// Creation ctor
 /// </summary>
 internal CData(XmlTree tree, XText text)
     : base(tree, ChunkTypes.RES_XML_CDATA_TYPE)
 {
     Data = text.Value;
     TypedData = new Value(Value.Types.TYPE_NULL, 0);
 }