public Package(string directory, string name, string versionName, string license) { RootDirectory = directory; Name = name; License = license; VersionName = versionName; LoadedTypes = new ObservableCollection <Type>(); LoadedAssemblies = new ObservableCollection <PackageAssembly>(); Dependencies = new ObservableCollection <PackageDependency>(); LoadedCustomNodes = new ObservableCollection <CustomNodeInfo>(); AdditionalFiles = new ObservableCollection <PackageFileInfo>(); Header = PackageUploadBuilder.NewRequestBody(this); }
private static PackageVersionUpload BuildPackageVersionUpload(PackageUploadRequestBody pkgHeader, string zipPath) { return(new PackageVersionUpload(pkgHeader.name, pkgHeader.version, pkgHeader.description, pkgHeader.keywords, pkgHeader.contents, "dynamo", pkgHeader.engine_version, pkgHeader.engine_metadata, pkgHeader.group, zipPath, pkgHeader.dependencies)); }
private static void WritePackageHeader(PackageUploadRequestBody pkgHeader, DirectoryInfo rootDir) { // build the package header json, which will be stored with the pkg var jsSer = new JsonSerializer(); var pkgHeaderStr = jsSer.Serialize(pkgHeader); // write the pkg header to the root directory of the pkg var headerPath = Path.Combine(rootDir.FullName, "pkg.json"); if (File.Exists(headerPath)) { File.Delete(headerPath); } File.WriteAllText(headerPath, pkgHeaderStr); }
public PackageUploadHandle(PackageUploadRequestBody header) { this.Header = header; }
private static string DoPackageFileOperationsAndZip(string rootPkgDir, CustomNodeManager customNodeManager, PackageUploadRequestBody header, Package pkg, List <string> files, PackageUploadHandle uploadHandle, bool isTestMode) { uploadHandle.UploadState = PackageUploadHandle.State.Copying; DirectoryInfo rootDir, dyfDir, binDir, extraDir; FormPackageDirectory(rootPkgDir, pkg.Name, out rootDir, out dyfDir, out binDir, out extraDir); // shouldn't do anything for pkg versions pkg.RootDirectory = rootDir.FullName; WritePackageHeader(header, rootDir); CopyFilesIntoPackageDirectory(files, dyfDir, binDir, extraDir); RemoveDyfFiles(files, dyfDir); RemapCustomNodeFilePaths(customNodeManager, files, dyfDir.FullName, isTestMode); uploadHandle.UploadState = PackageUploadHandle.State.Compressing; string zipPath; FileInfo info; try { zipPath = Greg.Utility.FileUtilities.Zip(rootDir.FullName); info = new FileInfo(zipPath); } catch { // give nicer error throw new Exception(Properties.Resources.CouldNotCompressFile); } if (info.Length > 100 * 1024 * 1024) { throw new Exception(Properties.Resources.PackageTooLarge); } return(zipPath); }