private static void SetFileInfo(KeyValueConfig config, string type, string hash, EncodingFile encoding) { if (!MD5Hash.TryParse(hash, out var ekey)) { return; } if (!encoding.TryGetEKeyEntry(ekey, out var encodedEntry)) { return; } var contentEntry = encoding.GetCKeyEntryByEKey(ekey); if (contentEntry == null) { return; } config.SetValue(type, contentEntry.CKey, 0); if (type != "root") { config.SetValue(type, hash, 1); config.SetValue(type + "-size", contentEntry.DecompressedSize, 0); config.SetValue(type + "-size", encodedEntry.CompressedSize, 1); } }
public static void BuildConfig(UnshippedBuild model, EncodingFile encoding, long eSize, long eCompressedSize) { var config = new KeyValueConfig(ConfigType.BuildConfig); SetFileInfo(config, "root", model.Root, encoding); SetFileInfo(config, "install", model.Install, encoding); SetFileInfo(config, "download", model.Download, encoding); SetFileInfo(config, "size", model.Size, encoding); config.SetValue("encoding", encoding.Checksum, 0); config.SetValue("encoding", model.Encoding, 1); config.SetValue("encoding-size", eSize, 0); config.SetValue("encoding-size", eCompressedSize, 1); config.SetValue("build-name", GetBuildName(model.Product, model.Build)); config.SetValue("build-uid", model.Product); config.Write(Consts.TempDir); }