Beispiel #1
0
        static void Main(string[] args)
        {
            NormalizedPath userHostPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            userHostPath = userHostPath.AppendPart("CKli");

            LogFile.RootLogPath = userHostPath.AppendPart("Logs");
            var logConfig = new GrandOutputConfiguration().AddHandler(
                new CK.Monitoring.Handlers.TextFileConfiguration()
            {
                Path = "Text"
            });

            GrandOutput.EnsureActiveDefault(logConfig);

            var monitor = new ActivityMonitor();

            monitor.Output.RegisterClient(new ColoredActivityMonitorConsoleClient());
            monitor.MinimalFilter = LogFilter.Debug;

            IBasicApplicationLifetime appLife = new FakeApplicationLifetime();

            try
            {
                using (var host = new UserHost(appLife, userHostPath))
                {
                    host.Initialize(monitor);
                    OpenKeyVault(monitor, host);
                    if (host.UserKeyVault.IsKeyVaultOpened)
                    {
                        host.Initialize(monitor);
                    }
                    DumpWorlds(host.WorldStore.ReadWorlds(monitor));
                    InteractiveRun(monitor, host);
                }
            }
            catch (Exception ex)
            {
                monitor.Fatal(ex);
                Console.ReadLine();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a <see cref="TestUniverse"/> in a given folder.
        /// </summary>
        /// <param name="path"> The path where the <see cref="TestUniverse"/> will be. The Directory will be deleted when disposed.</param>
        /// <returns></returns>
        public static TestUniverse Create(IActivityMonitor m, NormalizedPath path)
        {
            m.Info($"Creating TestUniverse from {path}.");
            NormalizedPath ckliPath = path.AppendPart(_ckliMapping);

            if (Directory.Exists(ckliPath))
            {
                ReplaceInDirectoriesPaths(
                    ckliPath: ckliPath,
                    oldString: GitWorldStore.CleanPathDirName(PlaceHolderString),
                    newString: GitWorldStore.CleanPathDirName(path)
                    );
            }
            PlaceHolderSwapEverything(m, path, PlaceHolderString, path);
            var userHost = new UserHost(new FakeApplicationLifetime(), ckliPath);
            var output   = new TestUniverse(m, path, userHost);

            userHost.Initialize(m);
            userHost.WorldStore.DeleteStackDefinition(m, "CK");
            userHost.WorldStore.DeleteStackDefinition(m, "CK-Build");
            return(output);
        }