예제 #1
0
파일: Log.cs 프로젝트: VlasovSergey/sdbger
        static Log()
        {
            BufferSize  = 1536;
            inputStream = inputStream ?? Console.OpenStandardInput();
            buffer      = new byte[BufferSize];

            Console.CancelKeyPress += new ConsoleCancelEventHandler((s, e) =>
            {
                Console.WriteLine("Are you sure to close?[y/n]");
                var a = Console.ReadLine();
                if (a != "y")
                {
                    e.Cancel = true;
                    return;
                }

                SpecflowManager.KillDrivers();
                Environment.Exit(0);
            });
        }
예제 #2
0
        public void InitDomain(string assemblyPath)
        {
//            File.Copy(Path.Combine(Path.GetDirectoryName(assemblyPath), "Log4NetConfiguration.xml"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4NetConfiguration.xml"), true);
//            File.Copy(Path.Combine(Path.GetDirectoryName(assemblyPath), "EntityFramework.dll"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "EntityFramework.dll"), true);

            var stp = new AppDomainSetup();

            stp.ConfigurationFile = assemblyPath + ".config";
            stp.ApplicationBase   = Path.GetDirectoryName(assemblyPath);

            var baseDir = AppDomain.CurrentDomain.BaseDirectory;
            var libs    = Directory.GetFiles(baseDir, "*.*").Where(s => s.EndsWith(".dll") || s.EndsWith(".exe"));

//                new[]
//            {
//                //Path.Combine(baseDir, "SDBGer.vshost.exe"),
//                Path.Combine(baseDir, "SDBGer.exe")
//            };
            foreach (string dll in libs)
            {
                File.Copy(dll, Path.Combine(stp.ApplicationBase, Path.GetFileName(dll)), true);
            }
            this.runnerDomain = AppDomain.CreateDomain("SpecflowDebugRunner", new Evidence(), stp);
            var type = typeof(SpecflowManager);

            this.logger.Trace("--initialized--");
            var value = (SpecflowManager)this.runnerDomain.CreateInstanceAndUnwrap(
                type.Assembly.FullName,
                type.FullName,
                false,
                BindingFlags.Default,
                null,
                new object[] { assemblyPath, this.logger },
                null,
                null);

            specManager = value;

            this.logger.Trace("'{0}' loaded.", assemblyPath);
        }
예제 #3
0
        private static void Main(string[] args)
        {
            // Kill chrome driver
            SpecflowManager.KillDrivers();

            r = new Runner(new DefaultLogger());

            try
            {
                ExecCommand("-Load");
            }
            catch (Exception e)
            {
                Log.Red(e);
            }

            Log.InitializeCursoreAnimation();

            while (true)
            {
                try
                {
                    Console.Write("> ");
                    Log.IsCursorBlinking = true;
                    ProcessLine(Log.ReadLine());
                }
                catch (Exception e)
                {
                    Log.Red(e);
                    if (autoClearIsEnabled)
                    {
                        ClearSteps();
                    }
                }
            }
        }