コード例 #1
0
ファイル: Main.cs プロジェクト: flberger/CodeWatchdog
        /// <summary>
        /// Instantiate a CSharpWatchdog, and use it to check a single file provided on the command line.
        /// </summary>
        public static void Main(string[] args)
        {
            CamelCaseCSharpWatchdog.CamelCaseCSharpWatchdog cswd = new CamelCaseCSharpWatchdog.CamelCaseCSharpWatchdog();

            cswd.Init();

            cswd.woff += PrintError;

            if (args.Length == 0)
            {
                Logging.Error("Please supply file names to check on the command line.");

                return;
            }

            foreach (string filePath in args)
            {
                Logging.Info("Checking file " + filePath);

                try
                {
                    cswd.Check(filePath);
                }
                catch (System.IO.FileNotFoundException e)
                {
                    // TODO: Log, and report later
                    //
                    Logging.Error(string.Format ("Cannot check '{0}' - file not found.", filePath));
                }
                catch (System.IO.DirectoryNotFoundException e)
                {
                    // TODO: Log, and report later
                    //
                    Logging.Error(string.Format ("Cannot check '{0}' - directory not found.", filePath));
                }
            }

            Console.Write(cswd.Summary());

            return;
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: flberger/CodeWatchdog
        /// <summary>
        /// Instantiate a CSharpWatchdog, and use it to check a single file provided on the command line.
        /// </summary>
        public static void Main(string[] args)
        {
            CamelCaseCSharpWatchdog.CamelCaseCSharpWatchdog cswd = new CamelCaseCSharpWatchdog.CamelCaseCSharpWatchdog();

            cswd.Init();

            cswd.woff += PrintError;

            if (args.Length == 0)
            {
                Logging.Error("Please supply file names to check on the command line.");

                return;
            }

            foreach (string filePath in args)
            {
                Logging.Info("Checking file " + filePath);

                try
                {
                    cswd.Check(filePath);
                }
                catch (System.IO.FileNotFoundException e)
                {
                    // TODO: Log, and report later
                    //
                    Logging.Error(string.Format("Cannot check '{0}' - file not found.", filePath));
                }
                catch (System.IO.DirectoryNotFoundException e)
                {
                    // TODO: Log, and report later
                    //
                    Logging.Error(string.Format("Cannot check '{0}' - directory not found.", filePath));
                }
            }

            Console.Write(cswd.Summary());

            return;
        }