Beispiel #1
0
        private void ConfigureForDebugging()
        {
            // Find the root "src" dir.
            string initPath;

            if (!string.IsNullOrEmpty(runtimeSetup.RuntimePath))
            {
                initPath = runtimeSetup.RuntimePath;
            }
            else if (!string.IsNullOrEmpty(runtimeSetup.ConfigurationFilePath))
            {
                initPath = runtimeSetup.ConfigurationFilePath;
            }
            else
            {
                initPath = AssemblyUtils.GetAssemblyDirectory(Assembly.GetExecutingAssembly());
            }

            string srcDir = initPath;

            while (srcDir != null && Path.GetFileName(srcDir) != @"src")
            {
                srcDir = Path.GetDirectoryName(srcDir);
            }

            if (srcDir == null) // not found!
            //return;
            {
                srcDir = initPath;
            }

            // Force the runtime path to be set to where the primary Gallio assemblies and Gallio.Host.exe
            // are located.
            string runtimePath = Path.Combine(srcDir, @"Gallio\Gallio\bin");

            if (!Directory.Exists(runtimePath))
            {
                runtimePath = srcDir;
            }
            runtimeSetup.RuntimePath = runtimePath;

            // Add the solution folder to the list of plugin directories so that we can resolve
            // all plugins that have been compiled within the solution.
            AddPluginDirectory(srcDir);

            //[BSE 07.08.20] extra "plugins" folder?
            foreach (string extraPluginFolder in Directory.GetDirectories(srcDir, "plugins", SearchOption.AllDirectories))
            {
                AddPluginDirectory(extraPluginFolder);
                foreach (string extraPluginSubFolder in Directory.GetDirectories(extraPluginFolder))
                {
                    AddPluginDirectory(extraPluginSubFolder);
                }
            }

            // Remember we are in debug mode.
            debugMode = true;
        }
        public static void InitializeLogging(bool turnOnConsoleLogger = false)
        {
#if (DEBUG)
            //log4net.Util.LogLog.InternalDebugging = true;
#endif

            var path = AssemblyUtils.GetAssemblyDirectory();
            var log4NetConfigPath = Path.Combine(path, "log4net.Config");
            XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(log4NetConfigPath));

            Log.Info("Logging Initialized");

            if (turnOnConsoleLogger)
            {
                var consoleAppender = new ColoredConsoleAppender
                {
                    Layout = new PatternLayout()
                };
                consoleAppender.ActivateOptions();
                BasicConfigurator.Configure(consoleAppender);
            }
        }