Beispiel #1
0
        public MainWindow()
        {
            //CodeSamples.TestOledbConnection();

            var fileUpdater = new FileUpdater();

            fileUpdater.CopyBattaryTableToLocalDirectory();
            fileUpdater.CopyCarTableToLocalDirectory();
            //using (var databaseOperations = new OleDatabaseOperations(Properties.Settings.Default.tableName))
            //{
            //    databaseOperations.UpdateSourceTable();
            //}


            InitializeComponent();

            documentManager = new DocumentManager();

            selectedCar        = null;
            selectedBattary    = null;
            selectedSubBattary = null;

            InitCarCollection();
            InitSubBattariesCollection();
        }
Beispiel #2
0
        private void CheckUpdates_OnClick(object sender, RoutedEventArgs e)
        {
            var updateWindow = new UpdatesResultWindow();

            try
            {
                List <ThreatsChanges> changes = FileUpdater.GetDifference(_items, out var newItems);
                if (changes.Count == 0)
                {
                    File.Delete("newdata.xlsx");
                    MessageBox.Show("Используется актуальная версия файла!", "Успешно", MessageBoxButton.OK,
                                    MessageBoxImage.Exclamation);
                    updateWindow.Close();
                }
                else
                {
                    File.Delete("data.xlsx");
                    File.Move("newdata.xlsx", "data.xlsx");
                    _items = newItems;
                    TreatsGrid.DataContext =
                        _items.Where(x => x.Id > (_pageNumber - 1) * 15 && x.Id <= (_pageNumber) * 15);
                    updateWindow.Changes.ItemsSource = changes;
                    updateWindow.Info.Text           = $"Идентификаторы угроз изменившихся записей (Всего {changes.Count}):";
                    updateWindow.Show();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show($"Ошибка обновления!\n{exception.Message}", "Ошибка");
                updateWindow.Close();
            }
        }
        [Test, Ignore("Fails on build server ")]//TODO:
        public void ShouldLogErrorsAndContinue()
        {
            var mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $"C:{Slash}dev{Slash}SampleProjectFile.xml", new MockFileData(ReadResourceFile("SampleProjectFile.xml")) },
                { $"C:{Slash}dev{Slash}InvalidXmlFile.xml", new MockFileData(ReadResourceFile("InvalidXmlFile.xml")) }
            });

            _updater = new FileUpdater(mockFileSystem, _console);

            var projFiles = new List <FileInfo>
            {
                new FileInfo($"C:{Slash}dev{Slash}InvalidXmlFile.xml"),
                new FileInfo($"C:{Slash}dev{Slash}SampleProjectFile.xml")
            };

            var expectedProjectFile = ConvertToXmlDoc(ReadResourceFile("ExpectedProjFile.xml"));

            _updater.UpdateProjectFiles(projFiles, _version2Point1Updater);

            var updatedXmlDoc = ConvertToXmlDoc(ReadFileFromFileSystem(projFiles[1], mockFileSystem));

            Assert.That(updatedXmlDoc, Is.EqualTo(expectedProjectFile));

            //            _console.Out.WriteLine();

//            Assert.That(_console.Out.ReadToEnd(), Is.EqualTo("Updating C:\\dev\\InvalidXmlFile.xml failed: File is not valid Xml"));
        }
Beispiel #4
0
        private void openFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (FolderBrowserDialog browser = new FolderBrowserDialog())
            {
                browser.Description         = "Select Unity Project folder";
                browser.SelectedPath        = FileUpdater.ProjectPath;
                browser.ShowNewFolderButton = false;
                DialogResult result = browser.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(browser.SelectedPath))
                {
                    try
                    {
                        FileUpdater.SetProjectPath(browser.SelectedPath);

                        // add or promote the folder in the Recent Folders list
                        m_recentProjects.Access(browser.SelectedPath);
                    }
                    catch (UnityProjectException exception)
                    {
                        MessageBox.Show(
                            exception.Message, "Invalid Directory",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
        public bool Run(bool preview)
        {
            Log.Information($"Task: {_taskCreator.Description}");
            UpdateFileOptions options = _file.Options;
            FileFinder        finder  = new FileFinder();
            FileUpdater       updater = new FileUpdater();

            _onUpdate();
            var files = finder
                        .FindWithMask(
                options.WorkingDirectory,
                options.Masks,
                options.Recursively)
                        .ToArray();

            bool atLeastOneUpdated = false;

            _onUpdate();
            updater.Run(
                files,
                folder =>
            {
                IFolderOrFileTask task = _taskCreator.Create();
                atLeastOneUpdated     |= task.Run(folder, options.WithPreview(preview));
                _onUpdate();
            });
            if (!atLeastOneUpdated)
            {
                Log.Information("\tTask completed. No changes.");
            }
            return(atLeastOneUpdated);
        }
Beispiel #6
0
        private FileUpdater ConfigureFileUpdater(FileUpdater updater, ITaskItem step)
        {
            updater.SkipIfNoReplacementFound = string.Equals(
                step.GetMetadata(nameof(updater.SkipIfNoReplacementFound)),
                "true",
                StringComparison.OrdinalIgnoreCase);

            // GetMetadata doesn't return null: empty string whether or not metadata is assigned.
            string oldValue = step.GetMetadata(ReplacementSubstituteOldMetadataName);
            string newValue = step.GetMetadata(ReplacementSubstituteNewMetadataName);

            if (!string.IsNullOrEmpty(oldValue))
            {
                updater.ReplacementTransform = v => v.Replace(oldValue, newValue);
            }
            else if (!string.IsNullOrEmpty(newValue))
            {
                Log.LogError(
                    $"Metadata {ReplacementSubstituteNewMetadataName} supplied for updater " +
                    $"{step.ItemSpec} without {ReplacementSubstituteOldMetadataName}. " +
                    "It is impossbile to replace the empty string with something.");
            }

            return(updater);
        }
        public void Generate()
        {
            var infos    = generatorContext.Types.GetObject <TupleTypeTable>(TypeIds.TupleTypeTable).Data;
            var filename = Path.Combine(CSharpConstants.GetDirectory(generatorContext, CSharpConstants.IcedNamespace), "TupleTypeTable.cs");
            var updater  = new FileUpdater(TargetLanguage.CSharp, "TupleTypeTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
Beispiel #8
0
        public void Generate()
        {
            var defs     = generatorContext.Types.GetObject <MemorySizeDefs>(TypeIds.MemorySizeDefs).Defs;
            var filename = generatorContext.Types.Dirs.GetRustFilename("memory_size.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "MemorySizeInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, defs));
        }
        public void Generate()
        {
            var infos    = RegisterInfoTable.Data;
            var filename = Path.Combine(generatorOptions.RustDir, "register.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "RegisterInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
        public void Generate()
        {
            var infos    = MemorySizeInfoTable.Data;
            var filename = Path.Combine(CSharpConstants.GetDirectory(generatorOptions, CSharpConstants.IcedNamespace), "MemorySizeExtensions.cs");
            var updater  = new FileUpdater(TargetLanguage.CSharp, "MemorySizeInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
Beispiel #11
0
        public void Generate()
        {
            var infos    = genTypes.GetObject <TupleTypeTable>(TypeIds.TupleTypeTable).Data;
            var filename = CSharpConstants.GetFilename(genTypes, CSharpConstants.IcedNamespace, "TupleTypeTable.cs");
            var updater  = new FileUpdater(TargetLanguage.CSharp, "TupleTypeTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
Beispiel #12
0
        public void Generate()
        {
            var infos    = generatorContext.Types.GetObject <MemorySizeInfoTable>(TypeIds.MemorySizeInfoTable).Data;
            var filename = Path.Combine(generatorContext.RustDir, "memory_size.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "MemorySizeInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
Beispiel #13
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);

            FileUpdater.Stop();
            m_updateLoopThread.Abort();
            m_updateLoopThread = null;
        }
        public void Generate()
        {
            var infos    = generatorContext.Types.GetObject <TupleTypeTable>(TypeIds.TupleTypeTable).Data;
            var filename = generatorContext.Types.Dirs.GetRustFilename("tuple_type_tbl.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "TupleTypeTable", filename);

            updater.Generate(writer => WriteTable(writer, infos));
        }
        public void Generate()
        {
            var defs     = generatorContext.Types.GetObject <RegisterInfoTable>(TypeIds.RegisterInfoTable).Data;
            var filename = Path.Combine(generatorContext.Types.Dirs.RustDir, "register.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "RegisterInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, defs));
        }
        public void Generate()
        {
            var defs     = generatorContext.Types.GetObject <RegisterDefs>(TypeIds.RegisterDefs).Defs;
            var filename = generatorContext.Types.Dirs.GetRustFilename("register.rs");
            var updater  = new FileUpdater(TargetLanguage.Rust, "RegisterInfoTable", filename);

            updater.Generate(writer => WriteTable(writer, defs));
        }
Beispiel #17
0
        private FileUpdater ConfigureFileUpdater(FileUpdater updater, ITaskItem step)
        {
            updater.SkipIfNoReplacementFound = string.Equals(
                step.GetMetadata(nameof(updater.SkipIfNoReplacementFound)),
                "true",
                StringComparison.OrdinalIgnoreCase);

            return(updater);
        }
Beispiel #18
0
 void OnRecentPathSelected(object sender, string path)
 {
     try
     {
         FileUpdater.SetProjectPath(path);
     }
     catch (UnityProjectException exception)
     {
         MessageBox.Show(
             exception.Message, "Invalid Directory",
             MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #19
0
        private void UpdateParseProgress()
        {
            int outstandingCount = FileUpdater.GetOutstandingFileCount();

            if (outstandingCount > 0)
            {
                parseQueueStatusLabel.Text = "Files to Parse: " + outstandingCount.ToString();
            }
            else
            {
                parseQueueStatusLabel.Text = "";
            }
        }
Beispiel #20
0
    public void saveGraph(Graph graph, string name)
    {
        GraphData graphData = new GraphData();

        graphData.vertices = graph.vertices;

        string      data        = JsonUtility.ToJson(graphData, true);
        FileUpdater fileUpdater = new FileUpdater();
        bool        status      = fileUpdater.saveJSONFile(name, data);

        if (status == true)
        {
            Debug.Log("Success");
        }
    }
Beispiel #21
0
        public void Test_Update_Flow()
        {
            //// Arrange
            var methodList     = new List <MethodEntity>();
            var coverageEntity = new CoverageEntity
            {
                FilePath = "a.txt"
            };

            //// Act
            var target = new FileUpdater(this._stubServiceProvider);

            target.Update(coverageEntity, methodList);

            //// Assert
            this._stubFileHelper.Received(1).WriteAllText(Arg.Any <string>(), Arg.Any <string>());
        }
        public void Test_Update_Flow()
        {
            //// Arrange
            var methodList     = new List <CoverageEntity>();
            var coverageEntity = new RepositoryCoverageEntity
            {
                CoverageFileName = "a.txt",
                OutputPath       = @"D:\",
            };

            //// Act
            var target = new FileUpdater(this._stubServiceProvider);

            target.Update(coverageEntity, methodList);

            //// Assert
            this._stubFileHelper.Received(1).WriteAllText(Arg.Any <string>(), Arg.Any <string>());
        }
Beispiel #23
0
        private void RunUpdater()
        {
            FileUpdater fileUpdater = new FileUpdater(this);

            fileUpdater.FilesUpdated += OnFilesUpdated;
            Thread updaterThread = new Thread(fileUpdater.RunUpdater);

            try
            {
                updaterThread.Start();
            }
            catch (OutOfMemoryException)
            {
                MessageBox.Show("Unable to start the updating process. It appears your computer is out of memory.");
            }
            catch (ThreadStateException)
            {
                MessageBox.Show("The updater thread could not be started. Try and restarting the launcher.");
            }
        }
Beispiel #24
0
    public Graph loadGraph(string name)
    {
        if (name != "")
        {
            // LOADS GRAPH FROM JSON DATA
            FileUpdater fileUpdater = new FileUpdater();
            String      json        = fileUpdater.loadJSONFile(name);
            GraphData   graphData   = JsonUtility.FromJson <GraphData>(json);
            if (graphData != null && graphData.vertices != null && graph != null)
            {
                graph.vertices = graphData.vertices;
            }

            return(graph);
        }
        else
        {
            return(new Graph());
        }
    }
        [Test, Ignore("Fails on build server ")]//TODO:
        public void ShouldNotUpdateTargetFrameworkWhenTargetingNetStandard()
        {
            var mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $"C:{Slash}dev{Slash}NetStandardXmlFile.xml", new MockFileData(ReadResourceFile("NetStandardXmlFile.xml")) }
            });

            _updater = new FileUpdater(mockFileSystem, _console);

            var projFiles = new List <FileInfo>
            {
                new FileInfo($"C:{Slash}dev{Slash}NetStandardXmlFile.xml")
            };

            _updater.UpdateProjectFiles(projFiles, _version2Point1Updater);

            var updatedXmlDoc = ConvertToXmlDoc(ReadFileFromFileSystem(projFiles[0], mockFileSystem));
            var expectedNetStandardProjFile = ConvertToXmlDoc(ReadResourceFile("ExpectedNetStandardXmlFile.xml"));

            Assert.That(updatedXmlDoc, Is.EqualTo(expectedNetStandardProjFile));
        }
Beispiel #26
0
        public async Task DeletedScript()
        {
            string destDir = FileHelper.GetTempDir();

            try
            {
                // Prepare running FileUpdater
                string workbench          = EngineTests.Project.Variables["TestBench"];
                string srcScriptFile      = Path.Combine(workbench, "FileUpdater", "Removed.script");
                string workScriptFile     = Path.Combine(destDir, "Removed.script");
                string workScriptTreePath = Path.Combine("TestSuite", "Updater", "Removed.script");
                File.Copy(srcScriptFile, workScriptFile);
                IniReadWriter.WriteKey(workScriptFile, "ScriptUpdate", "Url", @$ "http://localhost:{TestSetup.ServerPort}/Updater/Standalone/Removed.script");

                Project p  = EngineTests.Project;
                Script  sc = p.LoadScriptRuntime(workScriptFile, workScriptTreePath, new LoadScriptRuntimeOptions
                {
                    AddToProjectTree       = true,
                    IgnoreMain             = false,
                    OverwriteToProjectTree = true,
                });

                // Run an update, which must fail
                FileUpdater updater = new FileUpdater(EngineTests.Project, null, null);
                (Script newScript, LogInfo log) = await updater.UpdateScriptAsync(sc, true);

                Console.WriteLine(log.ToString());
                Assert.IsTrue(log.Message.Equals($"[{sc.Title}] was deleted from the server", StringComparison.Ordinal));
                Assert.IsNull(newScript);
            }
            finally
            {
                if (Directory.Exists(destDir))
                {
                    Directory.Delete(destDir, true);
                }
            }
        }
        [Test, Ignore("Fails on build server ")]//TODO:
        public void ShouldUpdateSuppliedFileWithExpectedChanges()
        {
            var mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $"C:{Slash}dev{Slash}SampleProjectFile.xml", new MockFileData(ReadResourceFile("SampleProjectFile.xml")) },
                { $"C:{Slash}dev{Slash}InvalidXmlFile.xml", new MockFileData(ReadResourceFile("InvalidXmlFile.xml")) }
            });

            _updater = new FileUpdater(mockFileSystem, _console);

            var projFiles = new List <FileInfo>
            {
                new FileInfo($"C:{Slash}dev{Slash}SampleProjectFile.xml")
            };

            var expectedProjectFile = ConvertToXmlDoc(ReadResourceFile("ExpectedProjFile.xml"));

            _updater.UpdateProjectFiles(projFiles, _version2Point1Updater);

            var updatedXmlDoc = ConvertToXmlDoc(ReadFileFromFileSystem(projFiles.First(), mockFileSystem));

            Assert.That(updatedXmlDoc, Is.EqualTo(expectedProjectFile));
        }
Beispiel #28
0
        private async void ScriptUpdateCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            // Force update of script interface controls (if changed)
            ScriptUpdateButton.Focus();

            // Must be filtered by ScriptCommand_CanExecute before
            if (Model.WorkInProgress)
            {
                Global.Logger.SystemWrite(new LogInfo(LogState.CriticalError, $"Race condition with {nameof(Model.WorkInProgress)} happened in {nameof(ScriptUpdateCommand_Executed)}"));
                return;
            }

            // Get instances of Script and Project
            Script  targetScript = Model.CurMainTree.Script;
            Project p            = Model.CurMainTree.Script.Project;
            // Do not apply updateMultipleScript to MainScript, because users should use project update for this job.
            bool updateMultipleScript = targetScript.Type == ScriptType.Directory;

            if (!updateMultipleScript && !targetScript.IsUpdateable)
            {
                Global.Logger.SystemWrite(new LogInfo(LogState.CriticalError, $"Race condition with {nameof(Script.IsUpdateable)} happened in {nameof(ScriptUpdateCommand_Executed)}"));
                return;
            }

            // Define local variables
            Script[] targetScripts = null;
            // Update one script
            Script  newScript  = null;
            LogInfo updaterLog = null;

            // Update scripts
            Script[]  newScripts  = null;
            LogInfo[] updaterLogs = null;

            // Turn on progress ring
            Model.WorkInProgress = true;
            try
            {
                // Populate BuildTree
                ProjectTreeItemModel treeRoot = MainViewModel.PopulateOneTreeItem(targetScript, null, null);
                Model.BuildTreeItems.Clear();
                if (updateMultipleScript)
                { // Update a list of scripts
                    // We have to search in p.AllScripts rather than in ProjectTreeItemModel to find hidden scripts
                    // (ProjectTreeItemModel only contains visible scripts)
                    targetScripts = p.AllScripts
                                    .Where(x => x.TreePath.StartsWith(targetScript.TreePath, StringComparison.OrdinalIgnoreCase) &&
                                           x.IsUpdateable)
                                    .ToArray();
                    MainViewModel.ScriptListToTreeViewModel(p, targetScripts, false, treeRoot);
                    targetScripts = targetScripts.Where(x => x.Type != ScriptType.Directory).ToArray();
                    if (targetScripts.Length == 0)
                    {
                        // Ask user for confirmation
                        MessageBox.Show(this,
                                        $"Directory [{targetScript.Title}] does not contain any scripts that are able to be updated.",
                                        "No updateable scripts",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                        return;
                    }
                }

                Model.BuildTreeItems.Add(treeRoot);
                Model.CurBuildTree = null;
                Debug.Assert(updateMultipleScript && targetScript != null && targetScripts != null ||
                             !updateMultipleScript && targetScript != null && targetScripts == null,
                             $"Check {updateMultipleScript}");

                // Ask user for confirmation
                string targetScriptCountStr;
                if (updateMultipleScript)
                {
                    targetScriptCountStr = targetScripts.Length == 1 ? "1 script" : $"{targetScripts.Length} scripts";
                }
                else
                {
                    targetScriptCountStr = $"script [{targetScript.Title}]";
                }
                MessageBoxResult result = MessageBox.Show(this,
                                                          $"Are you sure you want to update {targetScriptCountStr}?",
                                                          "Continue?",
                                                          MessageBoxButton.YesNo,
                                                          MessageBoxImage.Question);
                if (result == MessageBoxResult.No)
                {
                    return;
                }

                // Switch to Build View
                Model.BuildScriptFullProgressVisibility = Visibility.Collapsed;
                Model.SwitchNormalBuildInterface        = false;

                Stopwatch watch = Stopwatch.StartNew();

                // Run Updater
                string      customUserAgent = Global.Setting.General.UseCustomUserAgent ? Global.Setting.General.CustomUserAgent : null;
                FileUpdater updater         = new FileUpdater(p, Model, customUserAgent);
                if (updateMultipleScript) // Update a list of scripts
                {
                    (newScripts, updaterLogs) = await updater.UpdateScriptsAsync(targetScripts, true);

                    Logger.SystemWrite(updaterLogs);
                }
                else
                {
                    (newScript, updaterLog) = await updater.UpdateScriptAsync(targetScript, true);

                    Logger.SystemWrite(updaterLog);
                }

                watch.Stop();
                TimeSpan t = watch.Elapsed;
                Model.StatusBarText = $"Updated {targetScript.Title} ({t:h\\:mm\\:ss})";
            }
            finally
            {
                // Turn off progress ring
                Model.BuildScriptFullProgressVisibility = Visibility.Visible;
                Model.WorkInProgress = false;

                // Build Ended, Switch to Normal View
                Model.SwitchNormalBuildInterface = true;
                Model.DisplayScript(Model.CurMainTree.Script);
            }

            // Report results
            if (updateMultipleScript)
            { // Updated multiple scripts
                PackIconMaterialKind msgBoxIcon = PackIconMaterialKind.Information;
                StringBuilder        b          = new StringBuilder(updaterLogs.Length + 6);
                if (0 < newScripts.Length)
                {
                    b.AppendLine($"Successfully updated [{newScripts.Length}] scripts");
                }

                foreach (Script newSc in newScripts)
                {
                    ProjectTreeItemModel node = Model.CurMainTree.FindScriptByRealPath(newSc.RealPath);
                    Debug.Assert(node != null, "Internal error with MainTree management");
                    Model.PostRefreshScript(node, newSc);

                    b.AppendLine($"- {newSc.Title}");
                }

                LogInfo[] errorLogs = updaterLogs.Where(x => x.State == LogState.Error).ToArray();
                if (0 < errorLogs.Length)
                { // Failure
                    if (0 < newScripts.Length)
                    {
                        b.AppendLine();
                    }
                    b.AppendLine($"Failed to update [{targetScripts.Length - newScripts.Length}] scripts");
                    foreach (LogInfo log in errorLogs)
                    {
                        b.AppendLine($"- {log.Message}");
                    }

                    msgBoxIcon = PackIconMaterialKind.Alert;
                }

                const string   msgTitle = "Script Update Report";
                TextViewDialog dialog   = new TextViewDialog(this, msgTitle, msgTitle, b.ToString(), msgBoxIcon);
                dialog.ShowDialog();
            }
            else
            {     // Updated single script
                if (newScript != null)
                { // Success
                    ProjectTreeItemModel node = Model.CurMainTree.FindScriptByRealPath(newScript.RealPath);
                    Debug.Assert(node != null, "Internal error with MainTree management");
                    Model.PostRefreshScript(node, newScript);

                    MessageBox.Show(this, $"Successfully updated script {newScript.Title}",
                                    "Script Update Success",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
                else
                { // Failure
                    StringBuilder b = new StringBuilder(updaterLogs.Length + 6);

                    LogInfo[] errorLogs = updaterLogs.Where(x => x.State == LogState.Error).ToArray();
                    foreach (LogInfo log in errorLogs)
                    {
                        b.AppendLine($"- {log.Message}");
                    }

                    MessageBox.Show(this, b.ToString(), "Script Update Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Beispiel #29
0
        public async Task UpdateScript()
        {
            string destDir = FileHelper.GetTempDir();

            try
            {
                // Prepare running FileUpdater
                string srcScriptFile      = Path.Combine(TestSetup.WebRoot, "Updater", "Standalone", "PreserveInterface_r1.script");
                string workScriptFile     = Path.Combine(destDir, "PreserveInterface.script");
                string workScriptTreePath = Path.Combine("TestSuite", "Updater", "PreserveInterface.script");
                File.Copy(srcScriptFile, workScriptFile);

                Project p  = EngineTests.Project;
                Script  sc = p.LoadScriptRuntime(workScriptFile, workScriptTreePath, new LoadScriptRuntimeOptions
                {
                    AddToProjectTree       = true,
                    IgnoreMain             = false,
                    OverwriteToProjectTree = true,
                });

                // Run an update
                FileUpdater updater = new FileUpdater(EngineTests.Project, null, null);
                (Script newScript, LogInfo log) = await updater.UpdateScriptAsync(sc, true);

                // Validate updated script
                Console.WriteLine(log);
                Assert.IsNotNull(newScript);
                Assert.IsTrue(newScript.TidyVersion.Equals("1.2", StringComparison.Ordinal));
                Assert.AreEqual(SelectedState.True, newScript.Selected);
                IniKey[] keys =
                {
                    new IniKey("Interface",       "checkbox02"),
                    new IniKey("Interface",       "ComboBox02"),
                    new IniKey("Interface",       "bvl_Top"),
                    new IniKey("Interface",       "ComboBox01"),
                    new IniKey("Interface",       "CheckBox01"),
                    new IniKey("Interface",       "Button01"),
                    new IniKey("Interface",       "CheckBox03"),
                    new IniKey("ThirdInterface",  "RadioGroup01"),
                    new IniKey("FourthInterface", "RadioButton01"),
                    new IniKey("FourthInterface", "RadioButton02"),
                    new IniKey("FourthInterface", "RadioButton03"),
                };

                keys = IniReadWriter.ReadKeys(newScript.RealPath, keys);
                Dictionary <string, string> ifaceDict = keys.Where(x => x.Section.Equals("Interface"))
                                                        .ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
                Assert.IsTrue(ifaceDict["checkbox02"].Equals("checkbox02,1,3,10,10,200,18,False", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["ComboBox02"].Equals("C,1,4,262,120,150,22,A,B,C", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["bvl_Top"].Equals("\"Updated\",1,12,254,101,228,70,8,Normal", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["ComboBox01"].Equals("A,1,4,42,66,150,21,A,B,C", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["CheckBox01"].Equals("CheckBox01,1,3,42,98,173,18,False", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["Button01"].Equals("Button01,1,8,262,46,80,25,TestSection,0,False", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["CheckBox03"].Equals("CheckBox03,1,3,100,400,200,18,True", StringComparison.Ordinal));

                ifaceDict = keys.Where(x => x.Section.Equals("ThirdInterface"))
                            .ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
                Assert.IsTrue(ifaceDict["RadioGroup01"].Equals("RadioGroup01,1,14,10,30,150,60,A,B,C,1", StringComparison.Ordinal));

                ifaceDict = keys.Where(x => x.Section.Equals("FourthInterface"))
                            .ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
                Assert.IsTrue(ifaceDict["RadioButton01"].Equals("A,1,11,10,30,120,20,False", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["RadioButton02"].Equals("B,1,11,10,50,120,20,False", StringComparison.Ordinal));
                Assert.IsTrue(ifaceDict["RadioButton03"].Equals("C,1,11,10,70,120,20,True", StringComparison.Ordinal));

                Assert.IsFalse(IniReadWriter.ContainsSection(newScript.RealPath, "SecondInterface"));
            }
            finally
            {
                if (Directory.Exists(destDir))
                {
                    Directory.Delete(destDir, true);
                }
            }
        }