Esempio n. 1
0
 public T4MacroResolutionCache(
     Lifetime lifetime,
     [NotNull] IShellLocks locks,
     [NotNull] IPersistentIndexManager persistentIndexManager
     ) : base(lifetime, locks, persistentIndexManager, T4MacroResolutionDataMarshaller.Instance)
 {
 }
Esempio n. 2
0
        public BinaryUnityFileCache(Lifetime lifetime, ISolution solution,
                                    IPersistentIndexManager persistentIndexManager, IShellLocks locks,
                                    ChangeManager changeManager)
            : base(lifetime, persistentIndexManager, BinaryFileCacheItem.Marshaller)
        {
            myGroupingEvent = solution.Locks.GroupingEvents.CreateEvent(lifetime, "UnityRefresherOnSaveEvent",
                                                                        TimeSpan.FromMilliseconds(500), Rgc.Guarded, () =>
            {
                var changedFiles = new JetHashSet <IPsiSourceFile>(myChangedFiles);
                myChangedFiles.Clear();

                if (changedFiles.Count > 0)
                {
                    locks.ExecuteWithWriteLock(() => changeManager.ExecuteAfterChange(() =>
                    {
                        var builder = new PsiModuleChangeBuilder();
                        foreach (var file in changedFiles)
                        {
                            if (file.IsValid())
                            {
                                builder.AddFileChange(file, PsiModuleChange.ChangeType.Modified);
                            }
                        }

                        changeManager.OnProviderChanged(solution, builder.Result, SimpleTaskExecutor.Instance);
                    }));
                }
            });
            myChangedFiles = new JetHashSet <IPsiSourceFile>();
        }
 public UnityUsagesFinderConsumer(AssetHierarchyProcessor assetHierarchyProcessor, IPersistentIndexManager persistentIndexManager,
                                  FileSystemPath solutionDirectoryPath)
 {
     myAssetHierarchyProcessor = assetHierarchyProcessor;
     myPersistentIndexManager  = persistentIndexManager;
     mySolutionDirectoryPath   = solutionDirectoryPath;
 }
Esempio n. 4
0
 public UnitySceneDataCache(Lifetime lifetime, IPersistentIndexManager persistentIndexManager,
                            UnitySceneDataLocalCache unitySceneDataLocalCache, MetaFileGuidCache metaFileGuidCache)
     : base(lifetime, persistentIndexManager, UnitySceneData.Marshaller)
 {
     myUnitySceneDataLocalCache = unitySceneDataLocalCache;
     myMetaFileGuidCache        = metaFileGuidCache;
 }
Esempio n. 5
0
        public void Write(BinaryWriter writer, IPersistentIndexManager persistentIndexManager)
        {
            if (myChildren != null)
            {
                writer.Write(myChildren.Count);
                foreach (var child in myChildren)
                {
                    writer.Write(child.Key);
                    child.Value.Write(writer, persistentIndexManager);
                }
            }
            else
            {
                writer.Write(0);
            }

            if (myAnnotations != null)
            {
                writer.Write(myAnnotations.Count);
                foreach (var annotation in myAnnotations)
                {
                    writer.Write(persistentIndexManager.GetIdBySourceFile(annotation.SourceFile));
                    writer.Write(annotation.SourceFile.LastWriteTimeUtc.Ticks);
                    writer.Write(annotation.Offset);
                }
            }
            else
            {
                writer.Write(0);
            }
        }
Esempio n. 6
0
        public TaintedSinkWarning(
            IPersistentIndexManager persistentIndexManager,
            DocumentRange documentRange,
            List <Statement> trace)
        {
            myDocumentRange = documentRange;

            ErrorStripeToolTip = "";
            var innerTrace = string.Join("\n",
                                         trace.Skip(1).Take(trace.Count - 2).Select(statement => PrintStatement(persistentIndexManager, statement)));

            var writer = new StringWriter();

            writer.WriteLine("Tainted sink");
            writer.WriteLine(PrintStatement(persistentIndexManager, trace[0], true));

            if (innerTrace.Length > 0)
            {
                writer.WriteLine(innerTrace);
            }

            writer.WriteLine(PrintStatement(persistentIndexManager, trace.Last(), false, true));

            ToolTip            = writer.ToString();
            ErrorStripeToolTip = ToolTip;
        }
 public AssetMethodsElementContainer(IShellLocks shellLocks, ISolution solution, IPersistentIndexManager persistentIndexManager, AssetDocumentHierarchyElementContainer elementContainer)
 {
     myShellLocks             = shellLocks;
     mySolution               = solution;
     myPersistentIndexManager = persistentIndexManager;
     myAssetDocumentHierarchyElementContainer = elementContainer;
 }
        public static List <HighlightingInfo> HighlightingsFromStackTraces(
            [NotNull] IPersistentIndexManager persistentIndexManager,
            IDocument thisDocument,
            IEnumerable <IEnumerable <Statement> > stackTraces)
        {
            var highlightings =
                stackTraces.Select(stackTrace => stackTrace.ToList())
                .Select(stackTrace =>
            {
                var frame = stackTrace.Last();
                var range = LocationToDocumentRange(persistentIndexManager, frame.Location);
                if (!range.IsValid())
                {
                    return(null);
                }

                if (range.Document.Equals(thisDocument))
                {
                    using (ReadLockCookie.Create())
                    {
                        return(CreateHighlightingInfo(persistentIndexManager, range, stackTrace));
                    }
                }

                return(null);
            })
                .WhereNotNull();

            return(highlightings.ToList());
        }
Esempio n. 9
0
        private string PrintStatement(
            IPersistentIndexManager persistentIndexManager,
            Statement statement,
            bool first = false,
            bool last  = false)
        {
            var location = LocationToString(persistentIndexManager, statement.Location);

            if (statement is InfoStatement invocation)
            {
                return($"{(last ? "sink" : "pass")} -> {location} " + invocation.Info);
            }

            if (statement is ReturnStatement)
            {
                return($"return <- {location}");
            }

            if (statement is AssignmentStatement assignment)
            {
                return($"{(first ? "source" : "assign")} - {location}");
            }

            return("???");
        }
Esempio n. 10
0
        public AbstractILCompilerParams(
            /*[NotNull] IResolveContext resolveContext, */ File file,
            OneToListMap <IMethod, IMethod> hierarchyMembers,
            IPsiSourceFile sourceFile,
            IPersistentIndexManager persistentIndexManager,
            /*Dictionary<Type, Pointer> exceptionTypeToPointer, */
            CSharpCacheProvider cacheProvider,
            bool buildExpressions = true)
        {
            myPersistentIndexManager = persistentIndexManager;
            SourceFile       = sourceFile;
            HierarchyMembers = hierarchyMembers;
            File             = file;
            CacheProvider    = cacheProvider;
            //ExceptionTypeToPointer = exceptionTypeToPointer;
            //ResolveContext = resolveContext;
            InterruptCheck = () =>
            {
                var interruptHandler = InterruptableActivityCookie.GetCheck();
                return(interruptHandler != null && interruptHandler());
            };
            //BuildExpressions = buildExpressions;

            LocalVariableIndexer = new LocalVariableIndexer(this);

            myCollectedInteractiveRequests = new List <Request>();
        }
 public AnimatorScriptUsagesElementContainer([NotNull] IPersistentIndexManager manager,
                                             [NotNull] IShellLocks shellLocks,
                                             [NotNull] MetaFileGuidCache metaFileGuidCache)
 {
     myManager           = manager;
     myShellLocks        = shellLocks;
     myMetaFileGuidCache = metaFileGuidCache;
 }
Esempio n. 12
0
 public SpecflowSettingsFilesCache(Lifetime lifetime,
                                   IPersistentIndexManager persistentIndexManager,
                                   SpecflowSettingsProvider settingsProvider,
                                   SpecflowSettingsMarshaller marshaller)
     : base(lifetime, persistentIndexManager, marshaller)
 {
     _settingsProvider = settingsProvider;
 }
Esempio n. 13
0
 public NTriplesCache(
     Lifetime lifetime,
     IShellLocks shellLocks,
     IPsiConfiguration psiConfiguration,
     IPersistentIndexManager persistentIdIndex)
     : base(lifetime, shellLocks, psiConfiguration, persistentIdIndex)
 {
 }
Esempio n. 14
0
 public LinkedNamesCache(
     Lifetime lifetime,
     IPersistentIndexManager persistentIndexManager,
     IEnumerable <ILinkedTypesProvider> linkedTypesProviders)
     : base(lifetime, persistentIndexManager, new LinkedNamesDataMarshaller())
 {
     _linkedTypesProviders = linkedTypesProviders.ToList();
 }
Esempio n. 15
0
 public PsiCache(Lifetime lifetime,
                 IShellLocks shellLocks,
                 IPsiConfiguration psiConfiguration, IPersistentIndexManager persistentIdIndex)
 {
     myPsiConfiguration  = psiConfiguration;
     myPersistentIdIndex = persistentIdIndex;
     myShellLocks        = shellLocks;
 }
Esempio n. 16
0
 public ShaderLabCppFileLocationTracker(Lifetime lifetime, ISolution solution, UnityVersion unityVersion,
                                        IPersistentIndexManager persistentIndexManager)
     : base(
         lifetime, solution, persistentIndexManager, CppInjectionInfo.Read, CppInjectionInfo.Write)
 {
     mySolution     = solution;
     myUnityVersion = unityVersion;
 }
Esempio n. 17
0
        public AsmDefNameCache(Lifetime lifetime, IPersistentIndexManager persistentIndexManager, ISolution solution)
            : base(lifetime, persistentIndexManager, AsmDefCacheItem.Marshaller)
        {
            mySolution = solution;
#if DEBUG
            ClearOnLoad = true;
#endif
        }
Esempio n. 18
0
        public UnityProjectSettingsCache(Lifetime lifetime, IPersistentIndexManager persistentIndexManager,
                                         IEnumerable <IProjectSettingsAssetHandler> projectSettingsAssetHandlers)
            : base(lifetime, persistentIndexManager, ProjectSettingsCacheItem.Marshaller)
        {
            myProjectSettingsAssetHandlers = projectSettingsAssetHandlers;

            myLocalCache.Tags.AddItems("Untagged", "Respawn", "Finish", "EditorOnly", "MainCamera", "Player", "GameController");
        }
Esempio n. 19
0
 public NTriplesCache(
     Lifetime lifetime,
     IShellLocks shellLocks,
     IPsiConfiguration psiConfiguration,
     IPersistentIndexManager persistentIdIndex)
     : base(lifetime, shellLocks, psiConfiguration, persistentIdIndex)
 {
 }
Esempio n. 20
0
 public AnimationEventUsagesContainer([NotNull] IPersistentIndexManager manager,
                                      [NotNull] IShellLocks shellLocks,
                                      [NotNull] MetaFileGuidCache metaFileGuidCache,
                                      [NotNull] ISolution solution)
 {
     myShellLocks        = shellLocks;
     myMetaFileGuidCache = metaFileGuidCache;
     mySolution          = solution;
 }
 private static HighlightingInfo CreateHighlightingInfo(
     IPersistentIndexManager persistentIndexManager, DocumentRange documentRange, List <Statement> stackTrace)
 {
     return(new HighlightingInfo(documentRange,
                                 new TaintedSinkWarning(
                                     persistentIndexManager,
                                     documentRange,
                                     stackTrace)));
 }
 public InjectedHlslFileLocationTracker(Lifetime lifetime, ISolution solution, UnityVersion unityVersion,
                                        IPersistentIndexManager persistentIndexManager, CppExternalModule cppExternalModule)
     : base(
         lifetime, solution, persistentIndexManager, InjectedHlslLocationInfo.Read, InjectedHlslLocationInfo.Write)
 {
     mySolution          = solution;
     myUnityVersion      = unityVersion;
     myCppExternalModule = cppExternalModule;
 }
Esempio n. 23
0
 public AssetDocumentHierarchyElementContainer(IPersistentIndexManager manager, PrefabImportCache prefabImportCache, IShellLocks shellLocks,
                                               UnityExternalFilesModuleFactory psiModuleProvider, MetaFileGuidCache metaFileGuidCache, IEnumerable <IAssetInspectorValueDeserializer> assetInspectorValueDeserializers)
 {
     myManager           = manager;
     myPrefabImportCache = prefabImportCache;
     myShellLocks        = shellLocks;
     myPsiModule         = psiModuleProvider.PsiModule;
     myMetaFileGuidCache = metaFileGuidCache;
     myAssetInspectorValueDeserializers = assetInspectorValueDeserializers;
 }
        public AngularJsCache(Lifetime lifetime, IPersistentIndexManager persistentIndexManager)
            : base(lifetime, persistentIndexManager, AngularJsCacheItems.Marshaller)
        {
#if DEBUG
            // TODO: Useful for testing. Remove for release
            ClearOnLoad = true;
#endif

            CacheUpdated = new SimpleSignal(lifetime, "AngularJsCache");
        }
 public JavaScriptDependentFilesCacheHack(
 Lifetime lifetime, IViewable<ILibraryFiles> libraryFiles,
 JavaScriptDependentFilesModuleFactory dependentFilesModuleFactory,
 JavaScriptDependentFilesBuilder builder, IShellLocks locks,
 IPsiConfiguration configuration, IPersistentIndexManager persistentIndexManager)
     : base(lifetime, new ListEvents<ILibraryFiles>(lifetime, "booo"),
        dependentFilesModuleFactory, builder,
        locks, configuration, persistentIndexManager)
 {
 }
Esempio n. 26
0
 public TaintedSinksHighlighterDaemonStageProcess(
     [NotNull] IPsiSourceFile sourceFile,
     [NotNull] IDaemonProcess process,
     [NotNull] PersistentIndexManager persistentIndexManager)
 {
     DaemonProcess            = process;
     mySourceFile             = sourceFile ?? throw new ArgumentNullException();
     myCofraFacade            = process.Solution.GetComponent <CofraFacade>();
     myPersistentIndexManager = persistentIndexManager;
 }
Esempio n. 27
0
        public static AttributedTypesTrieNode Read(BinaryReader reader, IPersistentIndexManager persistentIndexManager)
        {
            var root = new AttributedTypesTrieNode();

            if (!root.ReadThis(reader, persistentIndexManager))
            {
                return(null);
            }
            return(root);
        }
Esempio n. 28
0
 public T4LightWeightAssemblyResolutionCache(
     Lifetime lifetime,
     [NotNull] IShellLocks locks,
     [NotNull] IPersistentIndexManager persistentIndexManager,
     [NotNull] RawVsServiceProvider provider
     ) : base(lifetime, locks, persistentIndexManager, T4LightWeightAssemblyResolutionDataMarshaller.Instance)
 {
     Components = Lazy.Of(() => new Optional <ITextTemplatingComponents>(
                              provider.Value.GetService <STextTemplating, ITextTemplatingComponents>()
                              ), true);
 }
Esempio n. 29
0
 public void Write(BinaryWriter writer, IPersistentIndexManager persistentIndexManager)
 {
     writer.Write(Roots.Count);
     foreach (var pair in Roots)
     {
         var name = pair.Key;
         writer.Write(name);
         var trieNode = pair.Value;
         trieNode.Write(writer, persistentIndexManager);
     }
 }
Esempio n. 30
0
 protected T4PsiAwareCacheBase(
     Lifetime lifetime,
     IPersistentIndexManager persistentIndexManager,
     IUnsafeMarshaller <TResponse> valueMarshaller
     ) : base(
         lifetime,
         persistentIndexManager,
         valueMarshaller
         )
 {
 }
Esempio n. 31
0
        public void Read(BinaryReader reader, IPersistentIndexManager persistentIndexManager)
        {
            var num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                var name = reader.ReadString();
                var trie = AttributedTypesTrieNode.Read(reader, persistentIndexManager) ?? new AttributedTypesTrieNode();
                // direct add to roots here... no collisions by name is guaranted
                Roots.Add(name, trie);
            }
        }
 public UnityUsagesFinderConsumer(AssetHierarchyProcessor assetHierarchyProcessor,
                                  [NotNull] AnimatorScriptUsagesElementContainer animatorContainer,
                                  IPersistentIndexManager persistentIndexManager,
                                  FileSystemPath solutionDirectoryPath,
                                  [NotNull] IDeclaredElement declaredElement)
 {
     myAssetHierarchyProcessor = assetHierarchyProcessor;
     myPersistentIndexManager  = persistentIndexManager;
     mySolutionDirectoryPath   = solutionDirectoryPath;
     myAnimatorContainer       = animatorContainer;
     myDeclaredElement         = declaredElement;
 }
Esempio n. 33
0
		public TestCache(Lifetime lifetime, ISolution solution, IUnitTestingSettingsAccessor settingsAccessor,
			IShellLocks shellLocks, IPsiConfiguration psiConfiguration, ISettingsStore settingsStore,
			KarmaTestProvider testProvider, JasmineElementFactory jasmineFactory,
			IPersistentIndexManager persistentIndexManager, IJavaScriptDependencyManager javaScriptDependencyManager)
		{
			_lifetime = lifetime;
			_solution = solution;
			_settingsAccessor = settingsAccessor;
			_shellLocks = shellLocks;
			_psiConfiguration = psiConfiguration;
			_testProvider = testProvider;
			myJasmineFactory = jasmineFactory;
			_persistentIndexManager = persistentIndexManager;
			_javaScriptDependencyManager = javaScriptDependencyManager;
			_settingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()), BindToContextFlags.Normal);
			_settingsStore.Changed.Advise(lifetime, OnSettingsChange);
			Active = new Property<bool>(lifetime, "KarmaTestCache", true);
		}
Esempio n. 34
0
        public NitraSolutionComponent(Lifetime lifetime, ISolution solution, ChangeManager changeManager, DocumentManager documentManager,
            IShellLocks locks, IPsiConfiguration psiConfiguration, IPersistentIndexManager persistentIndexManager)
        {
            _persistentIndexManager = persistentIndexManager;
              _psiConfiguration = psiConfiguration;
              _locks = locks;
              _solution = solution;
              _documentManager = documentManager;
              //changeManager.Changed2.Advise(lifetime, OnChangeManagerChanged);

              changeManager.RegisterChangeProvider(lifetime, this);
              changeManager.AddDependency(lifetime, this, documentManager.ChangeProvider);
              changeManager.AddDependency(lifetime, this, solution);

              foreach (var project in solution.GetAllProjects())
              {
            Debug.WriteLine(project.Name);
            //var projectItem = project as JetBrains.Proj
            foreach (var file in project.GetAllProjectFiles())
            {
              var ext = System.IO.Path.GetExtension(file.Name);
              if (string.Equals(ext, ".dll", StringComparison.InvariantCultureIgnoreCase))
            continue;

              if (file.LanguageType.Name == "MSBuild")
            continue;

              if (string.Equals(ext, ".dsl", StringComparison.InvariantCultureIgnoreCase))
              {
            var stream = file.CreateReadStream();
            string content = "";
            using (var streamReader = new StreamReader(stream))
              content = streamReader.ReadToEnd();
            Debug.WriteLine(content);
              }

              Debug.WriteLine(file.Name);
            }

              }
        }