BFSchema.CodeGenerators.CSharp.CSharpGenerator.ReadType C# (CSharp) Method

ReadType() public method

public ReadType ( IBfsType type ) : string
type IBfsType
return string
        public string ReadType(IBfsType type)
        {
            //if(type.ArrayExtension != null)

            if (type is BfsNamedType)
            {
                BfsNamedType namedType = type as BfsNamedType;
                return namedType.DataBlock.Name + ".Read(file)";
            }
            if (type is BfsPrimitiveType)
            {
                BfsPrimitiveType primitiveType = type as BfsPrimitiveType;
                return "file.Read" + primitiveType.PrimitiveType.ToString() + "()";
            }
            if (type is BfsFunctionType)
            {
                BfsFunctionType functionType = type as BfsFunctionType;
                if (functionType.FunctionName == "ascii")
                {
                    //CSharpPredefinedFunctions.AddReadAsciiStringMethod(rootParser);
                    return "file.ReadASCIIString(\"" + functionType.FunctionArgument + "\")";
                }
                else return "throw new NotImplementedException()";
            }

            return "null";
        }