/// <summary> /// Gets the external attributes generator. /// </summary> /// <param name="targetPlatform"> /// The target platform. /// </param> /// <returns> /// External attribute generator interface /// </returns> public static IPlatformTraits GetPlatformTraits(ZipPlatform targetPlatform) { if (targetPlatform == ZipPlatform.Unix) { return(new PosixPlatformTraits()); } return(new WindowsPlatformTraits()); }
public static void Zip(string zipFile, string path, int compressionLevel, ZipPlatform targetPlatform) { Zip(new CrossPlatformZipSettings { Artifacts = path, ZipFile = zipFile, CompressionLevel = compressionLevel, TargetPlatform = targetPlatform }); }
public static void ZipSingleFile( string zipFile, string filePath, string alternateName, int compressionLevel, ZipPlatform targetPlatform) { ZipSingleFile( new CrossPlatformZipSettings { Artifacts = filePath, ZipFile = zipFile, AlternateFileName = alternateName, CompressionLevel = compressionLevel, TargetPlatform = targetPlatform, LogMessage = Console.WriteLine, LogError = Console.Error.WriteLine }); }
public static bool CheckZipPlatform() { string p = CUtils.platform; var names = System.Enum.GetNames(typeof(ZipPlatform)); bool c = false; foreach (var s in names) { if (s.ToLower() == p.ToLower()) { c = true; } } if (c) { ZipPlatform curr = (ZipPlatform)System.Enum.Parse(typeof(ZipPlatform), p, true); Debug.Log(curr); if ((curr & HugulaEditorSetting.instance.zipPlatform) != 0) { return(true); } } return(false); }
/// <summary> /// Creates the zip file. /// </summary> /// <param name="zipFile"> /// The zip file. /// </param> /// <param name="compressionLevel">Compression level (0 = store, 9 = best)</param> /// <param name="targetPlatform"> /// The target Platform. /// </param> /// <returns> /// Open <see cref="ZipOutputStream"/> /// </returns> private static ZipOutputStream CreateZipFile(string zipFile, int compressionLevel, ZipPlatform targetPlatform) { if (compressionLevel < 0 || compressionLevel > 9) { throw new ArgumentException("Compression level must be between 0 and 9", nameof(compressionLevel)); } if (Environment.UserInteractive) { Console.WriteLine( $"Creating zip file '{zipFile}' with target platform {targetPlatform} and compression level {compressionLevel} (9 = best)"); } var stream = new ZipOutputStream(File.Create(zipFile)); stream.SetLevel(compressionLevel); return(stream); }