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); } }
public void Test2() { var envName = "Hello"; Directory.CreateDirectory("Managed"); var stream = new EnvStream("Managed", envName); stream.WriteEnv(EnvManager.Generate(envName)); }
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); }
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")}"); } } }
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]}"); }
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"); }