예제 #1
0
        public static IntField loadEntry(FStruct _struct, string name, List <string> fparams)
        {
            int      width = Int32.Parse(fparams[1].Trim());
            IntField f     = new IntField(_struct, name, width);

            return(f);
        }
예제 #2
0
파일: Format.cs 프로젝트: kohoutech/Gander
        public static FField loadField(FStruct fs, String fname, List <String> parms)
        {
            FField f = null;

            //check for loaded struct
            FEntry ftype = fs.format.structs.getEntry(parms[0].ToLower());

            if (ftype != null)
            {
                f = new StructField(fs, fname, (FStruct)ftype);
            }

            //else is a predefined struct
            else
            {
                switch (parms[0])
                {
                case "int":
                    f = IntField.loadEntry(fs, fname, parms);
                    break;

                case "fixedstr":
                    f = FixedString.loadEntry(fs, fname, parms);
                    break;

                case "fixedbuf":
                    f = FixedBuffer.loadEntry(fs, fname, parms);
                    break;

                case "varbuf":
                    f = VariableBuffer.loadEntry(fs, fname, parms);
                    break;

                case "vartable":
                    f = VariableTable.loadEntry(fs, fname, parms);
                    break;

                case "sizebuftable":
                    f = SizeBufferTable.loadEntry(fs, fname, parms);
                    break;

                default:
                    break;
                }
            }

            return(f);
        }