Ejemplo n.º 1
0
        public string CreateProject(string title, string summary, string template = null, string driver = SystemPlatforms.PostGres)
        {
            CheckAuthentication();
            var url     = Url.Combine(Config.Url, Constants.PROJECTS_URI);
            var payload = new ProjectResult()
            {
                Project = new Project
                {
                    Content = new ProjectContent
                    {
                        GuidedNavigation = 1,
                        Driver           = driver
                    },
                    Meta = new Meta
                    {
                        Title           = title,
                        Summary         = summary,
                        ProjectTemplate = template
                    }
                }
            };
            var response        = PostRequest(url, payload);
            var projectResponse = JsonConvert.DeserializeObject(response, typeof(UriResponse)) as UriResponse;

            return(projectResponse.Uri.ExtractId(Constants.PROJECTS_URI));
        }
Ejemplo n.º 2
0
 private void AppendProjectResult(ProjectResult projectAnalysisResult, ProjectResult projectResult, AnalyzerResult analyzerResult, FeatureDetectionResult featureDetectionResult)
 {
     _context.AddProjectToMap(analyzerResult);
     _solutionAnalysisResult.ProjectResults.Add(projectAnalysisResult);
     _solutionRunResult.ProjectResults.Add(projectResult);
     _projectTypeFeatureResults.Add(projectResult.ProjectFile, featureDetectionResult);
 }
Ejemplo n.º 3
0
        public ProjectResult getProjects(String str)
        {
            ProjectResult projectResult = new ProjectResult();

            Console.WriteLine("From db service");

            using (SqlConnection sqlConnection = new SqlConnection(sqlConGlobal))
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection = sqlConnection;
                    String comStringTxt = "Select Project.IdProject, Project.Name, T.idTask, T.Name, T.Description, T.DeadLine from Project INNER JOIN Task T on Project.IdProject = T.IdProject where Project.idProject = " + str + " order by T.deadline";
                    command.CommandText = comStringTxt;
                    sqlConnection.Open();

                    SqlDataReader sqlDr = command.ExecuteReader();
                    projectResult.tasks = new List <MyTask>();
                    while (sqlDr.Read())
                    {
                        MyTask myTask = new MyTask()
                        {
                            idTask      = Int32.Parse(sqlDr["idTask"].ToString()),
                            name        = sqlDr[4].ToString(),
                            description = sqlDr["description"].ToString(),
                            deadline    = sqlDr["Deadline"].ToString()
                        };
                        projectResult.name = sqlDr[1].ToString();
                        projectResult.id   = Int32.Parse(sqlDr[0].ToString());
                        projectResult.tasks.Add(myTask);
                    }
                }
            }

            return(projectResult);
        }
        public async Task TestEndToEnd()
        {
            var targetPath = @"TestData\StorageTest";

            if (Directory.Exists(targetPath))
            {
                Directory.Delete(targetPath, true);
            }

            Directory.CreateDirectory(targetPath);

            var facade = new NugetScanFacade(
                new ReportGenerator(),
                new NugetReferenceScan(),
                new ReportStorage(targetPath),
                "3.2.1");

            var project = new ProjectResult(new FileInfo(@"C:\s\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin.csproj"),
                                            new FileInfo(@"C:\s\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin\packages.config"));

            var project2 = new ProjectResult(new FileInfo(@"F:\Projects\_GitHub\DependencyScanner\DependencyScanner.Standalone\DependencyScanner.Standalone.csproj"),
                                             new FileInfo(@"F:\Projects\_GitHub\DependencyScanner\DependencyScanner.Standalone\packages.config"));

            for (int i = 0; i < 5; i++)
            {
                facade.ExecuteScan(project);
                facade.ExecuteScan(project2);
                await Task.Delay(1100);
            }
        }
        public IEnumerable <NugetReferenceResult> ScanNugetReferences(ProjectResult project)
        {
            // get all dependencies with no structure
            var allDependencies = ReadDependencies(project.ProjectInfo.DirectoryName);

            if (allDependencies == null)
            {
                return(null);
            }

            // execute scan
            var result = new List <NugetReferenceResult>();

            foreach (var dep in project.References)
            {
                // add current dependency
                ResolveProjectDependency(dep, allDependencies, a => result.Add(a));

                result.Add(new NugetReferenceResult(Path.GetFileNameWithoutExtension(project.ProjectInfo.Name), dep.ToString())
                {
                    color = "red"
                });
            }

            // generate report to programdata folder

            var test = JsonConvert.SerializeObject(result);

            Debug.WriteLine(JsonConvert.SerializeObject(result));

            return(result);
        }
        //public static string RunCalculationGetSummary(int projectId)
        //{
        //    var potController = new MappedObjectController();
        //    potController.createDamageExtent(projectId);

        //    return GetSummary(projectId);
        //}

        public static ProjectResult ComputeResult(int projectId, bool details = false)
        {
            var           _controller = new DamageExtentController();
            ProjectResult _result     = _controller.computeProjectResult(projectId, details);

            return(_result);
        }
Ejemplo n.º 7
0
        public IEnumerable <ProjectResult> GetSProjectList(DateTime startTime, DateTime endTime, int pageNumber, int pageRows)
        {
            Database             db     = new DatabaseProviderFactory().Create("JIRA");
            List <ProjectResult> result = new List <ProjectResult>();

            using (DbCommand cmd = db.GetStoredProcCommand("[dbo].[GetProjectList]"))
            {
                cmd.CommandTimeout = dbTimeout;
                db.AddInParameter(cmd, "@StartDate", DbType.DateTime2, startTime);
                db.AddInParameter(cmd, "@EndDate", DbType.DateTime2, endTime);
                db.AddInParameter(cmd, "@PageNumber", DbType.Int32, pageNumber);
                db.AddInParameter(cmd, "@PageRows", DbType.Int32, pageRows);
                DataSet ds = db.ExecuteDataSet(cmd);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ProjectResult item = new ProjectResult();
                    item.SeqNo     = (int)ds.Tables[0].Rows[i]["SeqNo"];
                    item.Id        = (int)ds.Tables[0].Rows[i]["Id"];
                    item.Subject   = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Subject"]) ? "" : (string)ds.Tables[0].Rows[i]["Subject"];
                    item.Status    = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Status"]) ? "" : (string)ds.Tables[0].Rows[i]["Status"];
                    item.StartTime = DBNull.Value.Equals(ds.Tables[0].Rows[i]["StartTime"]) ? DateTime.MinValue : (DateTime)ds.Tables[0].Rows[i]["StartTime"];
                    item.EndTime   = DBNull.Value.Equals(ds.Tables[0].Rows[i]["EndTime"]) ? DateTime.MinValue : (DateTime)ds.Tables[0].Rows[i]["EndTime"];
                    result.Add(item);
                }
                ProjectResult.TotalCount = (int)ds.Tables[1].Rows[0]["TotalCount"];
            }

            return(result);
        }
Ejemplo n.º 8
0
        public List <EmployeeProjectAllocationModel> Employee_BillingTillDate(EmployeeProjectAllocationModel ObjEmp)
        {
            List <EmployeeProjectAllocationModel> objList = new List <EmployeeProjectAllocationModel>();

            using (var _context = new RMS_Entities())
            {
                var db = _context.USP_Employee_BillingTillDate(Convert.ToString(ObjEmp.Flag), Convert.ToDateTime(ObjEmp.BillingTillDate), Convert.ToInt32(ObjEmp.EmpId),
                                                               Convert.ToInt32(ObjEmp.EPAId)).ToList <USP_Employee_BillingTillDate_Result>();
                EmployeeProjectAllocationModel objEmpl = null;
                foreach (var objSingle in db)
                {
                    objEmpl              = new EmployeeProjectAllocationModel();
                    objEmpl.EPAId        = objSingle.EPAId;
                    objEmpl.EPAIdEncr    = CommonRepository.Encode(objEmpl.EPAId.ToString());
                    objEmpl.EmpId        = objSingle.EmpId;
                    objEmpl.EmployeeName = objSingle.EmployeeName;
                    ProjectResult objProject = new ProjectResult();
                    objProject.ProjectName  = objSingle.ProjectName;
                    objEmpl.Projects        = objProject;
                    objEmpl.StartDate       = Convert.ToDateTime(objSingle.AllocationDate);
                    objEmpl.ActualRelDate   = Convert.ToDateTime(objSingle.ReleaseDate);
                    objEmpl.BillingTillDate = Convert.ToDateTime(objSingle.BillingTillDate);
                    //objEmpl.FirstName= objSingle.p

                    objList.Add(objEmpl);
                }
                return(objList);
            }
        }
Ejemplo n.º 9
0
        public async Task <ProjectResult> DeleteProject(IProviderAgencyOwner agencyOwner, Guid projectId)
        {
            var retVal = new ProjectResult()
            {
                ProjectId = projectId
            };

            var project = await Repository.Queryable()
                          .Include(x => x.Stories)
                          .Include(x => x.Contracts)
                          .ThenInclude(x => x.TimeEntries)
                          .FirstAsync(x => x.Id == projectId);

            project.Updated     = DateTimeOffset.UtcNow;
            project.UpdatedById = _userInfo.UserId;
            project.ObjectState = ObjectState.Modified;
            project.IsDeleted   = true;

            foreach (var contract in project.Contracts)
            {
                contract.Updated     = DateTimeOffset.UtcNow;
                contract.UpdatedById = _userInfo.UserId;
                contract.IsDeleted   = true;
                contract.ObjectState = ObjectState.Modified;

                foreach (var e in contract.TimeEntries)
                {
                    e.Updated     = DateTimeOffset.UtcNow;
                    e.UpdatedById = _userInfo.UserId;
                    e.IsDeleted   = true;
                    e.ObjectState = ObjectState.Modified;
                }
            }

            foreach (var story in project.Stories)
            {
                story.Updated     = DateTimeOffset.UtcNow;
                story.IsDeleted   = true;
                story.ObjectState = ObjectState.Modified;
            }

            var result = Repository.InsertOrUpdateGraph(project, true);

            _logger.LogDebug(GetLogMessage("{0} results updated"), result);

            if (result > 0)
            {
                retVal.Succeeded = true;

                await Task.Run(() =>
                {
                    RaiseEvent(new ProjectDeletedEvent()
                    {
                        ProjectId = project.Id
                    });
                });
            }

            return(retVal);
        }
Ejemplo n.º 10
0
 public static void free_project_result(ProjectResult p0)
 {
     storj_uplinkPINVOKE.free_project_result(ProjectResult.getCPtr(p0));
     if (storj_uplinkPINVOKE.SWIGPendingException.Pending)
     {
         throw storj_uplinkPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 11
0
        private async Task <ProjectResult> PauseProject(Project entity)
        {
            _logger.LogInformation(GetLogMessage("Project: {0}"), entity.Id);
            var retVal = new ProjectResult()
            {
                ProjectId = entity.Id
            };

            if (entity.Status != ProjectStatus.Paused)
            {
                entity.UpdatedById = _userInfo.UserId;
                entity.Updated     = DateTimeOffset.UtcNow;
                entity.Status      = ProjectStatus.Paused;
                entity.ObjectState = ObjectState.Modified;

                entity.StatusTransitions.Add(new ProjectStatusTransition()
                {
                    Status      = entity.Status,
                    ObjectState = ObjectState.Added
                });


                foreach (var contract in entity.Contracts)
                {
                    if (contract.Status == ContractStatus.Active)
                    {
                        contract.Status      = ContractStatus.Paused;
                        contract.ObjectState = ObjectState.Modified;
                        contract.Updated     = DateTimeOffset.UtcNow;
                        contract.UpdatedById = _userInfo.UserId;
                        contract.StatusTransitions.Add(new ContractStatusTransition()
                        {
                            ObjectState = ObjectState.Added,
                            Status      = ContractStatus.Paused
                        });
                    }
                }

                var records = Repository.InsertOrUpdateGraph(entity, true);

                _logger.LogDebug(GetLogMessage("{0} records updated"), records);
                if (records > 0)
                {
                    retVal.Succeeded = true;
                    await Task.Run(() => RaiseEvent(new ProjectPausedEvent()
                    {
                        ProjectId = entity.Id
                    }));
                }
            }
            else
            {
                _logger.LogDebug(GetLogMessage("The project is already paused"));
                retVal.Succeeded = true;
            }

            return(retVal);
        }
Ejemplo n.º 12
0
        private async Task ShowGeneralInfo()
        {
            tabControl.Enabled = false;
            CheckForIllegalCrossThreadCalls = false;
            lblBuildNumber.Text             = Resources.LoadingStatus;
            lblBuildDate.Text      = Resources.LoadingStatus;
            lblState.Text          = Resources.LoadingStatus;
            lblVersion.Text        = Resources.LoadingStatus;
            lblTotalProjects.Text  = Resources.LoadingStatus;
            lblTotalPlans.Text     = Resources.LoadingStatus;
            lblAvgPlanProject.Text = Resources.LoadingStatus;
            lblActiveProjects.Text = Resources.LoadingStatus;
            lblActivePlans.Text    = Resources.LoadingStatus;

            const string infoUri    = "info?os_authType=basic";
            const string projectUri = "project?expand=projects.project.plans.plan.stages&max-result=250&os_authType=basic";

            var generalInfo = await ExecuteRequest <InfoResult>(infoUri);

            if (generalInfo != null)
            {
                lblBuildNumber.Text = generalInfo.BuildNumber;
                lblBuildDate.Text   = generalInfo.BuildDate;
                lblState.Text       = generalInfo.State;
                lblVersion.Text     = generalInfo.Version;
            }

            _projects = await ExecuteRequest <ProjectResult>(projectUri);

            if (_projects != null)
            {
                var totalProjects = _projects.Projects.Size;
                var totalPlans    = _projects.Projects.Project.Sum(p => p.Plans.Size);

                var activeProjects = _projects.Projects.Project.Count(p => p.Plans.Plan.Any(l => l.Enabled));
                var activePlans    = _projects.Projects.Project.Sum(p => p.Plans.Plan.Count(l => l.Enabled));
                lblTotalProjects.Text      = totalProjects.ToString();
                lblTotalProjectsCount.Text = totalProjects.ToString();
                lblTotalPlans.Text         = totalPlans.ToString();
                lblTotalPlansCount.Text    = totalPlans.ToString();
                lblAvgPlanProject.Text     = Math.Round((totalPlans / (decimal)totalProjects), 2).ToString(CultureInfo.InvariantCulture);
                lblActiveProjects.Text     = activeProjects.ToString();
                lblActivePlans.Text        = activePlans.ToString();

                foreach (var project in _projects.Projects.Project)
                {
                    // Project Name | Project Key | Link | Plan Short Name | Plan Key | Plan Enabled | Plan Link | Average Time In Seconds | Stages | Branches
                    foreach (var plan in project.Plans.Plan)
                    {
                        TimeSpan ts = new TimeSpan(0, 0, Convert.ToInt32(plan.AverageBuildTimeInSeconds));
                        allProjectsGrid.Rows.Add(new object[] { project.Name, project.Key, string.Format("{0}/browse/{1}", _bambooHome, project.Key), plan.ShortName, plan.Key, plan.Enabled, string.Format("{0}/browse/{1}", _bambooHome, plan.Key), string.Format("{0}m {1}s", ts.Minutes, ts.Seconds), plan.Stages.Size, plan.Branches.Size });
                    }
                }
            }

            tabControl.Enabled = true;
        }
Ejemplo n.º 13
0
        public void OneTimeSetup()
        {
            var workingDirectory = Environment.CurrentDirectory;

            _testProjectPath = Directory.GetParent(workingDirectory).Parent.Parent.FullName;

            var codeAnalyzer = CreateDefaultCodeAnalyzer();
            // Get analyzer results from codelyzer (syntax trees, semantic models, package references, project references, etc)
            var analyzerResult = codeAnalyzer.AnalyzeProject(DownloadTestProjectsFixture.EShopLegacyWebFormsProjectPath).Result;

            var ctaArgs = new[]
            {
                "-p", DownloadTestProjectsFixture.EShopLegacyWebFormsProjectPath, // can hardcode for local use
                "-v", "net5.0",                                                   // set the Target Framework version
                "-d", "true",                                                     // use the default rules files (these will get downloaded from S3 and will tell CTA which packages to add to the new .csproj file)
                "-m", "false",                                                    // this is the "mock run" flag. Setting it to false means rules will be applied if we do a full port.
            };

            // Handle argument assignment
            PortCoreRulesCli cli = new PortCoreRulesCli();

            cli.HandleCommand(ctaArgs);
            if (cli.DefaultRules)
            {
                // Since we're using default rules, we want to specify where to find those rules (once they are downloaded)
                cli.RulesDir = Constants.RulesDefaultPath;
            }

            var packageReferences = new Dictionary <string, Tuple <string, string> >
            {
                { "Autofac", new Tuple <string, string>("4.9.1.0", "4.9.3") },
                { "EntityFramework", new Tuple <string, string>("6.0.0.0", "6.4.4") },
                { "log4net", new Tuple <string, string>("2.0.8.0", "2.0.12") },
                { "Microsoft.Extensions.Logging.Log4Net.AspNetCore", new Tuple <string, string>("1.0.0", "2.2.12") }
            };

            // Create a configuration object using the CLI and other arbitrary values
            PortCoreConfiguration projectConfiguration = new PortCoreConfiguration()
            {
                ProjectPath       = cli.FilePath,
                RulesDir          = cli.RulesDir,
                IsMockRun         = cli.IsMockRun,
                UseDefaultRules   = cli.DefaultRules,
                PackageReferences = packageReferences,
                PortCode          = false,
                PortProject       = true,
                TargetVersions    = new List <string> {
                    cli.Version
                }
            };

            var           projectRewriter = new ProjectRewriter(analyzerResult, projectConfiguration);
            ProjectResult projectResult   = projectRewriter.Initialize();

            _webFormsProjectAnalyzer = new ProjectAnalyzer(_testProjectPath, analyzerResult, projectConfiguration, projectResult);
            _blazorWorkspaceManager  = new WorkspaceManagerService();
        }
Ejemplo n.º 14
0
        public void ScanNugerRef_Test()
        {
            var scan = new NugetReferenceScan();

            var project = new ProjectResult(new FileInfo(@"C:\s\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin.csproj"),
                                            new FileInfo(@"C:\s\Serva.Base.Plugin\Serva.Base.Plugin\Serva.Base.Plugin\packages.config"));

            var actual = scan.ScanNugetReferences(project);
        }
Ejemplo n.º 15
0
        public static ProjectResult config_open_project(Config p0, Access p1)
        {
            ProjectResult ret = new ProjectResult(storj_uplinkPINVOKE.config_open_project(Config.getCPtr(p0), Access.getCPtr(p1)), true);

            if (storj_uplinkPINVOKE.SWIGPendingException.Pending)
            {
                throw storj_uplinkPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 16
0
        public void PaginationTestLastPageOptimizationNoTop()
        {
            var result = new ProjectResult(count: 19, skip: 10, top: null, inlineCount: true);

            PaginationHelper.Paginate(result, out var projected, out var count);
            count.ShouldEqual(result.Count);
            result.ExecutedCount.ShouldEqual(false); // optimized away
            result.ExecutedProject.ShouldEqual(true);
            projected.Cast <int>().Sum().ShouldEqual(Enumerable.Range(10, count: 9).Sum(i => i * i));
        }
Ejemplo n.º 17
0
        public void PaginationTestTopZeroOptimizationWithCount()
        {
            var result = new ProjectResult(count: 15, skip: 3, top: 0, inlineCount: true);

            PaginationHelper.Paginate(result, out var projected, out var count);
            count.ShouldEqual(result.Count);
            result.ExecutedCount.ShouldEqual(true);
            projected.Cast <object>().Count().ShouldEqual(0);
            result.ExecutedProject.ShouldEqual(false); // even after manually executing
        }
Ejemplo n.º 18
0
 public MigrationManager(string inputProjectPath, AnalyzerResult analyzerResult,
                         ProjectConfiguration projectConfiguration, ProjectResult projectResult)
 {
     _inputProjectPath     = inputProjectPath;
     _solutionPath         = projectConfiguration.SolutionPath;
     _analyzerResult       = analyzerResult;
     _projectConfiguration = projectConfiguration;
     _projectResult        = projectResult;
     _metricsContext       = new WebFormMetricContext();
 }
Ejemplo n.º 19
0
        public void PaginationTestFirstPageCountCase()
        {
            var result = new ProjectResult(count: 20, skip: 10, top: 10, inlineCount: true);

            PaginationHelper.Paginate(result, out var projected, out var count);
            count.ShouldEqual(result.Count);
            result.ExecutedCount.ShouldEqual(true);
            result.ExecutedProject.ShouldEqual(true);
            projected.Cast <int>().Sum().ShouldEqual(Enumerable.Range(10, count: 10).Sum(i => i * i));
        }
Ejemplo n.º 20
0
        public void PaginationTestNoCountCase()
        {
            var result = new ProjectResult(count: 10, skip: 1, top: null, inlineCount: false);

            PaginationHelper.Paginate(result, out var projected, out var count);
            count.ShouldEqual(null);
            result.ExecutedCount.ShouldEqual(false);
            result.ExecutedProject.ShouldEqual(false); // leaves in queryable form
            projected.Cast <int>().Last().ShouldEqual(81);
        }
Ejemplo n.º 21
0
        public async Task <SolutionResult> ScanSolution(string rootDirectory)
        {
            var solutions = GetSolutions(rootDirectory);

            if (!solutions.Any())
            {
                return(null);
            }

            var solutionPath = solutions.First();

            var result = new SolutionResult(new FileInfo(solutionPath), this);

            foreach (var projectPath in GetProjects(result.Info.DirectoryName))
            {
                var projectInfo = new FileInfo(projectPath);

                var packagePaths = GetPackages(projectInfo.DirectoryName);

                ProjectResult projectResult;

                if (packagePaths.Count() != 0)
                // Projects contains package.config file
                {
                    var packageInfo = new FileInfo(packagePaths.First());

                    projectResult = new ProjectResult(projectInfo, packageInfo);
                }
                else
                {
                    projectResult = new ProjectResult(projectInfo);
                }

                var nuspecInfo = GetNuspec(projectInfo.DirectoryName).FirstOrDefault();

                if (!string.IsNullOrEmpty(nuspecInfo))
                {
                    projectResult.NuspecInfo = new FileInfo(nuspecInfo);
                }

                result.Projects.Add(projectResult);
            }

            var gitPath = DirectoryTools.SearchDirectory(solutionPath, GetGitFolder);

            if (!string.IsNullOrEmpty(gitPath))
            {
                result.GitInformation = _gitCtor(gitPath);

                await result.GitInformation.Init(false);
            }

            return(result);
        }
Ejemplo n.º 22
0
        private static ProjectResult GetProject(MobilService client)
        {
            string result = client.GetProject();

            JavaScriptSerializer set = new JavaScriptSerializer();

            set.MaxJsonLength = Int32.MaxValue;
            ProjectResult returnValue = set.Deserialize <ProjectResult>(result);

            return(returnValue);
        }
Ejemplo n.º 23
0
        public ProjectAnalyzer(string inputProjectPath, AnalyzerResult analyzerResult, ProjectConfiguration projectConfiguration, ProjectResult projectResult)
        {
            _inputProjectPath    = inputProjectPath;
            AnalyzerResult       = analyzerResult;
            ProjectConfiguration = projectConfiguration;

            ProjectResult = projectResult;

            ProjectReferences = analyzerResult?.ProjectBuildResult?.ExternalReferences?.ProjectReferences.Select(p => p.AssemblyLocation).ToList();
            MetaReferences    = analyzerResult?.ProjectBuildResult?.Project?.MetadataReferences?.Select(m => m.Display).ToList();
        }
        public void PaginationTestTopZeroOptimizationNoCount()
        {
            var         result = new ProjectResult(count: 10, skip: 1, top: 0, inlineCount: false);
            IEnumerable projected;
            int?        count;

            PaginationHelper.Paginate(result, out projected, out count);
            count.ShouldEqual(null);
            result.ExecutedCount.ShouldEqual(false);
            projected.Cast <object>().Count().ShouldEqual(0);
            result.ExecutedProject.ShouldEqual(false); // even after manually executing
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Initializes the Solution Port
        /// </summary>
        public ProjectResult AnalysisRun()
        {
            // If the solution was already analyzed, don't duplicate the results
            if (_projectResult != null)
            {
                return(_projectResult);
            }

            _projectResult = _projectRewriter.Initialize();

            return(_projectResult);
        }
        private async Task <SolutionResult> ExecuteSolutionScan(string solutionPath, ICancelableProgress <ProgressMessage> progress, bool executeGitFetch)
        {
            var result = new SolutionResult(new FileInfo(solutionPath), this);

            foreach (var projectPath in GetProjects(result.Info.DirectoryName))
            {
                if (progress.Token.IsCancellationRequested)
                {
                    Log.Information("Cancelling scan");

                    throw new OperationCanceledException("Operation was canceled by user");
                }

                var projectInfo = new FileInfo(projectPath);

                var packagePaths = GetPackages(projectInfo.DirectoryName);

                ProjectResult projectResult;

                if (packagePaths.Count() != 0)
                // Projects contains package.config file
                {
                    var packageInfo = new FileInfo(packagePaths.First());

                    projectResult = new ProjectResult(projectInfo, packageInfo);
                }
                else
                {
                    projectResult = new ProjectResult(projectInfo);
                }

                var nuspecInfo = GetNuspec(projectInfo.DirectoryName).FirstOrDefault();

                if (!string.IsNullOrEmpty(nuspecInfo))
                {
                    projectResult.NuspecInfo = new FileInfo(nuspecInfo);
                }

                result.Projects.Add(projectResult);
            }

            var gitPath = DirectoryTools.SearchDirectory(solutionPath, GetGitFolder);

            if (!string.IsNullOrEmpty(gitPath))
            {
                result.GitInformation = new GitInfo(gitPath, _gitEngine);

                await result.GitInformation.Init(executeGitFetch);
            }

            return(result);
        }
Ejemplo n.º 27
0
        private string GenerateProjectFileContents(ProjectResult projectResult,
                                                   ProjectConfiguration projectConfiguration, List <String> projectReferences, List <String> metaReferences)
        {
            var projectActions = projectResult.ProjectActions;
            var packages       = projectActions.PackageActions.Distinct()
                                 .ToDictionary(p => p.Name, p => p.Version);

            // Now we can finally create the ProjectFileCreator and use it
            var projectFileCreator = new ProjectFileCreator(FullPath, projectConfiguration.TargetVersions, packages,
                                                            projectReferences, ProjectType.WebForms, metaReferences);

            return(projectFileCreator.CreateContents());
        }
Ejemplo n.º 28
0
 public CodeReplacer(List <SourceFileBuildResult> sourceFileBuildResults, ProjectConfiguration projectConfiguration, List <string> metadataReferences, AnalyzerResult analyzerResult,
                     List <string> updatedFiles = null, ProjectResult projectResult = null)
 {
     _sourceFileBuildResults = sourceFileBuildResults;
     if (updatedFiles != null)
     {
         _sourceFileBuildResults = _sourceFileBuildResults.Where(s => updatedFiles.Contains(s.SourceFileFullPath));
     }
     _analyzerResult       = analyzerResult;
     _projectConfiguration = projectConfiguration;
     _metadataReferences   = metadataReferences;
     _projectResult        = projectResult ?? new ProjectResult();
 }
Ejemplo n.º 29
0
 static void SaveProjectResult(Object obj, ProjectResult r)
 {
     if (m_ProjectResults.ContainsKey(obj))
     {
         m_ProjectResults[obj].Add(r);
     }
     else
     {
         m_ProjectResults.Add(obj, new List <ProjectResult>()
         {
             r
         });
     }
 }
Ejemplo n.º 30
0
        public ProjectDetailModel GetProjectDetail(int id)
        {
            ProjectDetailModel result        = new ProjectDetailModel();
            ProjectResult      projectResult = _projectDataAccess.FindProject(id);

            result.Subject           = projectResult.Subject;
            result.Status            = projectResult.Status;
            result.StartTime         = projectResult.StartTime.ToShortDateString();
            result.EndTime           = projectResult.EndTime.ToShortDateString();
            result.Description       = projectResult.Description;
            result.RecentSprint      = projectResult.RecentSprint;
            result.ReleasedVersion   = projectResult.ReleasedVersion;
            result.SourceRespository = projectResult.SourceRespository;

            return(result);
        }
        protected void EarnReputation(Company company, StarCategory projectWeight, ProjectResult projectResult)
        {
            var resultValue = 0;

            switch(projectResult)
            {
                case ProjectResult.Completed:
                    resultValue = 2;
                    break;
                case ProjectResult.CompletedWithExtension:
                    resultValue = 1;
                    break;
            }

            var weightValue = (int)projectWeight - 1;

            checked
            {
                company.Reputation.EarnedStars += weightValue * resultValue;

                company.Reputation.PossibleStars += weightValue * 2;
            }
        }
Ejemplo n.º 32
0
 public string CreateProject(string title, string summary, string template = null, string driver = SystemPlatforms.PostGres)
 {
     CheckAuthentication();
     var url = Url.Combine(Config.Url, Constants.PROJECTS_URI);
     var payload = new ProjectResult()
                   	{
                   		Project = new Project
                   		          	{
                   		          		Content = new ProjectContent
                   		          		          	{
                   		          		          		GuidedNavigation = 1,
                                                         Driver = driver
                   		          		          	},
                   		          		Meta = new Meta
                   		          		       	{
                   		          		       		Title = title,
                   		          		       		Summary = summary,
                   		          		       		ProjectTemplate = template
                   		          		       	}
                   		          	}
                   	};
     var response = PostRequest(url, payload);
     var projectResponse = JsonConvert.DeserializeObject(response, typeof (UriResponse)) as UriResponse;
     return projectResponse.Uri.ExtractId(Constants.PROJECTS_URI);
 }
Ejemplo n.º 33
0
        public void RunProject()
        {
            if (!this.CanRun)
                return;

            JaneRuntime.ConsoleEvent.Event += ConsoleWriteLine;
            this.SaveProject();

            this.CanRun = false;
            this.CanStop = true;
            result = new ProjectResult(this.MainClass.Content, this.MainClass.FileName);

            OutputWriteLineEvent(this, ">------ Program started ------<");
            ErrorsWriteLineEvent(this, ">------ Program started ------<");

            ProcessWriteLineEvent(this, "> Run project " + this.ProjectName);

            startTime = DateTime.Now;
            t1 = new Thread(delegate()
            {
                try {
                    result.StartRunning();
                } catch (ThreadAbortException)
                {
                    JaneRuntime.ConsoleEvent.Event -= ConsoleWriteLine;

                    finishTime = DateTime.Now;
                    var time = finishTime - startTime;

                    string message = ">------ Program aborted ------<";

                    OutputWriteLineEvent(this, message);
                    ProcessWriteLineEvent(this, message);
                    ProcessWriteLineEvent(this, "> Program aborted. Execute time:  " + time.TotalMilliseconds.ToString() + " msecs");

                    this.CanRun = true;
                    this.CanStop = false;
                }

            });
            t1.Start();

            t2 = new Thread(delegate()
            {
                t1.Join();
                JaneRuntime.ConsoleEvent.Event -= ConsoleWriteLine;
                if (result.NoErrors)
                {
                    finishTime = DateTime.Now;
                    var time = finishTime - startTime;
                    //OutputWriteLineEvent(this, result.RunResultValue);
                    OutputWriteLineEvent(this, ">------ Program finished successfully ------<");
                    ErrorsWriteLineEvent(this, ">------ Program finished successfully ------<");
                    ProcessWriteLineEvent(this, "> Program finished. Execute time:  " + time.TotalMilliseconds.ToString() + " msecs");
                }
                else
                {
                    List<AST.Error> errs = result.Errors;
                    int numerrs = errs.Count;
                    string message;
                    if (numerrs > 1)
                        message = ">------ Program terminated. " + numerrs.ToString() + " errors ------<";
                    else
                        message = ">------ Program terminated. 1 error ------<";

                    OutputWriteLineEvent(this, message);
                    ProcessWriteLineEvent(this, message);

                    foreach (AST.Error err in errs)
                    {
                        ErrorsWriteLineEvent(this, "Line " + err.Position.StartLine + " Error: " + err.ErrorMessage);
                    }
                    ErrorsWriteLineEvent(this, ">-----");
                }

                this.CanRun = true;
                this.CanStop = false;
            });
            t2.Start();
        }