private void SetActualVersionForSolution(Lifetime lt)
        {
            var projectVersionTxtPath =
                mySolutionDirectory.Combine("ProjectSettings/ProjectVersion.txt");

            myFileSystemTracker.AdviseFileChanges(lt,
                                                  projectVersionTxtPath,
                                                  _ =>
            {
                myVersionFromProjectVersionTxt = TryGetVersionFromProjectVersion(projectVersionTxtPath);
                UpdateActualVersionForSolution();
            });
            myVersionFromProjectVersionTxt = TryGetVersionFromProjectVersion(projectVersionTxtPath);

            var editorInstanceJsonPath = mySolutionDirectory.Combine("Library/EditorInstance.json");

            myFileSystemTracker.AdviseFileChanges(lt,
                                                  editorInstanceJsonPath,
                                                  _ =>
            {
                myVersionFromEditorInstanceJson =
                    TryGetApplicationPathFromEditorInstanceJson(editorInstanceJsonPath);
                UpdateActualVersionForSolution();
            });
            myVersionFromEditorInstanceJson =
                TryGetApplicationPathFromEditorInstanceJson(editorInstanceJsonPath);

            UpdateActualVersionForSolution();
        }
        private PackageData GetEmbeddedPackage(string id, string filePath)
        {
            // Embedded packages live in the Packages folder. When reading from packages-lock.json, the filePath has a
            // 'file:' prefix. We make sure it's the folder name when there is no packages-lock.json
            var packageFolder = myPackagesFolder.Combine(filePath.TrimFromStart("file:"));

            return(GetPackageDataFromFolder(id, packageFolder, PackageSource.Embedded));
        }
        public new void SetUp()
        {
            _solutionPathProvider = new FixedSolutionPathProvider(TestDataPath2.Parent.Parent.Parent);

            _gitRepositoryProvider = new TestGitRepositoryProvider();
            _gitDirectoryPath      = TestDataPath2.Parent.Combine(_gitRepositoryProvider.GitDirectoryName);

            _gitDirectoryPath.CreateDirectory();
            _gitDirectoryPath.Combine("config").WriteAllText("https://repository.url/");
            _gitDirectoryPath.Combine("HEAD").WriteAllText("my_branch");
        }
        private PackageData GetPackageDataFromFolder([CanBeNull] string id,
                                                     [NotNull] FileSystemPath packageFolder,
                                                     PackageSource packageSource,
                                                     [CanBeNull] GitDetails gitDetails          = null,
                                                     [CanBeNull] FileSystemPath tarballLocation = null)
        {
            if (packageFolder.ExistsDirectory)
            {
                var packageJsonFile = packageFolder.Combine("package.json");
                if (packageJsonFile.ExistsFile)
                {
                    try
                    {
                        var packageJson    = PackageJson.FromJson(packageJsonFile.ReadAllText2().Text);
                        var packageDetails = PackageDetails.FromPackageJson(packageJson, packageFolder);
                        return(new PackageData(id ?? packageDetails.CanonicalName, packageFolder,
                                               packageJsonFile.FileModificationTimeUtc, packageDetails, packageSource, gitDetails,
                                               tarballLocation));
                    }
                    catch (Exception e)
                    {
                        myLogger.LogExceptionSilently(e);
                        return(null);
                    }
                }
            }

            return(null);
        }
示例#5
0
        public void Initialise()
        {
            if (agentControl != null)
            {
                return;
            }

            var manifestLocation = agentLocation.Combine("DoubleAgent.sxs.manifest");

            agentControl = ActivationContext.Using(manifestLocation.FullPath, () => new Control());

            agentControl.AutoConnect    = 0;
            agentControl.CharacterStyle = (int)(CharacterStyleFlags.IdleEnabled
                                                | CharacterStyleFlags.Smoothed
                                                | CharacterStyleFlags.SoundEffects);

            agentControl.CharacterFiles.SearchPath = agentLocation.FullPath;

            agentControl.Click           += agentControl_Click;
            agentControl.Command         += agentControl_Command;
            agentControl.DblClick        += agentControl_DblClick;
            agentControl.DragStart       += agentControl_DragStart;
            agentControl.DragComplete    += agentControl_DragComplete;
            agentControl.Hide            += agentControl_Hide;
            agentControl.Move            += agentControl_Move;
            agentControl.RequestStart    += agentControl_RequestStart;
            agentControl.RequestComplete += agentControl_RequestComplete;
            agentControl.Show            += agentControl_Show;
        }
示例#6
0
        private bool CopyFiles(FileSystemPath pluginDir)
        {
            var updatedFileCount    = 0;
            var existingPluginFiles = pluginDir.GetChildFiles();

            foreach (var filename in ourPluginFiles)
            {
                var path = pluginDir.Combine(filename);
                if (existingPluginFiles.Contains(path))
                {
                    continue;
                }

                var resourceName = resourceNamespace + filename;
                using (var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
                {
                    if (resourceStream == null)
                    {
                        myLogger.LogMessage(LoggingLevel.ERROR, "Plugin file not found in manifest resources. " + filename);
                        return(false);
                    }

                    using (var fileStream = path.OpenStream(FileMode.CreateNew))
                    {
                        resourceStream.CopyTo(fileStream);
                        updatedFileCount++;
                    }
                }
            }

            return(updatedFileCount > 0);
        }
        public static Version GetVersionByAppPath(FileSystemPath appPath)
        {
            if (appPath == null || appPath.Exists == FileSystemPath.Existence.Missing)
            {
                return(null);
            }

            Version version = null;

            ourLogger.CatchWarn(() => // RIDER-23674
            {
                switch (PlatformUtil.RuntimePlatform)
                {
                case PlatformUtil.Platform.Windows:

                    ourLogger.CatchWarn(() =>
                    {
                        version = new Version(
                            new Version(FileVersionInfo.GetVersionInfo(appPath.FullPath).FileVersion)
                            .ToString(3));
                    });

                    var resource = new VersionResource();
                    resource.LoadFrom(appPath.FullPath);
                    var unityVersionList = resource.Resources.Values.OfType <StringFileInfo>()
                                           .Where(c => c.Default.Strings.Keys.Any(b => b == "Unity Version")).ToArray();
                    if (unityVersionList.Any())
                    {
                        var unityVersion = unityVersionList.First().Default.Strings["Unity Version"].StringValue;
                        version          = Parse(unityVersion);
                    }

                    break;

                case PlatformUtil.Platform.MacOsX:
                    var infoPlistPath = appPath.Combine("Contents/Info.plist");
                    if (infoPlistPath.ExistsFile)
                    {
                        var docs          = XDocument.Load(infoPlistPath.FullPath);
                        var keyValuePairs = docs.Descendants("dict")
                                            .SelectMany(d => d.Elements("key").Zip(d.Elements().Where(e => e.Name != "key"),
                                                                                   (k, v) => new { Key = k, Value = v }))
                                            .GroupBy(x => x.Key.Value)
                                            .Select(g =>
                                                    g.First()) // avoid exception An item with the same key has already been added.
                                            .ToDictionary(i => i.Key.Value, i => i.Value.Value);
                        version = Parse(keyValuePairs["CFBundleVersion"]);
                    }

                    break;

                case PlatformUtil.Platform.Linux:
                    version = Parse(appPath.FullPath);     // parse from path
                    break;
                }
            });
            return(version);
        }
        public PackageManager(Lifetime lifetime, ISolution solution, ILogger logger,
                              UnitySolutionTracker unitySolutionTracker,
                              UnityVersion unityVersion,
                              IFileSystemTracker fileSystemTracker)
        {
            myLifetime          = lifetime;
            mySolution          = solution;
            myLogger            = logger;
            myUnityVersion      = unityVersion;
            myFileSystemTracker = fileSystemTracker;

            // Refresh the packages in the guarded context, safe from reentrancy.
            myGroupingEvent = solution.Locks.GroupingEvents.CreateEvent(lifetime, "Unity::PackageManager",
                                                                        TimeSpan.FromMilliseconds(500), Rgc.Guarded, DoRefresh);

            myPackagesById     = new DictionaryEvents <string, PackageData>(lifetime, "Unity::PackageManager");
            myPackageLifetimes = new Dictionary <string, LifetimeDefinition>();

            myPackagesFolder   = mySolution.SolutionDirectory.Combine("Packages");
            myPackagesLockPath = myPackagesFolder.Combine("packages-lock.json");
            myManifestPath     = myPackagesFolder.Combine("manifest.json");

            unitySolutionTracker.IsUnityProject.AdviseUntil(lifetime, value =>
            {
                if (!value)
                {
                    return(false);
                }

                ScheduleRefresh();

                // Track changes to manifest.json and packages-lock.json. Also track changes in the Packages folder, but
                // only top level, not recursively. We only want to update the packages if a new package has been added
                // or removed
                var packagesFolder = mySolution.SolutionDirectory.Combine("Packages");
                fileSystemTracker.AdviseFileChanges(lifetime, packagesFolder.Combine("packages-lock.json"),
                                                    _ => ScheduleRefresh());
                fileSystemTracker.AdviseFileChanges(lifetime, packagesFolder.Combine("manifest.json"),
                                                    _ => ScheduleRefresh());
                fileSystemTracker.AdviseDirectoryChanges(lifetime, packagesFolder, false, _ => ScheduleRefresh());

                // We're all set up, terminate the advise
                return(true);
            });
        }
示例#9
0
        public void Combine_Multipart_Multipart()
        {
            var path1    = FileSystemPath.Parse(@"a\b");
            var path2    = FileSystemPath.Parse(@"c\d");
            var result   = FileSystemPath.Combine(path1, path2);
            var expected = FileSystemPath.Parse(@"a\b\c\d");

            Assert.AreEqual(expected, result);
        }
示例#10
0
        public TestAdapterLoader GetTestAdapterLoader(ITestRunnerContext context)
        {
            var framework = context.RuntimeEnvironment.TargetFrameworkId.IsNetCoreSdk()
                ? "netstandard20"
                : "net461";

            var adapters = Root.Combine($"{Namespace}.Adapters.{framework}.dll");
            var tasks    = Root.Combine($"{Namespace}.Tasks.{framework}.dll");

            var type = TypeInfoFactory.Create($"{Namespace}.Adapters.MspecRunner", adapters.FullPath);

            return(new TestAdapterInfo(type, type)
            {
                AdditionalAssemblies = new[]
                {
                    tasks.FullPath
                }
            });
        }
        private ProcessStartInfo GetCoreProcessStartInfo(int port, FileSystemPath basePath)
        {
            var sdkMajorVersion   = myNuGetVersion.Major < 3 ? 3 : myNuGetVersion.Major;
            var runtimeConfigPath = basePath.Combine(ProtocolConstants.CoreRuntimeConfigFilename(sdkMajorVersion));
            var fileSystemPath    = basePath.Combine(ProtocolConstants.TypeProvidersHostCoreFilename);
            var dotnetArgs        = $"--runtimeconfig \"{runtimeConfigPath}\"";

            Assertion.Assert(fileSystemPath.ExistsFile, $"can't find '{fileSystemPath.FullPath}'");
            Assertion.Assert(runtimeConfigPath.ExistsFile, $"can't find '{runtimeConfigPath.FullPath}'");

            var processStartInfo = new ProcessStartInfo
            {
                Arguments =
                    $"{dotnetArgs} \"{fileSystemPath.FullPath}\" {port} \"{ProtocolConstants.LogFolder.Combine($"{DateTime.UtcNow:yyyy_MM_dd_HH_mm_ss_ffff}.log")}\"",
                FileName = "exec"
            };

            return(processStartInfo);
        }
        private static FileSystemPath GetCustomHubInstallPath(FileSystemPath appData)
        {
            var filePath = appData.Combine("UnityHub/secondaryInstallPath.json");

            if (filePath.ExistsFile)
            {
                var text = filePath.ReadAllText2().Text.TrimStart('"').TrimEnd('"');
                var customHubLocation = FileSystemPath.Parse(text);
                if (customHubLocation.ExistsDirectory)
                {
                    return(customHubLocation);
                }
            }
            return(FileSystemPath.Empty);
        }
示例#13
0
        public static FileSystemPath GetAreaFolder([CanBeNull] IProject project, [CanBeNull] string area)
        {
            if (project == null)
            {
                return(FileSystemPath.Empty);
            }
            FileSystemPath basePath = project.Location;

            // Empty area ("") is the same as no area (null)
            if (!area.IsEmpty())
            {
                basePath = basePath.Combine(AreasFolder).Combine(area);
            }
            return(basePath);
        }
        private static ProcessStartInfo GetFrameworkProcessStartInfo(int port, FileSystemPath basePath)
        {
            var fileSystemPath = basePath.Combine(ProtocolConstants.TypeProvidersHostFrameworkFilename);

            Assertion.Assert(fileSystemPath.ExistsFile, $"can't find '{fileSystemPath.FullPath}'");

            var processStartInfo = new ProcessStartInfo
            {
                Arguments =
                    $"{port} \"{ProtocolConstants.LogFolder.Combine($"{DateTime.UtcNow:yyyy_MM_dd_HH_mm_ss_ffff}.log")}\"",
                FileName = fileSystemPath.FullPath
            };

            return(processStartInfo);
        }
        private FileSystemPath FindGitDirectory(FileSystemPath directory)
        {
            do
            {
                var gitDirectory = directory.Combine(GitDirectoryName);

                // IDEA: Add support for ".git"-file redirect

                if (gitDirectory.ExistsDirectory)
                {
                    return(gitDirectory);
                }

                directory = directory.Parent;
            } while (!directory.IsEmpty);

            return(null);
        }
        public static FileSystemPath GetApplicationContentsPath(FileSystemPath applicationPath)
        {
            if (applicationPath.IsEmpty)
            {
                return(applicationPath);
            }

            AssertApplicationPath(applicationPath);

            switch (PlatformUtil.RuntimePlatform)
            {
            case PlatformUtil.Platform.MacOsX:
                return(applicationPath.Combine("Contents"));

            case PlatformUtil.Platform.Linux:
            case PlatformUtil.Platform.Windows:
                return(applicationPath.Directory.Combine("Data"));
            }
            ourLogger.Error("Unknown runtime platform");
            return(FileSystemPath.Empty);
        }
        private PackageData GetBuiltInPackage(string id, string version, FileSystemPath builtInPackagesFolder)
        {
            // If we can identify the module root of the current project, use it to look up the module
            if (builtInPackagesFolder.ExistsDirectory)
            {
                var packageFolder = builtInPackagesFolder.Combine(id);
                return(GetPackageDataFromFolder(id, packageFolder, PackageSource.BuiltIn));
            }

            // We can't find the actual package. If we "know" it's a module/built in package, then mark it as an
            // unresolved built in package, rather than just an unresolved package. The Unity Explorer can use this to
            // put the unresolved package in the right place, rather than show as a top level unresolved package simply
            // because we haven't found the application package cache yet.
            // We can rely on an ID starting with "com.unity.modules." as this is the convention Unity uses. Since they
            // control the namespace of their own registries, we can be confident that they won't publish normal
            // packages with the same naming convention. We can't be sure for third part registries, but if anyone does
            // that, they only have themselves to blame.
            // If we don't recognise the package as a built in, let someone else handle it
            return(id.StartsWith("com.unity.modules.")
                ? PackageData.CreateUnknown(id, version, PackageSource.BuiltIn)
                : null);
        }
示例#18
0
        private void SyncFromCloud(FileSystemPath localPath)
        {
            var remotePath = myRootFolder.Combine(localPath.Name).FullPath.Replace('\\', '/');

            myClient.GetFileAsync(remotePath,
                                  response =>
            {
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    localPath.WriteAllBytes(response.RawBytes);
                }
            },
                                  exception =>
            {
                if ((exception is DropboxRestException) && (((DropboxRestException)exception).StatusCode == HttpStatusCode.NotFound))
                {
                    myClient.UploadFileAsync(myRootFolder.FullPath.Replace('\\', '/'), new FileInfo(localPath.FullPath),
                                             data => { },
                                             myClient.LogException);
                    return;
                }
                myClient.LogException(exception);
            });
        }
 private FileSystemPath GetChunkFilePath(Vector3I chunkOffset)
 {
     return(FileSystemPath.Combine(worldDataPathRoot,
                                   FileSystemPath.CombineFileName(chunkOffset.ToString(),
                                                                  ChunkFileExtension)));
 }
示例#20
0
 private string GetRemotePath(FileSystemPath localPath)
 {
     return(myRootFolder.Combine(localPath.Name).FullPath.Replace('\\', '/'));
 }
示例#21
0
        public GameWorld(GameWorldConfiguration configuration,
                         FileSystemPath worldFilePath, TrippingCubesGame game)
        {
            DateTime startTime = DateTime.Now;

            Game = game;

            Entities = new ReadOnlyCollection <IEntity>(entities);

            Physics = new PhysicsSystem(IsBlockSolid, IsBlockLiquid);

            Paths = new ReadOnlyDictionary <string, PathLinear>(
                configuration.Paths ?? new Dictionary <string, PathLinear>());

            Log.Trace("Initializing world style...");
            try
            {
                Game.Resources.LoadMesh(MeshData.Skybox).Subscribe(
                    r => skyboxMesh = r);
                Game.Resources.LoadTexture(configuration.SkyboxPath,
                                           TextureFilter.Linear).Subscribe(
                    r => skyboxTexture = r);
                if (!configuration.InnerSkyboxPath.IsEmpty)
                {
                    Game.Resources.LoadTexture(configuration.InnerSkyboxPath,
                                               TextureFilter.Linear).Subscribe(
                        r => innerSkyboxTexture = r);
                }
            }
            catch (Exception exc)
            {
                Log.Warning("The skybox couldn't be loaded and will not " +
                            "be available.", exc);
            }
            try
            {
                DateTime             localStartTime       = DateTime.Now;
                BlockRegistryBuilder blockRegistryBuilder =
                    BlockRegistryBuilder.FromXml(
                        configuration.BlockRegistryPath,
                        FileSystem, false);
                Blocks = blockRegistryBuilder.GenerateRegistry(
                    FileSystem);
                Log.Trace("Block registry with " + Blocks.Count +
                          " block definitions initialized in " +
                          (DateTime.Now - localStartTime).TotalMilliseconds + "ms.");
            }
            catch (Exception exc)
            {
                throw new Exception("The block registry couldn't be " +
                                    "initialized.", exc);
            }


            Log.Trace("Initializing world chunk manager...");
            try
            {
                FileSystemPath primaryWorldBackupPath =
                    FileSystemPath.Combine(worldFilePath.GetParentDirectory(),
                                           $"{worldFilePath.GetFileName(false)}1");
                FileSystemPath secondaryWorldBackupPath =
                    FileSystemPath.Combine(worldFilePath.GetParentDirectory(),
                                           $"{worldFilePath.GetFileName(false)}2");

                if (FileSystem.IsWritable)
                {
                    try
                    {
                        if (FileSystem.ExistsFile(primaryWorldBackupPath))
                        {
                            using Stream secondaryBackupStream =
                                      FileSystem.CreateFile(secondaryWorldBackupPath,
                                                            true);
                            using Stream primaryWorldBackup =
                                      FileSystem.OpenFile(primaryWorldBackupPath,
                                                          false);

                            primaryWorldBackup.CopyTo(secondaryBackupStream);
                        }

                        if (FileSystem.ExistsFile(worldFilePath))
                        {
                            using Stream primaryWorldBackup =
                                      FileSystem.CreateFile(primaryWorldBackupPath,
                                                            true);
                            using Stream worldFile =
                                      FileSystem.OpenFile(worldFilePath, false);

                            worldFile.CopyTo(primaryWorldBackup);
                        }
                    }
                    catch (Exception exc)
                    {
                        throw new Exception("The world backups couldn't be " +
                                            "updated.", exc);
                    }
                }

                if (FileSystem.ExistsFile(worldFilePath))
                {
                    zipFileSystem = new ZipFileSystem(FileSystem.OpenFile(
                                                          worldFilePath, FileSystem.IsWritable));
                }
                else if (FileSystem.IsWritable)
                {
                    Log.Information("No world data file was found at the " +
                                    "specified path. A new world file is initialized.");
                    zipFileSystem = ZipFileSystem.Initialize(FileSystem,
                                                             worldFilePath, false);
                }
                else
                {
                    throw new Exception("The world data file doesn't exist " +
                                        $"under the path {worldFilePath} and can't be created, " +
                                        "as the file system is read-only.");
                }

                RootChunk = new Chunk <BlockVoxel>(
                    new BlockChunkManager(Blocks, Game.Resources,
                                          zipFileSystem, "/"));
            }
            catch (Exception exc)
            {
                throw new Exception("The world chunk manager couldn't be " +
                                    "initialized.", exc);
            }


            Log.Trace("Spawning entities...");
            foreach (EntityInstantiation instantiation in
                     configuration.Entities)
            {
                if (configuration.EntityConfigurations.TryGetValue(
                        instantiation.ConfigurationIdentifier,
                        out EntityConfiguration entityConfiguration))
                {
                    try
                    {
                        IEntity entity = entityConfiguration.Instantiate(this,
                                                                         instantiation.InstanceParameters);
                        entities.Add(entity);
                    }
                    catch (Exception exc)
                    {
                        Log.Warning($"Entity #{entities.Count} couldn't " +
                                    "be spawned and will be skipped.", exc);
                    }
                }
            }
            Log.Trace($"Spawned {entities.Count} entities.");

            Log.Trace("Game world initialized in " +
                      (DateTime.Now - startTime).TotalMilliseconds + "ms.");
        }
 public static string GetAngularJsVersion(FileSystemPath root, Version version)
 {
     return(root.Combine("angular." + version.ToString(3) + ".js").FullPath);
 }
    public static ISymbolTable GetReferenceSymbolTable(IPathReference pathReference, bool useReferenceName, bool includeHttpHandlers = true)
    {
      var propertiesSearcher =
        pathReference.GetTreeNode().GetSolution().GetComponent<MSBuildPropertiesCache>();

      string productHomeDir = propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(),
        "ProductHomeDir");
      var basePath = new FileSystemPath(productHomeDir);
      if (basePath.IsEmpty)
      {
        return EmptySymbolTable.INSTANCE;
      }

      FolderQualifierInfo folderQualifierInfo = null;
      IPsiServices psiServices = pathReference.GetTreeNode().GetPsiServices();
      var baseProjectFolder = psiServices.Solution.FindProjectItemsByLocation(basePath).FirstOrDefault() as IProjectFolder;
      if (baseProjectFolder != null)
      {
        folderQualifierInfo = new FolderQualifierInfo(baseProjectFolder);
      }

      FileSystemPath websiteRoot = GetRootPath(pathReference);
      IQualifier qualifier = pathReference.GetQualifier();
      if (useReferenceName)
      {
        PathDeclaredElement target = null;
        string name = pathReference.GetName();
        switch (name)
        {
          case PathDeclaredElement.CURRENT_DIR_NAME:
            target = new PathDeclaredElement(PathDeclaredElement.CURRENT_DIR_NAME, psiServices, basePath);
            break;
          case PathDeclaredElement.LEVEL_UP_NAME:
            target = new PathDeclaredElement(PathDeclaredElement.LEVEL_UP_NAME, psiServices, basePath.Directory);
            break;
          case PathDeclaredElement.ROOT_NAME:
            if (qualifier != null)
            {
              goto default;
            }
            target = new PathDeclaredElement(PathDeclaredElement.ROOT_NAME, psiServices, websiteRoot);
            break;
          default:
            try
            {
              string parserGenOutputBase =
                propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(), "ParserGenOutputBase");
              FileSystemPath path = basePath.Combine(parserGenOutputBase + "\\" + name);
              target = new PathDeclaredElement(name, psiServices, path);
            }
            catch (InvalidPathException)
            {
            }
            catch (ArgumentException)
            {
            }
            break;
        }
        var table = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
        if (target != null)
        {
          table.AddSymbol(target, EmptySubstitution.INSTANCE, 1);
        }
        return table;
      }

      FileSystemPath rootPath = (qualifier == null) ? websiteRoot : FileSystemPath.Empty;
      ISymbolTable symbolTableByPath = PathReferenceUtil.GetSymbolTableByPath(basePath, psiServices, basePath.Directory, rootPath, true);
      FileSystemPath basePathBeforeMapping = GetBasePathBeforeMapping(pathReference);
      if (!basePathBeforeMapping.IsNullOrEmpty())
      {
        IWebProjectPathMapping pathMapping = WebPathMappingManager.GetPathMapping(pathReference);
        List<FileSystemPath> mappedPaths = pathMapping.GetAllPathPartsIn(basePathBeforeMapping).ToList();
        if (mappedPaths.Any())
        {
          var mappedPathsTable = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
          foreach (FileSystemPath mappedPath in mappedPaths)
          {
            var declaredElement = new PathDeclaredElement(psiServices, mappedPath);
            mappedPathsTable.AddSymbol(declaredElement, EmptySubstitution.INSTANCE, 1);
          }
          symbolTableByPath = symbolTableByPath.Merge(mappedPathsTable);
        }
      }

      if (!includeHttpHandlers)
      {
        return symbolTableByPath;
      }

      var httpHandlersTable = new SymbolTable(psiServices);

      return httpHandlersTable.Merge(symbolTableByPath);
    }
        public static ISymbolTable GetReferenceSymbolTable(IPathReference pathReference, bool useReferenceName, bool includeHttpHandlers = true)
        {
            var propertiesSearcher =
                pathReference.GetTreeNode().GetSolution().GetComponent <MSBuildPropertiesCache>();

            string productHomeDir = propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(),
                                                                                "ProductHomeDir");
            var basePath = new FileSystemPath(productHomeDir);

            if (basePath.IsEmpty)
            {
                return(EmptySymbolTable.INSTANCE);
            }

            FolderQualifierInfo folderQualifierInfo = null;
            IPsiServices        psiServices         = pathReference.GetTreeNode().GetPsiServices();
            var baseProjectFolder = psiServices.Solution.FindProjectItemsByLocation(basePath).FirstOrDefault() as IProjectFolder;

            if (baseProjectFolder != null)
            {
                folderQualifierInfo = new FolderQualifierInfo(baseProjectFolder);
            }

            FileSystemPath websiteRoot = GetRootPath(pathReference);
            IQualifier     qualifier   = pathReference.GetQualifier();

            if (useReferenceName)
            {
                PathDeclaredElement target = null;
                string name = pathReference.GetName();
                switch (name)
                {
                case PathDeclaredElement.CURRENT_DIR_NAME:
                    target = new PathDeclaredElement(PathDeclaredElement.CURRENT_DIR_NAME, psiServices, basePath);
                    break;

                case PathDeclaredElement.LEVEL_UP_NAME:
                    target = new PathDeclaredElement(PathDeclaredElement.LEVEL_UP_NAME, psiServices, basePath.Directory);
                    break;

                case PathDeclaredElement.ROOT_NAME:
                    if (qualifier != null)
                    {
                        goto default;
                    }
                    target = new PathDeclaredElement(PathDeclaredElement.ROOT_NAME, psiServices, websiteRoot);
                    break;

                default:
                    try
                    {
                        string parserGenOutputBase =
                            propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(), "ParserGenOutputBase");
                        FileSystemPath path = basePath.Combine(parserGenOutputBase + "\\" + name);
                        target = new PathDeclaredElement(name, psiServices, path);
                    }
                    catch (InvalidPathException)
                    {
                    }
                    catch (ArgumentException)
                    {
                    }
                    break;
                }
                var table = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
                if (target != null)
                {
                    table.AddSymbol(target, EmptySubstitution.INSTANCE, 1);
                }
                return(table);
            }

            FileSystemPath rootPath              = (qualifier == null) ? websiteRoot : FileSystemPath.Empty;
            ISymbolTable   symbolTableByPath     = PathReferenceUtil.GetSymbolTableByPath(basePath, psiServices, basePath.Directory, rootPath, true);
            FileSystemPath basePathBeforeMapping = GetBasePathBeforeMapping(pathReference);

            if (!basePathBeforeMapping.IsNullOrEmpty())
            {
                IWebProjectPathMapping pathMapping = WebPathMappingManager.GetPathMapping(pathReference);
                List <FileSystemPath>  mappedPaths = pathMapping.GetAllPathPartsIn(basePathBeforeMapping).ToList();
                if (mappedPaths.Any())
                {
                    var mappedPathsTable = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
                    foreach (FileSystemPath mappedPath in mappedPaths)
                    {
                        var declaredElement = new PathDeclaredElement(psiServices, mappedPath);
                        mappedPathsTable.AddSymbol(declaredElement, EmptySubstitution.INSTANCE, 1);
                    }
                    symbolTableByPath = symbolTableByPath.Merge(mappedPathsTable);
                }
            }

            if (!includeHttpHandlers)
            {
                return(symbolTableByPath);
            }

            var httpHandlersTable = new SymbolTable(psiServices);

            return(httpHandlersTable.Merge(symbolTableByPath));
        }
        public void Default()
        {
            _gitDirectory.Combine("HEAD").WriteAllText("ref: refs/heads/my_branch");

            DoNamedTest();
        }
 public static string GetAngularJsVersion(FileSystemPath root, Version version)
 {
     return root.Combine("angular." + version.ToString(3) + ".js").FullPath;
 }