Esempio n. 1
0
        private static void TraverseMap(XmlNode node, PsoBuilder pb, PsoStructureEntryInfo entry, PsoStructureInfo infos, byte[] data, PsoArrayResults arrayResults)
        {
            var mapidx1     = entry.ReferenceKey & 0x0000FFFF;
            var mapidx2     = (entry.ReferenceKey >> 16) & 0x0000FFFF;
            var mapreftype1 = infos.Entries[mapidx2];
            var mapreftype2 = infos.Entries[mapidx1];

            if (mapreftype2.ReferenceKey != 0)
            {
            }

            var xStruct = pb.AddMapNodeStructureInfo((MetaName)mapreftype2.ReferenceKey);
            var xName   = xStruct.IndexInfo.NameHash;
            var kEntry  = xStruct?.FindEntry(MetaName.Key);
            var iEntry  = xStruct?.FindEntry(MetaName.Item);

            if (kEntry.Type != PsoDataType.String)
            {
            }



            List <byte[]> nodesData = new List <byte[]>();

            foreach (XmlNode cnode in node.ChildNodes)
            {
                var kattr = cnode.Attributes["key"].Value;
                var tattr = cnode.Attributes["type"].Value;//CW invention for convenience..!
                var khash = (MetaName)(uint)GetHash(kattr);
                var thash = (MetaName)(uint)GetHash(tattr);

                byte[] strucBytes = Traverse(cnode, pb, thash);
                byte[] nodeBytes  = new byte[xStruct.StructureLength];

                TraverseStringRaw(kattr, pb, kEntry, nodeBytes); //write the key

                if (xName != (MetaName)MetaTypeName.ARRAYINFO)   // (mapreftype2.ReferenceKey != 0)
                {
                    //value struct embedded in ARRAYINFO node
                    Buffer.BlockCopy(strucBytes, 0, nodeBytes, iEntry.DataOffset, strucBytes.Length);
                }
                else
                {
                    //normal ARRAYINFO with pointer value
                    var itemptr = pb.AddItemPtr(thash, strucBytes);
                    itemptr.SwapEnd(); //big schmigg
                    var ptrbytes = MetaTypes.ConvertToBytes(itemptr);
                    Buffer.BlockCopy(ptrbytes, 0, nodeBytes, iEntry.DataOffset, ptrbytes.Length);
                }

                nodesData.Add(nodeBytes);
            }



            Write(0x1000000, data, entry.DataOffset);
            Write(0, data, entry.DataOffset + 4);

            arrayResults.Structures[entry.DataOffset + 8] = pb.AddItemArrayPtr(xName, nodesData.ToArray());  //pb.AddPointerArray(nodeptrs);
        }
Esempio n. 2
0
 private void EnsureInstances(Meta Meta)
 {
     if (CMapData.instancedData.GrassInstanceList.Count1 != 0)
     {
         rage__fwGrassInstanceListDef[] batches  = MetaTypes.ConvertDataArray <rage__fwGrassInstanceListDef>(Meta, MetaName.rage__fwGrassInstanceListDef, CMapData.instancedData.GrassInstanceList);
         YmapGrassInstanceBatch[]       gbatches = new YmapGrassInstanceBatch[batches.Length];
         for (int i = 0; i < batches.Length; i++)
         {
             var batch = batches[i];
             rage__fwGrassInstanceListDef__InstanceData[] instdatas = MetaTypes.ConvertDataArray <rage__fwGrassInstanceListDef__InstanceData>(Meta, MetaName.rage__fwGrassInstanceListDef__InstanceData, batch.InstanceList);
             YmapGrassInstanceBatch gbatch = new YmapGrassInstanceBatch();
             gbatch.Ymap      = this;
             gbatch.Batch     = batch;
             gbatch.Instances = instdatas;
             gbatch.Position  = (batch.BatchAABB.min.XYZ() + batch.BatchAABB.max.XYZ()) * 0.5f;
             gbatch.Radius    = (batch.BatchAABB.max.XYZ() - gbatch.Position).Length();
             gbatch.AABBMin   = (batch.BatchAABB.min.XYZ());
             gbatch.AABBMax   = (batch.BatchAABB.max.XYZ());
             gbatches[i]      = gbatch;
         }
         GrassInstanceBatches = gbatches;
     }
     if (CMapData.instancedData.PropInstanceList.Count1 != 0)
     {
     }
 }
Esempio n. 3
0
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            int datalength = ItemCount * StructureSize;

            byte[] data = reader.ReadBytes(datalength);
            Items = MetaTypes.ConvertDataArray <T>(data, 0, ItemCount);
        }
Esempio n. 4
0
 public void SwapEnd()
 {
     VersionNumber = MetaTypes.SwapBytes(VersionNumber);
     var r = RegionDefs; r.SwapEnd(); RegionDefs = r;
     var g = Groups; g.SwapEnd(); Groups = g;
     var i = InteriorNames; i.SwapEnd(); InteriorNames = i;
 }
Esempio n. 5
0
 public void SwapEnd()
 {
     Pointer = MetaTypes.SwapBytes(Pointer);
     Count1  = MetaTypes.SwapBytes(Count1);
     Count2  = MetaTypes.SwapBytes(Count2);
     Unk1    = MetaTypes.SwapBytes(Unk1);
 }
Esempio n. 6
0
 public Array_Structure SwapEnd()
 {
     Pointer = MetaTypes.SwapBytes(Pointer);
     Count1  = MetaTypes.SwapBytes(Count1);
     Count2  = MetaTypes.SwapBytes(Count2);
     Unk1    = MetaTypes.SwapBytes(Unk1);
     return(this);
 }
Esempio n. 7
0
        private static int GetEnumInt(MetaName type, string enumString, MetaStructureEntryDataType dataType)
        {
            var infos = MetaTypes.GetEnumInfo(type);

            if (infos == null)
            {
                return(0);
            }


            bool isFlags = (dataType == MetaStructureEntryDataType.IntFlags1) ||
                           (dataType == MetaStructureEntryDataType.IntFlags2);// ||

            //(dataType == MetaStructureEntryDataType.ShortFlags);

            if (isFlags)
            {
                //flags enum. (multiple values, comma-separated)
                var split   = enumString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int enumVal = 0;

                for (int i = 0; i < split.Length; i++)
                {
                    var enumName = (MetaName)(uint)GetHash(split[i].Trim());

                    for (int j = 0; j < infos.Entries.Length; j++)
                    {
                        var entry = infos.Entries[j];
                        if (entry.EntryNameHash == enumName)
                        {
                            enumVal += (1 << entry.EntryValue);
                            break;
                        }
                    }
                }

                return(enumVal);
            }
            else
            {
                //single value enum.

                var enumName = (MetaName)(uint)GetHash(enumString);

                for (int j = 0; j < infos.Entries.Length; j++)
                {
                    var entry = infos.Entries[j];

                    if (entry.EntryNameHash == enumName)
                    {
                        return(entry.EntryValue);
                    }
                }
            }

            return(0);
        }
Esempio n. 8
0
        private void WriteBytes <T>(T val, int offset) where T : struct
        {
            var data = MetaTypes.ConvertToBytes(val);

            for (int i = 0; i < data.Length; i++)
            {
                Bytes[offset + i] = data[i];
            }
        }
Esempio n. 9
0
        public void SwapEnd()
        {
            Name = new MetaHash(MetaTypes.SwapBytes(Name.Hash));
            var b = Bounds; b.SwapEnd(); Bounds = b;
            var w = WeatherTypes; w.SwapEnd(); WeatherTypes = w;

            HoursOnOff = MetaTypes.SwapBytes(HoursOnOff);
            Flags      = MetaTypes.SwapBytes(Flags);
        }
Esempio n. 10
0
        private static void TraverseStringRaw(string str, PsoBuilder pb, PsoStructureEntryInfo entry, byte[] data)
        {
            switch (entry.Unk_5h)
            {
            default:
                break;

            case 0:
                var str0len = (int)((entry.ReferenceKey >> 16) & 0xFFFF);
                if (!string.IsNullOrEmpty(str))
                {
                    byte[] strdata = Encoding.ASCII.GetBytes(str);
                    Buffer.BlockCopy(strdata, 0, data, entry.DataOffset, strdata.Length);
                    if (strdata.Length > str0len)
                    {
                    }
                }
                break;

            case 1:
            case 2:
                if (!string.IsNullOrEmpty(str))
                {
                    var bptr = pb.AddString(str);
                    var ptr  = new PsoPOINTER(bptr.BlockID, bptr.Offset);
                    ptr.SwapEnd();
                    var val = MetaTypes.ConvertToBytes(ptr);
                    Buffer.BlockCopy(val, 0, data, entry.DataOffset, val.Length);
                }
                break;

            case 3:
                if (!string.IsNullOrEmpty(str))
                {
                    var bptr = pb.AddString(str);
                    var ptr  = new CharPointer(bptr.Pointer, str.Length);
                    ptr.SwapEnd();
                    var val = MetaTypes.ConvertToBytes(ptr);
                    Buffer.BlockCopy(val, 0, data, entry.DataOffset, val.Length);
                }
                break;

            case 7:    //hash only?
            case 8:    //hash with STRF entry?

                var hashVal = string.IsNullOrEmpty(str) ? 0 : GetHash(str);
                Write(hashVal, data, entry.DataOffset);

                if (entry.Unk_5h == 8)
                {
                    pb.AddStringToSTRF(str);
                }
                break;
            }
        }
Esempio n. 11
0
        private static Vector4[] TraverseVector3ArrayRaw(XmlNode node)
        {
            var items = new List <Vector4>();


            var split = node.InnerText.Split('\n');// Regex.Split(node.InnerText, @"[\s\r\n\t]");


            float x = 0f;
            float y = 0f;
            float z = 0f;
            float w = 0f;

            for (int i = 0; i < split.Length; i++)
            {
                var s = split[i]?.Trim();
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                var split2 = Regex.Split(s, @"[\s\t]");
                int c      = 0;
                x = 0f; y = 0f; z = 0f;
                for (int n = 0; n < split2.Length; n++)
                {
                    var ts = split2[n]?.Trim();
                    if (ts.EndsWith(","))
                    {
                        ts = ts.Substring(0, ts.Length - 1);
                    }
                    if (string.IsNullOrEmpty(ts))
                    {
                        continue;
                    }
                    var f = FloatUtil.Parse(ts);
                    switch (c)
                    {
                    case 0: x = f; break;

                    case 1: y = f; break;

                    case 2: z = f; break;
                    }
                    c++;
                }
                if (c >= 3)
                {
                    var val = new Vector4(x, y, z, w);
                    items.Add(MetaTypes.SwapBytes(val)); //big schmig
                }
            }


            return(items.ToArray());
        }
Esempio n. 12
0
        public void LoadChildren(Meta meta)
        {
            var centities = MetaTypes.ConvertDataArray <CEntityDef>(meta, MetaName.CEntityDef, _MloArchetypeDefData.entities);

            if (centities != null)
            {
                entities = new MCEntityDef[centities.Length];
                for (int i = 0; i < centities.Length; i++)
                {
                    entities[i] = new MCEntityDef(meta, ref centities[i])
                    {
                        Archetype = this
                    };
                }
            }

            var crooms = MetaTypes.ConvertDataArray <CMloRoomDef>(meta, MetaName.CMloRoomDef, _MloArchetypeDefData.rooms);

            if (crooms != null)
            {
                rooms = new MCMloRoomDef[crooms.Length];
                for (int i = 0; i < crooms.Length; i++)
                {
                    rooms[i] = new MCMloRoomDef(meta, crooms[i])
                    {
                        Archetype = this, Index = i
                    };
                }
            }

            var cportals = MetaTypes.ConvertDataArray <CMloPortalDef>(meta, MetaName.CMloPortalDef, _MloArchetypeDefData.portals);

            if (cportals != null)
            {
                portals = new MCMloPortalDef[cportals.Length];
                for (int i = 0; i < cportals.Length; i++)
                {
                    portals[i] = new MCMloPortalDef(meta, cportals[i]);
                }
            }

            var centitySets = MetaTypes.ConvertDataArray <CMloEntitySet>(meta, MetaName.CMloEntitySet, _MloArchetypeDefData.entitySets);

            if (centitySets != null)
            {
                entitySets = new MCMloEntitySet[centitySets.Length];
                for (int i = 0; i < centitySets.Length; i++)
                {
                    entitySets[i] = new MCMloEntitySet(meta, centitySets[i]);
                }
            }


            timeCycleModifiers = MetaTypes.ConvertDataArray <CMloTimeCycleModifier>(meta, MetaName.CMloTimeCycleModifier, _MloArchetypeDefData.timeCycleModifiers);
        }
Esempio n. 13
0
 public void AddStructureInfo(MetaName name)
 {
     if (!StructureInfos.ContainsKey(name))
     {
         MetaStructureInfo si = MetaTypes.GetStructureInfo(name);
         if (si != null)
         {
             StructureInfos[name] = si;
         }
     }
 }
Esempio n. 14
0
 public void AddEnumInfo(MetaName name)
 {
     if (!EnumInfos.ContainsKey(name))
     {
         MetaEnumInfo ei = MetaTypes.GetEnumInfo(name);
         if (ei != null)
         {
             EnumInfos[name] = ei;
         }
     }
 }
Esempio n. 15
0
        internal Trait(
            MetaTypes _metaType,
            ushort _structureType,

            EntityId _entityId,
            LatticeId _latticeId)
        {
            TraitType = _traitType;
            EntityId  = _entityId;
            LatticeId = _latticeId;
        }
Esempio n. 16
0
 private void EnsureDistantLODLights(Meta Meta)
 {
     if (CMapData.DistantLODLightsSOA.position.Count1 != 0)
     {
         DistantLODLights                  = new YmapDistantLODLights();
         DistantLODLights.Ymap             = this;
         DistantLODLights.CDistantLODLight = CMapData.DistantLODLightsSOA;
         DistantLODLights.colours          = MetaTypes.GetUintArray(Meta, CMapData.DistantLODLightsSOA.RGBI);
         DistantLODLights.positions        = MetaTypes.ConvertDataArray <MetaVECTOR3>(Meta, MetaName.VECTOR3, CMapData.DistantLODLightsSOA.position);
         DistantLODLights.CalcBB();
     }
 }
Esempio n. 17
0
 private void EnsureOccludeModels(Meta meta)
 {
     COccludeModels = MetaTypes.ConvertDataArray <Unk_2741784237>(Meta, (MetaName)2741784237, CMapData.occludeModels);
     if (COccludeModels != null)
     {
         OccludeModels = new YmapOccludeModel[COccludeModels.Length];
         for (int i = 0; i < COccludeModels.Length; i++)
         {
             OccludeModels[i] = new YmapOccludeModel(this, COccludeModels[i]);
         }
     }
 }
Esempio n. 18
0
        private static MetaHash[] TraverseHashArrayRaw(XmlNode node)
        {
            var items = new List <MetaHash>();

            foreach (XmlNode cnode in node.ChildNodes)
            {
                var val = GetHash(cnode.InnerText);
                items.Add(MetaTypes.SwapBytes(val));
            }

            return(items.ToArray());
        }
Esempio n. 19
0
 private void EnsureBoxOccluders(Meta meta)
 {
     CBoxOccluders = MetaTypes.ConvertDataArray <Unk_975711773>(Meta, (MetaName)975711773, CMapData.boxOccluders);
     if (CBoxOccluders != null)
     {
         BoxOccluders = new YmapBoxOccluder[CBoxOccluders.Length];
         for (int i = 0; i < CBoxOccluders.Length; i++)
         {
             BoxOccluders[i] = new YmapBoxOccluder(this, CBoxOccluders[i]);
         }
     }
 }
Esempio n. 20
0
 public static uint[] GetUintArray(PsoFile pso, Array_uint arr)
 {
     uint[] uints = GetUintArrayRaw(pso, arr);
     if (uints == null)
     {
         return(null);
     }
     for (int i = 0; i < uints.Length; i++)
     {
         uints[i] = MetaTypes.SwapBytes(uints[i]);
     }
     return(uints);
 }
Esempio n. 21
0
        /// <summary>
        /// Returns the MetaType for the specified Type.
        /// </summary>
        /// <param name="type">The Type to provide the MetaType for.</param>
        /// <returns>The constructed MetaType.</returns>
        public static MetaType GetMetaType(Type type)
        {
            Debug.Assert(!TypeUtility.IsPredefinedType(type), "Should never attempt to create a MetaType for a base type.");

            MetaType metaType = null;

            if (!MetaTypes.TryGetValue(type, out metaType))
            {
                metaType        = new MetaType(type);
                MetaTypes[type] = metaType;
            }
            return(metaType);
        }
Esempio n. 22
0
 public static float[] GetFloatArray(PsoFile pso, Array_float arr)
 {
     float[] floats = GetFloatArrayRaw(pso, arr);
     if (floats == null)
     {
         return(null);
     }
     for (int i = 0; i < floats.Length; i++)
     {
         floats[i] = MetaTypes.SwapBytes(floats[i]);
     }
     return(floats);
 }
Esempio n. 23
0
 public static ushort[] GetUShortArray(PsoFile pso, Array_Structure arr)
 {
     ushort[] ushorts = GetUShortArrayRaw(pso, arr);
     if (ushorts == null)
     {
         return(null);
     }
     for (int i = 0; i < ushorts.Length; i++)
     {
         ushorts[i] = MetaTypes.SwapBytes(ushorts[i]);
     }
     return(ushorts);
 }
Esempio n. 24
0
 private void EnsureCarGens(Meta Meta)
 {
     CCarGens = MetaTypes.ConvertDataArray <CCarGen>(Meta, MetaName.CCarGen, CMapData.carGenerators);
     if (CCarGens != null)
     {
         //string str = MetaTypes.GetTypesInitString(resentry, Meta); //to generate structinfos and enuminfos
         CarGenerators = new YmapCarGen[CCarGens.Length];
         for (int i = 0; i < CCarGens.Length; i++)
         {
             CarGenerators[i] = new YmapCarGen(this, CCarGens[i]);
         }
     }
 }
Esempio n. 25
0
 public static MetaHash[] GetHashArray(PsoFile pso, Array_uint arr)
 {
     uint[] uints = GetUintArrayRaw(pso, arr);
     if (uints == null)
     {
         return(null);
     }
     MetaHash[] hashes = new MetaHash[uints.Length];
     for (int n = 0; n < uints.Length; n++)
     {
         hashes[n].Hash = MetaTypes.SwapBytes(uints[n]);
     }
     return(hashes);
 }
Esempio n. 26
0
        public void WriteArrays(byte[] data)
        {
            foreach (KeyValuePair <int, Array_Structure> ptr in Structures)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_StructurePointer> ptr in StructurePointers)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_uint> ptr in UInts)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_ushort> ptr in UShorts)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_byte> ptr in UBytes)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_float> ptr in Floats)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_Vector3> ptr in Float_XYZs)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }

            foreach (KeyValuePair <int, Array_uint> ptr in Hashes)
            {
                var _data = MetaTypes.ConvertToBytes(ptr.Value);
                Buffer.BlockCopy(_data, 0, data, ptr.Key, _data.Length);
            }
        }
Esempio n. 27
0
        private void LoadMeta()
        {
            var vVariationInfo = MetaTypes.GetTypedData <CPedVariationInfo>(Meta, MetaName.CPedVariationInfo);

            VariationInfo = new MCPedVariationInfo();
            VariationInfo.Load(Meta, vVariationInfo);

            Strings = MetaTypes.GetStrings(Meta);
            if (Strings != null)
            {
                foreach (string str in Strings)
                {
                    JenkIndex.Ensure(str); //just shove them in there
                }
            }
        }
Esempio n. 28
0
        //public uint PadCount { get; set; }
        //public byte[] PadData { get; set; }
        //public string[] TestStrings { get; set; }


        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            Count         = MetaTypes.SwapBytes(reader.ReadUInt32()); //okay. so this is big endian
            EncryptedData = reader.ReadBytes((int)Count);
            //PadCount = (uint)((8 - (reader.Position % 8)) % 8);//maybe next block just needs to be aligned instead?
            //PadData = reader.ReadBytes((int)PadCount);


            ////none of these work :(
            //var strs = new List<string>();
            //foreach (var key in GTA5Keys.PC_NG_KEYS)
            //{
            //    var decr = GTACrypto.DecryptNG(EncryptedData, key);
            //    strs.Add(Encoding.ASCII.GetString(decr));
            //}
            //TestStrings = strs.ToArray();
        }
Esempio n. 29
0
 private void EnsureTimeCycleModifiers(Meta Meta)
 {
     CTimeCycleModifiers = MetaTypes.ConvertDataArray <CTimeCycleModifier>(Meta, MetaName.CTimeCycleModifier, CMapData.timeCycleModifiers);
     if (CTimeCycleModifiers != null)
     {
         TimeCycleModifiers = new YmapTimeCycleModifier[CTimeCycleModifiers.Length];
         for (int i = 0; i < CTimeCycleModifiers.Length; i++)
         {
             YmapTimeCycleModifier tcm = new YmapTimeCycleModifier();
             tcm.Ymap = this;
             tcm.CTimeCycleModifier = CTimeCycleModifiers[i];
             tcm.BBMin             = tcm.CTimeCycleModifier.minExtents;
             tcm.BBMax             = tcm.CTimeCycleModifier.maxExtents;
             TimeCycleModifiers[i] = tcm;
         }
     }
 }
Esempio n. 30
0
        private void LoadScenarioPointRegion(Meta meta, MetaDataBlock rootblock)
        {
            FileFormat  = YmtFileFormat.RSC;
            ContentType = YmtFileContentType.ScenarioPointRegion;

            var cdata = MetaTypes.ConvertData <CScenarioPointRegion>(rootblock.Data);

            CScenarioPointRegion     = new MCScenarioPointRegion();
            CScenarioPointRegion.Ymt = this;
            CScenarioPointRegion.Load(meta, cdata);


            ScenarioRegion = new ScenarioRegion();
            ScenarioRegion.Load(this);

            //string stypes = MetaTypes.GetTypesInitString(meta);
            //if (!string.IsNullOrEmpty(stypes))
            //{ }
        }
Esempio n. 31
0
 /// <summary>
 /// Add meta info to the PoIType.
 /// </summary>
 /// <param name="title">Display title</param>
 /// <param name="source">Source label</param>
 /// <param name="type"></param>
 /// <param name="searchable"></param>
 /// <param name="visibleInCallout"></param>
 /// <param name="section"></param>
 /// <param name="options"></param>
 /// <param name="minvalue"></param>
 /// <param name="maxvalue"></param>
 /// <param name="format"></param>
 /// <param name="editActive"></param>
 /// <param name="canEdit"></param>
 public MetaInfo AddMetaInfo(string title, string source, MetaTypes type = MetaTypes.text, bool searchable = false,
     bool visibleInCallout = true, string section = "Info", List<string> options = null, double minvalue = Double.NaN,
     double maxvalue = Double.NaN, string format = null, bool editActive = false, bool canEdit = true)
 {
     var metaInfo = MetaInfo ?? new MetaInfoCollection();
     var mi = new MetaInfo
     {
         Label = source,
         Title = title,
         Type = type,
         VisibleInCallOut = visibleInCallout,
         IsSearchable = searchable,
         Options = options,
         MinValue = minvalue,
         MaxValue = maxvalue,
         StringFormat = format,
         EditActive = editActive,
         IsEditable = canEdit
     };
     if (!String.IsNullOrEmpty(section))
         mi.Section = section;
     metaInfo.Add(mi);
     MetaInfo = metaInfo;
     return mi;
 }