예제 #1
0
        public void SetFormat(string fieldName, Type fieldType, string format, int width)
        {
            if (!string.IsNullOrWhiteSpace(fieldName))
            {
                if (!string.IsNullOrWhiteSpace(format))
                {
                    if (!FormatFields.ContainsKey(fieldName))
                    {
                        FormatFields.Add(fieldName, format);
                    }
                }

                if (fieldType != null)
                {
                    if (!TypeFields.ContainsKey(fieldName))
                    {
                        TypeFields.Add(fieldName, fieldType);
                    }
                }

                if (width > 0)
                {
                    if (!SizeFields.ContainsKey(fieldName))
                    {
                        SizeFields.Add(fieldName, width);
                    }
                }
            }
        }
예제 #2
0
        public IFieldBuilder DefineField(string name, IType fieldType, FieldAttributes attributes)
        {
            var builder = new AsmFieldBuilder(this, fieldType, attributes, name);

            TypeFields.Add(builder);
            return(builder);
        }
예제 #3
0
            private void ReadEmbedded(UnityBinaryReader reader, int version, int typeVersion)
            {
                int fieldCount        = reader.ReadInt32();
                int stringTableLength = reader.ReadInt32();

                TypeFields.Capacity = fieldCount;
                TypeFields.Clear();

                for (int i = 0; i < fieldCount; i++)
                {
                    var field = new Field(reader);
                    TypeFields.Add(field);
                }

                ReadStringTable(reader, stringTableLength);
            }