Esempio n. 1
0
 /// <summary>
 /// 清除单个文件
 /// </summary>
 /// <param name="Path"></param>
 public void Clearn(string Path)
 {
     Path = Application.streamingAssetsPath + "/" + Path;
     if (MapDict.ContainsKey(Path))
     {
         MapDict[Path].Clear();
         MapDict.Remove(Path);
     }
     if (IDList.ContainsKey(Path))
     {
         IDList[Path].Clear();
         IDList.Remove(Path);
     }
 }
Esempio n. 2
0
        protected virtual void ProcessTree([NotNull] ProcessIntegrationItemsOptions processIntegrationItemsOptions, [NotNull] SynchContext synchContext)
        {
            Assert.ArgumentNotNull(processIntegrationItemsOptions, "processIntegrationItemsOptions");
            Assert.ArgumentNotNull(synchContext, "synchContext");

            IntegrationCache.AddIntegrationConfigData(synchContext.ParentID, synchContext.IntegrationConfigData, (synchContext.IntegrationConfigData.ExpirationInterval > 0) ? synchContext.IntegrationConfigData.ExpirationInterval : DefaultTimeout);

            // IDList existenChildrenList = new IDList();
            // foreach (Item it in SynchContext.ParentItem.GetChildren())
            // {
            //   existenChildrenList.Add(it.ID);
            // }
            IDList existenChildrenList = synchContext.Database.DataManager.DataSource.GetChildIDs(synchContext.ParentID);

            var existenList = new List <ID>(existenChildrenList.Cast <ID>());

            foreach (SharepointBaseItem listItem in this.GetSubItems(this.GetList(synchContext.IntegrationConfigData), synchContext.IntegrationConfigData))
            {
                ID id = Utils.GetID(synchContext.ParentID.ToString(), listItem.UniqueID);

                bool itemExist = existenList.IndexOf(id) != -1;

                if (Switcher <bool, SynchDisabler> .CurrentValue == false)
                {
                    if (itemExist)
                    {
                        if (IsActiveIntegrationDataItem(id, synchContext.Database))
                        {
                            IntegrationPipelinesRunner.UpdateIntegrationItem(id, listItem, synchContext, processIntegrationItemsOptions, EventSender.Sharepoint);
                        }

                        existenChildrenList.Remove(id);
                    }
                    else
                    {
                        IntegrationPipelinesRunner.CreateIntegrationItem(id, listItem, synchContext, processIntegrationItemsOptions, EventSender.Sharepoint);
                    }
                }

                if (listItem is FolderItem)
                {
                    if (IsActiveIntegrationDataItem(id, synchContext.Database))
                    {
                        var newSynchContext = new SynchContext(id, synchContext.Database);
                        if (processIntegrationItemsOptions.Recursive)
                        {
                            ProcessTree(processIntegrationItemsOptions, newSynchContext);
                        }
                    }
                }

                IntegrationCache.AddIntegrationItemInfo(id, listItem, synchContext.ParentID, (synchContext.IntegrationConfigData.ExpirationInterval > 0) ? synchContext.IntegrationConfigData.ExpirationInterval : DefaultTimeout);
            }

            if (Switcher <bool, SynchDisabler> .CurrentValue == false)
            {
                foreach (ID id in existenChildrenList)
                {
                    if (IsActiveIntegrationDataItem(id, synchContext.Database))
                    {
                        IntegrationPipelinesRunner.DeleteIntegrationItem(id, synchContext);
                    }
                }
            }
        }