public override ProjectInfoBase Load(IFile projectFile) { if (!projectFile.Exists || !Path.GetFileName(projectFile.Name).Equals($"info{ExtensionTypes.First().Extension}", StringComparison.OrdinalIgnoreCase)) { return(null); } var projectFolder = new FolderFromPath(Path.GetDirectoryName(projectFile.Path), true); return(new FactorioProjectInfo(projectFolder, projectFile, this)); }
public override async Task Run(Command command) { if (!(_windowManager.ShowDialog(_newProjectDialog) is bool result) || !result) { return; } var root = new FolderFromPath(_newProjectDialog.RootLocation); var solutionName = _newProjectDialog.SolutionName.TrimStart().TrimEnd(); var solutionFolder = await root.CreateFolderAsync(_newProjectDialog.SolutionName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false); var projectName = _newProjectDialog.ProjectName.TrimStart().TrimEnd(); var projectFolder = _newProjectDialog.ProjectInRoot ? new FolderFromPath(solutionFolder.Path) : await solutionFolder.CreateFolderAsync(projectName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false); var solutionData = new SolutionDataBase() { Name = solutionName, Projects = { new ProjectData() { Name = projectName, Path = solutionFolder.GetProjectPath(projectFolder) } } }; var solutionProvider = new FactrIDESolutionProvider(); var solutioFile = await solutionProvider.Create(solutionData, solutionFolder).ConfigureAwait(false); var solutionInfo = await solutionProvider.Load(solutioFile).ConfigureAwait(false); _solutionExplorer.Load(solutionInfo); }