public IChallengeHandler GetHandler(Challenge c, IReadOnlyDictionary<string, object> initParams)
        {
            var h = new ManualChallengeHandler();

            // Start off with the current (default) settings
            var p = h.WriteOutPath;
            var a = h.Append;
            var o = h.Overwrite;

            if (initParams?.Count > 0)
            {
                // See which ones are overridden
                if (initParams.ContainsKey(WRITE_OUT_PATH.Name))
                    p = (string) initParams[WRITE_OUT_PATH.Name];
                if (initParams.ContainsKey(APPEND.Name))
                    a = (bool) initParams[APPEND.Name];
                if (initParams.ContainsKey(OVERWRITE.Name))
                    o = (bool) initParams[OVERWRITE.Name];

                // Apply any changes
                h.SetOut(p, a, o);
            }

            return h;
        }
Beispiel #2
0
        public IChallengeHandler GetHandler(Challenge c, IReadOnlyDictionary <string, object> initParams)
        {
            var h = new ManualChallengeHandler();

            // Start off with the current (default) settings
            var p = h.WriteOutPath;
            var a = h.Append;
            var o = h.Overwrite;

            if (initParams?.Count > 0)
            {
                // See which ones are overridden
                if (initParams.ContainsKey(WRITE_OUT_PATH.Name))
                {
                    p = (string)initParams[WRITE_OUT_PATH.Name];
                }
                if (initParams.ContainsKey(APPEND.Name))
                {
                    a = (bool)initParams[APPEND.Name];
                }
                if (initParams.ContainsKey(OVERWRITE.Name))
                {
                    o = (bool)initParams[OVERWRITE.Name];
                }
                if (initParams.ContainsKey(OUTPUT_JSON.Name))
                {
                    h.OutputJson = (bool)initParams[OUTPUT_JSON.Name];
                }

                // Apply any changes
                h.SetOut(p, a, o);
            }

            return(h);
        }