public ImmutableList <byte> GetNewTextId(ChromGroupHeaderInfo chromGroupHeaderInfo) { byte[] textIdBytes = _originalCache.GetTextIdBytes(chromGroupHeaderInfo.TextIdIndex, chromGroupHeaderInfo.TextIdLen); if (textIdBytes == null) { return(null); } const CacheFormatVersion versionNewTextId = CacheFormatVersion.Thirteen; ImmutableList <byte> newTextId; if (_originalCache.Version < versionNewTextId || _cacheFormat.FormatVersion >= versionNewTextId) { newTextId = ImmutableList.ValueOf(textIdBytes); } else { if (textIdBytes[0] == '#') { newTextId = ImmutableList.ValueOf(textIdBytes); } else { var oldKey = new PeptideLibraryKey(Encoding.UTF8.GetString(textIdBytes), 0); var newKey = oldKey.FormatToOneDecimal(); newTextId = ImmutableList.ValueOf(Encoding.UTF8.GetBytes(newKey.ModifiedSequence)); } } return(newTextId); }
// ReSharper disable NonLocalizedString public static int GetStructSize(CacheFormatVersion formatVersion) { if (formatVersion >= CacheFormatVersion.Thirteen) { return(52); } if (formatVersion > CacheFormatVersion.Eight) { return(48); } else if (formatVersion > CacheFormatVersion.Five) { return(36); } else if (formatVersion > CacheFormatVersion.Four) { return(28); } else if (formatVersion > CacheFormatVersion.Three) { return(24); } else if (formatVersion > CacheFormatVersion.Two) { return(20); } else { return(12); } }
private SkylineVersion(Func <String> getLabelFunc, String versionName, CacheFormatVersion cacheFormatVersion, DocumentFormat srmDocumentVersion) { _getLabelFunc = getLabelFunc; InvariantVersionName = versionName; CacheFormatVersion = cacheFormatVersion; SrmDocumentVersion = srmDocumentVersion; }
public ShareType DecideShareType(FolderInformation folderInfo, SrmDocument document) { ShareType shareType = ShareType.DEFAULT; var settings = document.Settings; Assume.IsTrue(document.IsLoaded); var cacheVersion = settings.HasResults ? settings.MeasuredResults.CacheVersion : null; if (!cacheVersion.HasValue) { // The document may not have any chromatogram data. return(shareType); } CacheFormatVersion supportedVersion = GetSupportedSkydVersion(folderInfo); if (supportedVersion >= cacheVersion.Value) { return(shareType); } var skylineVersion = SkylineVersion.SupportedForSharing().FirstOrDefault(ver => ver.CacheFormatVersion <= supportedVersion); if (skylineVersion == null) { throw new PanoramaServerException(string.Format( Resources.PublishDocumentDlg_ServerSupportsSkydVersion_, (int)cacheVersion.Value)); } return(shareType.ChangeSkylineVersion(skylineVersion)); }
public static CacheFormat FromVersion(CacheFormatVersion formatVersion) { if (formatVersion > CacheFormatVersion.CURRENT) { throw new NotSupportedException(); } CacheFormatVersion versionRequired; if (formatVersion.CompareTo(CacheHeaderStruct.WithStructSizes) >= 0) { versionRequired = CacheHeaderStruct.WithStructSizes; } else { versionRequired = formatVersion; } return(new CacheFormat { FormatVersion = formatVersion, VersionRequired = versionRequired, ChromPeakSize = ChromPeak.GetStructSize(formatVersion), ChromTransitionSize = ChromTransition.GetStructSize(formatVersion), CachedFileSize = CachedFileHeaderStruct.GetStructSize(formatVersion), ChromGroupHeaderSize = ChromGroupHeaderInfo.GetStructSize(formatVersion) }); }
public static StructSerializer <CacheHeaderStruct> GetStructSerializer(CacheFormatVersion cacheFormatVersion) { return(new StructSerializer <CacheHeaderStruct>() { ItemSizeOnDisk = GetStructSize(cacheFormatVersion), PadFromStart = true }); }
public CacheHeaderStruct(CacheFormat cacheFormat) : this() { chromPeakSize = cacheFormat.ChromPeakSize; chromTransitionSize = cacheFormat.ChromTransitionSize; chromGroupHeaderSize = cacheFormat.ChromGroupHeaderSize; cachedFileSize = cacheFormat.CachedFileSize; formatVersion = cacheFormat.FormatVersion; versionRequired = cacheFormat.VersionRequired; }
public static int GetStructSize(CacheFormatVersion cacheFormatVersion) { if (cacheFormatVersion >= WithStructSizes) { return(Marshal.SizeOf <CacheHeaderStruct>()); } if (cacheFormatVersion >= CacheFormatVersion.Nine) { return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"locationScanIds")); } if (cacheFormatVersion >= CacheFormatVersion.Five) { return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"numScoreTypes")); } return(Marshal.SizeOf <CacheHeaderStruct>() - (int)Marshal.OffsetOf <CacheHeaderStruct>(@"formatVersion")); }
private SkylineVersion(Func <String> getLabelFunc, String versionName, CacheFormatVersion cacheFormatVersion, DocumentFormat srmDocumentVersion) : base(versionName, getLabelFunc) { CacheFormatVersion = cacheFormatVersion; SrmDocumentVersion = srmDocumentVersion; }