Ejemplo n.º 1
0
        /// <summary>This runs the CheckIndex tool on the index in.  If any
        /// issues are hit, a RuntimeException is thrown; else,
        /// true is returned.
        /// </summary>
        public static bool CheckIndex(Directory dir)
        {
            System.IO.MemoryStream bos = new System.IO.MemoryStream(1024);

            CheckIndex checker = new CheckIndex(dir);

            checker.SetInfoStream(new System.IO.StreamWriter(bos));
            CheckIndex.Status indexStatus = checker.CheckIndex_Renamed_Method(null);
            if (indexStatus == null || indexStatus.clean == false)
            {
                System.Console.Out.WriteLine("CheckIndex failed");
                using (var reader = new StreamReader(bos))
                {
                    System.Console.Out.WriteLine(reader.ReadToEnd());
                    throw new System.SystemException("CheckIndex failed");
                }
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>This runs the CheckIndex tool on the index in.  If any
        /// issues are hit, a RuntimeException is thrown; else,
        /// true is returned.
        /// </summary>
        public static bool CheckIndex(Directory dir)
        {
            System.IO.MemoryStream bos = new System.IO.MemoryStream(1024);

            CheckIndex checker = new CheckIndex(dir);

            checker.SetInfoStream(new System.IO.StreamWriter(bos));
            CheckIndex.Status indexStatus = checker.CheckIndex_Renamed_Method();
            if (indexStatus == null || indexStatus.clean == false)
            {
                System.Console.Out.WriteLine("CheckIndex failed");
                char[] tmpChar;
                byte[] tmpByte;
                tmpByte = bos.GetBuffer();
                tmpChar = new char[bos.Length];
                System.Array.Copy(tmpByte, 0, tmpChar, 0, tmpChar.Length);
                System.Console.Out.WriteLine(new System.String(tmpChar));
                throw new System.SystemException("CheckIndex failed");
            }
            else
            {
                return(true);
            }
        }