コード例 #1
0
        public void Can_skip_empty_line()
        {
            var places = UoAutomapImporter.Import(string.Empty + Environment.NewLine
                                                  + "-point of interest: 1542 822 1 Bandita" + Environment.NewLine
                                                  + "+point of interest: 940 2110 1 brouci i bojovnik");

            places.Length.Should().Be(2);
        }
コード例 #2
0
        public void Can_skip_lines_not_starting_with_plus_or_minus()
        {
            var places = UoAutomapImporter.Import("3" + Environment.NewLine
                                                  + "-point of interest: 1542 822 1 Bandita" + Environment.NewLine
                                                  + "+point of interest: 940 2110 1 brouci i bojovnik");

            places.Length.Should().Be(2);
        }
コード例 #3
0
        public void Can_import_line()
        {
            var places = UoAutomapImporter.Import("-point of interest: 1542 822 1 Bandita");

            places.Length.Should().Be(1);
            places.First().Type.Should().Be("point of interest");
            places.First().X.Should().Be(1542);
            places.First().Y.Should().Be(822);
            places.First().Name.Should().Be("Bandita");
        }
コード例 #4
0
        public void Can_import_multiple_lines()
        {
            var places = UoAutomapImporter.Import("-point of interest: 1542 822 1 Bandita" + Environment.NewLine + "-point of interest: 940 2110 1 brouci i bojovnik");

            places.Length.Should().Be(2);
            var secondPlace = places.Skip(1).First();

            secondPlace.Name.Should().Be("brouci i bojovnik");
            secondPlace.X.Should().Be(940);
            secondPlace.Y.Should().Be(2110);
            secondPlace.Type.Should().Be("point of interest");
        }
コード例 #5
0
        private void OnImportButtonClicked(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "UOAutomap files (*.map)|*.map";
            if (openFileDialog.ShowDialog() == true)
            {
                string importedText   = File.ReadAllText(openFileDialog.FileName);
                var    importedPlaces = UoAutomapImporter.Import(importedText);
                var    importWindow   = new AutomapImportWindow(importedPlaces, this.editPlaceViewModel);
                importWindow.ShowDialog();
            }
        }