4 using System.Collections.Generic;
8 using SiliconStudio.Core;
9 using SiliconStudio.Core.IO;
10 using SiliconStudio.Core.Storage;
12 namespace SiliconStudio.
Paradox.StorageTool
19 public string Location {
get; set; }
23 public long Size {
get; set; }
25 public long SizeNotCompressed {
get; set; }
29 return string.Format(
"{0}\t{1}\t{2}\t{3}", Location, Id, Size, SizeNotCompressed);
42 public static void View(
string bundlePath)
44 var entries = GetBundleListing(bundlePath);
45 var dumpFilePath = bundlePath +
".txt";
47 var text =
new StringBuilder();
48 foreach (var entry
in entries)
50 text.AppendLine(entry.ToString());
52 File.WriteAllText(dumpFilePath, text.ToString());
54 System.Diagnostics.Process.Start(dumpFilePath);
62 private static List<ObjectEntry> GetBundleListing(
string bundlePath)
64 if (bundlePath == null)
throw new ArgumentNullException(
"bundlePath");
66 if (!
File.Exists(bundlePath))
throw new StorageAppException(
"Bundle file [{0}] not found".ToFormat(bundlePath));
69 using (var stream = File.OpenRead(bundlePath))
71 bundle = BundleOdbBackend.ReadBundleDescription(stream);
74 var objectInfos = bundle.Objects.ToDictionary(x => x.Key, x => x.Value);
77 var entries =
new List<ObjectEntry>();
78 foreach (var locationIds
in bundle.
Assets)
80 var entry =
new ObjectEntry { Location = locationIds.Key, Id = locationIds.Value };
83 if (objectInfos.TryGetValue(entry.Id, out objectInfo))
86 entry.Size = objectInfo.EndOffset - objectInfo.StartOffset;
87 entry.SizeNotCompressed = objectInfo.SizeNotCompressed;
Object Database Backend (ODB) implementation that bundles multiple chunks into a .bundle files, optionally compressed with LZ4.
Description of a bundle: header, dependencies, objects and assets.
A hash to uniquely identify data.
List< KeyValuePair< string, ObjectId > > Assets
const string BundleExtension
The bundle file extension.
override string ToString()
Description of an object entry in the bundle.