private void CreateUWPPlot(CodeStats codeStats) { UwpPlotModel = new PlotModel { Title = "UWP" }; var pieSlice = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; pieSlice.Slices.Add(new PieSlice("Share", codeStats.ShareCodeInUWP) { IsExploded = true, Fill = OxyColors.Green }); pieSlice.Slices.Add(new PieSlice("Specific", codeStats.UWPSpecificCode) { IsExploded = true, Fill = OxyColors.Red }); UwpPlotModel.Series.Add(pieSlice); }
public static CodeStats CalculateStats(Solution _currentSolution) { var stats = new CodeStats() { ShareCodeInAndroid = Math.Round(((double)_currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC) / (_currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Android).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC) + _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC)) ) * 100, 2), ShareCodeIniOS = Math.Round(((double)_currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC) / (_currentSolution.Projects.Where(x => x.Platform == EnumPlatform.iOS).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC) + _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC)) ) * 100, 2), AmountOfFiles = _currentSolution.Projects.SelectMany(p => p.Files).Count(), CodeFiles = _currentSolution.Projects.SelectMany(x => x.Files).Count(x => x.IsUserInterface == false), UIFiles = _currentSolution.Projects.SelectMany(x => x.Files).Count(x => x.IsUserInterface == true), TotalLinesOfCode = _currentSolution.Projects.SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC), TotalLinesOfUI = _currentSolution.Projects.SelectMany(x => x.Files).Where(x => x.IsUserInterface == true).Sum(x => x.LOC), AndroidFiles = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Android).SelectMany(x => x.Files).Count(), iOSFiles = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.iOS).SelectMany(x => x.Files).Count(), TotalLinesCore = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Sum(x => x.LOC), TotalLinesInAndroid = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Android).SelectMany(x => x.Files).Sum(x => x.LOC), TotalLinesIniOS = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.iOS).SelectMany(x => x.Files).Sum(x => x.LOC) }; stats.iOSSpecificCode = 100 - stats.ShareCodeIniOS; stats.AndroidSpecificCode = 100 - stats.ShareCodeInAndroid; return(stats); }
public static CodeStats CalculateStats(Solution _currentSolution) { var files = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Android).SelectMany(x => x.Files); foreach (var item in files) { Debug.WriteLine($"file: {item.Name}"); } var stats = new CodeStats() { ShareCodeInAndroid = CalculateShareCodePerPlaform(_currentSolution, EnumPlatform.Android), AndroidFiles = files.Count(), TotalLinesInAndroid = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Android).SelectMany(x => x.Files).Sum(x => x.LOC), ShareCodeIniOS = CalculateShareCodePerPlaform(_currentSolution, EnumPlatform.iOS), iOSFiles = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.iOS).SelectMany(x => x.Files).Count(), TotalLinesIniOS = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.iOS).SelectMany(x => x.Files).Sum(x => x.LOC), ShareCodeInUWP = CalculateShareCodePerPlaform(_currentSolution, EnumPlatform.UWP), UWPFiles = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.UWP).SelectMany(x => x.Files).Count(), TotalLinesInUWP = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.UWP).SelectMany(x => x.Files).Sum(x => x.LOC), AmountOfFiles = _currentSolution.Projects.SelectMany(p => p.Files).Count(), CodeFiles = _currentSolution.Projects.SelectMany(x => x.Files).Count(x => x.IsUserInterface == false), UIFiles = _currentSolution.Projects.SelectMany(x => x.Files).Count(x => x.IsUserInterface == true), TotalLinesOfCode = _currentSolution.Projects.SelectMany(x => x.Files).Where(x => x.IsUserInterface == false).Sum(x => x.LOC), TotalLinesOfUI = _currentSolution.Projects.SelectMany(x => x.Files).Where(x => x.IsUserInterface == true).Sum(x => x.LOC), TotalLinesCore = _currentSolution.Projects.Where(x => x.Platform == EnumPlatform.Core).SelectMany(x => x.Files).Sum(x => x.LOC), }; stats.iOSSpecificCode = Math.Round(100 - stats.ShareCodeIniOS, 2); stats.AndroidSpecificCode = Math.Round(100 - stats.ShareCodeInAndroid, 2); stats.UWPSpecificCode = Math.Round(100 - stats.ShareCodeInUWP, 2); return(stats); }
public static string CreateShareUrl(CodeStats stats) { return(string.Format(BASEURL, stats.ShareCodeIniOS, stats.ShareCodeInAndroid, stats.iOSSpecificCode, stats.AndroidSpecificCode, stats.TotalLinesOfCode)); }