internal static void Parse(string PackageName, PackageRepository mifRepo, ClassRepository repo) { // Find the package that contains the class we want Package pkg = mifRepo.Find(p => p.PackageLocation.ToString(MifCompiler.NAME_FORMAT) == PackageName) as Package; if (pkg == null) // Check if package was found { System.Diagnostics.Trace.WriteLine(string.Format("Could not find static model '{0}'. Any dependent models may not be rendered correctly!", PackageName), "warn"); return; } // Process the package IPackageCompiler comp = null; if (pkg is GlobalStaticModel) comp = new StaticModelCompiler(); else if (pkg is SerializedStaticModel) comp = new SerializedStaticModelCompiler(); else { System.Diagnostics.Trace.WriteLine(String.Format("Can't find an appropriate compiler for package '{0}'... Package will not be parsed", PackageName), "error"); return; } comp.ClassRepository = repo; comp.Package = pkg; comp.PackageRepository = pkg.MemberOfRepository; comp.Compile(); }
public static void ManualTrigger(TextWriter log) { var key = ConfigurationManager.AppSettings["NugetApiKey"]; var packageRepository = new PackageRepository(key); var observer = new DriverVersionObserver(packageRepository); string latestVersionValue = observer.GetSourceVersionAsync().Result.Trim(); string versionValue = observer.GetPackageVersion(); log.WriteLine($"Latest version of ChromeDriver is {latestVersionValue}"); log.WriteLine($"Current version of ChromeDriver package is {versionValue}"); float latestVersion; float version; if (float.TryParse(latestVersionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out latestVersion) && float.TryParse(versionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out version)) { if (latestVersion > version) { var logger = new StringLogger(); var builder = new DriverPackageBuilder(logger, new DriverSourceLoader(), packageRepository); var package = builder.Build($@"..\build\{latestVersionValue}", latestVersionValue); builder.Push(package); log.WriteLine("New version was published"); log.Write(logger.ToString()); } else { log.WriteLine("New version is absent"); } } else { throw new InvalidOperationException("Invalid version format"); } }
private void NotifyIcon_Click(object sender, EventArgs e) { // Remove the notify icon DestroyIcon(); // Show AddInManager window on click using (AddInManagerView view = AddInManagerView.Create()) { var viewModel = view.ViewModel; if (viewModel != null) { // Activate update view explicitly viewModel.UpdatedAddInsViewModel.IsExpandedInView = true; var firstRepositoryWithUpdates = viewModel.UpdatedAddInsViewModel.PackageRepositories.FirstOrDefault(pr => pr.SourceUrl == _firstRepositoryWithUpdates.SourceUrl); if (firstRepositoryWithUpdates != null) { // Directly go to first repository containing an update viewModel.UpdatedAddInsViewModel.SelectedPackageSource = firstRepositoryWithUpdates; } } _firstRepositoryWithUpdates = null; view.ShowDialog(); } }
public when_querying_packages() { RefreshDb(); var state = StateMother.Published; SaveAndFlush(state); _id = Guid.NewGuid(); Session.Save(new ReadPackageMother(_id, state).VVi); Session.Save(new ReadPackageMother(_id, state).VVi); Session.Save(new ReadPackageMother(state).VLi); Session.Flush(); _repository = new PackageRepository(Session); }
internal static void ParseClassFromPackage(string ClassName, PackageRepository mifRepo, ClassRepository repo) { // Class and package location string classNamePart = ClassName.Substring(ClassName.IndexOf(".") + 1); string packageLocationPart = ClassName.Substring(0, ClassName.IndexOf(".")); // Find the package that contains the class we want GlobalStaticModel pkg = mifRepo.Find(p => (p is GlobalStaticModel) && (p as GlobalStaticModel).OwnedClass.Find(c => c.Choice is MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class && (c.Choice as MohawkCollege.EHR.HL7v3.MIF.MIF20.StaticModel.Flat.Class).Name == classNamePart) != null && p.PackageLocation.ToString(MifCompiler.NAME_FORMAT) == packageLocationPart) as GlobalStaticModel; // Process the package if (pkg == null) throw new InvalidOperationException(string.Format("Can't find '{0}' in the package repository, cannot continue processing", ClassName)); StaticModelCompiler comp = new StaticModelCompiler(); comp.ClassRepository = repo; comp.Package = pkg; comp.PackageRepository = pkg.MemberOfRepository; comp.Compile(); }
private static async Task RunAdd(AddOptions options) { var packageRepo = new PackageRepository(options.RepositoryOptions); await packageRepo.Add(options.Source); }
public Package GetPackageById(long packageId) { return(PackageRepository.GetById(packageId)); }
public ReimportPackageCommand(PackageRepository mPackageRepository) { this.mPackageRepository = mPackageRepository; }
protected IProcessScriptRuntime GetProcessScriptRuntime(string definitionId) { return(ProcessSession.Current.GetOrAddSessionData("_ProcessScript_" + definitionId, () => PackageRepository.GetScriptRuntime(definitionId))); }
private async Task <bool> RestoreForProject(string projectJsonPath, string rootDirectory, string packagesDirectory, IList <IWalkProvider> remoteProviders, SummaryContext summary) { var success = true; Reports.Information.WriteLine(string.Format("Restoring packages for {0}", projectJsonPath.Bold())); var sw = new Stopwatch(); sw.Start(); var projectFolder = Path.GetDirectoryName(projectJsonPath); var projectLockFilePath = Path.Combine(projectFolder, LockFileFormat.LockFileName); Runtime.Project project; var diagnostics = new List <DiagnosticMessage>(); if (!Runtime.Project.TryGetProject(projectJsonPath, out project, diagnostics)) { var errorMessages = diagnostics .Where(x => x.Severity == DiagnosticMessageSeverity.Error) .Select(x => x.Message); throw new InvalidOperationException(errorMessages.Any() ? $"Errors occured when while parsing project.json:{Environment.NewLine}{string.Join(Environment.NewLine, errorMessages)}" : "Invalid project.json"); } if (diagnostics.HasErrors()) { var errorMessages = diagnostics .Where(x => x.Severity == DiagnosticMessageSeverity.Error) .Select(x => x.Message); summary.ErrorMessages.GetOrAdd(projectJsonPath, _ => new List <string>()).AddRange(errorMessages); } var lockFile = await ReadLockFile(projectLockFilePath); var useLockFile = false; if (Lock == false && Unlock == false && lockFile != null && lockFile.Islocked) { useLockFile = true; } if (useLockFile && !lockFile.IsValidForProject(project)) { // Exhibit the same behavior as if it has been run with "dnu restore --lock" Reports.Information.WriteLine("Updating the invalid lock file with {0}", "dnu restore --lock".Yellow().Bold()); useLockFile = false; Lock = true; } Func <string, string> getVariable = key => { return(null); }; if (!SkipRestoreEvents) { if (!ScriptExecutor.Execute(project, "prerestore", getVariable)) { summary.ErrorMessages.GetOrAdd("prerestore", _ => new List <string>()).Add(ScriptExecutor.ErrorMessage); Reports.Error.WriteLine(ScriptExecutor.ErrorMessage); return(false); } } var projectDirectory = project.ProjectDirectory; var projectResolver = new ProjectResolver(projectDirectory, rootDirectory); var packageRepository = new PackageRepository(packagesDirectory) { CheckHashFile = CheckHashFile }; var restoreOperations = new RestoreOperations(Reports.Verbose); var projectProviders = new List <IWalkProvider>(); var localProviders = new List <IWalkProvider>(); var contexts = new List <RestoreContext>(); var cache = new Dictionary <LibraryRange, Task <WalkProviderMatch> >(); projectProviders.Add( new LocalWalkProvider( new ProjectReferenceDependencyProvider( projectResolver))); localProviders.Add( new LocalWalkProvider( new NuGetDependencyResolver(packageRepository))); // Add the embedded package provider at the very end of the local providers localProviders.Add(new ImplicitPackagesWalkProvider()); var tasks = new List <Task <TargetContext> >(); if (useLockFile) { Reports.Information.WriteLine(string.Format("Following lock file {0}", projectLockFilePath.White().Bold())); var context = new RestoreContext { FrameworkName = FallbackFramework, ProjectLibraryProviders = projectProviders, LocalLibraryProviders = localProviders, RemoteLibraryProviders = remoteProviders, MatchCache = cache }; contexts.Add(context); foreach (var lockFileLibrary in lockFile.PackageLibraries) { var projectLibrary = new LibraryRange(lockFileLibrary.Name, frameworkReference: false) { VersionRange = new SemanticVersionRange { MinVersion = lockFileLibrary.Version, MaxVersion = lockFileLibrary.Version, IsMaxInclusive = true, VersionFloatBehavior = SemanticVersionFloatBehavior.None, } }; tasks.Add(CreateGraphNode(restoreOperations, context, projectLibrary, _ => false)); } } else { var frameworks = TargetFrameworks.Count == 0 ? project.GetTargetFrameworks().Select(f => f.FrameworkName) : TargetFrameworks; foreach (var frameworkName in frameworks) { var context = new RestoreContext { FrameworkName = frameworkName, ProjectLibraryProviders = projectProviders, LocalLibraryProviders = localProviders, RemoteLibraryProviders = remoteProviders, MatchCache = cache }; contexts.Add(context); } if (!contexts.Any()) { contexts.Add(new RestoreContext { FrameworkName = FallbackFramework, ProjectLibraryProviders = projectProviders, LocalLibraryProviders = localProviders, RemoteLibraryProviders = remoteProviders, MatchCache = cache }); } foreach (var context in contexts) { var projectLibrary = new LibraryRange(project.Name, frameworkReference: false) { VersionRange = new SemanticVersionRange(project.Version) }; tasks.Add(CreateGraphNode(restoreOperations, context, projectLibrary, _ => true)); } } var targetContexts = await Task.WhenAll(tasks); foreach (var targetContext in targetContexts) { Reduce(targetContext.Root); } if (!useLockFile) { var projectRuntimeFile = RuntimeFile.ParseFromProject(project); var restoreRuntimes = GetRestoreRuntimes(projectRuntimeFile.Runtimes.Keys).ToList(); if (restoreRuntimes.Any()) { var runtimeTasks = new List <Task <TargetContext> >(); foreach (var pair in contexts.Zip(targetContexts, (context, graph) => new { context, graph })) { var runtimeFileTasks = new List <Task <RuntimeFile> >(); ForEach(pair.graph.Root, node => { var match = node?.Item?.Match; if (match == null) { return; } runtimeFileTasks.Add(match.Provider.GetRuntimes(node.Item.Match, pair.context.FrameworkName)); }); var libraryRuntimeFiles = await Task.WhenAll(runtimeFileTasks); var runtimeFiles = new List <RuntimeFile> { projectRuntimeFile }; runtimeFiles.AddRange(libraryRuntimeFiles.Where(file => file != null)); foreach (var runtimeName in restoreRuntimes) { Reports.WriteVerbose($"Restoring packages for {pair.context.FrameworkName} on {runtimeName}..."); var runtimeDependencies = new Dictionary <string, DependencySpec>(); var runtimeNames = new HashSet <string>(); var runtimeStopwatch = Stopwatch.StartNew(); FindRuntimeDependencies( runtimeName, runtimeFiles, runtimeDependencies, runtimeNames); runtimeStopwatch.Stop(); Reports.WriteVerbose($" Scanned Runtime graph in {runtimeStopwatch.ElapsedMilliseconds:0.00}ms"); // If there are no runtime specs in the graph, we still want to restore for the specified runtime, so synthesize one if (!runtimeNames.Any(r => r.Equals(runtimeName))) { runtimeNames.Add(runtimeName); } var runtimeContext = new RestoreContext { FrameworkName = pair.context.FrameworkName, ProjectLibraryProviders = pair.context.ProjectLibraryProviders, LocalLibraryProviders = pair.context.LocalLibraryProviders, RemoteLibraryProviders = pair.context.RemoteLibraryProviders, RuntimeName = runtimeName, AllRuntimeNames = runtimeNames, RuntimeDependencies = runtimeDependencies, MatchCache = cache }; var projectLibrary = new LibraryRange(project.Name, frameworkReference: false) { VersionRange = new SemanticVersionRange(project.Version) }; runtimeTasks.Add(CreateGraphNode(restoreOperations, runtimeContext, projectLibrary, _ => true)); } } var runtimeTragetContexts = await Task.WhenAll(runtimeTasks); foreach (var runtimeTargetContext in runtimeTragetContexts) { Reduce(runtimeTargetContext.Root); } targetContexts = targetContexts.Concat(runtimeTragetContexts).ToArray(); } } var graphItems = new List <GraphItem>(); var installItems = new List <GraphItem>(); var missingItems = new HashSet <LibraryRange>(); foreach (var context in targetContexts) { ForEach(context.Root, node => { if (node == null || node.LibraryRange == null) { return; } if (node.Item == null || node.Item.Match == null) { // This is a workaround for #1322. Since we use restore to generate the lock file // after publish, it's possible to fail restore after copying the closure if (!IgnoreMissingDependencies) { if (!node.LibraryRange.IsGacOrFrameworkReference && missingItems.Add(node.LibraryRange)) { var versionString = node.LibraryRange.VersionRange == null ? string.Empty : (" " + node.LibraryRange.VersionRange.ToString()); var errorMessage = $"Unable to locate {DependencyTargets.GetDisplayForTarget(node.LibraryRange.Target)} " + $"{node.LibraryRange.Name.Red().Bold()}{versionString}"; summary.ErrorMessages.GetOrAdd(projectJsonPath, _ => new List <string>()).Add(errorMessage); Reports.Error.WriteLine(errorMessage); success = false; } } return; } if (!string.Equals(node.Item.Match.Library.Name, node.LibraryRange.Name, StringComparison.Ordinal)) { // Fix casing of the library name to be installed node.Item.Match.Library = node.Item.Match.Library.ChangeName(node.LibraryRange.Name); } var isRemote = remoteProviders.Contains(node.Item.Match.Provider); var isInstallItem = installItems.Any(item => item.Match.Library == node.Item.Match.Library); if (!isInstallItem && isRemote) { // It's ok to download rejected nodes so we avoid downloading them in the future // The trade off is that subsequent restores avoid going to any remotes installItems.Add(node.Item); } // Don't add rejected nodes since we only want to write reduced nodes // to the lock file if (node.Disposition != GraphNode.DispositionType.Rejected) { var isGraphItem = graphItems.Any(item => item.Match.Library == node.Item.Match.Library); if (!isGraphItem) { graphItems.Add(node.Item); } context.Matches.Add(node.Item.Match); } }); } if (!SkipInstall) { await InstallPackages(installItems, packagesDirectory); summary.InstallCount += installItems.Count; } if (!useLockFile) { Reports.Information.WriteLine(string.Format("Writing lock file {0}", projectLockFilePath.White().Bold())); var repository = new PackageRepository(packagesDirectory); WriteLockFile(lockFile, projectLockFilePath, project, graphItems, repository, projectResolver, targetContexts); } if (!SkipRestoreEvents) { if (!ScriptExecutor.Execute(project, "postrestore", getVariable)) { summary.ErrorMessages.GetOrAdd("postrestore", _ => new List <string>()).Add(ScriptExecutor.ErrorMessage); Reports.Error.WriteLine(ScriptExecutor.ErrorMessage); return(false); } if (!ScriptExecutor.Execute(project, "prepare", getVariable)) { summary.ErrorMessages.GetOrAdd("prepare", _ => new List <string>()).Add(ScriptExecutor.ErrorMessage); Reports.Error.WriteLine(ScriptExecutor.ErrorMessage); return(false); } } Reports.Information.WriteLine(string.Format("{0}, {1}ms elapsed", "Restore complete".Green().Bold(), sw.ElapsedMilliseconds)); return(success); }
public IQueryable <V2FeedPackage> GetUpdates( string packageIds, string versions, bool includePrerelease, bool includeAllVersions, string targetFrameworks, string versionConstraints) { if (String.IsNullOrEmpty(packageIds) || String.IsNullOrEmpty(versions)) { return(Enumerable.Empty <V2FeedPackage>().AsQueryable()); } // Workaround https://github.com/NuGet/NuGetGallery/issues/674 for NuGet 2.1 client. Can probably eventually be retired (when nobody uses 2.1 anymore...) // Note - it was URI un-escaping converting + to ' ', undoing that is actually a pretty conservative substitution because // space characters are never acepted as valid by VersionUtility.ParseFrameworkName. if (!string.IsNullOrEmpty(targetFrameworks)) { targetFrameworks = targetFrameworks.Replace(' ', '+'); } var idValues = packageIds.Trim().ToLowerInvariant().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var versionValues = versions.Trim().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var targetFrameworkValues = String.IsNullOrEmpty(targetFrameworks) ? null : targetFrameworks.Split('|').Select(tfx => NuGetFramework.Parse(tfx)).ToList(); var versionConstraintValues = String.IsNullOrEmpty(versionConstraints) ? new string[idValues.Length] : versionConstraints.Split('|'); if (idValues.Length == 0 || idValues.Length != versionValues.Length || idValues.Length != versionConstraintValues.Length) { // Exit early if the request looks invalid return(Enumerable.Empty <V2FeedPackage>().AsQueryable()); } var versionLookup = idValues.Select((id, i) => { NuGetVersion currentVersion; if (NuGetVersion.TryParse(versionValues[i], out currentVersion)) { VersionRange versionConstraint = null; if (versionConstraintValues[i] != null) { if (!VersionRange.TryParse(versionConstraintValues[i], out versionConstraint)) { versionConstraint = null; } } return(Tuple.Create(id, Tuple.Create(currentVersion, versionConstraint))); } return(null); }) .Where(t => t != null) .ToLookup(t => t.Item1, t => t.Item2, StringComparer.OrdinalIgnoreCase); var packages = PackageRepository.GetAll() .Include(p => p.PackageRegistration) .Include(p => p.SupportedFrameworks) .Where(p => !p.Deleted && p.Listed && (includePrerelease || !p.IsPrerelease) && idValues.Contains(p.PackageRegistration.Id.ToLower())) .OrderBy(p => p.PackageRegistration.Id); return(GetUpdates(packages, versionLookup, targetFrameworkValues, includeAllVersions).AsQueryable() .ToV2FeedPackageQuery(GetSiteRoot(), Configuration.Features.FriendlyLicenses)); }
public static void BeforePackagesScenarios() { var context = new ShopAnyWareSql(); var userRepository = new UserRepository(context); var packageRepository = new PackageRepository(); var itemsRepository = new ItemsRepository(); var addressRepository = new AddressRepository(); var logger = new FakeLogger(); var emailSvc = new FakeEmailService(); var packagesService = new PackagesService( packageRepository, userRepository, addressRepository, emailSvc, logger); var itemsService = new ItemsService(itemsRepository, packageRepository, logger); ScenarioContext.Current.Set(packagesService); ScenarioContext.Current.Set(itemsService); }
private PackageService GetPackageService() { IPackageRepository packageRepository = new PackageRepository(ConfigurationManager.ConnectionStrings["ENetCareLiveAll"].ConnectionString); return(new PackageService(packageRepository)); }
public NuGetDependencyResolver(PackageRepository repository) { _repository = repository; Dependencies = Enumerable.Empty <LibraryDescription>(); }
public NuGetDependencyResolver(PackageRepository repository) { _repository = repository; }
public ManagerService() { MR = new ManagerRepository(); PR = new PackageRepository(); }
public void CanSetAllPackageProperties() { PackageRepository.Create(TestRootPath) .Package( name: "PackageD", version: "1.2.3", package: out PackageIdentity package, authors: "UserA;UserB", description: "Custom description", copyright: "Copyright 2000", developmentDependency: true, #if !NET46 icon: @"some\icon.jpg", #endif iconUrl: "https://icon.url", language: "Pig latin", licenseMetadata: new LicenseMetadata(LicenseType.Expression, "MIT", null, null, Version.Parse("1.0.0")), owners: "Owner1;Owner2", packageTypes: new List <PackageType> { PackageType.Dependency, PackageType.DotnetCliTool }, projectUrl: "https://project.url", releaseNotes: "Release notes for PackageD", repositoryType: "Git", repositoryUrl: "https://repository.url", repositoryBranch: "Branch1000", repositoryCommit: "Commit14", requireLicenseAcceptance: true, serviceable: true, summary: "Summary of PackageD", tags: "Tag1 Tag2 Tag3", title: "Title of PackageD"); package.ShouldNotBeNull(); package.Id.ShouldBe("PackageD"); package.Version.ShouldBe(NuGetVersion.Parse("1.2.3")); FileInfo manifestFilePath = new FileInfo(VersionFolderPathResolver.GetManifestFilePath(package.Id, package.Version)) .ShouldExist(); using (Stream stream = File.OpenRead(manifestFilePath.FullName)) { Manifest manifest = Manifest.ReadFrom(stream, validateSchema: true); manifest.Metadata.Authors.ShouldBe(new[] { "UserA", "UserB" }); manifest.Metadata.Copyright.ShouldBe("Copyright 2000"); manifest.Metadata.Description.ShouldBe("Custom description"); manifest.Metadata.DevelopmentDependency.ShouldBeTrue(); #if !NET46 manifest.Metadata.Icon.ShouldBe(@"some\icon.jpg"); #endif manifest.Metadata.IconUrl.ShouldBe(new Uri("https://icon.url")); manifest.Metadata.Id.ShouldBe("PackageD"); manifest.Metadata.Language.ShouldBe("Pig latin"); manifest.Metadata.LicenseMetadata.License.ShouldBe("MIT"); manifest.Metadata.LicenseMetadata.Type.ShouldBe(LicenseType.Expression); manifest.Metadata.LicenseMetadata.Version.ShouldBe(Version.Parse("1.0.0")); manifest.Metadata.Owners.ShouldBe(new[] { "Owner1", "Owner2" }); manifest.Metadata.PackageTypes.ShouldBe(new[] { PackageType.Dependency, PackageType.DotnetCliTool }); manifest.Metadata.ProjectUrl.ShouldBe(new Uri("https://project.url")); manifest.Metadata.ReleaseNotes.ShouldBe("Release notes for PackageD"); manifest.Metadata.Repository.Branch.ShouldBe("Branch1000"); manifest.Metadata.Repository.Commit.ShouldBe("Commit14"); manifest.Metadata.Repository.Type.ShouldBe("Git"); manifest.Metadata.Repository.Url.ShouldBe("https://repository.url"); manifest.Metadata.RequireLicenseAcceptance.ShouldBeTrue(); manifest.Metadata.Serviceable.ShouldBeTrue(); manifest.Metadata.Summary.ShouldBe("Summary of PackageD"); manifest.Metadata.Tags.ShouldBe("Tag1 Tag2 Tag3"); manifest.Metadata.Title.ShouldBe("Title of PackageD"); } }
protected void btnRegister_Click(object sender, ImageClickEventArgs e) { try { User user = new User(); UserRepository userrepo = new UserRepository(); UserActivation objUserActivation = new UserActivation(); Coupon objCoupon = new Coupon(); CouponRepository objCouponRepository = new CouponRepository(); SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml"); try { if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium") { if (TextBox1.Text.Trim() != "") { string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString(); if (resp != "valid") { // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert(Not valid);", true); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true); return; } } if (txtPassword.Text == txtConfirmPassword.Text) { user.PaymentStatus = "unpaid"; //user.AccountType = Request.QueryString["type"]; user.AccountType = DropDownList1.SelectedValue.ToString(); if (string.IsNullOrEmpty(user.AccountType)) { user.AccountType = AccountType.Free.ToString(); } user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); user.UserName = txtFirstName.Text + " " + txtLastName.Text; user.Password = this.MD5Hash(txtPassword.Text); user.EmailId = txtEmail.Text; user.UserStatus = 1; user.ActivationStatus = "0"; if (TextBox1.Text.Trim() != "") { user.CouponCode = TextBox1.Text.Trim().ToString(); } if (!userrepo.IsUserExist(user.EmailId)) { try { if (Request.QueryString["refid"] != null) { User UserValid = null; if (IsUserValid(Request.QueryString["refid"].ToString(), ref UserValid)) { user.RefereeStatus = "1"; UpdateUserReference(UserValid); AddUserRefreeRelation(user, UserValid); } else { user.RefereeStatus = "0"; } } } catch (Exception) { throw; } UserRepository.Add(user); if (TextBox1.Text.Trim() != "") { objCoupon.CouponCode = TextBox1.Text.Trim(); List <Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon); objCoupon.Id = lstCoupon[0].Id; objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate; objCoupon.ExpCouponDate = lstCoupon[0].ExpCouponDate; objCoupon.Status = "1"; objCouponRepository.SetCouponById(objCoupon); } Session["LoggedUser"] = user; objUserActivation.Id = Guid.NewGuid(); objUserActivation.UserId = user.Id; objUserActivation.ActivationStatus = "0"; UserActivationRepository.Add(objUserActivation); //add package start UserPackageRelation objUserPackageRelation = new UserPackageRelation(); UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository(); PackageRepository objPackageRepository = new PackageRepository(); Package objPackage = objPackageRepository.getPackageDetails(user.AccountType); objUserPackageRelation.Id = new Guid(); objUserPackageRelation.PackageId = objPackage.Id; objUserPackageRelation.UserId = user.Id; objUserPackageRelation.ModifiedDate = DateTime.Now; objUserPackageRelation.PackageStatus = true; objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation); //end package SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString()); TeamRepository teamRepo = new TeamRepository(); Team team = teamRepo.getTeamByEmailId(txtEmail.Text); if (team != null) { Guid teamid = Guid.Parse(Request.QueryString["tid"]); teamRepo.updateTeamStatus(teamid); TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository(); List <TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in lstteammember) { try { SocialProfilesRepository socialRepo = new SocialProfilesRepository(); SocialProfile socioprofile = new SocialProfile(); socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = item.ProfileId; socioprofile.ProfileType = item.ProfileType; socioprofile.UserId = user.Id; socialRepo.addNewProfileForUser(socioprofile); if (item.ProfileType == "facebook") { try { FacebookAccount fbAccount = new FacebookAccount(); FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository(); FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId); fbAccount.AccessToken = userAccount.AccessToken; fbAccount.EmailId = userAccount.EmailId; fbAccount.FbUserId = item.ProfileId; fbAccount.FbUserName = userAccount.FbUserName; fbAccount.Friends = userAccount.Friends; fbAccount.Id = Guid.NewGuid(); fbAccount.IsActive = true; fbAccount.ProfileUrl = userAccount.ProfileUrl; fbAccount.Type = userAccount.Type; fbAccount.UserId = user.Id; fbAccountRepo.addFacebookUser(fbAccount); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "twitter") { try { TwitterAccount twtAccount = new TwitterAccount(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId); twtAccount.FollowersCount = twtAcc.FollowersCount; twtAccount.FollowingCount = twtAcc.FollowingCount; twtAccount.Id = Guid.NewGuid(); twtAccount.IsActive = true; twtAccount.OAuthSecret = twtAcc.OAuthSecret; twtAccount.OAuthToken = twtAcc.OAuthToken; twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl; twtAccount.ProfileUrl = twtAcc.ProfileUrl; twtAccount.TwitterName = twtAcc.TwitterName; twtAccount.TwitterScreenName = twtAcc.TwitterScreenName; twtAccount.TwitterUserId = twtAcc.TwitterUserId; twtAccount.UserId = user.Id; twtAccRepo.addTwitterkUser(twtAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccount insAccount = new InstagramAccount(); InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId); insAccount.AccessToken = InsAcc.AccessToken; insAccount.FollowedBy = InsAcc.FollowedBy; insAccount.Followers = InsAcc.Followers; insAccount.Id = Guid.NewGuid(); insAccount.InstagramId = item.ProfileId; insAccount.InsUserName = InsAcc.InsUserName; insAccount.IsActive = true; insAccount.ProfileUrl = InsAcc.ProfileUrl; insAccount.TotalImages = InsAcc.TotalImages; insAccount.UserId = user.Id; insAccRepo.addInstagramUser(insAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { LinkedInAccount linkAccount = new LinkedInAccount(); LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository(); LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId); linkAccount.Id = Guid.NewGuid(); linkAccount.IsActive = true; linkAccount.LinkedinUserId = item.ProfileId; linkAccount.LinkedinUserName = linkAcc.LinkedinUserName; linkAccount.OAuthSecret = linkAcc.OAuthSecret; linkAccount.OAuthToken = linkAcc.OAuthToken; linkAccount.OAuthVerifier = linkAcc.OAuthVerifier; linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl; linkAccount.ProfileUrl = linkAcc.ProfileUrl; linkAccount.UserId = user.Id; linkedAccountRepo.addLinkedinUser(linkAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } } lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>"; Response.Redirect("~/Home.aspx"); } else { lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>"; } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true); } } catch (Exception ex) { logger.Error(ex.StackTrace); lblerror.Text = "Please Insert Correct Information"; Console.WriteLine(ex.StackTrace); //Response.Redirect("Home.aspx"); } } catch (Exception ex) { logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); //Response.Redirect("Home.aspx"); } }
/// <summary> /// Create a new instance of the repository compiler /// </summary> public RepositoryCompiler(PackageRepository pkrep) { this.repository = pkrep; }
public void LibrariesAreResolvedCorrectly(string packageName, string framework, bool resolved) { var repo = new PackageRepository("path/to/packages"); var resolver = new NuGetDependencyResolver(repo); var net45Target = new LockFileTarget { TargetFramework = new FrameworkName(".NETFramework,Version=v4.5"), Libraries = new List <LockFileTargetLibrary> { new LockFileTargetLibrary { Name = "MetaPackage", Version = SemanticVersion.Parse("1.0.0"), }, new LockFileTargetLibrary { Name = "Net451LibPackage", Version = SemanticVersion.Parse("1.0.0"), }, new LockFileTargetLibrary { Name = "Net451RefPackage", Version = SemanticVersion.Parse("1.0.0"), }, new LockFileTargetLibrary { Name = "AssemblyPlaceholderPackage", Version = SemanticVersion.Parse("1.0.0"), CompileTimeAssemblies = new List <LockFileItem> { Path.Combine("ref", "net45", "_._") }, RuntimeAssemblies = new List <LockFileItem> { Path.Combine("lib", "net45", "_._") } } } }; var dnx451Target = new LockFileTarget { TargetFramework = new FrameworkName("DNX,Version=v4.5.1"), Libraries = new List <LockFileTargetLibrary> { new LockFileTargetLibrary { Name = "MetaPackage", Version = SemanticVersion.Parse("1.0.0") }, new LockFileTargetLibrary { Name = "Net451LibPackage", Version = SemanticVersion.Parse("1.0.0"), CompileTimeAssemblies = new List <LockFileItem> { Path.Combine("lib", "net451", "Net451LibPackage.dll") }, RuntimeAssemblies = new List <LockFileItem> { Path.Combine("lib", "net451", "Net451LibPackage.dll") } }, new LockFileTargetLibrary { Name = "Net451RefPackage", Version = SemanticVersion.Parse("1.0.0"), CompileTimeAssemblies = new List <LockFileItem> { Path.Combine("ref", "net451", "Net451LibPackage.dll") } }, new LockFileTargetLibrary { Name = "AssemblyPlaceholderPackage", Version = SemanticVersion.Parse("1.0.0") } } }; var metaPackageLibrary = new LockFileLibrary { Name = "MetaPackage", Version = SemanticVersion.Parse("1.0.0") }; var net451LibPackageLibrary = new LockFileLibrary { Name = "Net451LibPackage", Version = SemanticVersion.Parse("1.0.0"), Files = new List <string> { Path.Combine("lib", "net451", "Net451LibPackage.dll"), Path.Combine("lib", "net451", "Net451LibPackage.xml") } }; var net451RefPackageLibrary = new LockFileLibrary { Name = "Net451RefPackage", Version = SemanticVersion.Parse("1.0.0"), Files = new List <string> { Path.Combine("ref", "net451", "Net451LibPackage.dll") } }; var assemblyPlaceholderPackageLibrary = new LockFileLibrary { Name = "AssemblyPlaceholderPackage", Version = SemanticVersion.Parse("1.0.0"), Files = new List <string> { Path.Combine("lib", "net45", "_._"), Path.Combine("ref", "net45", "_._"), } }; var lockFile = new LockFile() { Targets = new List <LockFileTarget> { net45Target, dnx451Target }, Libraries = new List <LockFileLibrary> { metaPackageLibrary, net451LibPackageLibrary, net451RefPackageLibrary, assemblyPlaceholderPackageLibrary } }; resolver.ApplyLockFile(lockFile); var libToLookup = new LibraryRange(packageName, frameworkReference: false); Assert.Equal(resolved, resolver.GetDescription(libToLookup, new FrameworkName(framework)).Resolved); }
private void WriteLockFile(LockFile previousLockFile, string projectLockFilePath, Runtime.Project project, List <GraphItem> graphItems, PackageRepository repository, IProjectResolver projectResolver, IEnumerable <TargetContext> contexts) { var resolver = new DefaultPackagePathResolver(repository.RepositoryRoot.Root); var previousPackageLibraries = previousLockFile?.PackageLibraries.ToDictionary(l => Tuple.Create(l.Name, l.Version)); var lockFile = new LockFile(); lockFile.Islocked = Lock; // Use empty string as the key of dependencies shared by all frameworks lockFile.ProjectFileDependencyGroups.Add(new ProjectFileDependencyGroup( string.Empty, project.Dependencies.Select(x => x.LibraryRange.ToString()))); foreach (var frameworkInfo in project.GetTargetFrameworks()) { lockFile.ProjectFileDependencyGroups.Add(new ProjectFileDependencyGroup( frameworkInfo.FrameworkName.ToString(), frameworkInfo.Dependencies.Select(x => x.LibraryRange.ToString()))); } // Record all libraries used foreach (var item in graphItems.OrderBy(x => x.Match.Library, new LibraryComparer())) { if (item.Match.LibraryType.Equals(LibraryTypes.Implicit)) { continue; } var library = item.Match.Library; if (library.Name == project.Name) { continue; } if (item.Match.LibraryType.Equals(LibraryTypes.Project)) { var projectDependency = projectResolver.FindProject(library.Name); var projectLibrary = LockFileUtils.CreateLockFileProjectLibrary(project, projectDependency); lockFile.ProjectLibraries.Add(projectLibrary); } else if (item.Match.LibraryType.Equals(LibraryTypes.Package)) { var packageInfo = repository.FindPackagesById(library.Name) .FirstOrDefault(p => p.Version == library.Version); if (packageInfo == null) { throw new InvalidOperationException($"Unresolved package: {library.Name}"); } LockFilePackageLibrary previousLibrary = null; previousPackageLibraries?.TryGetValue(Tuple.Create(library.Name, library.Version), out previousLibrary); var package = packageInfo.Package; // The previousLibrary can't be a project, otherwise exception has been thrown. lockFile.PackageLibraries.Add(LockFileUtils.CreateLockFilePackageLibrary( previousLibrary, resolver, package, correctedPackageName: library.Name)); } else { throw new InvalidOperationException($"Unresolved library: {library.Name}"); } } var packageLibraries = lockFile.PackageLibraries.ToDictionary(lib => Tuple.Create(lib.Name, lib.Version)); // Add the contexts foreach (var context in contexts) { var target = new LockFileTarget(); target.TargetFramework = context.RestoreContext.FrameworkName; target.RuntimeIdentifier = context.RestoreContext.RuntimeName; foreach (var match in context.Matches.OrderBy(x => x.Library, new LibraryComparer())) { if (match.Library.Name == project.Name) { continue; } if (match.LibraryType.Equals(LibraryTypes.Project)) { var projectDependency = projectResolver.FindProject(match.Library.Name); var projectTargetLibrary = LockFileUtils.CreateLockFileTargetLibrary(projectDependency, context.RestoreContext); target.Libraries.Add(projectTargetLibrary); } else if (match.LibraryType.Equals(LibraryTypes.Package)) { var packageInfo = repository.FindPackagesById(match.Library.Name) .FirstOrDefault(p => p.Version == match.Library.Version); var package = packageInfo.Package; target.Libraries.Add(LockFileUtils.CreateLockFileTargetLibrary( packageLibraries[Tuple.Create(match.Library.Name, match.Library.Version)], package, context.RestoreContext, correctedPackageName: match.Library.Name)); } } lockFile.Targets.Add(target); } var lockFileFormat = new LockFileFormat(); lockFileFormat.Write(projectLockFilePath, lockFile); }
public UpdatePackageCommand(PackageRepository packageRepository) { mPackageRepository = packageRepository; }
public static void BeforeItemsScenarios() { var itemsRepository = new ItemsRepository(); var packageRepository = new PackageRepository(); var logger = new FakeLogger(); var itemsService = new ItemsService(itemsRepository, packageRepository, logger); ScenarioContext.Current.Set(itemsService); }
private void Events_PackageListDownloadEnded(object sender, PackageListDownloadEndedEventArgs e) { if (sender != _updatedAddInViewModel) { return; } if (e.WasCancelled) { return; } // Do we have any new updates? Collect this information from all configured repositories if (e.WasSuccessful) { _firstRepositoryWithUpdates = _updatedAddInViewModel.PackageRepositories.FirstOrDefault(pr => pr.HasHighlightCount); if (_firstRepositoryWithUpdates != null) { // There must be updates, show an update notification _hasNotified = true; Detach(); _services.Events.AddInManagerViewOpened += Events_AddInManagerViewOpened; _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location); _notifyIcon.Click += NotifyIcon_Click; _notifyIcon.BalloonTipClicked += NotifyIcon_Click; _notifyIcon.Text = SD.ResourceService.GetString("AddInManager2.UpdateNotifier.BubbleTitle"); _notifyIcon.BalloonTipTitle = _notifyIcon.Text; _notifyIcon.BalloonTipText = SD.ResourceService.GetString("AddInManager2.UpdateNotifier.BubbleText"); _notifyIcon.Visible = true; _notifyIcon.ShowBalloonTip(40000); return; } } Detach(); }
private static MetaStatistics GetMetaStatisticsCore(Cache cache) { Statistics stats = PackageRepository.GetCurrentStatistics(cache); return(GetMetaStatistics(stats)); }
public PackageServices() { Repo = new PackageRepository(); FromProgramToDb = new ConvertFromProgramToDb(); FromDbToProgram = new ConvertFromDbToProgramModel(); }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { return(PackageRepository.GetAll().Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) .ToV2FeedPackageQuery(GetSiteRoot())); }
protected ProcessDef GetProcessDef(string definitionId) { return(ProcessSession.Current.GetOrAddSessionData("_ProcessDef_" + definitionId, () => PackageRepository.GetProcessDef(definitionId))); }
public NuGetDependencyResolver(string packagesPath, IFrameworkReferenceResolver frameworkReferenceResolver) { _repository = new PackageRepository(packagesPath); _frameworkReferenceResolver = frameworkReferenceResolver; Dependencies = Enumerable.Empty <LibraryDescription>(); }