public ImportedExternalSDK GenerateBSPForSDK(ImportedSDKLocation location, ISDKImportHost host) { var bsp = ParseKSDKManifest(location.Directory, host.WarningSink); bsp.Save(location.Directory); return(new ImportedExternalSDK { BSPID = bsp.BSP.PackageID }); }
public ImportedExternalSDK GenerateBSPForSDK(ImportedSDKLocation location, ISDKImportHost host) { string[] manifestFiles = Directory.GetFiles(location.Directory, "*manifest*.xml"); if (manifestFiles.Length < 1) { throw new Exception($"No manifest files in {location.Directory}"); } string manifestFile = Directory.GetFiles(location.Directory, "*manifest*.xml")[0]; XmlDocument doc = new XmlDocument(); doc.Load(manifestFile); var bsp = new ParserImpl(location.Directory, doc, host.WarningSink).ParseKSDKManifest(host); bsp.Save(location.Directory); return(new ImportedExternalSDK { BSPID = bsp.BSP.PackageID, Directory = location.Directory }); }
public ImportedExternalSDK GenerateBSPForSDK(ImportedSDKLocation location, ISDKImportHost host) { string temporaryDir = Path.Combine(host.GetDefaultDirectoryForImportedSDKs("arm-eabi"), Guid.NewGuid().ToString()); Directory.CreateDirectory(temporaryDir); try { host.ExtractZIPFile(location.OriginallySelectedFile, temporaryDir); var bsp = GenerateBSPForSTARTProject(temporaryDir, host.WarningSink); string newDir = Path.Combine(Path.GetDirectoryName(temporaryDir), bsp.PackageID); if (Directory.Exists(newDir)) { if (!host.AskWarn($"{newDir} already exists. Overwrite?")) { throw new OperationCanceledException(); } host.DeleteDirectoryRecursively(newDir); } Directory.Move(temporaryDir, newDir); return(new ImportedExternalSDK { BSPID = bsp.PackageID, Directory = newDir }); } catch { try { host.DeleteDirectoryRecursively(temporaryDir); } catch { } throw; } }