public void Visit(FileSystemChangeDelta delta)
            {
                switch (delta.ChangeType)
                {
                case FileSystemChangeType.ADDED:
                case FileSystemChangeType.CHANGED:
                    Upload(delta.NewPath);
                    break;

                case FileSystemChangeType.DELETED:
                    Delete(delta.OldPath);
                    break;

                case FileSystemChangeType.RENAMED:
                    Rename(delta.OldPath, delta.NewPath);
                    break;

                case FileSystemChangeType.SUBTREE_CHANGED:
                    foreach (var changeDelta in delta.GetChildren())
                    {
                        changeDelta.Accept(this);
                    }
                    break;
                }
            }
 public void Visit(FileSystemChangeDelta delta)
 {
     switch (delta.ChangeType)
     {
       case FileSystemChangeType.ADDED:
       case FileSystemChangeType.CHANGED:
     Upload(delta.NewPath);
     break;
       case FileSystemChangeType.DELETED:
     Delete(delta.OldPath);
     break;
       case FileSystemChangeType.RENAMED:
     Rename(delta.OldPath, delta.NewPath);
     break;
       case FileSystemChangeType.SUBTREE_CHANGED:
     foreach (var changeDelta in delta.GetChildren())
     {
       changeDelta.Accept(this);
     }
     break;
     }
 }
Example #3
0
        private void ProcessFileSystemChangeDelta(FileSystemChangeDelta delta, PsiModuleChangeBuilder builder,
                                                  List <FileSystemPath> projectFilesToAdd)
        {
            var module = myModuleFactory.PsiModule;

            if (module == null)
            {
                return;
            }

            IPsiSourceFile sourceFile;

            switch (delta.ChangeType)
            {
            case FileSystemChangeType.ADDED:
                if (delta.NewPath.IsInterestingAsset())
                {
                    if (!IsKnownBinaryAsset(delta.NewPath) && !IsAssetExcludedByName(delta.NewPath))
                    {
                        projectFilesToAdd.Add(delta.NewPath);
                    }
                }
                else if (delta.NewPath.IsInterestingMeta())
                {
                    AddMetaPsiSourceFile(builder, delta.NewPath);
                }
                break;

            case FileSystemChangeType.DELETED:
                sourceFile = GetYamlPsiSourceFile(module, delta.OldPath);
                if (sourceFile != null)
                {
                    builder.AddFileChange(sourceFile, PsiModuleChange.ChangeType.Removed);
                }
                break;

            case FileSystemChangeType.CHANGED:
                sourceFile = GetYamlPsiSourceFile(module, delta.NewPath);
                if (sourceFile != null)
                {
                    // Make sure we update the cached file system data, or all of our files will have stale
                    // timestamps and never get updated by ICache implementations!
                    if (sourceFile is PsiSourceFileFromPath psiSourceFileFromPath)
                    {
                        psiSourceFileFromPath.GetCachedFileSystemData().Refresh(delta.NewPath);
                    }

                    // Has the file flipped from binary back to text?
                    if (myBinaryUnityFileCache.IsBinaryFile(sourceFile) &&
                        sourceFile.GetLocation().SniffYamlHeader())
                    {
                        myBinaryUnityFileCache.Invalidate(sourceFile);
                    }

                    builder.AddFileChange(sourceFile, PsiModuleChange.ChangeType.Modified);
                }
                break;

            case FileSystemChangeType.SUBTREE_CHANGED:
            case FileSystemChangeType.RENAMED:
            case FileSystemChangeType.UNKNOWN:
                break;
            }

            foreach (var child in delta.GetChildren())
            {
                ProcessFileSystemChangeDelta(child, builder, projectFilesToAdd);
            }
        }