示例#1
0
            void _SysTablesXML(System.IO.Stream output)
            {
                string xml;

                using (GlobalCriticalSection.GetLock())
                {
                    xml = LoadSysTablesXml_unlocked();
                }

                int ColLineLength = 1 + (200 * 2);

                foreach (string _line in xml.Split('\n'))
                {
                    string    line = _line.Trim('\n', '\r');
                    recordset rs   = recordset.Prepare();
                    rs.PutByte(0); // Nullable byte.
                    rs.PutString(line);
                    {
                        ByteSlice bs = rs.ToByteSlice();
                        if (bs.Length > ColLineLength)
                        {
                            throw new Exception("Column Line: length is too long: " + line);
                        }
                        for (int ibs = 0; ibs < bs.Length; ibs++)
                        {
                            output.WriteByte(bs[ibs]);
                        }
                        for (int ibs = bs.Length; ibs < DSpace_OutputRecordLength; ibs++)
                        {
                            output.WriteByte(0);
                        }
                    }
                }
            }
示例#2
0
            void _SysHelp(System.IO.Stream output)
            {
                string xml = LoadUsageXml();

                const int ColLineChars  = 1000;
                int       ColLineLength = 1 + (ColLineChars * 2);

                foreach (string _linex in xml.Split('\n'))
                {
                    string linex = _linex.Trim();
                    while (linex.Length > 0)
                    {
                        string line;
                        if (linex.Length > ColLineChars - 1)
                        {
                            line  = linex.Substring(0, ColLineChars - 1);
                            linex = linex.Substring(ColLineChars - 1);
                        }
                        else
                        {
                            line  = linex;
                            linex = "";
                        }
                        recordset rs = recordset.Prepare();
                        rs.PutByte(0); // Nullable byte.
                        rs.PutString(line);
                        {
                            ByteSlice bs = rs.ToByteSlice();
                            if (bs.Length > ColLineLength)
                            {
                                //DSpace_Log("bs.Length = " + bs.Length.ToString());
                                //DSpace_Log("ColLineLength = " + ColLineLength.ToString());
                                throw new Exception("Column Line: length is too long: " + line);
                            }
                            for (int ibs = 0; ibs < bs.Length; ibs++)
                            {
                                output.WriteByte(bs[ibs]);
                            }
                            for (int ibs = bs.Length; ibs < DSpace_OutputRecordLength; ibs++)
                            {
                                output.WriteByte(0);
                            }
                        }
                    }
                }
            }
示例#3
0
            void _SysIndexes(System.IO.Stream output)
            {
                const int ColLineChars  = 1000;
                int       ColLineLength = 1 + (ColLineChars * 2);

                int ip = TableName.IndexOf('(');

                if (-1 == ip || TableName[TableName.Length - 1] != ')')
                {
                    return;
                }
                string indexdir = QlArgsUnescape(TableName.Substring(ip + 1, TableName.Length - ip - 1 - 1));

                System.IO.DirectoryInfo dir   = new System.IO.DirectoryInfo(indexdir);
                System.IO.FileInfo[]    files = dir.GetFiles("ind.Index.*.ind");
                foreach (System.IO.FileInfo file in files)
                {
                    string[] parts     = file.Name.Split('.');
                    string   indexname = parts[2];

                    recordset rs = recordset.Prepare();
                    rs.PutByte(0); // Nullable byte.
                    rs.PutString(indexname);
                    {
                        ByteSlice bs = rs.ToByteSlice();
                        if (bs.Length > ColLineLength)
                        {
                            throw new Exception("Column Line: length is too long: " + indexname);
                        }
                        for (int ibs = 0; ibs < bs.Length; ibs++)
                        {
                            output.WriteByte(bs[ibs]);
                        }
                        for (int ibs = bs.Length; ibs < DSpace_OutputRecordLength; ibs++)
                        {
                            output.WriteByte(0);
                        }
                    }
                }
            }
示例#4
0
            void _SysTables(System.IO.Stream output)
            {
                System.Xml.XmlDocument systables;
                using (GlobalCriticalSection.GetLock())
                {
                    systables = LoadSysTables_unlocked();
                }

                foreach (System.Xml.XmlNode xn in systables.SelectNodes("/tables/table"))
                {
                    recordset rs = recordset.Prepare();

                    int    ColTableLength = 1 + (100 * 2);
                    string Table          = xn["name"].InnerText;
                    rs.PutByte(0); // Nullable byte.
                    rs.PutString(Table);
                    {
                        ByteSlice bs = rs.ToByteSlice();
                        if (bs.Length > ColTableLength)
                        {
                            throw new Exception("Column Table: length is too long: " + Table);
                        }
                        for (int ibs = bs.Length; ibs < ColTableLength; ibs++)
                        {
                            rs.PutByte(0);
                        }
                    }

                    int    ColFileLength = 1 + (120 * 2);
                    string File          = xn["file"].InnerText;
                    rs.PutByte(0); // Nullable byte.
                    rs.PutString(File);
                    {
                        ByteSlice bs = rs.ToByteSlice();
                        if (bs.Length > ColTableLength + ColFileLength)
                        {
                            throw new Exception("Column File: length is too long: " + File);
                        }
                        for (int ibs = bs.Length; ibs < ColTableLength + ColFileLength; ibs++)
                        {
                            rs.PutByte(0);
                        }
                    }

                    {
                        ByteSlice bs = rs.ToByteSlice();
                        if (bs.Length > DSpace_OutputRecordLength)
                        {
                            throw new Exception("Record too long");
                        }
                        for (int ibs = 0; ibs < bs.Length; ibs++)
                        {
                            output.WriteByte(bs[ibs]);
                        }
                        for (int ibs = bs.Length; ibs < DSpace_OutputRecordLength; ibs++)
                        {
                            output.WriteByte(0);
                        }
                    }
                }
            }