Permalink
Browse files

merged and got all tests passing

  • Loading branch information...
mrlacey committed Aug 7, 2017
2 parents 23b5c8b + 0ad592b commit 5e156826e829f84bdfe17b6b9374f2b3312c39fd
Showing with 2,680 additions and 2,834 deletions.
  1. +1 −1 LICENSE.md
  2. +9 −5 README.md
  3. +3 −11 _utils/Set-All-Text-File-Template-Encodings.ps1
  4. +9 −0 code/Big.sln
  5. +1 −1 code/GlobalSuppressions.cs
  6. +4 −2 code/src/Core/Core.csproj
  7. +4 −4 code/src/Core/Diagnostics/ShellHealthWriter.cs
  8. +2 −0 code/src/Core/Gen/TempGenerationResult.cs
  9. +193 −0 code/src/Core/PostActions/Catalog/NewItemGeneration/CreateSummaryPostAction.cs
  10. +0 −121 code/src/Core/PostActions/Catalog/NewItemGeneration/CreateSyncInstructionsPostAction.cs
  11. +0 −151 code/src/Core/PostActions/Catalog/NewItemGeneration/CreateSyncSummaryPostAction.cs
  12. +3 −11 code/src/Core/PostActions/Catalog/SortNamespaces/ImportsComparer.cs
  13. +3 −11 code/src/Core/PostActions/Catalog/SortNamespaces/NamespaceComparer.cs
  14. +3 −11 code/src/Core/PostActions/Catalog/SortNamespaces/SortImportsPostAction.cs
  15. +3 −11 code/src/Core/PostActions/Catalog/SortNamespaces/SortUsingsPostAction.cs
  16. +3 −11 code/src/Core/PostActions/Catalog/SortNamespaces/UsingComparer.cs
  17. +2 −2 code/src/Core/PostActions/NewItemPostActionFactory.cs
  18. +93 −182 code/src/Core/Resources/StringRes.Designer.cs
  19. +113 −124 code/src/Core/Resources/StringRes.cs-CZ.resx
  20. +113 −124 code/src/Core/Resources/StringRes.de-DE.resx
  21. +113 −124 code/src/Core/Resources/StringRes.es-ES.resx
  22. +113 −124 code/src/Core/Resources/StringRes.fr-FR.resx
  23. +113 −124 code/src/Core/Resources/StringRes.it-IT.resx
  24. +113 −124 code/src/Core/Resources/StringRes.ja-JP.resx
  25. +113 −124 code/src/Core/Resources/StringRes.ko-KR.resx
  26. +113 −124 code/src/Core/Resources/StringRes.pl-PL.resx
  27. +113 −124 code/src/Core/Resources/StringRes.pt-BR.resx
  28. +110 −124 code/src/Core/Resources/StringRes.resx
  29. +113 −124 code/src/Core/Resources/StringRes.ru-RU.resx
  30. +113 −124 code/src/Core/Resources/StringRes.tr-TR.resx
  31. +113 −124 code/src/Core/Resources/StringRes.zh-CN.resx
  32. +113 −124 code/src/Core/Resources/StringRes.zh-TW.resx
  33. +4 −3 code/src/Installer.2017/Commands/RelayCommand.cs
  34. +4 −2 code/src/Installer.2017/Commands/RelayCommandPackage.cs
  35. +4 −2 code/src/UI/Controls/CodeViewer.cs
  36. +2 −0 code/src/UI/Generation/NewItemGenController.cs
  37. +2 −2 code/src/UI/Resources/StringRes.Designer.cs
  38. +1 −1 code/src/UI/Resources/StringRes.cs-CZ.resx
  39. +1 −1 code/src/UI/Resources/StringRes.de-DE.resx
  40. +1 −1 code/src/UI/Resources/StringRes.es-ES.resx
  41. +1 −1 code/src/UI/Resources/StringRes.fr-FR.resx
  42. +1 −1 code/src/UI/Resources/StringRes.it-IT.resx
  43. +1 −1 code/src/UI/Resources/StringRes.ja-JP.resx
  44. +1 −1 code/src/UI/Resources/StringRes.ko-KR.resx
  45. +1 −1 code/src/UI/Resources/StringRes.pl-PL.resx
  46. +1 −1 code/src/UI/Resources/StringRes.pt-BR.resx
  47. +1 −1 code/src/UI/Resources/StringRes.resx
  48. +1 −1 code/src/UI/Resources/StringRes.ru-RU.resx
  49. +1 −1 code/src/UI/Resources/StringRes.tr-TR.resx
  50. +1 −1 code/src/UI/Resources/StringRes.zh-CN.resx
  51. +1 −1 code/src/UI/Resources/StringRes.zh-TW.resx
  52. +2 −2 code/src/UI/Services/DragAndDropService/DragAndDropService.Members.cs
  53. +6 −5 code/src/UI/Services/DragAndDropService/DragAndDropService.cs
  54. +3 −3 code/src/UI/TemplateSelectors/FileExtensionTemplateSelector.cs
  55. +3 −2 code/src/UI/TemplateSelectors/FileStatusTemplateSelector.cs
  56. +2 −0 code/src/UI/UI.csproj
  57. +23 −0 code/src/UI/ViewModels/Common/FileExtension.cs
  58. +15 −0 code/src/UI/ViewModels/Common/FileStatus.cs
  59. +3 −9 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/BaseFileViewModel.cs
  60. +2 −0 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/ConflictingFileViewModel.cs
  61. +1 −0 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/FailedMergesFileViewModel.cs
  62. +1 −0 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/ModifiedFileViewModel.cs
  63. +2 −0 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/NewFileViewModel.cs
  64. +2 −0 code/src/UI/ViewModels/NewItem/ChangesSummaryFiles/UnchangedFileViewModel.cs
  65. +1 −1 code/src/UI/ViewModels/NewItem/MainViewModel.cs
  66. +1 −2 code/src/UI/ViewModels/NewItem/NewItemSetupViewModel.cs
  67. +2 −4 code/src/UI/ViewModels/NewProject/MainViewModel.cs
  68. +1 −1 code/src/UI/Views/NewProject/InformationWindow.xaml.cs
  69. +3 −11 code/src/UI/VisualStudio/SolutionWizardCS.cs
  70. +3 −11 code/src/UI/VisualStudio/SolutionWizardVB.cs
  71. +1 −2 code/src/UI/VisualStudio/VsGenShell.cs
  72. +1 −4 code/test/Core.Test/Composition/CompositionQueryTest.cs
  73. +1 −1 code/test/Core.Test/Composition/FakeTemplateInfo.cs
  74. +10 −9 code/test/Core.Test/Config/ConfigurationTests.cs
  75. +10 −0 code/test/Core.Test/Core.Test.csproj
  76. +0 −3 code/test/Core.Test/Diagnostics/FileHealthWriterTest.cs
  77. +16 −17 code/test/Core.Test/Diagnostics/HealthTest.cs
  78. +1 −1 code/test/Core.Test/Diagnostics/TelemetryFixture.cs
  79. +0 −1 code/test/Core.Test/Diagnostics/TelemetryServiceTest.cs
  80. +28 −9 code/test/Core.Test/Localization/LocalizationTest.cs
  81. +11 −13 code/test/Core.Test/Locations/TemplatexTests.cs
  82. +5 −9 code/test/Core.Test/Locations/UnitTestTemplatesSource.cs
  83. +27 −13 code/test/Core.Test/Naming/NamingTest.cs
  84. +1 −2 code/test/Core.Test/PostActions/Catalog/GenerateTestCertificatePostActionTest.cs
  85. +64 −32 code/test/Core.Test/PostActions/Catalog/HandleRemovalsTest.cs
  86. +3 −11 code/test/Core.Test/PostActions/Catalog/SortImportsTest.cs
  87. +0 −1 code/test/Core.Test/PostActions/Catalog/SortUsingsTest.cs
  88. +10 −7 code/test/Core.Test/Properties/AssemblyInfo.cs
  89. +63 −25 code/test/Core.Test/Templates/ITemplateInfoExtensionsTest.cs
  90. +0 −1 code/test/Fakes/FakeGenShell.cs
  91. +7 −0 code/test/Fakes/Fakes.csproj
  92. +35 −36 code/test/Fakes/MSBuild/FakeMsBuildProject.cs
  93. +0 −1 code/test/Fakes/MSBuild/VsItemType.cs
  94. +5 −2 code/test/Fakes/Properties/AssemblyInfo.cs
  95. +2 −4 code/test/Fakes/Solution/FakeSolution.cs
  96. +1 −1 code/test/Templates.Test/CodeStyleEnforcementTests.cs
  97. +3 −12 code/test/Templates.Test/FileEncodingTests.cs
  98. +3 −1 code/test/Templates.Test/GenerationFixture.cs
  99. +56 −0 code/test/Templates.Test/GlobalSuppressions.cs
  100. +12 −10 code/test/Templates.Test/NewItemGenerationTests.cs
  101. +24 −16 code/test/Templates.Test/ProjectGenerationTests.cs
  102. +9 −6 code/test/Templates.Test/Properties/AssemblyInfo.cs
  103. +3 −1 code/test/Templates.Test/StyleCopGenerationTestsFixture.cs
  104. +3 −3 code/test/Templates.Test/StyleCopPlusLocalTemplatesSource.cs
  105. +6 −4 code/test/Templates.Test/StyleCopProjectGenerationTests.cs
  106. +8 −0 code/test/Templates.Test/Templates.Test.csproj
  107. +0 −1 code/test/VsEmulator/Converters/BoolToVisibilityConverter.cs
  108. +3 −8 code/test/VsEmulator/LoadProject/LoadProjectViewModel.cs
  109. +7 −10 code/test/VsEmulator/Main/MainViewModel.cs
  110. +1 −3 code/test/VsEmulator/NewProject/NewProjectViewModel.cs
  111. +25 −24 code/test/VsEmulator/Properties/AssemblyInfo.cs
  112. +8 −5 code/test/VsEmulator/TemplatesContent/TemplatesContentViewModel.cs
  113. +10 −0 code/test/VsEmulator/VsEmulator.csproj
  114. +11 −13 code/tools/Localization/ClientInterface/ToolCommandHandler.cs
  115. +3 −8 code/tools/Localization/ClientInterface/ToolCommandInfo.cs
  116. +2 −2 code/tools/Localization/Localization.csproj
  117. +8 −16 code/tools/Localization/Logic/CSharpProjectTemplateGenerator.cs
  118. +52 −23 code/tools/Localization/Logic/LocalizableItemsExtractor.cs
  119. +1 −1 code/tools/Localization/Logic/LocalizationTool.cs
  120. +20 −19 code/tools/Localization/Logic/ProjectTemplateGeneratorBase.cs
  121. +20 −16 code/tools/Localization/Logic/RightClickCommandGenerator.cs
  122. +8 −16 code/tools/Localization/Logic/VisualBasicProjectTemplateGenerator.cs
  123. +0 −4 code/tools/Localization/Program.cs
  124. +5 −2 code/tools/Localization/Properties/AssemblyInfo.cs
  125. +17 −40 docs/roadmap.md
  126. +26 −19 docs/telemetryData.md
  127. +3 −1 templates/Features/SampleData/Models/Order.cs
View
@@ -1,6 +1,6 @@
# Windows Template Studio
Copyright (c) Microsoft and Contributors
Copyright (c) .NET Foundation and Contributors.
All rights reserved.
View
@@ -36,6 +36,7 @@ Once you select the attributes you want your new UWP app to have, you can quickl
## Known issues
* [Project creation failing with VS 15.2 and VS Preview side by side](https://github.com/Microsoft/WindowsTemplateStudio/issues/668) - We believe right now there is a side by side issue.
* [Chart page in x86 mode design-time error](https://github.com/Microsoft/WindowsTemplateStudio/issues/818) - Waiting for a fix
## Feedback, Requests and Roadmap
@@ -47,7 +48,7 @@ Here is what we're currently thinking in our [roadmap](docs/roadmap.md)
## Contributing
Do you want to contribute? Here are our [contribution guidelines](CONTRIBUTING.md).
Do you want to contribute? We would love to have you help out. Here are our [contribution guidelines](CONTRIBUTING.md).
## Principles
@@ -60,14 +61,17 @@ Do you want to contribute? Here are our [contribution guidelines](CONTRIBUTING.m
1. Templates released in production will try to adhere to the design language used in the current release of Windows 10.
1. Code should follow [.NET Core coding style](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md)
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
## License
This code is distributed under the terms and conditions of the [MIT license](LICENSE.md).
## Code of Conduct
## Privacy Statement
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
The extension does [log basic telemetry](docs/telemetry.md) for what is being selected. Please read the [Microsoft privacy statement](http://go.microsoft.com/fwlink/?LinkId=521839) for more information.
## Privacy Statement
## .NET Foundation
The extension does [log basic telemetry](docs/telemetry.md) for what is being selected. Please read the [Microsoft privacy statement](http://go.microsoft.com/fwlink/?LinkId=521839) for more information.
This project is supported by the [.NET Foundation](https://dotnetfoundation.org).
@@ -1,14 +1,6 @@
# ******************************************************************
# Copyright (c) Microsoft. All rights reserved.
# This code is licensed under the MIT License (MIT).
# THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
# THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
# ******************************************************************
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# This script checks that all text files in the templates folder have
# the UTF8+BOM encoding.
View
@@ -38,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fakes", "test\Fakes\Fakes.csproj", "{FB3C81AD-823E-409C-BF6D-27534B84A8AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Localization", "tools\Localization\Localization.csproj", "{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Analyze|Any CPU = Analyze|Any CPU
@@ -98,6 +100,12 @@ Global
{FB3C81AD-823E-409C-BF6D-27534B84A8AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB3C81AD-823E-409C-BF6D-27534B84A8AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB3C81AD-823E-409C-BF6D-27534B84A8AF}.Release|Any CPU.Build.0 = Release|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Analyze|Any CPU.ActiveCfg = Analyze|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Analyze|Any CPU.Build.0 = Analyze|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -109,5 +117,6 @@ Global
{D5E1C23A-7547-412A-82F1-F00C34622C1E} = {428D8EC8-DF58-4921-B464-967086C924A4}
{2B997E0A-16C8-4B8E-810A-D1D7DAFBD760} = {428D8EC8-DF58-4921-B464-967086C924A4}
{FB3C81AD-823E-409C-BF6D-27534B84A8AF} = {481CC407-92E7-42A9-AD6E-AA157E5D40C3}
{84900DD1-8F31-4D6F-8C8A-0BAAC25829DA} = {85F5D200-F318-4B12-981F-8DECF8FA3078}
EndGlobalSection
EndGlobal
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// This file is used by Code Analysis to maintain SuppressMessage
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
@@ -191,8 +191,7 @@
<Compile Include="PostActions\Catalog\AddContextItemsToProjectPostAction.cs" />
<Compile Include="PostActions\Catalog\Merge\MergeFailureType.cs" />
<Compile Include="PostActions\Catalog\Merge\PostActionFormatter.cs" />
<Compile Include="PostActions\Catalog\NewItemGeneration\CreateSyncInstructionsPostAction.cs" />
<Compile Include="PostActions\Catalog\NewItemGeneration\CreateSyncSummaryPostAction.cs" />
<Compile Include="PostActions\Catalog\NewItemGeneration\CreateSummaryPostAction.cs" />
<Compile Include="PostActions\Catalog\Merge\GenerateMergeInfoPostAction.cs" />
<Compile Include="PostActions\Catalog\Merge\GetMergeFilesFromProjectPostAction.cs" />
<Compile Include="PostActions\Catalog\Merge\MergeConfiguration.cs" />
@@ -395,5 +394,8 @@
<LastGenOutput>StringRes.zh-TW.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -12,14 +12,14 @@ namespace Microsoft.Templates.Core.Diagnostics
{
public class ShellHealthWriter : IHealthWriter
{
GenShell shell;
GenShell _shell;
public ShellHealthWriter(GenShell shell)
{
this.shell = shell;
_shell = shell;
}
public async SystemTasks.Task WriteExceptionAsync(Exception ex, string message = null)
{
if (shell != null)
if (_shell != null)
{
await SafeTrackAsync(() =>
{
@@ -41,7 +41,7 @@ public async SystemTasks.Task WriteExceptionAsync(Exception ex, string message =
public async SystemTasks.Task WriteTraceAsync(TraceEventType eventType, string message, Exception ex = null)
{
if (shell != null)
if (_shell != null)
{
await SafeTrackAsync(() =>
{
@@ -15,5 +15,7 @@ public class TempGenerationResult
public List<string> ConflictingFiles { get; } = new List<string>();
public List<string> UnchangedFiles { get; } = new List<string>();
public bool SyncGeneration { get; set; }
}
}
@@ -0,0 +1,193 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Templates.Core.Gen;
using Microsoft.Templates.Core.Resources;
using Microsoft.Templates.Core.PostActions.Catalog.Merge;
namespace Microsoft.Templates.Core.PostActions.Catalog
{
public class CreateSummaryPostAction : PostAction<TempGenerationResult>
{
public CreateSummaryPostAction(TempGenerationResult config) : base(config)
{
}
public override void Execute()
{
var fileName = GetFileName();
if (_config.SyncGeneration)
{
var newFiles = BuildNewFilesSection(StringRes.SyncSummarySectionNewFiles);
var modifiedFiles = BuildMergeFileSection(StringRes.SyncSummarySectionModifiedFiles, StringRes.SyncSummaryTemplateModifiedFile, GenContext.Current.MergeFilesFromProject.Where(f => !GenContext.Current.FailedMergePostActions.Any(m => m.FileName == f.Key)));
var failedMergeFiles = BuildMergeFileSection(StringRes.SyncSummarySectionFailedMergeFiles, StringRes.SyncSummaryTemplateFailedMerges, GenContext.Current.MergeFilesFromProject.Where(f => GenContext.Current.FailedMergePostActions.Any(m => m.FileName == f.Key)));
var conflictingFiles = BuildConflictingFilesSection(StringRes.SyncSummarySectionConflictingFiles);
File.WriteAllText(fileName, string.Format(StringRes.SyncSummaryTemplate, GenContext.Current.OutputPath, newFiles, modifiedFiles, failedMergeFiles, conflictingFiles));
}
else
{
var newFiles = BuildNewFilesSection(StringRes.SyncInstructionsSectionNewFiles);
var modifiedFiles = BuildMergeFileSection(StringRes.SyncInstructionsSectionModifiedFiles, StringRes.SyncInstructionsTemplateModifiedFile, GenContext.Current.MergeFilesFromProject);
var conflictingFiles = BuildConflictingFilesSection(StringRes.SyncInstructionsSectionConflictingFiles);
var unchangedFiles = BuildUnchangedFilesSection(StringRes.SyncInstructionsSectionUnchangedFiles);
File.WriteAllText(fileName, string.Format(StringRes.SyncInstructionsTemplate, GenContext.Current.OutputPath, newFiles, modifiedFiles, conflictingFiles, unchangedFiles));
}
GenContext.Current.FilesToOpen.Add(fileName);
GenContext.Current.FailedMergePostActions.Clear();
GenContext.Current.MergeFilesFromProject.Clear();
}
private string GetFileName()
{
if (_config.SyncGeneration)
{
return Path.Combine(GenContext.Current.OutputPath, StringRes.SyncSummaryFileName);
}
else
{
return Path.Combine(GenContext.Current.OutputPath, StringRes.SyncInstructionsFileName);
}
}
private string BuildMergeFileSection(string sectionTemplate, string modifiedFileTemplate, IEnumerable<KeyValuePair<string, List<MergeInfo>>> mergeFiles)
{
if (mergeFiles.Any())
{
var sb = new StringBuilder();
foreach (var mergeFile in mergeFiles)
{
sb.AppendLine(GetMergeFileDescription(mergeFile, modifiedFileTemplate));
}
return string.Format(sectionTemplate, sb.ToString());
}
else
{
return string.Empty;
}
}
private string GetMergeFileDescription(KeyValuePair<string, List<Merge.MergeInfo>> mergeFile, string modifiedFileTemplate)
{
var sb = new StringBuilder();
foreach (var mergeInfo in mergeFile.Value)
{
sb.AppendLine($"```{mergeInfo.Format}");
sb.AppendLine(mergeInfo.PostActionCode);
sb.AppendLine("```");
}
return string.Format(modifiedFileTemplate, mergeFile.Key, sb.ToString(), GetMergeResult(mergeFile));
}
private string GetMergeResult(KeyValuePair<string, List<Merge.MergeInfo>> mergeFile)
{
if (!GenContext.Current.FailedMergePostActions.Any(w => w.FileName == mergeFile.Key))
{
return GetLinkToFile(mergeFile.Key);
}
else
{
var sb = new StringBuilder();
var failedMergePostActions = GenContext.Current.FailedMergePostActions.Where(w => w.FileName == mergeFile.Key);
foreach (var failedMergePostAction in failedMergePostActions)
{
sb.AppendLine();
sb.AppendLine($"* {failedMergePostAction.Description}");
}
return sb.ToString();
}
}
private string BuildNewFilesSection(string sectionTemplate)
{
if (_config.NewFiles.Any())
{
return string.Format(sectionTemplate, GetFileList(_config.NewFiles));
}
else
{
return string.Empty;
}
}
private string BuildUnchangedFilesSection(string sectionTemplate)
{
if (_config.UnchangedFiles.Any())
{
return string.Format(sectionTemplate, GetFileList(_config.UnchangedFiles));
}
else
{
return string.Empty;
}
}
private string BuildConflictingFilesSection(string sectionTemplate)
{
if (_config.ConflictingFiles.Any())
{
var sb = new StringBuilder();
foreach (var conflictFile in _config.ConflictingFiles)
{
sb.AppendLine(GetCompareLink(conflictFile));
}
return string.Format(sectionTemplate, sb.ToString());
}
else
{
return string.Empty;
}
}
private StringBuilder GetFileList(List<string> files)
{
var fileList = new StringBuilder();
foreach (var file in files)
{
fileList.AppendLine($"* {GetLinkToFile(file)}");
}
return fileList;
}
private string GetLinkToFile(string fileName)
{
if (_config.SyncGeneration)
{
var filePath = Path.Combine(GenContext.Current.ProjectPath, fileName);
return $"[{fileName}]({FormatFilePath(filePath)})";
}
else
{
return $"[{fileName}]({fileName})";
}
}
private static string FormatFilePath(string filePath)
{
return $"about:/{filePath.Replace(" ", "%20").Replace(@"\", "/")}";
}
private string GetCompareLink(string fileName)
{
var filePath = Path.Combine(GenContext.Current.ProjectPath, fileName);
return $"* {StringRes.SyncSummaryTempGenerationFile}: [{fileName}]({fileName}), {StringRes.SyncSummaryProjectFile}: [{fileName}]({FormatFilePath(filePath)})";
}
}
}
Oops, something went wrong.

0 comments on commit 5e15682

Please sign in to comment.