public static void ImportProFile() { QtVersionManager vm = QtVersionManager.The(); string qtVersion = vm.GetDefaultVersion(); string qtDir = vm.GetInstallPath(qtVersion); if (qtDir == null) { Messages.DisplayErrorMessage(SR.GetString("CannotFindQMake")); return; } #if (VS2010 || VS2012 || VS2013) VersionInformation vi = new VersionInformation(qtDir); if (vi.qtMajor < 5) { #if VS2010 Messages.DisplayErrorMessage(SR.GetString("NoVS2010Support")); #elif VS2012 Messages.DisplayErrorMessage(SR.GetString("NoVS2012Support")); #else Messages.DisplayErrorMessage(SR.GetString("NoVS2013Support")); #endif return; } #endif if (Connect._applicationObject != null) { ProjectImporter proFileImporter = new ProjectImporter(Connect._applicationObject); proFileImporter.ImportProFile(qtVersion); } }
/// <summary> /// Handles the Click event of the btn_ProjImport control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// Erstellt von Veit Berg, am 27.01.16 private void btn_ProjImport_Click(object sender, EventArgs e) { string exportFilePath = ""; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Zip Files|*.zip"; ofd.Title = "Wähle Exportdatei"; if (ofd.ShowDialog() == DialogResult.OK) { exportFilePath = ofd.FileName; } if (exportFilePath != "") { try { ProjectImporter projImporter = new ProjectImporter(exportFilePath); projImporter.ImportWholeProject(); } catch (Exception exception) { MessageBox.Show(exception.Message); } } RefreshDropDown(); }
public static void ImportProFile() { ThreadHelper.ThrowIfNotOnUIThread(); var vm = QtVersionManager.The(); var qtVersion = vm.GetDefaultVersion(); var qtDir = vm.GetInstallPath(qtVersion); if (qtDir == null) { Messages.DisplayErrorMessage(SR.GetString("CannotFindQMake")); return; } var vi = VersionInformation.Get(qtDir); if (vi.qtMajor < 5) { Messages.DisplayErrorMessage(SR.GetString("NoVSSupport")); return; } if (QtVsToolsPackage.Instance.Dte != null) { var proFileImporter = new ProjectImporter(QtVsToolsPackage.Instance.Dte); proFileImporter.ImportProFile(qtVersion); } }
public static void ImportProFile() { var manager = QtVersionManager.The(); var qtVersion = manager.GetDefaultVersion(); var qtDir = manager.GetInstallPath(qtVersion); if (qtDir == null) { Messages.DisplayErrorMessage(SR.GetString("CannotFindQMake")); return; } var info = new VersionInformation(qtDir); if (info.qtMajor < 5) { Messages.DisplayErrorMessage(SR.GetString("NoVS2015Support")); return; } if (VSPackage.dte != null) { var importer = new ProjectImporter(VSPackage.dte); importer.ImportProFile(qtVersion); } }
public void SetUp() { guiToolkitMock = new Mock <IGUIToolkit> (); App.Current.GUIToolkit = guiToolkitMock.Object; mockDialogs = new Mock <IDialogs> (); App.Current.Dialogs = mockDialogs.Object; dbMock = new Mock <IStorage> (); dbManagerMock = new Mock <IStorageManager> (); dbManagerMock.Setup(d => d.ActiveDB).Returns(dbMock.Object); App.Current.DatabaseManager = dbManagerMock.Object; toolsManager = new ToolsManager(); importer = new ProjectImporter { Description = "", ImportFunction = () => null, FilterName = "", Extensions = new string [] { }, NeedsEdition = false, CanOverwrite = false, }; toolsManager.ProjectImporters.Add(importer); toolsManager.Start(); }
public async Task TestGameAnalysis() { Guid projectID; App.Init(); CoreServices.Init(); App.Current.DependencyRegistry.Register <VAS.DB.IFileStorage, FileStorage> (0); AddinsManager.Initialize(App.Current.PluginsConfigDir, App.Current.PluginsDir); App.Current.DrawingToolkit = drawingToolkitMock.Object; App.Current.MultimediaToolkit = multimediaToolkitMock.Object; App.Current.GUIToolkit = guiToolkitMock.Object; App.Current.Dialogs = mockDialogs.Object; App.Current.Config.AutoSave = true; App.Current.LicenseManager = mockLicenseManager.Object; App.Current.LicenseLimitationsService = mockLicenseLimitationService.Object; App.Current.PreviewService = new Mock <IPreviewService> ().Object; CoreServices.Start(App.Current.GUIToolkit, App.Current.MultimediaToolkit); // Start importing templates App.Current.TeamTemplatesProvider.Save( App.Current.TeamTemplatesProvider.LoadFile(Utils.SaveResource("spain.ltt", tmpPath))); App.Current.TeamTemplatesProvider.Save( App.Current.TeamTemplatesProvider.LoadFile(Utils.SaveResource("france.ltt", tmpPath))); App.Current.CategoriesTemplatesProvider.Save( App.Current.CategoriesTemplatesProvider.LoadFile(Utils.SaveResource("basket.lct", tmpPath))); Assert.AreEqual(4, App.Current.TeamTemplatesProvider.Templates.Count); Assert.AreEqual(2, App.Current.CategoriesTemplatesProvider.Templates.Count); // Create a new project and open it LMProject p = CreateProject(); projectID = p.ID; LMProjectAnalysisVM viewModel; viewModel = new LMProjectAnalysisVM(); IVideoPlayerController playerController = new Mock <IVideoPlayerController> ().Object; viewModel.Project = new LMProjectVM { Model = p }; viewModel.VideoPlayer = new VideoPlayerVM { Player = playerController }; eventsController.SetViewModel(viewModel); // Do controllers start in here since the EventBroker is instantiante again in the test await eventsController.Start(); toolsManager.Start(); App.Current.DatabaseManager.ActiveDB.Store <LMProject> (p, true); // Tag some events Assert.AreEqual(0, p.Timeline.Count); AddEvent(p, 5, 3000, 3050, 3025); Assert.AreEqual(1, p.Timeline.Count); LMProject savedP = App.Current.DatabaseManager.ActiveDB.Retrieve <LMProject> (p.ID); Assert.AreEqual(1, savedP.Timeline.Count); AddEvent(p, 6, 3000, 3050, 3025); AddEvent(p, 7, 3000, 3050, 3025); AddEvent(p, 8, 3000, 3050, 3025); AddEvent(p, 5, 3000, 3050, 3025); Assert.AreEqual(5, p.Timeline.Count); savedP = App.Current.DatabaseManager.ActiveDB.Retrieve <LMProject> (p.ID); Assert.AreEqual(5, savedP.Timeline.Count); // Delete some events var events = new List <TimelineEvent> { p.Timeline [0], p.Timeline [1] }; await App.Current.EventsBroker.Publish <EventsDeletedEvent> ( new EventsDeletedEvent { TimelineEvents = events.Select(e => new TimelineEventVM() { Model = e }) } ); Assert.AreEqual(3, p.Timeline.Count); savedP = App.Current.DatabaseManager.ActiveDB.Retrieve <LMProject> (p.ID); Assert.AreEqual(3, savedP.Timeline.Count); // Now create a new LMProject with the same templates LMProject newProject = CreateProject(); viewModel.Project.Model = newProject; App.Current.DatabaseManager.ActiveDB.Store <LMProject> (newProject); Assert.AreEqual(2, App.Current.DatabaseManager.ActiveDB.Count <LMProject> ()); // Add some events and than remove it from the DB AddEvent(newProject, 6, 3000, 3050, 3025); AddEvent(newProject, 7, 3000, 3050, 3025); AddEvent(newProject, 8, 3000, 3050, 3025); AddEvent(newProject, 5, 3000, 3050, 3025); App.Current.DatabaseManager.ActiveDB.Delete <LMProject> (newProject); // Reopen the old project savedP = App.Current.DatabaseManager.ActiveDB.RetrieveAll <LMProject> ().FirstOrDefault(pr => pr.ID == projectID); viewModel.Project.Model = savedP; await App.Current.EventsBroker.Publish <SaveProjectEvent> ( new SaveProjectEvent { Project = savedP, ProjectType = ProjectType.FileProject } ); // Export this project to a new file savedP = App.Current.DatabaseManager.ActiveDB.Retrieve <LMProject> (projectID); Assert.AreEqual(3, savedP.Timeline.Count); Assert.AreEqual(12, savedP.LocalTeamTemplate.List.Count); Assert.AreEqual(12, savedP.VisitorTeamTemplate.List.Count); string tmpFile = Path.Combine(tmpPath, "longomatch.lgm"); mockDialogs.Setup(g => g.SaveFile(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string []> ())).Returns(tmpFile); await App.Current.EventsBroker.Publish <ExportProjectEvent> (new ExportProjectEvent { Project = p }); Assert.IsTrue(File.Exists(tmpFile)); savedP = Project.Import(tmpFile) as LMProject; Assert.IsNotNull(savedP); // Import a new project LongoMatchImporter importPlugin = new LongoMatchImporter(); ProjectImporter importer = new ProjectImporter { Description = importPlugin.Description + " test ", ImportFunction = new Func <Project> (importPlugin.ImportProject), FilterName = importPlugin.FilterName, Extensions = importPlugin.FilterExtensions, NeedsEdition = importPlugin.NeedsEdition, CanOverwrite = importPlugin.CanOverwrite, }; CoreServices.toolsManager.ProjectImporters.Add(importer); string projectPath = Utils.SaveResource("spain_france_test.lgm", tmpPath); mockDialogs.Setup(g => g.ChooseOption( It.IsAny <Dictionary <string, object> > (), It.IsAny <string> (), It.IsAny <object> ())). Returns(Task.Factory.StartNew(() => (object)importer) ); mockDialogs.Setup(g => g.OpenFile(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string []> ())).Returns(projectPath); await App.Current.EventsBroker.Publish <ImportProjectEvent> (new ImportProjectEvent()); Assert.AreEqual(2, App.Current.DatabaseManager.ActiveDB.Count <LMProject> ()); LMProject importedProject = App.Current.DatabaseManager.ActiveDB.RetrieveAll <LMProject> (). SortByCreationDate(true).ToList() [0]; Assert.IsNotNull(importedProject); Assert.AreNotEqual(importedProject.ID, p.ID); int eventsCount = p.Timeline.Count; AddEvent(p, 2, 3000, 3050, 3025); AddEvent(p, 3, 3000, 3050, 3025); savedP = App.Current.DatabaseManager.ActiveDB.Retrieve <LMProject> (p.ID); Assert.AreEqual(eventsCount + 2, savedP.Timeline.Count); await eventsController.Stop(); toolsManager.Stop(); }
public void SetUp() { Importer = new(); }