Example #1
0
 public static FrontendConfig ReadConfig(Dictionary <string, string> Config, FrontendConfig FConfig)
 {
     FConfig.LoadLast      = Config.ToBool(nameof(FrontendConfig.LoadLast));
     FConfig.RootInputDir  = Config[nameof(FrontendConfig.RootInputDir)];
     FConfig.RootOutputDir = Config[nameof(FrontendConfig.RootOutputDir)];
     FConfig.WatchDir      = Config.ToBool(nameof(FrontendConfig.WatchDir));
     FConfig.Badpixel      = Config[nameof(FrontendConfig.Badpixel)];
     return(FConfig);
 }
Example #2
0
		private void MainForm_Load(object sender, EventArgs e)
		{
			LogLine("Umbrella2 NEARBY Interface");
			LogLine("Core", "Loading configuration");

			try
			{
				var ConfSet = Configurator.ReadConfigFile(ConfigFile);
				Config = Configurator.ReadConfig(ConfSet);
			}
			catch (Exception ex)
			{
				LogLine("Core", "Failed to load configuration file. Error follows:\n" + ex.ToString());
				Config = new FrontendConfig { LoadLast = false, RootInputDir = string.Empty, RootOutputDir = Path.GetTempPath(), WatchDir = false };
				LogLine("Core", "Using default configuration");
			}

			LogLine("Core", "Loaded configuration file");

			bool LoadedLast = false;
			if (Config.LoadLast)
			{
				if (TryLoadLast()) { LogLine("Core", "Found field not yet run"); LoadedLast = true; }
				else LogLine("Core", "All fields ran");
			}
			try
			{
				if (Config.WatchDir & !LoadedLast) { fileSystemWatcher1.Path = Config.RootInputDir; fileSystemWatcher1.EnableRaisingEvents = true; LogLine("Core", "Watching directory for changes"); }
			}
			catch { LogLine("Core", "Could not watch root input directory."); }
			Pipeline = new Umbrella2.Pipeline.Standard.ClassicPipeline();
			textBox3.Text = Config.RootOutputDir;
			LogLine("Core", "Loading integrated plugins");
			foreach (System.Reflection.Assembly asm in Program.GetAssemblies())
				Plugins.LoadableTypes.RegisterNewTypes(asm.GetTypes());
			LogLine("Core", "Plugins loaded");
			LogLine("Core", "Initialized");

			if (Program.Args.Length != 0)
			{
				LogLine("Automation", "Arguments specified on the command line.");
				if (Program.Args[0] == "autofield")
				{
					LogLine("Automation", "Automatically running field " + Program.Args[1]);
					textBox1.Text = Program.Args[1];
					textBox1_Validating(null, null);
					textBox2_Validating(null, null);
					button1_Click(null, null);
				}
			}
		}
Example #3
0
        public static void WriteConfig(Dictionary <string, string> Config, FrontendConfig FConfig)
        {
            if (Config.ContainsKey(nameof(FrontendConfig.LoadLast)))
            {
                Config[nameof(FrontendConfig.LoadLast)] = FConfig.LoadLast.ToString();
            }
            else
            {
                Config.Add(nameof(FrontendConfig.LoadLast), FConfig.LoadLast.ToString());
            }

            if (Config.ContainsKey(nameof(FrontendConfig.RootInputDir)))
            {
                Config[nameof(FrontendConfig.RootInputDir)] = FConfig.RootInputDir;
            }
            else
            {
                Config.Add(nameof(FrontendConfig.RootInputDir), FConfig.RootInputDir);
            }

            if (Config.ContainsKey(nameof(FrontendConfig.RootOutputDir)))
            {
                Config[nameof(FrontendConfig.RootOutputDir)] = FConfig.RootOutputDir;
            }
            else
            {
                Config.Add(nameof(FrontendConfig.RootOutputDir), FConfig.RootOutputDir);
            }

            if (Config.ContainsKey(nameof(FrontendConfig.WatchDir)))
            {
                Config[nameof(FrontendConfig.WatchDir)] = FConfig.WatchDir.ToString();
            }
            else
            {
                Config.Add(nameof(FrontendConfig.WatchDir), FConfig.WatchDir.ToString());
            }

            if (Config.ContainsKey(nameof(FrontendConfig.Badpixel)))
            {
                Config[nameof(FrontendConfig.Badpixel)] = FConfig.Badpixel.ToString();
            }
            else
            {
                Config.Add(nameof(FrontendConfig.Badpixel), FConfig.Badpixel);
            }
        }
 public PipelineConfig(FrontendConfig Configuration, Standard.ClassicPipeline Pipeline)
 {
     InitializeComponent();
     Config        = Configuration;
     this.Pipeline = Pipeline;
 }