Exemple #1
0
        public static FunctionMetadataRegistry CreateRegistry()
        {
            using (StringReader br = new StringReader(Resource1.functionMetadata))
            {
                FunctionDataBuilder fdb = new FunctionDataBuilder(400);

                try
                {
                    while (true)
                    {
                        String line = br.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (line.Length < 1 || line[0] == '#')
                        {
                            continue;
                        }
                        String TrimLine = line.Trim();
                        if (TrimLine.Length < 1)
                        {
                            continue;
                        }
                        ProcessLine(fdb, line);
                    }
                }
                catch (IOException)
                {
                    throw;
                }

                return(fdb.Build());
            }
        }
Exemple #2
0
        public static FunctionMetadataRegistry CreateRegistry()
        {
            using (StreamReader br = new StreamReader(typeof(FunctionMetadataReader).GetTypeInfo().Assembly.GetManifestResourceStream(METADATA_FILE_NAME)))
            {
                FunctionDataBuilder fdb = new FunctionDataBuilder(400);

                try
                {
                    while (true)
                    {
                        String line = br.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (line.Length < 1 || line[0] == '#')
                        {
                            continue;
                        }
                        String TrimLine = line.Trim();
                        if (TrimLine.Length < 1)
                        {
                            continue;
                        }
                        ProcessLine(fdb, line);
                    }
                }
                catch (IOException)
                {
                    throw;
                }

                return(fdb.Build());
            }
        }
Exemple #3
0
        public static FunctionMetadataRegistry CreateRegistry()
        {
            try
            {
                using (StreamReader br = new StreamReader(typeof(FunctionMetadataReader).Assembly.GetManifestResourceStream(METADATA_FILE_NAME)))
                {
                    FunctionDataBuilder fdb = new FunctionDataBuilder(400);

                    try
                    {
                        while (true)
                        {
                            String line = br.ReadLine();
                            if (line == null)
                            {
                                break;
                            }
                            if (line.Length < 1 || line[0] == '#')
                            {
                                continue;
                            }
                            String TrimLine = line.Trim();
                            if (TrimLine.Length < 1)
                            {
                                continue;
                            }
                            ProcessLine(fdb, line);
                        }
                    }
                    catch (IOException)
                    {
                        throw;
                    }

                    return(fdb.Build());
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Seems like we cannot read it, please save the file in older version of excel.", ex);
            }
        }
        private static void ProcessLine(FunctionDataBuilder fdb, String line)
        {
            Regex regex = new Regex(TAB_DELIM_PATTERN);
            String[] parts = regex.Split(line);
            if (parts.Length != 8)
            {
                throw new Exception("Bad line format '" + line + "' - expected 8 data fields");
            }
            int functionIndex = ParseInt(parts[0]);
            String functionName = parts[1];
            int minParams = ParseInt(parts[2]);
            int maxParams = ParseInt(parts[3]);
            byte returnClassCode = ParseReturnTypeCode(parts[4]);
            byte[] parameterClassCodes = ParseOperandTypeCodes(parts[5]);
            // 6 IsVolatile
            bool hasNote = parts[7].Length > 0;

            ValidateFunctionName(functionName);
            // TODO - make POI use IsVolatile
            fdb.Add(functionIndex, functionName, minParams, maxParams,
                    returnClassCode, parameterClassCodes, hasNote);
        }
        public static FunctionMetadataRegistry CreateRegistry()
        {
            using (StringReader br = new StringReader(Resource1.functionMetadata))
            {

                FunctionDataBuilder fdb = new FunctionDataBuilder(400);

                try
                {
                    while (true)
                    {
                        String line = br.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (line.Length < 1 || line[0] == '#')
                        {
                            continue;
                        }
                        String TrimLine = line.Trim();
                        if (TrimLine.Length < 1)
                        {
                            continue;
                        }
                        ProcessLine(fdb, line);
                    }
                }
                catch (IOException)
                {
                    throw;
                }

                return fdb.Build();
            }
        }
        public static FunctionMetadataRegistry CreateRegistry()
        {
            using (StreamReader br = new StreamReader (typeof (FunctionMetadataReader).Assembly.GetManifestResourceStream (METADATA_FILE_NAME)))
            {

                FunctionDataBuilder fdb = new FunctionDataBuilder(400);

                try
                {
                    while (true)
                    {
                        String line = br.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (line.Length < 1 || line[0] == '#')
                        {
                            continue;
                        }
                        String TrimLine = line.Trim();
                        if (TrimLine.Length < 1)
                        {
                            continue;
                        }
                        ProcessLine(fdb, line);
                    }
                }
                catch (IOException)
                {
                    throw;
                }

                return fdb.Build();
            }
        }
        private static void ProcessLine(FunctionDataBuilder fdb, String line)
        {

            Regex regex = new Regex(TAB_DELIM_PATTERN);
            String[] parts = regex.Split(line);
            if (parts.Length != 8)
            {
                throw new Exception("Bad line format '" + line + "' - expected 8 data fields");
            }
            int functionIndex = ParseInt(parts[0]);
            String functionName = parts[1];
            int minParams = ParseInt(parts[2]);
            int maxParams = ParseInt(parts[3]);
            byte returnClassCode = ParseReturnTypeCode(parts[4]);
            byte[] parameterClassCodes = ParseOperandTypeCodes(parts[5]);
            // 6 IsVolatile
            bool hasNote = parts[7].Length > 0;

            ValidateFunctionName(functionName);
            // TODO - make POI use IsVolatile
            fdb.Add(functionIndex, functionName, minParams, maxParams,
                    returnClassCode, parameterClassCodes, hasNote);
        }