public RiotProject LoadProject(RiotProjectType projectType, string projectPath) { // - Find the RADS Project's latest release directory ------------------------------------ var versionStringParser = new VersionStringUtilities(); var releasesPath = Path.Combine(projectPath, "releases"); var releases = from releasePath in Directory.GetDirectories(releasesPath) let versionString = versionStringParser.GetVersionString(releasePath) where !string.IsNullOrWhiteSpace(versionString) let versionNumber = versionStringParser.GetVersionNumber(versionString) select new { ReleasePath = releasePath, VersionNumber = versionNumber }; var latestRelease = releases.MaxBy((release) => release.VersionNumber); // - Load RADS Project Release Manifest and assign to RADS Project ----------------------- var releaseManifestPath = Path.Combine(latestRelease.ReleasePath, "releasemanifest"); var releaseManifest = new ReleaseManifestLoader().LoadFile(releaseManifestPath); // - Project-Type-Specific Hacks ------------------------------------------------ if (projectType == RiotProjectType.AirClient) { var rootEntry = releaseManifest.Root; var overloadName = Path.Combine(latestRelease.ReleasePath, "deploy"); var overload = new ReleaseManifestRootDirectoryOverload((ReleaseManifestDirectoryEntry)rootEntry, overloadName); releaseManifest.Root = overload; } return(new RiotProject(projectType, releaseManifest, latestRelease.VersionNumber)); }
public RiotFileSystem(RadsService radsService, RiotProjectType projectType) { this.radsService = radsService; this.projectType = projectType; radsService.Resumed += HandleRadsServiceResumed; radsService.Suspending += HandleRadsServiceSuspending; }
public RiotProject GetProjectUnsafe(RiotProjectType projectType) { lock (synchronization) { RiotProject result; if (!projectsByType.TryGetValue(projectType, out result)) { result = new RiotProjectLoader(solutionPath).LoadProject(projectType); } return result; } }
public RiotProject GetProjectUnsafe(RiotProjectType projectType) { lock (synchronization) { RiotProject result; if (!projectsByType.TryGetValue(projectType, out result)) { result = new RiotProjectLoader(solutionPath).LoadProject(projectType); } return(result); } }
public RiotProject LoadProject(RiotProjectType projectType) { string projectName; if (projectType == RiotProjectType.AirClient) { projectName = "lol_air_client"; } else if (projectType == RiotProjectType.GameClient) { projectName = "lol_game_client"; } else { throw new NotImplementedException(); } return(LoadProject(projectType, Path.Combine(projectsDirectoryPath, projectName))); }
public ReleaseManifest LoadProjectManifest(string radsPath, RiotProjectType projectType) { string projectName; if (projectType == RiotProjectType.GameClient) { projectName = "lol_game_client"; } else { throw new NotImplementedException("TODO: Refactor project types into attributes"); } var releasesPath = Path.Combine(radsPath, "projects", projectName, "releases"); var releasesNames = Directory.EnumerateDirectories(releasesPath, "*", SearchOption.TopDirectoryOnly); var maximumRelease = releasesNames.MaxBy(new VersionStringUtilities().GetVersionNumber); var releaseManifestPath = Path.Combine(releasesPath, maximumRelease, "releasemanifest"); return(LoadFile(releaseManifestPath)); }
public void LoadProjectAndResolver(RiotProjectType projectType, out RiotProject riotProject, out Resolver resolver) { Tuple <WeakReference <RiotProject>, DateTime, WeakReference <Resolver> > tuple; if (cache.TryGetValue(projectType, out tuple) && tuple.Item1.TryGetTarget(out riotProject) && tuple.Item3.TryGetTarget(out resolver) && File.GetLastWriteTime(riotProject.ReleaseManifest.Path) == tuple.Item2) { logger?.Info("Successfully saved project and resolver from GCing: " + projectType); } else { logger?.Info("Constructing new project and resolver: " + projectType); var riotProjectLoader = new RiotProjectLoader(leagueConfiguration.RadsPath); riotProject = riotProjectLoader.LoadProject(projectType); resolver = new Resolver(riotProject.ReleaseManifest.Root, new ResolverConfigurationImpl(systemState)); var manifestLastModified = File.GetLastWriteTime(riotProject.ReleaseManifest.Path); cache[projectType] = new Tuple <WeakReference <RiotProject>, DateTime, WeakReference <Resolver> >(new WeakReference <RiotProject>(riotProject), manifestLastModified, new WeakReference <Resolver>(resolver)); } }
public RiotProject(RiotProjectType projectType, ReleaseManifest releaseManifest, uint version) { this.projectType = projectType; this.releaseManifest = releaseManifest; this.version = version; }
public ReleaseManifest GetReleaseManifestUnsafe(RiotProjectType projectType) { lock (synchronization) { return(new ReleaseManifestLoader().LoadProjectManifest(solutionPath, projectType)); } }
public IRadsProjectReference GetProjectReference(RiotProjectType projectType) { lock (synchronization) { return(new RadsProjectReference(GetProjectUnsafe(projectType))); } }
public ReleaseManifest GetReleaseManifestUnsafe(RiotProjectType projectType) { lock (synchronization) { return new ReleaseManifestLoader().LoadProjectManifest(solutionPath, projectType); } }
public IRadsProjectReference GetProjectReference(RiotProjectType projectType) { lock (synchronization) { return new RadsProjectReference(GetProjectUnsafe(projectType)); } }