public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            string r;

            object var;
            if (VSErr.Succeeded(ProjectHierarchy.GetProperty(itemidAdded, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, out var))
                && (bool)var)
            {
                return VSErr.S_OK; // Extra item for show all files
            }

            if (_loaded)
            {
                if (VSErr.Succeeded(VsProject.GetMkDocument(itemidAdded, out r))
                    && SvnItem.IsValidPath(r))
                {
                    // Check out VSHPROPID_IsNewUnsavedItem
                    if (!SvnItem.PathExists(r))
                    {
                        SetPreCreatedItem(itemidAdded);
                    }
                    else
                    {
                        SetPreCreatedItem(VSItemId.Nil);

                        SetDirty();
                    }
                }
            }

            return VSErr.S_OK;
        }
        public void PerformRefresh(IEnumerable <SvnClientAction> sccRefreshItems)
        {
            Debug.Assert(WebLikeFileHandling, "Refreshing a project that manages itself");

            RefreshState state = new RefreshState(_context, ProjectHierarchy, VsProject, ProjectDirectory);

            if (state.VsProject == null || state.ProjectDirectory == null)
            {
                return; // Can't fix it
            }
            VSDOCUMENTPRIORITY[] prio      = new VSDOCUMENTPRIORITY[1];
            IVsHierarchy         hierarchy = null;

            foreach (SvnClientAction action in sccRefreshItems)
            {
                if (!action.AddOrRemove)
                {
                    continue; // Not for me
                }
                SvnItem item = state.Cache[action.FullPath];
                if (!item.IsBelowPath(ProjectDirectory))
                {
                    return;
                }

                int  found;
                uint id;

                // Check the real project here instead of our cache to keep the update initiative
                // at the project. Checking our cache might be unsafe, as we get file add and remove
                // events from the project while we are updating
                if (!VSErr.Succeeded(VsProject.IsDocumentInProject(item.FullPath, out found, prio, out id)))
                {
                    continue;
                }

                bool bFound = (found != 0);

                if (!bFound)
                {
                    if (hierarchy == null)
                    {
                        hierarchy = VsProject as IVsHierarchy;
                    }

                    // We need this additional check to find directories in Websites
                    if (hierarchy != null &&
                        VSErr.Succeeded(hierarchy.ParseCanonicalName(item.FullPath, out id)))
                    {
                        bFound = (id != VSItemId.Nil) && (id != VSItemId.Root);

                        // Perform an extra validation step to avoid issue #700
                        string foundName;
                        if (bFound &&
                            VSErr.Succeeded(VsProject.GetMkDocument(id, out foundName)))
                        {
                            foundName = SharpSvn.SvnTools.GetNormalizedFullPath(foundName);
                            bFound    = String.Equals(item.FullPath, foundName, StringComparison.OrdinalIgnoreCase);
                        }
                    }
                }
                if (bFound == item.Exists)
                {
                    continue; //
                }
                if (!bFound)
                {
                    state.AddItem(item);
                }
                else
                {
                    state.RemoveItem(item, id);
                }
            }
        }