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"));
            }
        }
Пример #2
0
        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);
            }
        }
Пример #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);
            }
        }
Пример #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}");
        }
Пример #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;
        }
Пример #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));
 }
Пример #7
0
 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));
        }
Пример #9
0
        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);
        }
Пример #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();
        }
Пример #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}");
    }
Пример #12
0
 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));
 }
Пример #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);
 }
Пример #15
0
        public void ValueSet_SetDoubleAndAppend()
        {
            Input input = new Input();

            input.Value = 3.1415;
            input.Add(7);
            Assert.AreEqual(3.14157, input.Value);
        }
Пример #16
0
 public Engine WithInput(params long[] input)
 {
     foreach (var value in input)
     {
         Input.Add(value);
     }
     return(this);
 }
Пример #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);
     }
 }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
 }
Пример #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);
        }
Пример #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);
        }
Пример #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();
        }
Пример #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
        }
Пример #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();
        }
Пример #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);
            }
        }
Пример #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);
        }
Пример #31
0
        public ExpandoOperationViewModel()
        {
            AddInputCommand = new RequeryCommand(
                () => Input.Add(new ConnectorViewModel()),
                () => Input.Count < MaxInput);

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