Beispiel #1
0
        public static int Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (s, e) => OnUnhandledException(e.ExceptionObject as Exception);

            CliArgs = CliArgs.Parse(args);

            using var mutex = new Mutex(initiallyOwned: true, SingletonMutexName, out var notAlreadyRunning);

            if (CliArgs.IsUpdateRestart)
            {
                try {
                    // wait for old version to exit and release the mutex.
                    mutex.WaitOne(TimeSpan.FromSeconds(5), exitContext: false);
                    UpdateInstaller.CleanupUpdate();
                } catch (Exception e) {
                    Logger.LogException("Restart failed after update", e);
                }

                // the application has exited so we are not already running.
                notAlreadyRunning = true;
            }

            if (notAlreadyRunning)   // we are the only one around :(
            {
                var cancellationTokenSource = new CancellationTokenSource();
                Task.Run(() => RunPipeServer(cancellationTokenSource.Token), cancellationTokenSource.Token);

                var exitCode = RunApp();

                cancellationTokenSource.Cancel();
                mutex.ReleaseMutex();
                return(exitCode);
            }
            else     // another instance is already running
            {
                using var client = new NamedPipeClientStream(".", PipeName, PipeDirection.Out, PipeOptions.Asynchronous);
                client.Connect(TimeSpan.FromSeconds(10).Milliseconds);

                if (CliArgs.IsProxyStart)
                {
                    using var writer = new StreamWriter(client);
                    writer.WriteLine(CliArgs.ProxyStartOption);
                    writer.Flush();
                }

                return(0);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public (FilterChain, string[], string[]) RegisterCliOptions(string[] args)
        {
            // Register Filters
            FilterBundle.RegisterCliOptions();
            _filterCount = CliArgs.GetItems().Count();

            // Register Experimental Filters
            ExperimentalBundle.RegisterCliOptions();
            _experimentalFilterCount = CliArgs.GetItems().Count() - _filterCount;

            // Parse CLI args and generate FilterSet of them
            (var filterChain, string[] nonOptionArgs) = CliArgs.ParseFilterArgs(args);

            // Extract non-option and remaining option arguments
            string[] nonFilterOptionArgs;
            (nonOptionArgs, nonFilterOptionArgs) = CliArgs.ExtractOptionArguments(nonOptionArgs);

            return(filterChain, nonOptionArgs, nonFilterOptionArgs);
        }
Beispiel #3
0
        private static async Task RunPipeServer(CancellationToken cancellationToken)
        {
            using var server = new NamedPipeServerStream(PipeName, PipeDirection.In, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);

            cancellationToken.Register(() => {
                if (server.IsConnected)
                {
                    server.Disconnect();
                }
                server.Dispose();
            });
            await server.WaitForConnectionAsync(cancellationToken);

            // we received a connection, which means another instance was started -> we bring the window to the front
            _ = Application.Current.Dispatcher.BeginInvoke(() => {
                var mainWindow = (MainWindow)Application.Current.MainWindow;
                mainWindow.Dispatcher.BeginInvoke(() => {
                    mainWindow.Deminimize();
                });
            });

            using var reader = new StreamReader(server);
            if (await reader.ReadLineAsync() is string line)
            {
                if (line == CliArgs.ProxyStartOption)
                {
                    StartWithSpotify.HandleProxiedStart();
                    if (!CliArgs.IsProxyStart)
                    {
                        CliArgs = CliArgs with {
                            IsProxyStart = true
                        }
                    }
                    ;
                }
            }

            server.Disconnect();

            // restart server
            await RunPipeServer(cancellationToken);
        }
Beispiel #4
0
        internal MitosisFilenames ExtractFilenames(String workingDir)
        {
            String config = String.IsNullOrEmpty(Args.ConfigFile)
                ? null
                : ExtractFilename(workingDir, Args.ConfigFile);
            String initial = String.IsNullOrEmpty(Args.InitialConditionsFile)
                ? null
                : ExtractFilename(workingDir, Args.InitialConditionsFile);
            String poles = String.IsNullOrEmpty(Args.PoleCoordsFile)
                ? null
                : ExtractFilename(workingDir, Args.PoleCoordsFile);

            String[] cells = null;
            if (!String.IsNullOrEmpty(Args.CellFile) && Args.CellCount >= 1)
            {
                cells = CliArgs.MultiplyCells(Args.CellFile, Args.CellCount);
                for (int i = 0; i < cells.Length; i++)
                {
                    cells[i] = ExtractFilename(workingDir, cells[i]);
                }
            }

            return(new MitosisFilenames(config, initial, poles, cells));
        }
Beispiel #5
0
        public static void RegisterCliOptions()
        {
            if (GetInstance()._isRegistered)
            {
                return;
            }

            CliArgs.Register(new List <string> {
                "-leS", "--levels-hsv-saturation"
            }, LevelsHsvSaturation, 5,
                             desc:
                             "Adjusts levels of HSV saturation. Takes five parameters: input black (0..1), input white (0..1), gamma (0.01..9.99), output black (0..1), output white (0..1)");

            CliArgs.Register(new List <string> {
                "-ipc"
            },
                             InvertPerceivedLightnessWithCorrection, 0, 1,
                             paramList: "[=<corr>]",
                             desc: "Inverts perceived brightness with correction parameter.",
                             paramDesc:
                             "<corr> is value between 0..1, 0 is safest conversion, 1 is closest to truth but also causes clipping of some colors.");

            CliArgs.Register(new List <string> {
                "-ilv"
            }, InvertMixedLightnessAndValue, 0, 1,
                             paramList: "=<mix>",
                             desc: "Inverts colors using both lightness and value, by mixing the result by parameter (0..1)",
                             paramDesc: "<mix> is mix parameter 0..1, 0 is full lightness inversion, 1 is full value inversion.");

            CliArgs.Register(new List <string> {
                "-ipm"
            },
                             InvertMixedPerceivedLightnessAndValue, 0, 1,
                             paramList: "=<mix>",
                             desc: "Inverts colors using both lightness and value, by mixing the result by parameter (0..1)",
                             paramDesc: "<mix> is mix parameter 0..1, 0 is full lightness inversion, 1 is full value inversion.");

            CliArgs.Register(new List <string> {
                "-b2l", "--brightness-to-lightness"
            }, BrightnessToLightness, 0, 0,
                             desc: "Translates perceived brightness to lightness."
                             );

            CliArgs.Register(new List <string> {
                "-b2v", "--brightness-to-value"
            }, BrightnessToValue, 0, 0,
                             desc: "Translates perceived brightness to value."
                             );

            CliArgs.Register(new List <string> {
                "-cS", "--contrast-hsv-sat"
            }, ContrastHsvSaturation, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to HSV saturation.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");


            CliArgs.Register(new List <string> {
                "-gaS", "--gamma-hsv-sat"
            }, GammaHsvSaturation, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of HSV saturation.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");


            CliArgs.Register(new List <string> {
                "-S", "--hsv-saturation"
            }, GainHsvSaturation, 1,
                             paramList: "=<value>",
                             desc: "HSV saturation gain.",
                             paramDesc: "<value> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "--tolight"
            }, ToLight, 0, 0,
                             desc: "A preset with multiple filters to convert dark scheme to light");

            CliArgs.Register(new List <string> {
                "-ipv", "--invert-per-value"
            }, InvertPerceivedValue, 0, 0,
                             desc: "Inverts perceived brightness.");

            // CliArgs.Register(new List<string> {"--bypass"}, ByBass, 0);

            GetInstance()._isRegistered = true;
        }
        public static void PrintHelp(int filterCount = -1, int expFilterCount = -1, bool verbose = true)
        {
            string usage =
                "\nUsage:\n"
                + "  colschman [-filter] <sourcefile> [<targetfile>]\n"
                + "  colschman [-filter][=param1][,param2][,param3] <sourcefile> [<targetfile>]\n"
                + "  colschman [-filter1] [--filter2] <sourcefile> [<targetfile>]\n"
                + "  colschman [-filter][(rangeattr1:min-max,rangeattr2:min-max)[=param] <sourcefile> [<targetfile>]\n"
                + "  colschman [-filter][(rangeattr:min/slope-max/slope)[=param] <sourcefile> [<targetfile>]\n"
                + "  colschman [-filter][(rangeattr:minstart,minend,maxstart,maxend)[=param] <sourcefile> [<targetfile>]\n";

            if (!verbose)
            {
                usage += "\nMore detailed help:\n  colschman --help\n";
            }

            Console.WriteLine(usage);

            Console.WriteLine("Available Filters:");
            if (verbose)
            {
                Console.WriteLine();
            }
            if (filterCount == -1 || expFilterCount == -1)
            {
                // all filters
                foreach (var cliArg in CliArgs.GetItems())
                {
                    Console.WriteLine(cliArg.GetDescription(verbose));
                    if (verbose)
                    {
                        Console.WriteLine();
                    }
                }

                return;
            }

            // non experimental filters
            for (int i = 0; i < filterCount; i++)
            {
                Console.WriteLine(CliArgs.GetItem(i).GetDescription(verbose));
                if (verbose && i < filterCount - 1)
                {
                    Console.WriteLine();
                }
            }

            // experimental filters
            if (expFilterCount > 0)
            {
                Console.WriteLine("Experimental Filters:");
                if (verbose)
                {
                    Console.WriteLine();
                }
                for (int i = filterCount; i < filterCount + expFilterCount; i++)
                {
                    Console.WriteLine(CliArgs.GetItem(i).GetDescription(verbose));
                    if (verbose && i < filterCount + expFilterCount - 1)
                    {
                        Console.WriteLine();
                    }
                    ;
                }
            }

            if (!verbose)
            {
                Console.WriteLine();
            }
            ;

            const int col1 = -13;
            const int col2 = -14;

            string help_tail = "Range attributes:\n"
                               + $"  {"h, hue",col1} {"Hue",col2}|  {"r, red",col1} {"Red",col2}\n"
                               + $"  {"s, sat",col1} {"Saturation",col2}|  {"g, green",col1} {"Green",col2}\n"
                               + $"  {"l, light",col1} {"Lightness",col2}|  {"b, blue",col1} {"Blue",col2}\n"
                               + $"  {"v, value",col1} {"Value",col2}|  {"bri, bright",col1} {"Brightness",col2}\n\n"
                               + "Example:\n"
                               + "  colschman -al=0.1,0.9 -s(hue:40/10-180/10)=1.2 my_scheme.icls fixed_scheme.icls\n\n";

            Console.Write(help_tail);
        }
Beispiel #7
0
        internal String Apply(String workingDir)
        {
            if (Args == null)
            {
                throw new ApplicationException("Cannot launch simulation without CLI arguments");
            }

            CliArgs defaultArgs    = new CliArgs();
            String  oldCellFile    = Args.CellFile;
            bool    needCellFile   = Args.Mode != LaunchMode.Help && Args.Mode != LaunchMode.Info;
            String  oldConfig      = Args.ConfigFile;
            bool    needConfig     = Args.Mode == LaunchMode.New || Args.Mode == LaunchMode.Continue || Args.Mode == LaunchMode.Restart;
            String  oldInitialFile = Args.InitialConditionsFile;
            String  oldPoleFile    = Args.PoleCoordsFile;

            try
            {
                //Settings file for results.
                if (needCellFile || Args.CellFile != defaultArgs.CellFile)
                {
                    Args.CellFile = ExtractFilename(workingDir, oldCellFile);
                }
                if (Args.Mode == LaunchMode.Fix)
                {
                    return(Args.Export());
                }

                //Storing config.
                if (needConfig || Args.ConfigFile != defaultArgs.ConfigFile)
                {
                    if (Config == null)
                    {
                        throw new ApplicationException("Cannot launch simulation without config");
                    }
                    if (String.IsNullOrEmpty(Args.ConfigFile))
                    {
                        Args.ConfigFile = "mitosis.conf";
                    }
                    Args.ConfigFile = ExtractFilename(workingDir, oldConfig);
                    File.WriteAllText(Args.ConfigFile, Config.ExportAsProps());
                }

                //Storing initial states.
                if (InitialStates != null)
                {
                    if (String.IsNullOrEmpty(Args.InitialConditionsFile))
                    {
                        Args.InitialConditionsFile = "initial.xml";
                    }
                    Args.InitialConditionsFile = ExtractFilename(workingDir, Args.InitialConditionsFile);
                    File.WriteAllText(Args.InitialConditionsFile, InitialStates.ToString());
                }

                //Storing information about poles.
                if (PoleCoords != null)
                {
                    if (String.IsNullOrEmpty(Args.PoleCoordsFile))
                    {
                        Args.PoleCoordsFile = "poles.xml";
                    }
                    Args.PoleCoordsFile = ExtractFilename(workingDir, Args.PoleCoordsFile);
                    File.WriteAllText(Args.PoleCoordsFile, PoleCoords.ToString());
                }

                //Done, exporting.
                return(Args.Export());
            }
            finally
            {
                Args.CellFile              = oldCellFile;
                Args.ConfigFile            = oldConfig;
                Args.InitialConditionsFile = oldInitialFile;
                Args.PoleCoordsFile        = oldPoleFile;
            }
        }
Beispiel #8
0
        public static void RegisterCliOptions()
        {
            if (GetInstance()._isRegistered)
            {
                return;
            }

            CliArgs.Register(new CliArgBuilder()
                             .Filter(ShiftHslHue)
                             .AddOptions("-h", "--hue")
                             .Params(1)
                             .ParamString("=<offset>")
                             .Description("Hue shift.")
                             .ParamDescription("<offset> is hue offset in range of -360..360 (0)")
                             );

            CliArgs.Register(new List <string> {
                "-s", "--saturation"
            }, GainHslSaturation, 1,
                             paramList: "=<gain>",
                             desc: "Saturation gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-g", "--gain"
            }, GainRgb, 1,
                             paramList: "=<gain>",
                             desc: "RGB gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-l", "--lightness"
            }, GainLightness, 1,
                             paramList: "=<gain>",
                             desc: "Lightness gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-v", "--value"
            }, GainValue, 1,
                             paramList: "=<gain>",
                             desc: "Value gain.",
                             paramDesc: "<gain> is multiplier in range of 0..10 (1.0)");

            CliArgs.Register(new List <string> {
                "-c", "--contrast"
            }, ContrastRgb, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc: "Adjusts contrast by S-spline curve.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0.0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cl", "--contrast-lightness"
            }, ContrastLightness, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to lightness.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cv", "--contrast-value"
            }, ContrastValue, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to value.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-cs", "--contrast-saturation"
            }, ContrastHslSaturation, 1, 2,
                             paramList: "=<contrast>[,<ip>]",
                             desc:
                             "Applies contrast curve to saturation.",
                             paramDesc:
                             "<contrast> is curvature strength in range of -1..1 (0), <ip> is inflection point in range of 0..1 (0.5)");

            CliArgs.Register(new List <string> {
                "-ga", "--gamma"
            }, GammaRgb, 1, 1,
                             paramList: "=<gamma>",
                             desc: "Gamma correction for all RGB channels equally.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gar", "--gamma-red"
            }, GammaRed, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of red channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gag", "--gamma-green"
            }, GammaGreen, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of green channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gab", "--gamma-blue"
            }, GammaBlue, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of blue channel.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gal", "--gamma-lightness"
            }, GammaLightness, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of lightness.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gav", "--gamma-value"
            }, GammaValue, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of value.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-gas", "--gamma-saturation"
            }, GammaHslSaturation, 1,
                             paramList: "=<gamma>",
                             desc: "Adjusts gamma of saturation.",
                             paramDesc: "<gamma> is value in range of 0.01..9.99 (1.0)");

            CliArgs.Register(new List <string> {
                "-le", "--levels"
            }, LevelsRgb, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of all RGB channels.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-ler", "--levels-red"
            }, LevelsRed, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-leg", "--levels-green"
            }, LevelsGreen, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-leb", "--levels-blue"
            }, LevelsBlue, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of red channel.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-al", "--auto-levels"
            }, AutoLevelsRgb, 0, 3,
                             paramList: "=<min>,<max>,<g>",
                             desc:
                             "Auto levels RGB channels by normalizing them by HSV values to full scale between given minimum and maximum.",
                             paramDesc: "<min> is output min 0..1 (0), <max> is output max 0..1 (1), <g> is gamma 0.01..9.99 (1)");

            CliArgs.Register(new List <string> {
                "-all", "--auto-levels-lightness"
            }, AutoLevelsLightness, 0, 3,
                             paramList: "=<min>,<max>,<g>",
                             desc:
                             "Auto levels lightness by normalizing values to full scale between given minimum and maximum.",
                             paramDesc: "<min> is output min 0..1 (0), <max> is output max 0..1 (1), <g> is gamma 0.01..9.99 (1)");

            CliArgs.Register(new List <string> {
                "-lel", "--levels-lightness"
            }, LevelsLightness, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of lightness.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-lev", "--levels-value"
            }, LevelsValue, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc:
                             "Adjusts levels of value.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white 0..1 (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-les", "--levels-saturation"
            }, LevelsHslSaturation, 5, 5,
                             paramList: "=<ib>,<iw>,<g>,<ob>,<ow>",
                             desc: "Adjusts levels of saturation.",
                             paramDesc:
                             "<ib> is input black 0..1 (0), <iw> is input white (1), <g> is gamma 0.01..9.99 (1), <ob> is output black 0..1 (0), <ow> is output white 0..1 (1)");

            CliArgs.Register(new List <string> {
                "-i", "--invert-rgb"
            }, InvertRgb, 0, 0,
                             desc: "Inverts RGB channels.");

            CliArgs.Register(new List <string> {
                "-il", "--invert-lightness"
            }, InvertLightness, 0, 0,
                             desc: "Inverts lightness.");

            CliArgs.Register(new List <string> {
                "-iv", "--invert-value"
            }, InvertValue, 0, 0,
                             desc: "Inverts value.");

            CliArgs.Register(new List <string> {
                "-ipl", "--invert-per-lightness"
            }, InvertPerceivedLightness, 0, 0,
                             desc: "Inverts perceived lightness.");

            CliArgs.Register(new List <string> {
                "-gsb", "--grayscale-brightness"
            }, BrightnessToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on perceived brightness.");

            CliArgs.Register(new List <string> {
                "-gsl", "--grayscale-ligthness"
            }, LightnessToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on lightness.");

            CliArgs.Register(new List <string> {
                "-gsv", "--grayscale-value"
            }, ValueToGrayScale, 0, 0,
                             desc: "Converts to gray scale based on HSV value.");

            CliArgs.Register(new List <string> {
                "--min-lightness"
            }, MinLightness, 1, 1,
                             paramList: "=<min>",
                             desc: "Limits lower end of lightness.",
                             paramDesc: "<min> minimum lightness"
                             );

            CliArgs.Register(new List <string> {
                "--max-lightness"
            }, MaxLightness, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of lightness.",
                             paramDesc: "<max> max lightness"
                             );

            CliArgs.Register(new List <string> {
                "--min-value"
            }, MinValue, 1, 1,
                             paramList: "=<min>",
                             desc: "Limits lower end of HSV value.",
                             paramDesc: "<min> minimum lightness"
                             );

            CliArgs.Register(new List <string> {
                "--max-value"
            }, MaxValue, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of value.",
                             paramDesc: "<max> max HSV value"
                             );

            CliArgs.Register(new List <string> {
                "--max-saturation"
            }, MaxHslSaturation, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of saturation.",
                             paramDesc: "<max> max saturation"
                             );

            CliArgs.Register(new List <string> {
                "--max-saturation-hsv"
            }, MaxHsvSaturation, 1, 1,
                             paramList: "=<max>",
                             desc: "Limits higher end of HSV saturation.",
                             paramDesc: "<max> max saturation"
                             );

            CliArgs.Register(new List <string> {
                "--clamp"
            }, Clamp, 0, 0,
                             desc:
                             "Clamps color values to normal range of 0..1. Tries to preserve hue. This is automatically applied as last filter.");

            GetInstance()._isRegistered = true;
        }