-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nowsprinting/feature/namespace_provider
Support namespace provider
- Loading branch information
Showing
16 changed files
with
366 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) 2021-2023 Koji Hasegawa. | ||
// This software is released under the MIT License. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("CreateScriptFoldersWithTests.Editor.Tests")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2021-2023 Koji Hasegawa. | ||
// This software is released under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace CreateScriptFoldersWithTests.Editor.Internals | ||
{ | ||
internal class DotSettingsCreator | ||
{ | ||
private readonly string _assemblyName; | ||
private readonly List<string> _namespaceFoldersToSkip; | ||
|
||
public DotSettingsCreator(string assemblyName) | ||
{ | ||
_assemblyName = assemblyName; | ||
_namespaceFoldersToSkip = new List<string>(); | ||
} | ||
|
||
public void AddNamespaceFoldersToSkip(string path) | ||
{ | ||
var key = path | ||
.ToLower() | ||
.Replace("/", "_005C") | ||
.Replace(".", "_002E") | ||
.Replace("-", "_002D") | ||
.Replace(" ", "_0020") | ||
.Replace("(", "_0028") | ||
.Replace(")", "_0029"); | ||
|
||
_namespaceFoldersToSkip.Add( | ||
$"<s:Boolean x:Key=\"/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/={key}/@EntryIndexedValue\">True</s:Boolean>"); | ||
} | ||
|
||
public bool WasAddNamespaceFoldersToSkip() | ||
{ | ||
return _namespaceFoldersToSkip.Any(); | ||
} | ||
|
||
public void Flush() | ||
{ | ||
using (var writer = new StreamWriter($"{_assemblyName}.csproj.DotSettings")) | ||
{ | ||
writer.WriteLine( | ||
"<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">"); | ||
foreach (var s in _namespaceFoldersToSkip) | ||
{ | ||
writer.WriteLine(s); | ||
} | ||
|
||
writer.WriteLine("</wpf:ResourceDictionary>"); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.