예제 #1
0
 private void OnChangeAction(FileSystemChangeDelta delta)
 {
     if (delta.ChangeType == FileSystemChangeType.ADDED || delta.ChangeType == FileSystemChangeType.DELETED)
     {
         SetValues();
     }
 }
예제 #2
0
            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;
                }
            }
예제 #3
0
 private void OnChangeActionProjectSettingsFolder(FileSystemChangeDelta delta)
 {
     if (IsInterestingProjectSettingsFile(delta.NewPath) || IsInterestingProjectSettingsFile(delta.OldPath))
     {
         OnChangeAction(delta);
     }
 }
예제 #4
0
 private void AdviseFileAddedOrDeleted(FileSystemChangeDelta delta)
 {
     if (delta.NewPath.ExtensionNoDot == "cs")
     {
         myLogger.Verbose($"fileSystemTracker.AdviseDirectoryChanges {delta.ChangeType}, {delta.NewPath}, {delta.OldPath}");
         myRefresher.Refresh(RefreshType.Normal);
     }
 }
 private void AdviseFileAddedOrDeleted(FileSystemChangeDelta delta)
 {
     if (delta.NewPath.ExtensionNoDot == "cs")
     {
         myLogger.Verbose($"fileSystemTracker.AdviseDirectoryChanges {delta.ChangeType}, {delta.NewPath}, {delta.OldPath}");
         myGroupingEvent.FireIncoming();
     }
 }
예제 #6
0
 private void OnChangeAction(FileSystemChangeDelta delta)
 {
     if (delta.ChangeType == FileSystemChangeType.ADDED || delta.ChangeType == FileSystemChangeType.DELETED)
     {
         IsAbleToEstablishProtocolConnectionWithUnity.SetValue(
             ProjectExtensions.IsAbleToEstablishProtocolConnectionWithUnity(mySolution.SolutionDirectory));
     }
 }
예제 #7
0
        private void OnProjectDirectoryChange(FileSystemChangeDelta delta)
        {
            var builder           = new PsiModuleChangeBuilder();
            var projectFilesToAdd = new List <FileSystemPath>();

            ProcessFileSystemChangeDelta(delta, builder, projectFilesToAdd);
            AddAssetProjectFiles(projectFilesToAdd);
            FlushChanges(builder);
        }
예제 #8
0
 private void OnChangeActionProjectSettingsFolder(FileSystemChangeDelta delta)
 {
     if (delta.NewPath.Name == "ProjectSettings" || delta.NewPath.Name == "ProjectVersion.txt" || delta.NewPath.ExtensionNoDot == "asset"
         ||
         delta.OldPath.Name == "ProjectSettings" || delta.OldPath.Name == "ProjectVersion.txt" || delta.OldPath.ExtensionNoDot == "asset")
     {
         OnChangeAction(delta);
     }
 }
 private void OnProjectDirectoryChange(FileSystemChangeDelta delta)
 {
     myLocks.ExecuteOrQueue(Lifetime.Eternal, "UnityExternalFilesModuleProcessor::OnProjectDirectoryChange",
                            () =>
     {
         var builder           = new PsiModuleChangeBuilder();
         var projectFilesToAdd = new List <FileSystemPath>();
         ProcessFileSystemChangeDelta(delta, builder, projectFilesToAdd);
         FlushChanges(builder, projectFilesToAdd);
     });
 }
예제 #10
0
 private void OnChangeAction(FileSystemChangeDelta delta)
 {
     // connect on reload of server
     if (delta.ChangeType != FileSystemChangeType.ADDED && delta.ChangeType != FileSystemChangeType.CHANGED)
     {
         return;
     }
     if (!myComponentLifetime.IsTerminated)
     {
         myLocks.ExecuteOrQueue(myComponentLifetime, "CreateProtocol",
                                () => CreateProtocols(delta.NewPath));
     }
 }
예제 #11
0
        private void OnProtocolInstanceJsonChange(FileSystemChangeDelta delta)
        {
            // Connect when protocols.json is updated (AppDomain start/reload in Unity editor)
            if (delta.ChangeType != FileSystemChangeType.ADDED && delta.ChangeType != FileSystemChangeType.CHANGED)
            {
                return;
            }
            if (!delta.NewPath.ExistsFile)
            {
                return;
            }
            if (delta.NewPath.FileModificationTimeUtc == myLastChangeTime)
            {
                return;
            }
            myLastChangeTime = delta.NewPath.FileModificationTimeUtc;

            SafeExecuteOrQueueEx("CreateProtocol", () => CreateProtocol(delta.NewPath));
        }
예제 #12
0
            public override void Visit(FileSystemChangeDelta delta)
            {
                base.Visit(delta);

                switch (delta.ChangeType)
                {
                case FileSystemChangeType.ADDED:
                case FileSystemChangeType.DELETED:
                    myRefreshTracker.AdviseFileAddedOrDeleted(delta);
                    break;

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

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
예제 #13
0
 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;
     }
 }
예제 #14
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);
            }
        }