protected override void DoTest() { RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("Rat_Plasma.sky"))); WaitForDocumentLoaded(); String v36Path = TestFilesDir.GetTestPath("Version36.sky.zip"); RunUI(() => SkylineWindow.ShareDocument(v36Path, ShareType.COMPLETE.ChangeSkylineVersion(SkylineVersion.V3_6))); using (ZipFile zipFile = new ZipFile(v36Path)) { ZipEntry zipEntryDocument = zipFile.Entries.First(entry => entry.FileName == "Rat_Plasma.sky"); using (var stream = zipEntryDocument.OpenReader()) { using (var xmlReader = new XmlTextReader(stream)) { var xmlDocument = new XmlDocument(); xmlDocument.Load(xmlReader); Assert.IsNotNull(xmlDocument.DocumentElement); Assert.AreEqual("3.6", xmlDocument.DocumentElement.GetAttribute("format_version")); } } ZipEntry zipEntrySkyd = zipFile.Entries.First(entry => entry.FileName == "Rat_Plasma.skyd"); using (var stream = zipEntrySkyd.OpenReader()) { var memoryStream = new MemoryStream(); CopyStreamTo(stream, memoryStream); CacheHeaderStruct cacheHeader = CacheHeaderStruct.Read(memoryStream); Assert.AreEqual(CacheFormatVersion.Eleven, cacheHeader.formatVersion); } } }
internal CacheHeader(CacheHeaderStruct s) { Unknown8 = s.Unknown8; AssetChecksum = s.AssetChecksum; Unknown18 = s.Unknown18; HeaderSize = s.HeaderSize; TagDataSize = s.TagDataSize; ResourceDataSize = s.ResourceDataSize; HeaderAlignment = s.HeaderAlignment; TagDataAlignment = s.TagDataAlignment; ResourceDataAlignment = s.ResourceDataAlignment; Unknown4B = s.Unknown4B; Unknown4C = s.Unknown4C; ZoneSetInfo = s.ZoneSetInfo; _dependencies = s.Dependencies.Select(ss => new TagDependency(ss, s.StringTable)).ToList(); _dataBlocks = s.DataBlocks.Select(ss => new DataBlockDefinition(ss)).ToList(); _tagStructs = s.TagStructs.Select(ss => new TagStructDefinition(ss)).ToList(); _dataReferences = s.DataReferences.Select(ss => new DataReferenceDefinition(ss)).ToList(); _tagReferences = s.TagReferences.Select(ss => new TagReferenceDefinition(ss, s.StringTable)).ToList(); _stringIds = s.StringIds.Select(ss => new StringIdDefinition(ss, s.StringTable)).ToList(); Dependencies = _dependencies.AsReadOnly(); DataBlocks = _dataBlocks.AsReadOnly(); TagStructs = _tagStructs.AsReadOnly(); DataReferences = _dataReferences.AsReadOnly(); TagReferences = _tagReferences.AsReadOnly(); StringIds = _stringIds.AsReadOnly(); }
public static long CacheSize(SrmDocument docInitial, long format3Size, int groupCount, int tranCount, int peakCount) { long cacheSize = format3Size; int fileCachedCount = docInitial.Settings.MeasuredResults.MSDataFileInfos.Count(); if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_3) { // Cache version 4 stores instrument information, and is bigger in size. cacheSize += sizeof(int) * fileCachedCount; } if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_4) { // Cache version 5 adds an int for flags for each file // Allow for a difference in sizes due to the extra information. int fileFlagsSize = sizeof(int) * fileCachedCount; // And SeqIndex, SeqCount, StartScoreIndex and padding var deltaSize5 = ChromGroupHeaderInfo.GetStructSize(CacheFormatVersion.Five) - ChromGroupHeaderInfo.GetStructSize(CacheFormatVersion.Four); int groupHeadersSize = deltaSize5 * groupCount; // And flags for each transition int transitionFlagsSize = ChromTransition5.DeltaSize5 * tranCount; // And num seq byte count, seq location, score types, num scores and score location const int headerScoreSize = sizeof(int) + sizeof(long) + sizeof(int) + sizeof(int) + sizeof(long); cacheSize += groupHeadersSize + fileFlagsSize + transitionFlagsSize + headerScoreSize; } if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_5) { // Cache version 6 adds status graph dimensions for every file cacheSize += sizeof(float) * 2 * fileCachedCount; } if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_6) { // Cache version 7 adds ion mobility information cacheSize += sizeof(float) * 2 * tranCount; } if (ChromatogramCache.FORMAT_VERSION_CACHE > ChromatogramCache.FORMAT_VERSION_CACHE_8) { // Cache version 9 adds scan id values for every file cacheSize += (sizeof(int) + sizeof(long)) * fileCachedCount; // And scan ids location to global header cacheSize += sizeof(long); } if (ChromatogramCache.FORMAT_VERSION_CACHE >= ChromatogramCache.FORMAT_VERSION_CACHE_11) { // Version 11 adds uncompressed buffer size for convenience, and some time span metadata cacheSize += ChromGroupHeaderInfo.DeltaSize11 * groupCount; } if (ChromatogramCache.FORMAT_VERSION_CACHE >= CacheFormatVersion.Twelve) { cacheSize += peakCount * (ChromPeak.GetStructSize(CacheFormatVersion.Twelve) - ChromPeak.GetStructSize(CacheFormatVersion.Eleven)); cacheSize += tranCount * (ChromTransition.GetStructSize(CacheFormatVersion.Twelve) - ChromTransition.GetStructSize(CacheFormatVersion.Eleven)); } cacheSize += fileCachedCount * (CachedFileHeaderStruct.GetStructSize(ChromatogramCache.FORMAT_VERSION_CACHE) - CachedFileHeaderStruct.GetStructSize(CacheFormatVersion.Nine)); cacheSize += CacheHeaderStruct.GetStructSize(ChromatogramCache.FORMAT_VERSION_CACHE) - CacheHeaderStruct.GetStructSize(ChromatogramCache.FORMAT_VERSION_CACHE_11); return(cacheSize); }