void SaveContainerXml(IBundleContainer bundleContainer) { var assetCounter = new AssetCounter(); assetCounter.Visit(bundleContainer.Bundles); var xml = new XDocument( new XElement( "Container", new XAttribute("Version", version), new XAttribute("AssetCount", assetCounter.Count), from bundle in bundleContainer.Bundles select CreateBundleElement(bundle, bundleContainer) ) ); using (var fileStream = containerFile.Open(FileMode.Create, FileAccess.Write, FileShare.None)) { xml.Save(fileStream); } }
bool IsSameAssetCount(IEnumerable <Bundle> unprocessedSourceBundles, XElement containerXml) { var assetCountAttribute = containerXml.Attribute("AssetCount"); if (assetCountAttribute == null) { return(false); } int assetCount; if (int.TryParse(assetCountAttribute.Value, out assetCount) == false) { return(false); } var assetCounter = new AssetCounter(); assetCounter.Visit(unprocessedSourceBundles); return(assetCount == assetCounter.Count); }
bool IsSameAssetCount(IEnumerable<Bundle> unprocessedSourceBundles, XElement containerXml) { var assetCountAttribute = containerXml.Attribute("AssetCount"); if (assetCountAttribute == null) return false; int assetCount; if (int.TryParse(assetCountAttribute.Value, out assetCount) == false) return false; var assetCounter = new AssetCounter(); assetCounter.Visit(unprocessedSourceBundles); return assetCount == assetCounter.Count; }