コード例 #1
0
        public void Execute(List <string> args)
        {
            if (args.Count == 0)
            {
                Console.WriteLine(Description);
                return;
            }

            var envName = args[0];

            try
            {
                var stream = new EnvStream(Settings.ApplicationWorkDirectoryPath, envName);
                var env    = stream.LoadEnv();
                if (env.Files.Count == 0)
                {
                    Console.WriteLine("No files in this env.");
                }
                else
                {
                    foreach (var file in env.Files)
                    {
                        Console.WriteLine($" - {file.OrdinaryFilePath}");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
        public void Test2()
        {
            var envName = "Hello";

            Directory.CreateDirectory("Managed");
            var stream = new EnvStream("Managed", envName);

            stream.WriteEnv(EnvManager.Generate(envName));
        }
コード例 #3
0
        public void Test3()
        {
            var envName = "Hello";

            Directory.CreateDirectory("Managed");
            var stream = new EnvStream("Managed", envName);

            var env = EnvManager.Generate(envName);

            stream.WriteEnv(env);

            var env_loaded = stream.LoadEnv();

            Assert.Equal(env.Name, env_loaded.Name);
            Assert.True(env.Enabled == env_loaded.Enabled);
            Assert.Equal(env.Files, env_loaded.Files);
        }
コード例 #4
0
        public void Execute(List <string> args)
        {
            var envNames = Settings.EnvNames;

            if (envNames.Count == 0)
            {
                Console.WriteLine("No envs which are found.");
            }
            else
            {
                foreach (var envName in envNames)
                {
                    var stream = new EnvStream(Settings.ApplicationWorkDirectoryPath, envName);
                    var env    = stream.LoadEnv();
                    Console.WriteLine($" - Name: {env.Name} Active: {(env.Enabled ? "True" : "False")}");
                }
            }
        }
コード例 #5
0
ファイル: Add.cmd.cs プロジェクト: capra314cabra/ParallelEnvs
        public void Execute(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine(Description);
                return;
            }

            var stream = new EnvStream(Settings.ApplicationWorkDirectoryPath, args[0]);

            var env = stream.LoadEnv();

            {
                EnvManager.AddFile(ref env, args[1], Settings);
            }
            stream.WriteEnv(env);

            Console.WriteLine($"Add {args[1]} to {args[0]}");
        }
コード例 #6
0
        public void Execute(List <string> args)
        {
            if (args.Count == 0)
            {
                Console.WriteLine(Description);
                return;
            }

            var envName = args[0];
            var env     = EnvManager.Generate(envName);

            Settings.EnvNames.Add(env.Name);
            Settings.SaveToFile();

            var stream = new EnvStream(Settings.ApplicationWorkDirectoryPath, env.Name);

            stream.WriteEnv(env);

            Console.WriteLine("Created");
        }