Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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;
        }