public void Downgrade() { if (fileMLVersion < TConstants.NewTmodVersion) { return; } fileTable = null; foreach (var kvp in files) { kvp.Value.OriginalData = GetTrueBytes(kvp.Value); kvp.Value.CompressedLength = kvp.Value.Length = kvp.Value.OriginalData.Length; kvp.Value.Offset = -1; } fileMLVersion = TConstants.OldTmodVersion; var buildProp = BuildProperties.ReadFromModFile(this); if (new Version(buildProp.BuildVersion) >= TConstants.NewTmodVersion) { buildProp.BuildVersion = TConstants.OldTmodVersion.ToString(); ReplaceFile(TConstants.InfoFileName, buildProp.ToBytes()); } Close(); }
public void Upgrade() { if (fileMLVersion >= TConstants.NewTmodVersion) { return; } fileTable = null; foreach (var fe in files) { CheckAndCompress(fe.Value); } fileMLVersion = TConstants.NewestTmodVersion; var buildProp = BuildProperties.ReadFromModFile(this); buildProp.BuildVersion = TConstants.NewestTmodVersion.ToString(); ReplaceFile(TConstants.InfoFileName, buildProp.ToBytes()); Close(); }