internal byte[] Export() { if (!this.IsExportable) { throw new InvalidOperationException(Strings.ClassificationRuleCollectionExportEncyrptedProhibited); } TransportRule storedRuleCollection = base.StoredRuleCollection; ExAssert.RetailAssert(storedRuleCollection != null, "The classification rule collection presentation object should store reference to its backing transport rule instance."); byte[] result; Exception ex; bool condition = ClassificationDefinitionUtils.TryUncompressXmlBytes(storedRuleCollection.ReplicationSignature, out result, out ex); ExAssert.RetailAssert(condition, "Decompression of classification rule collection must succeed since the presentation was initialized successfully before. Details: {0}", new object[] { (ex != null) ? ex.ToString() : string.Empty }); return(result); }
internal static XDocument GetRuleCollectionDocumentFromTransportRule(TransportRule transportRule) { if (transportRule == null) { throw new ArgumentNullException("transportRule"); } if (!ClassificationDefinitionUtils.IsAdObjectAClassificationRuleCollection(transportRule)) { throw new InvalidOperationException(); } if (transportRule.ReplicationSignature == null) { throw new ArgumentException(new ArgumentException().Message, "transportRule"); } byte[] bytes; Exception ex; if (!ClassificationDefinitionUtils.TryUncompressXmlBytes(transportRule.ReplicationSignature, out bytes, out ex)) { throw new AggregateException(new Exception[] { ex }); } XDocument result; try { result = XDocument.Parse(Encoding.Unicode.GetString(bytes)); } catch (ArgumentException ex2) { throw new AggregateException(new Exception[] { ex2 }); } return(result); }