コード例 #1
0
ファイル: AssetWorkspace.cs プロジェクト: roffyy/UABEA
        public void RemoveReplacer(AssetsFileInstance forFile, AssetsReplacer replacer, bool closePreviewStream = true)
        {
            AssetID assetId = new AssetID(forFile.name, replacer.GetPathID());

            if (NewAssets.ContainsKey(assetId))
            {
                NewAssets.Remove(assetId);
            }
            if (NewAssetDatas.ContainsKey(assetId))
            {
                if (closePreviewStream)
                {
                    NewAssetDatas[assetId].Close();
                }
                NewAssetDatas.Remove(assetId);
            }

            if (ItemUpdated != null)
            {
                ItemUpdated(assetId);
            }

            if (NewAssets.Count == 0)
            {
                Modified = false;
            }
        }
コード例 #2
0
        public AssetContainer GetAssetContainer(AssetItem item)
        {
            var fileInst = LoadedFiles[item.FileID];
            var assetId  = new AssetID(fileInst.path, item.PathID);

            if (!LoadedContainers.TryGetValue(assetId, out var cont))
            {
                return(null);
            }

            if (cont.HasInstance)
            {
                return(cont);
            }

            var newData = NewAssetDatas.ContainsKey(assetId);

            cont = newData ? MakeAssetContainer(item, NewAssetDatas[assetId]) : MakeAssetContainer(item);
            LoadedContainers[assetId] = cont;
            return(cont);
        }
コード例 #3
0
        public void RemoveReplacer(AssetsReplacer replacer, bool closePreviewStream = true)
        {
            if (replacer == null)
            {
                return;
            }
            var forInstance = LoadedFiles[replacer.GetFileID()];
            var assetId     = new AssetID(forInstance.path, replacer.GetPathID());

            NewAssets.Remove(assetId);
            if (NewAssetDatas.ContainsKey(assetId))
            {
                if (closePreviewStream)
                {
                    NewAssetDatas[assetId].Close();
                }
                NewAssetDatas.Remove(assetId);
            }

            Modified = NewAssets.Count != 0;
        }