public void AddFiles(IList <string> files)
        {
            bool allValidFiles = true;

            foreach (var file in files)
            {
                if (ValidateFile(file))
                {
                    Input.Add(file);
                }
                else
                {
                    allValidFiles = false;
                }
            }
            if (files.Count > 0 && allValidFiles)
            {
                InputFilesAdded = true;
                ConversionSettings.OutputDirectory = Directory.GetParent(files[0]).FullName;
            }

            if (!allValidFiles)
            {
                MessageService.ShowMessage(String.Format("Some file(s) are not valid. Only vector files (.svg) are allowed"));
            }
        }
        private async Task LoadAsync(DateTime date, string month)
        {
            ButtonPressed = month;

            GetPeriod(month);

            if (ButtonPressed == "Year")
            {
                var l_all_atendimentos = await _appAtendimento.ByAll(date);

                Input.Add(l_all_atendimentos);

                var setores = _appSetores.List();

                foreach (Setor s in setores)
                {
                    var setor = await _appAtendimento.BySetor(s.Nome, date);

                    if (setor.Count() > 1)
                    {
                        Input.Add(setor);
                    }
                }
            }
            else
            {
                await LoadAsyncMonth(Periodo);
            }
        }
Exemple #3
0
        public DiagnosticChain(ActionCall call) : base(BuildRoute(call))
        {
            if (call.HasInput)
            {
                Route.ApplyInputType(call.InputType());
            }

            Tags.Add(NoTracing);

            RouteName = call.HandlerType.Name.Replace("FubuDiagnostics", "")
                        + ":"
                        + call.Method.Name.Replace("get_", "").Replace("post_", "").Replace("{", "").Replace("}", "");

            AddToEnd(call);

            if (call.HasInput)
            {
                Input.Add(new NewtonsoftJsonFormatter());
            }
            if (call.HasOutput && call.OutputType() != typeof(HtmlTag) && !call.OutputType().CanBeCastTo <HtmlDocument>())
            {
                var writerType = typeof(DiagnosticJsonWriter <>).MakeGenericType(call.OutputType());
                var writer     = Activator.CreateInstance(writerType).As <IMediaWriter>();
                Output.Add(writer);
            }
        }
Exemple #4
0
        public override void Solve()
        {
            int oneJoltDiffs   = 0;
            int threeJoltDiffs = 0;

            Input.Add(0);
            Input.Sort();
            for (int i = 0; i < Input.Count - 1; i++)
            {
                int diff = Input[i + 1] - Input[i];
                if (diff == 1)
                {
                    oneJoltDiffs++;
                }
                else if (diff == 3)
                {
                    threeJoltDiffs++;
                }
                else if (diff != 2)
                {
                    throw new ArgumentException($"Diff {diff} is too large between {Input[i + 1]} and {Input[i]}");
                }
            }

            threeJoltDiffs++; // device's built-in adapter
            Console.WriteLine($"The product of diff counts is {oneJoltDiffs * threeJoltDiffs}");
        }
Exemple #5
0
        public override void SetUp()
        {
            Input.Add(new Channel("x0", null));            //the reference point

            n = (int)GetInitParameter(InitWords, "n", true);

            for (int i = 0; i < n; i++)
            {
                Input.Add(new Channel("f" + i.ToString(), null));
            }
            for (int i = 0; i < n; i++)
            {
                Input.Add(new Channel("eta" + i.ToString(), null));
            }
            for (int i = 0; i < n; i++)
            {
                Output.Add(new Channel("x" + (i + 1).ToString(), this));
            }

            x = new double[n + 1]; v = new double[n + 1]; a = new double[n + 1];


            InputDefaultInit();

            //x=0; xo=0; xoo=0; v = 0; a = 0;
        }
Exemple #6
0
 public void FillInput()
 {
     Input.Add(new KeyValuePair <int, int>(9, 2));
     Input.Add(new KeyValuePair <int, int>(9, 4));
     Input.Add(new KeyValuePair <int, int>(4, 3));
     Input.Add(new KeyValuePair <int, int>(6, 5));
 }
 public void ValueSet_SetDoubleAndAppend()
 {
     Input input = new Input();
     input.Value = 3.1415;
     input.Add(7);
     Assert.AreEqual(3.14157, input.Value);
 }
        public void MultipleHeadersAreEnumerableWithOrderPreserved()
        {
            App.OptionReadRequestBody = true;

            Input.Add(
                "Get / HTTP/1.1\r\nContent-Length: 0\r\n" +
                "x-1:alpha beta1\r\n" +
                "x-1: alpha beta2\r\n" +
                "x-2: foo1 \r\n" +
                "x-1:alpha beta3 \r\n" +
                "x-2: foo2 \r\n" +
                "x-1:\talpha beta4\t\r\n" +
                "x-1:\t  \t \talpha\tbeta5\t  \t \t\r\n" +
                "\r\n");
            Input.End();

            AssertInputState(false, true, "");
            AssertOutputState(true);

            var x1 = App.RequestHeaders["x-1"].ToArray();

            Assert.Equal(5, x1.Length);
            Assert.Equal("alpha beta1*alpha beta2*alpha beta3*alpha beta4*alpha\tbeta5", string.Join("*", x1));

            var x2 = App.RequestHeaders["x-2"].ToArray();

            Assert.Equal(2, x2.Length);
            Assert.Equal("foo1*foo2", string.Join("*", x2));
        }
        public void AddTest()
        {
            var    context = GetContext();
            IInput input   = new Input(context);
            var    inUser  = new User()
            {
                Username = "******",
                FName    = "Test",
                LName    = "User",
                Password = "******"
            };

            input.Add(inUser);

            var output = from item in context.Users.AsEnumerable()
                         where
                         (
                item.FName == inUser.FName &&
                item.LName == inUser.LName &&
                item.Username == inUser.Username &&
                item.Password == inUser.Password
                         )
                         select item;

            Assert.True(output.Count() == 1);
        }
Exemple #10
0
        public override void SetUp()
        {
            Input.Add(new Channel("signal", null));
            Output.Add(new Channel("tick", this));  //0: gets to 1 if the digital signal raises

            InputDefaultInit();
        }
Exemple #11
0
    public static void Run()
    {
        var input = File.ReadAllLines("2.txt");

        for (int i = 0; i < input.Length; i++)
        {
            var pattern = @"(\d+)x(\d+)x(\d+)";
            var entry   = new Regex(pattern).Match(input[i]);
            if (entry.Success)
            {
                Input.Add(new Dim(Convert.ToInt32(entry.Groups[1].Value), Convert.ToInt32(entry.Groups[2].Value), Convert.ToInt32(entry.Groups[3].Value)));
            }
        }
        long total = 0;

        foreach (var item in Input)
        {
            var areas = new List <int>();
            areas.Add(2 * item.l * item.w);
            areas.Add(2 * item.w * item.h);
            areas.Add(2 * item.l * item.h);
            total += areas.Sum() + areas.Min() / 2;
        }

        Console.WriteLine($"it's {total}");
    }
 public IActionResult OnPostAddInput()
 {
     Subjects = _context.Subjects.ToList();
     Input.ForEach(i => i.SubjectId.Name = Subjects.FirstOrDefault(s => s.Id == i.SubjectId.Id)?.Name);
     Input.Add(new SubjectInput());
     return(Partial("_CreateModalPartial", this));
 }
Exemple #13
0
        public override void SetUp()
        {
            Input.Add(new Channel("in1", null));
            Input.Add(new Channel("in2", null));

            Output.Add(new Channel("out", this));
            InputDefaultInit();
        }
 public void BlankLineEndsHeadersAndCallsTheAppDelegate()
 {
     Input.Add("GET / HTTP/1.1\r\nfoo: bar\r\nfrap: quad\r\n\r\n");
     Input.End();
     AssertInputState(false, true, "");
     Assert.Equal(1, App.CallCount);
     AssertOutputState(true);
 }
        public void ValueSet_SetDoubleAndAppend()
        {
            Input input = new Input();

            input.Value = 3.1415;
            input.Add(7);
            Assert.AreEqual(3.14157, input.Value);
        }
Exemple #16
0
 public Engine WithInput(params long[] input)
 {
     foreach (var value in input)
     {
         Input.Add(value);
     }
     return(this);
 }
Exemple #17
0
        public override void SetUp()
        {
            base.SetUp();

            Input.Add(new Channel("D", null));

            InputDefaultInit();
        }
        public void AfterHeadersMoreReadingIsNeeded()
        {
            Input.Add(
                @"POST / HTTP/1.1
Transfer-Encoding: chunked

");
            AssertInputState(false, false, "");
        }
 public BlockingIntcodeComputer(int[] intcode, params int[] initialInp)
 {
     Intcode = new int[intcode.Length];
     Array.Copy(intcode, Intcode, intcode.Length);
     foreach (var i in initialInp)
     {
         Input.Add(i);
     }
 }
Exemple #20
0
        public gain(string[] words)
        {
            Init(words);

            Input.Add(new Channel("signal", null));
            Output.Add(new Channel("out", this));

            Console.WriteLine("Circuit {0} (gain) created.\n", Name);
        }
Exemple #21
0
        public integrator(string[] words)
        {
            Init(words, 1, 1);

            Input.Add(new Channel("signal", null));
            Output.Add(new Channel("out", this));

            Console.WriteLine("Integrator {0} created.\n", Name);
        }
Exemple #22
0
        public runavg(string[] words)
        {
            Init(words);

            Input.Add(new Channel("signal", null));
            Output.Add(new Channel("out", this));

            Console.WriteLine("Circuit {0} (Running Averager) created.\n", Name);
        }
Exemple #23
0
 /// <summary>
 /// Add a input data to input.
 /// </summary>
 /// <param name="inputData"></param>
 public Boolean AddInput(string inputData)
 {
     if (!Input.Contains(inputData))
     {
         Input.Add(inputData);
         return(true);
     }
     return(false);
 }
Exemple #24
0
        public delay(string[] words)
        {
            Init(words);

            Input.Add(new Channel("signal", null));   //0
            Output.Add(new Channel("out", this));     //0

            Console.WriteLine("Circuit {0} (Delay) created.\n", Name);
        }
Exemple #25
0
        public PHP(string[] words, int ord, double fcut)
        {
            Init(words);

            Input.Add(new Channel("signal", null));
            Output.Add(new Channel("out", this));

            Console.WriteLine("Circuit {0} (RC) created.\n", Name);
        }
Exemple #26
0
        public override void SetUp()
        {
            base.SetUp();

            //input 0 is the clock
            Input.Add(new Channel("S", null));
            Input.Add(new Channel("R", null));

            InputDefaultInit();
        }
Exemple #27
0
        public nacl(string[] words)
        {
            Init(words);
            Input.Add(new Channel("x", null));   //0
            Input.Add(new Channel("y", null));   //1
            Input.Add(new Channel("z", null));   //2

            Output.Add(new Channel("Fy", this)); //0
            Output.Add(new Channel("Fz", this)); //2
        }
Exemple #28
0
        public override void SetUp()
        {
            Input.Add(new Channel("signal1", null));
            Input.Add(new Channel("signal2", this));

            Output.Add(new Channel("tick", this));
            Output.Add(new Channel("delay", this));

            InputDefaultInit();
        }
Exemple #29
0
        private void BuildInputDictionary(IOSpecDefinition iOSpec)
        {
            Input.Clear();

            foreach (IOItemDefinition itemDefinition in iOSpec.Input.Values)
            {
                var item = new IOItem(itemDefinition, itemDefinition.Name);
                Input.Add(itemDefinition.Name, item);
            }
        }
Exemple #30
0
        public vdWpsc(string[] words)
        {
            Init(words, 1, 1);

            Input.Add(new Channel("ztip", null));

            Output.Add(new Channel("Fz", this));

            Console.WriteLine("Circuit {0} (vdW plane-sphere/cone) created.", Name);
        }
        public ExpandoOperationViewModel()
        {
            AddInputCommand = new RequeryCommand(
                () => Input.Add(new ConnectorViewModel()),
                () => Input.Count < MaxInput);

            RemoveInputCommand = new RequeryCommand(
                () => Input.RemoveAt(Input.Count - 1),
                () => Input.Count > MinInput);
        }