Beispiel #1
0
        public ReadBenchmark()
        {
            Directory.CreateDirectory(TestDirectory);
            _rawIniParser = new IniParser($"{TestDirectory}rawBenchmark.ini", BufferSize);
            _iniWrapper   = new IniWrapperFactory().CreateWithDefaultIniParser(x =>
            {
                x.IniFilePath = $"{TestDirectory}benchmark.ini";
                x.DefaultIniWrapperBufferSize = BufferSize;
            });

            _configurationBenchmark = new ConfigurationBenchmark()
            {
                Test        = 10,
                Age         = 20,
                Description = "TestDescription",
                ListInt     = new List <int>()
                {
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
                },
                InnerConfiguration = new InnerConfiguration()
                {
                    Description = "Description1234",
                    Age         = 100
                }
            };

            _iniWrapper.SaveConfiguration(_configurationBenchmark);
        }
        public void SetUp()
        {
            if (Directory.Exists(TestDirectory))
            {
                Directory.Delete(TestDirectory, true);
            }

            Directory.CreateDirectory(TestDirectory);
            _iniWrapper = new IniWrapperFactory().CreateWithDefaultIniParser(x =>
            {
                x.IniFilePath = $"{TestDirectory}integrationTest.ini";
            });
        }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();

            var exePath      = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
            var settingsPath = Path.Combine(exePath, "settings.ini");

            var iniSettings = new IniSettings()
            {
                IniFilePath = settingsPath,
            };

            iniWrapper = new IniWrapperFactory().CreateWithDefaultIniParser(iniSettings);

            if (!File.Exists(settingsPath))
            {
                File.WriteAllText(settingsPath, ";this file is IniEditor settings file.");
                iniWrapper.SaveConfiguration(new ViewModel());
            }

            DataContext = iniWrapper.LoadConfiguration <ViewModel>();

            // 強調表示
            textEditor.SyntaxHighlighting = LoadHighlightingDefinition("AvalonEdit.ini.xshd");

            // 折り畳み
            foldingManager = FoldingManager.Install(textEditor.TextArea);
            // 2秒おきに折り畳みチェック(微妙な気がするがサンプルがそうなっている)
            var foldingTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(2)
            };

            foldingTimer.Tick += (s, e)
                                 => foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
            foldingTimer.Start();

            // コード補完
            textEditor.TextArea.TextEntering += TextArea_TextEntering;
            textEditor.TextArea.TextEntered  += TextArea_TextEntered;


            textEditor.Options = new TextEditorOptions
            {
                AllowScrollBelowDocument = true,
                HighlightCurrentLine     = true,
            };

            vm.FilePath = settingsPath;
            textEditor.Load(vm.FilePath);
        }
Beispiel #4
0
 public void SetUp()
 {
     _iniParser  = Substitute.For <IIniParser>();
     _iniWrapper = MockWrapperFactory.CreateWithFileSystem(_iniParser);
 }
 public ComplexTypeConverter(IIniWrapper iniWrapper)
 {
     _iniWrapper = iniWrapper;
 }