Merge pull request #5 from unoplatform/dev/jela/net9-update

.NET 9 Update
This commit is contained in:
Jérôme Laban 2024-10-26 14:25:46 -04:00 коммит произвёл GitHub
Родитель 393d5413e6 8e84f5ed2b
Коммит fdcda3ede2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
181 изменённых файлов: 3255 добавлений и 1567 удалений

1
.github/FUNDING.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
github: [KirillOsenkov]

48
.github/workflows/roslynquoter.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,48 @@
name: Build and deploy .NET Core application to Web App roslynquoter
on:
push:
branches:
- main
env:
AZURE_WEBAPP_NAME: roslynquoter
AZURE_WEBAPP_PACKAGE_PATH: src\Quoter.Web\published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 6.0.x
WORKING_DIRECTORY: src\Quoter.Web
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
- name: Publish Artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
deploy:
runs-on: windows-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4.1.7
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.roslynquoter_186F }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

Просмотреть файл

@ -1,22 +1,16 @@
jobs:
- job: VS_Latest
container: unoplatform/wasm-build:2.0
pool:
vmImage: 'ubuntu-latest'
variables:
SourceLinkEnabled: false
DotnetRuntimePath: /usr/share/dotnet
steps:
- task: UseDotNet@2
displayName: 'Use .Net Core runtime 2.2.x'
displayName: 'Use .NET SDK'
inputs:
packageType: runtime
version: 2.2.x
installationPath: '$(DotnetRuntimePath)'
version: 9.0.100-rc.2.24474.11
includePreviewVersions: true
- task: nventiveCanaryUpdater@5
displayName: 'Canary Update'
@ -29,39 +23,30 @@ jobs:
nugetUpdaterVersion: 2.0.6
packageAuthor: nventive
- task: UseDotNet@2
displayName: 'Use .Net Core runtime 2.1.0'
inputs:
packageType: runtime
version: 2.1.0
installationPath: '$(DotnetRuntimePath)'
- task: GitVersion@5
- task: gitversion/setup@0
retryCountOnTaskFailure: 3
inputs:
versionSpec: '5.10.3'
- task: gitversion/execute@0
retryCountOnTaskFailure: 3
inputs:
updateAssemblyInfo: 'False'
useConfigFile: true
configFilePath: gitversion.yml
- bash: |
cd ~
git clone https://github.com/emscripten-core/emsdk
cd emsdk
./emsdk install sdk-1.39.11
./emsdk activate sdk-1.39.11
displayName: 'Setup Emscripten'
displayName: Use GitVersion
- script: |
source ~/emsdk/emsdk_env.sh
cd $(build.sourcesdirectory)
msbuild /r /p:Configuration=Release $(build.sourcesdirectory)/src/uno/RoslynQuoter.Wasm/RoslynQuoter.Wasm.csproj "/p:InformationalVersion=$GITVERSION_INFORMATIONALVERSION"
dotnet publish -f net9.0-browserwasm $(build.sourcesdirectory)/src/uno/RoslynQuoter/RoslynQuoterApp.csproj "/p:InformationalVersion=$GITVERSION_INFORMATIONALVERSION"
env:
GITVERSION_FullSemVer: $(GITVERSION_FullSemVer)
displayName: 'Build Calculator'
displayName: 'Build'
- task: PublishBuildArtifacts@1
displayName: Publish Package Artifacts
inputs:
pathToPublish: $(build.sourcesdirectory)/src/uno/RoslynQuoter.Wasm/bin/Release/netstandard2.0/dist
pathToPublish: $(build.sourcesdirectory)/src/uno/RoslynQuoter/bin/Release/net9.0-browserwasm/publish/wwwroot
artifactType: container
artifactName: RoslynQuoter-Wasm

12
Directory.Packages.props Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<Project ToolsVersion="15.0">
<!--
To update the version of Uno, you should instead update the Sdk version in the global.json file.
See https://aka.platform.uno/using-uno-sdk for more information.
See https://aka.platform.uno/using-uno-sdk#implicit-packages for more information regarding the Implicit Packages.
-->
<ItemGroup>
<PackageVersion Include="Uno.WinUI.Sample.Banner" Version="1.45.0-dev.64" />
<PackageVersion Include="Microsoft.TypeScript.MSBuild" Version="5.6.2" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.128
# Visual Studio Version 17
VisualStudioVersion = 17.12.35410.144
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quoter", "src\Quoter\Quoter.csproj", "{927AB47F-479C-423A-B21F-5DEC48533E1D}"
EndProject
@ -11,18 +11,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quoter.Web", "src\Quoter.We
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "uno", "uno", "{03213811-C0E4-4165-A36A-21955DEECD9B}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RoslynQuoter.Shared", "src\uno\RoslynQuoter.Shared\RoslynQuoter.Shared.shproj", "{6279C845-92F8-4333-AB99-3D213163593C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoslynQuoterApp", "src\uno\RoslynQuoter\RoslynQuoterApp.csproj", "{D0912442-3957-4840-9294-43CDC51DBD1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoslynQuoter.UWP", "src\uno\RoslynQuoter.UWP\RoslynQuoter.UWP.csproj", "{20F64AA7-D240-49D8-BC35-578E322C7279}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynQuoter.Wasm", "src\uno\RoslynQuoter.Wasm\RoslynQuoter.Wasm.csproj", "{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6ED38E1A-AA67-408E-8EA3-CE3EB4AF9980}"
ProjectSection(SolutionItems) = preProject
src\uno\Directory.Build.props = src\uno\Directory.Build.props
src\uno\Directory.Build.targets = src\uno\Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
EndProjectSection
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\uno\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems*{20f64aa7-d240-49d8-bc35-578e322c7279}*SharedItemsImports = 4
src\uno\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems*{6279c845-92f8-4333-ab99-3d213163593c}*SharedItemsImports = 13
src\uno\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems*{a706d15c-b407-42a2-b6e3-b6f88ba24e7e}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
Ad-Hoc|ARM = Ad-Hoc|ARM
@ -194,123 +193,60 @@ Global
{8726E4D4-7D55-4F90-B6B6-9DECE6A88C64}.Release|x64.Build.0 = Release|Any CPU
{8726E4D4-7D55-4F90-B6B6-9DECE6A88C64}.Release|x86.ActiveCfg = Release|Any CPU
{8726E4D4-7D55-4F90-B6B6-9DECE6A88C64}.Release|x86.Build.0 = Release|Any CPU
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|Any CPU.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|Any CPU.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|Any CPU.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|ARM.ActiveCfg = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|ARM.Build.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|ARM.Deploy.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhone.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhone.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhone.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x64.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x64.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x64.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x86.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x86.Build.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Ad-Hoc|x86.Deploy.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|Any CPU.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|Any CPU.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|Any CPU.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|ARM.ActiveCfg = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|ARM.Build.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|ARM.Deploy.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhone.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhone.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhone.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhoneSimulator.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhoneSimulator.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|iPhoneSimulator.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x64.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x64.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x64.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x86.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x86.Build.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.AppStore|x86.Deploy.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|Any CPU.ActiveCfg = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|ARM.ActiveCfg = Debug|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|ARM.Build.0 = Debug|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|ARM.Deploy.0 = Debug|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|iPhone.ActiveCfg = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x64.ActiveCfg = Debug|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x64.Build.0 = Debug|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x64.Deploy.0 = Debug|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x86.ActiveCfg = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x86.Build.0 = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Debug|x86.Deploy.0 = Debug|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|Any CPU.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|Any CPU.Build.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|ARM.ActiveCfg = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|ARM.Build.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|ARM.Deploy.0 = Release|ARM
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|iPhone.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|iPhoneSimulator.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x64.ActiveCfg = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x64.Build.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x64.Deploy.0 = Release|x64
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x86.ActiveCfg = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x86.Build.0 = Release|x86
{20F64AA7-D240-49D8-BC35-578E322C7279}.Release|x86.Deploy.0 = Release|x86
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|ARM.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|iPhone.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|x64.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|x64.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|x86.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.AppStore|x86.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|ARM.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|ARM.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|iPhone.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|x64.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|x64.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|x86.ActiveCfg = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Debug|x86.Build.0 = Debug|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|Any CPU.Build.0 = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|ARM.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|ARM.Build.0 = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|iPhone.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|iPhone.Build.0 = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|x64.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|x64.Build.0 = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|x86.ActiveCfg = Release|Any CPU
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E}.Release|x86.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|ARM.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|iPhone.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|x64.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|x64.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|x86.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.AppStore|x86.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|ARM.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|iPhone.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|x64.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|x64.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|x86.ActiveCfg = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Debug|x86.Build.0 = Debug|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|Any CPU.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|ARM.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|ARM.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|iPhone.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|iPhone.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|x64.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|x64.Build.0 = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|x86.ActiveCfg = Release|Any CPU
{D0912442-3957-4840-9294-43CDC51DBD1B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6279C845-92F8-4333-AB99-3D213163593C} = {03213811-C0E4-4165-A36A-21955DEECD9B}
{20F64AA7-D240-49D8-BC35-578E322C7279} = {03213811-C0E4-4165-A36A-21955DEECD9B}
{A706D15C-B407-42A2-B6E3-B6F88BA24E7E} = {03213811-C0E4-4165-A36A-21955DEECD9B}
{D0912442-3957-4840-9294-43CDC51DBD1B} = {03213811-C0E4-4165-A36A-21955DEECD9B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {43B50B6E-3AC4-4C96-93BB-CC268492FD03}

10
global.json Normal file
Просмотреть файл

@ -0,0 +1,10 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "5.6.0-dev.51"
},
"sdk":{
"allowPrerelease": true
}
}

Просмотреть файл

@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Quoter.Tests</AssemblyName>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<IncludeAssets>runtime;build;native;contentFiles;analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
@ -18,8 +17,4 @@
<ProjectReference Include="..\Quoter\Quoter.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

Просмотреть файл

@ -5,9 +5,30 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using RoslynQuoter;
using Xunit;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
public class Tests
{
[Fact]
public void TestInterpolatedStringWithNewLine()
{
var expected = $@"InterpolatedStringExpression(
Token(SyntaxKind.InterpolatedStringStartToken))
.WithContents(
SingletonList<InterpolatedStringContentSyntax>(
InterpolatedStringText()
.WithTextToken(
Token(
TriviaList(),
SyntaxKind.InterpolatedStringTextToken,
""Foo \\n!"",
@""Foo {"\n"}!"",
TriviaList()))))
.NormalizeWhitespace()";
Test("$\"Foo \\n!\"", expected, shortenCodeWithUsingStatic: true, nodeKind: NodeKind.Expression);
}
[Fact]
public void TestUsingSystemWithRedundantCalls()
{
@ -19,6 +40,8 @@ public class Tests
SyntaxFactory.IdentifierName(""System""))
.WithUsingKeyword(
SyntaxFactory.Token(SyntaxKind.UsingKeyword))
.WithNamespaceOrType(
SyntaxFactory.IdentifierName(""System""))
.WithSemicolonToken(
SyntaxFactory.Token(SyntaxKind.SemicolonToken))))
.WithEndOfFileToken(
@ -152,6 +175,8 @@ namespace N
SyntaxFactory.IdentifierName(""System""))
.WithUsingKeyword(
SyntaxFactory.Token(SyntaxKind.UsingKeyword))
.WithNamespaceOrType(
SyntaxFactory.IdentifierName(""System""))
.WithSemicolonToken(
SyntaxFactory.Token(SyntaxKind.SemicolonToken))))
.WithMembers(
@ -279,6 +304,68 @@ namespace N
Test("class C { char c = 'z'; }");
}
[Theory]
[InlineData("'")]
[InlineData("0")]
[InlineData("a")]
[InlineData("b")]
[InlineData("f")]
[InlineData("n")]
[InlineData("r")]
[InlineData("t")]
[InlineData("v")]
public void TestEscapedCharLiterals(string ch)
{
Test($"'\\{ch}'", $@"SyntaxFactory.LiteralExpression(
SyntaxKind.CharacterLiteralExpression,
SyntaxFactory.Literal('\{ch}'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
}
[Theory]
[InlineData("u1234", "ሴ")]
[InlineData("x123a", "ሺ")]
[InlineData("U00001234", "ሴ")]
public void TestEscapedCharLiterals2(string ch, string charValue)
{
Test($"'\\{ch}'", $@"SyntaxFactory.LiteralExpression(
SyntaxKind.CharacterLiteralExpression,
SyntaxFactory.Literal(
""'\\{ch}'"",
'{charValue}'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestEscapedCharLiterals3()
{
Test("'\"'", $@"SyntaxFactory.LiteralExpression(
SyntaxKind.CharacterLiteralExpression,
SyntaxFactory.Literal('""'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestEscapedCharLiterals4()
{
Test("'\\\\'", $@"SyntaxFactory.LiteralExpression(
SyntaxKind.CharacterLiteralExpression,
SyntaxFactory.Literal('\\'))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestEscapedChar5()
{
Test("\"@abc\\rdef\"", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestEscapedChar6()
{
Test("@\"\\n\"", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestTrueFalseAndNull()
{
@ -324,7 +411,7 @@ class Program
}
[Fact]
public void Roundtrip6()
public void RoundtripBoolLiteral()
{
Test(@"class C { bool b = true; }");
}
@ -393,6 +480,12 @@ int i
Test(@"class C { void M() { a ? b : c; } }");
}
[Fact]
public void NotPattern()
{
Test("x is not null", nodeKind: NodeKind.Expression);
}
private static string GetPath(string relativePath)
{
if (Path.IsPathRooted(relativePath))
@ -428,6 +521,16 @@ int i
Test("#line 1 \"a\\\b\"");
}
[Fact]
public void Roundtrip21_1()
{
Test("\"\b\"", nodeKind: NodeKind.Expression);
Test(" \"\b\"", nodeKind: NodeKind.Expression);
Test("\"\b\" ", nodeKind: NodeKind.Expression);
Test(" \"\b\" ", nodeKind: NodeKind.Expression);
Test("\"a\\\b\"", nodeKind: NodeKind.Expression);
}
[Fact]
public void Roundtrip22()
{
@ -571,7 +674,197 @@ class C { }");
[Fact]
public void TestIssue49()
{
Test(@"if () {}", "Parse error. Have you selected the right Parse As context?", nodeKind: NodeKind.MemberDeclaration);
Test(
@"if () {}",
"Parse error. Have you selected the right Parse As context?",
nodeKind: NodeKind.MemberDeclaration,
testRoundtrip: false);
}
[Fact]
public void TestIssue61()
{
Test(@"void M() { var a = M() is char and > 'H' }");
}
[Fact]
public void TestIdentifiers()
{
Test(@"using System;
var @class = 12;
Console.WriteLine(nameof(@class));");
}
[Fact]
public void TestFloatLiteral()
{
Test("1F", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(1F))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression);
}
[Fact]
public void TestDoubleLiteral()
{
Test("1D", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1D"",
1D))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestDoubleLiteralSmall()
{
Test("1d", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1d"",
1d))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestDecimalLiteral()
{
Test("1M", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(1M))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestDecimalLiteralSmall()
{
Test("1m", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1m"",
1m))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestUnsignedLiteral()
{
Test("1u", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1u"",
1u))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
Test("0x1u", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""0x1u"",
0x1u))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestLongLiteral()
{
Test("1l", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1l"",
1l))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
Test("0x1L", @"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""0x1L"",
0x1L))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Theory]
[InlineData("ul")]
[InlineData("uL")]
[InlineData("Ul")]
[InlineData("lu")]
[InlineData("lU")]
[InlineData("Lu")]
[InlineData("LU")]
public void TestUnsignedLongLiteral(string suffix)
{
Test("1" + suffix, $@"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""1{suffix}"",
1{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
Test("0x2" + suffix, $@"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""0x2{suffix}"",
0x2{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestUL()
{
const string suffix = "UL";
Test("1" + suffix, $@"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(1{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
Test("0x2" + suffix, $@"SyntaxFactory.LiteralExpression(
SyntaxKind.NumericLiteralExpression,
SyntaxFactory.Literal(
""0x2{suffix}"",
0x2{suffix}))
.NormalizeWhitespace()", nodeKind: NodeKind.Expression
);
}
[Fact]
public void TestIssue77()
{
Test("Foo(0x0000800000000000)", NodeKind.Expression);
}
[Fact]
public void TestBinaryLiteral()
{
Test("0b_0010_1010", NodeKind.Expression);
}
[Fact]
public void TestRecordStruct()
{
Test("record struct A();",
@"RecordDeclaration(
SyntaxKind.RecordStructDeclaration,
Token(SyntaxKind.RecordKeyword),
Identifier(""A""))
.WithClassOrStructKeyword(
Token(SyntaxKind.StructKeyword))
.WithParameterList(
ParameterList())
.WithSemicolonToken(
Token(SyntaxKind.SemicolonToken))
.NormalizeWhitespace()",
shortenCodeWithUsingStatic: true,
nodeKind: NodeKind.MemberDeclaration);
}
private void Test(
@ -580,7 +873,8 @@ class C { }");
bool useDefaultFormatting = true,
bool removeRedundantModifyingCalls = true,
bool shortenCodeWithUsingStatic = false,
NodeKind nodeKind = NodeKind.CompilationUnit)
NodeKind nodeKind = NodeKind.CompilationUnit,
bool testRoundtrip = true)
{
var quoter = new Quoter
{
@ -591,16 +885,24 @@ class C { }");
var actual = quoter.QuoteText(sourceText, nodeKind);
Assert.Equal(expected, actual);
Test(sourceText);
if (testRoundtrip)
{
Test(sourceText, nodeKind);
}
}
private void Test(string sourceText)
private void Test(string sourceText, NodeKind nodeKind = NodeKind.CompilationUnit)
{
Test(sourceText, useDefaultFormatting: true, removeRedundantCalls: true, shortenCodeWithUsingStatic: false);
Test(sourceText, useDefaultFormatting: false, removeRedundantCalls: true, shortenCodeWithUsingStatic: true);
Test(sourceText, useDefaultFormatting: true, removeRedundantCalls: true, shortenCodeWithUsingStatic: false, nodeKind);
Test(sourceText, useDefaultFormatting: false, removeRedundantCalls: true, shortenCodeWithUsingStatic: true, nodeKind);
}
private static void Test(string sourceText, bool useDefaultFormatting, bool removeRedundantCalls, bool shortenCodeWithUsingStatic)
private static void Test(
string sourceText,
bool useDefaultFormatting,
bool removeRedundantCalls,
bool shortenCodeWithUsingStatic,
NodeKind nodeKind = NodeKind.CompilationUnit)
{
if (useDefaultFormatting)
{
@ -614,9 +916,10 @@ class C { }");
var quoter = new Quoter
{
UseDefaultFormatting = useDefaultFormatting,
RemoveRedundantModifyingCalls = removeRedundantCalls
RemoveRedundantModifyingCalls = removeRedundantCalls,
ShortenCodeWithUsingStatic = shortenCodeWithUsingStatic
};
var generatedCode = quoter.Quote(sourceText);
var generatedCode = quoter.Quote(sourceText, nodeKind);
var resultText = quoter.Evaluate(generatedCode);
@ -630,7 +933,7 @@ class C { }");
Assert.Equal(sourceText, resultText);
}
public void CheckSourceFiles()
internal void CheckSourceFiles()
{
var rootFolder = @"C:\roslyn-internal\Closed\Test\Files\";
var files = Directory.GetFiles(rootFolder, "*.cs", SearchOption.AllDirectories);
@ -640,7 +943,7 @@ class C { }");
}
}
public void VerifyRoundtrip(string file)
internal void VerifyRoundtrip(string file)
{
try
{

Просмотреть файл

@ -0,0 +1,69 @@
using System;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using RoslynQuoter;
namespace QuoterService.Controllers
{
[Route("api/[controller]")]
public class LinqpadController : Controller
{
[HttpGet]
public IActionResult Get(
string sourceText,
NodeKind nodeKind = NodeKind.CompilationUnit,
bool openCurlyOnNewLine = false,
bool closeCurlyOnNewLine = false,
bool preserveOriginalWhitespace = false,
bool keepRedundantApiCalls = false,
bool avoidUsingStatic = false)
{
string responseText;
if (string.IsNullOrEmpty(sourceText))
{
responseText = "Please specify the source text.";
}
else if (sourceText.Length > 2000)
{
responseText = "Only strings shorter than 2000 characters are supported; your input string is " + sourceText.Length + " characters long.";
}
else
{
try
{
var quoter = new Quoter
{
OpenParenthesisOnNewLine = openCurlyOnNewLine,
ClosingParenthesisOnNewLine = closeCurlyOnNewLine,
UseDefaultFormatting = !preserveOriginalWhitespace,
RemoveRedundantModifyingCalls = !keepRedundantApiCalls,
ShortenCodeWithUsingStatic = !avoidUsingStatic
};
responseText = quoter.QuoteText(sourceText, nodeKind);
}
catch (Exception ex)
{
responseText = ex.ToString();
}
}
var linqpadFile = $@"<Query Kind=""Expression"">
<NuGetReference>Microsoft.CodeAnalysis.Compilers</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference>
<Namespace>static Microsoft.CodeAnalysis.CSharp.SyntaxFactory</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp.Syntax</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp</Namespace>
<Namespace>Microsoft.CodeAnalysis</Namespace>
</Query>
{responseText}
";
var responseBytes = Encoding.UTF8.GetBytes(linqpadFile);
return File(responseBytes, "application/octet-stream", "Quoter.linq");
}
}
}

Просмотреть файл

@ -1,9 +1,7 @@
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using Microsoft.AspNetCore.Mvc;
using QuoterWeb;
using RoslynQuoter;
namespace QuoterService.Controllers
@ -11,27 +9,24 @@ namespace QuoterService.Controllers
[Route("api/[controller]")]
public class QuoterController : Controller
{
[HttpGet]
public IActionResult Get(
string sourceText,
NodeKind nodeKind = NodeKind.CompilationUnit,
bool openCurlyOnNewLine = false,
bool closeCurlyOnNewLine = false,
bool preserveOriginalWhitespace = false,
bool keepRedundantApiCalls = false,
bool avoidUsingStatic = false,
bool generateLINQPad = false)
[HttpPost]
public IActionResult Post([FromBody] QuoterRequestArgument arguments)
{
string prefix = null;
string responseText = "Quoter is currently down for maintenance. Please check back later.";
if (string.IsNullOrEmpty(sourceText))
if (arguments is null)
{
return BadRequest(responseText);
}
if (string.IsNullOrEmpty(arguments.SourceText))
{
responseText = "Please specify the source text.";
}
else if (sourceText.Length > 2000)
else if (arguments.SourceText.Length > 2000)
{
responseText = "Only strings shorter than 2000 characters are supported; your input string is " + sourceText.Length + " characters long.";
responseText = "Only strings shorter than 2000 characters are supported; your input string is " + arguments.SourceText.Length + " characters long.";
}
else
{
@ -39,14 +34,19 @@ namespace QuoterService.Controllers
{
var quoter = new Quoter
{
OpenParenthesisOnNewLine = openCurlyOnNewLine,
ClosingParenthesisOnNewLine = closeCurlyOnNewLine,
UseDefaultFormatting = !preserveOriginalWhitespace,
RemoveRedundantModifyingCalls = !keepRedundantApiCalls,
ShortenCodeWithUsingStatic = !avoidUsingStatic
OpenParenthesisOnNewLine = arguments.OpenCurlyOnNewLine,
ClosingParenthesisOnNewLine = arguments.CloseCurlyOnNewLine,
UseDefaultFormatting = !arguments.PreserveOriginalWhitespace,
RemoveRedundantModifyingCalls = !arguments.KeepRedundantApiCalls,
ShortenCodeWithUsingStatic = !arguments.AvoidUsingStatic
};
responseText = quoter.QuoteText(sourceText, nodeKind);
responseText = quoter.QuoteText(arguments.SourceText, arguments.NodeKind);
if (arguments.ReadyToRun)
{
responseText = ReadyToRunHelper.CreateReadyToRunCode(arguments, responseText);
}
}
catch (Exception ex)
{
@ -56,25 +56,6 @@ namespace QuoterService.Controllers
}
}
if (generateLINQPad)
{
var linqpadFile = $@"<Query Kind=""Expression"">
<NuGetReference>Microsoft.CodeAnalysis.Compilers</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference>
<Namespace>static Microsoft.CodeAnalysis.CSharp.SyntaxFactory</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp.Syntax</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp</Namespace>
<Namespace>Microsoft.CodeAnalysis</Namespace>
</Query>
{responseText}
";
var responseBytes = Encoding.UTF8.GetBytes(linqpadFile);
return File(responseBytes, "application/octet-stream", "Quoter.linq");
}
responseText = HttpUtility.HtmlEncode(responseText);
if (prefix != null)

Просмотреть файл

@ -0,0 +1,17 @@
using RoslynQuoter;
namespace QuoterWeb
{
public class QuoterRequestArgument
{
public string SourceText { get; set; }
public NodeKind NodeKind { get; set; }
public bool OpenCurlyOnNewLine { get; set; }
public bool CloseCurlyOnNewLine { get; set; }
public bool PreserveOriginalWhitespace { get; set; }
public bool KeepRedundantApiCalls { get; set; }
public bool AvoidUsingStatic { get; set; }
public bool GenerateLinqPad { get; set; }
public bool ReadyToRun { get; set; }
}
}

Просмотреть файл

@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>113425b6-d4c0-42c1-bd99-694335fdfa16</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace QuoterWeb
{
public static class ReadyToRunHelper
{
public static string CreateReadyToRunCode(QuoterRequestArgument arguments, string roslynCode)
{
return @$"using System;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;{(arguments.AvoidUsingStatic ? string.Empty : @"
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;")}
/*
{arguments.SourceText}
*/
var tree = SyntaxTree(
//CODE FROM ROSLYN QUOTER:
{roslynCode}
//END
);
var refApis = AppDomain.CurrentDomain.GetAssemblies()
.Where(a => !a.IsDynamic)
.Select(a => MetadataReference.CreateFromFile(a.Location));
var compilation = CSharpCompilation.Create(""something"", new[] {{ tree }}, refApis);
var diag = compilation.GetDiagnostics().Where(e => e.Severity == DiagnosticSeverity.Error).ToList();
foreach(var d in diag)
{{
Console.WriteLine(d);
}}";
}
}
}

Просмотреть файл

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace QuoterWeb
{
@ -23,17 +18,19 @@ namespace QuoterWeb
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddMvc(o =>
{
o.EnableEndpointRouting = false;
})
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
app.UseFileServer();
}

Просмотреть файл

@ -3,6 +3,7 @@
<head>
<title>Roslyn Quoter</title>
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.min.js" integrity="sha512-GoORoNnxst42zE3rYPj4bNBm0Q6ZRXKNH2D9nEmNvVF/z24ywVnijAWVi/09iBiVDQVf3UlZHpzhAJIdd9BXqw==" crossorigin="anonymous"></script>
<script src="scripts.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-115404565-5"></script>
@ -17,14 +18,13 @@
<body onload="onPageLoad();">
<p class="para">Open-source at <a href="https://github.com/KirillOsenkov/RoslynQuoter" target="_blank">https://github.com/KirillOsenkov/RoslynQuoter</a></p>
<div id="inputDiv">
<div>
<textarea id="inputBox" maxlength="2000" spellcheck="false">class C { }</textarea>
</div>
<div id="inputBox"></div>
<div>
<label>
Parse as:
<select id="nodeKind">
<option value="CompilationUnit">File</option>
<option value="CompilationUnit">Regular-File</option>
<option value="Script">Script-File</option>
<option value="MemberDeclaration">Member</option>
<option value="Statement">Statement</option>
<option value="Expression">Expression</option>
@ -56,6 +56,11 @@
<input id="avoidUsingStatic" type="checkbox" />&nbsp;Do not require 'using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;'
</label>
</div>
<div>
<label>
<input id="readyToRun" type="checkbox" />&nbsp;Ready-To-Run (with compilation and diagnostics)
</label>
</div>
<div>
<button id="submitButton" type="button" onclick="onSubmitClick();">Get Roslyn API calls to generate this code!</button> &nbsp;<span id="working" style="display: none">Working...</span>
</div>
@ -63,13 +68,12 @@
<button id="LINQPadButton" type="button" onclick="onSubmitLINQPad();">Get Roslyn API calls to generate this code as LINQPad file!</button>
</div>
</div>
<div id="outputDiv" xml:space="preserve">
CompilationUnit()
<div id="outputDiv"><div id="outputBox" xml:space="preserve">CompilationUnit()
.WithMembers(
SingletonList&lt;MemberDeclarationSyntax&gt;(
ClassDeclaration("C")))
.NormalizeWhitespace()
</div>
</div></div>
<a href="https://github.com/KirillOsenkov/RoslynQuoter" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>

Просмотреть файл

@ -1,16 +1,67 @@
function onPageLoad() {
var editor;
var resultDisplay;
function onPageLoad() {
ace.config.set('basePath', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/');
editor = ace.edit("inputBox");
editor.setTheme("ace/theme/textmate");
editor.setKeyboardHandler("ace/keyboard/vscode");
editor.session.setMode("ace/mode/csharp");
resultDisplay = ace.edit("outputBox",
{
minLines: 5,
maxLines: 500
});
resultDisplay.setReadOnly(true);
resultDisplay.setTheme("ace/theme/textmate");
resultDisplay.setKeyboardHandler("ace/keyboard/vscode");
resultDisplay.session.setMode("ace/mode/csharp");
}
function generateQuery() {
function generateArguments() {
var nodeKind = document.getElementById("nodeKind").value;
var openCurlyOnNewLine = getCheckboxValue("openCurlyOnNewLine");
var closeCurlyOnNewLine = getCheckboxValue("closeCurlyOnNewLine");
var preserveOriginalWhitespace = getCheckboxValue("preserveOriginalWhitespace");
var keepRedundantApiCalls = getCheckboxValue("keepRedundantApiCalls");
var avoidUsingStatic = getCheckboxValue("avoidUsingStatic");
var query = "api/quoter/?sourceText=" + encodeURIComponent(inputBox.value);
var readyToRun = getCheckboxValue("readyToRun");
var arguments = new Object();
arguments.sourceText = editor.getValue();
arguments.nodeKind = nodeKind;
query = query + "&nodeKind=" + nodeKind;
if (openCurlyOnNewLine) {
arguments.openCurlyOnNewLine = true;
}
if (closeCurlyOnNewLine) {
arguments.closeCurlyOnNewLine = true;
}
if (preserveOriginalWhitespace) {
arguments.preserveOriginalWhitespace = true;
}
if (keepRedundantApiCalls) {
arguments.keepRedundantApiCalls = true;
}
if (avoidUsingStatic) {
arguments.avoidUsingStatic = true;
}
if (readyToRun) {
arguments.readyToRun = true;
}
return arguments;
}
function generateLinqpadQuery(arguments) {
var query = "api/linqpad/?sourceText=" + encodeURIComponent(arguments.sourceText);
query = query + "&nodeKind=" + arguments.nodeKind;
if (openCurlyOnNewLine) {
query = query + "&openCurlyOnNewLine=true";
@ -35,16 +86,16 @@ function generateQuery() {
return query;
}
function onSubmitClick() {
var query = generateQuery();
getUrl(query, loadResults);
function onSubmitClick() {
var arguments = generateArguments();
getUrl(arguments, loadResults);
}
function onSubmitLINQPad() {
var query = generateQuery();
query = query + "&generateLINQPad=true";
var arguments = generateArguments();
var query = generateLinqpadQuery(arguments);
window.location = query;
}
@ -53,22 +104,24 @@ function getCheckboxValue(id) {
return document.getElementById(id).checked;
}
function getUrl(url, callback) {
function getUrl(requestArgument, callback) {
enableSubmit(false);
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.setRequestHeader("Accept", "text/html");
xhr.open("POST", "api/quoter", true);
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
var data = xhr.responseText;
if (typeof data === "string" && data.length > 0) {
data = JSON.parse(data);
callback(data);
}
}
enableSubmit(true);
};
xhr.send();
xhr.send(JSON.stringify(requestArgument));
return xhr;
}
@ -86,12 +139,12 @@ function enableSubmit(enabled) {
}
function setResult(data) {
var container = document.getElementById("outputDiv");
if (container) {
container.innerHTML = data;
}
resultDisplay.setValue(data);
}
function loadResults(data) {
setResult(data);
// The return value is XML encoded, decode special chars
var doc = new DOMParser().parseFromString(data, "text/html");
setResult(doc.documentElement.textContent);
}

Просмотреть файл

@ -24,9 +24,7 @@
#inputBox {
width: 100%;
height: 150px;
text-wrap: normal;
margin-bottom: 10px;
font-family: Consolas, 'Courier New', monospace;
}
#submitButton {
@ -34,9 +32,5 @@
}
#outputDiv {
height: 70%;
padding: 30px;
padding-top: 0px;
white-space: pre-wrap;
font-family: Consolas, 'Courier New', monospace;
padding: 30px 0;
}

Просмотреть файл

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
@ -44,17 +45,18 @@ namespace RoslynQuoter
public bool RemoveRedundantModifyingCalls { get; set; }
public bool ShortenCodeWithUsingStatic { get; set; }
private readonly ScriptOptions options = ScriptOptions.Default
.AddReferences(
typeof(SyntaxNode).Assembly,
typeof(CSharpSyntaxNode).Assembly)
.AddReferences("System.Runtime")
.AddImports(
"System",
"Microsoft.CodeAnalysis",
"Microsoft.CodeAnalysis.CSharp",
"Microsoft.CodeAnalysis.CSharp.Syntax",
"Microsoft.CodeAnalysis.CSharp.SyntaxFactory");
// Unused options
// private readonly ScriptOptions options = ScriptOptions.Default
// .AddReferences(
// typeof(SyntaxNode).Assembly,
// typeof(CSharpSyntaxNode).Assembly)
// .AddReferences("System.Runtime")
// .AddImports(
// "System",
// "Microsoft.CodeAnalysis",
// "Microsoft.CodeAnalysis.CSharp",
// "Microsoft.CodeAnalysis.CSharp.Syntax",
// "Microsoft.CodeAnalysis.CSharp.SyntaxFactory");
public Quoter()
{
@ -112,16 +114,21 @@ namespace RoslynQuoter
/// <param name="nodeKind">What kind of C# syntax node should the input be parsed as</param>
private static SyntaxNode Parse(string sourceText, NodeKind nodeKind)
{
var regularParseOptions = new CSharpParseOptions(LanguageVersion.Preview, kind: SourceCodeKind.Regular);
switch (nodeKind)
{
case NodeKind.Script:
return SyntaxFactory.ParseCompilationUnit(sourceText,
options: new CSharpParseOptions(LanguageVersion.Preview, kind: SourceCodeKind.Script));
case NodeKind.CompilationUnit:
return SyntaxFactory.ParseCompilationUnit(sourceText);
return SyntaxFactory.ParseCompilationUnit(sourceText,
options: regularParseOptions);
case NodeKind.MemberDeclaration:
return SyntaxFactory.ParseMemberDeclaration(sourceText);
return SyntaxFactory.ParseMemberDeclaration(sourceText, options: regularParseOptions);
case NodeKind.Statement:
return SyntaxFactory.ParseStatement(sourceText);
return SyntaxFactory.ParseStatement(sourceText, options: regularParseOptions);
case NodeKind.Expression:
return SyntaxFactory.ParseExpression(sourceText);
return SyntaxFactory.ParseExpression(sourceText, options: regularParseOptions);
default:
throw new InvalidOperationException();
}
@ -228,10 +235,12 @@ namespace RoslynQuoter
if (node is AccessorDeclarationSyntax ||
node is AssignmentExpressionSyntax ||
node is BinaryExpressionSyntax ||
node is BinaryPatternSyntax ||
node is ClassOrStructConstraintSyntax ||
node is CheckedExpressionSyntax ||
node is CheckedStatementSyntax ||
node is ConstructorInitializerSyntax ||
node is DocumentationCommentTriviaSyntax ||
node is GotoStatementSyntax ||
node is InitializerExpressionSyntax ||
node is LiteralExpressionSyntax ||
@ -239,7 +248,7 @@ namespace RoslynQuoter
node is OrderingSyntax ||
node is PostfixUnaryExpressionSyntax ||
node is PrefixUnaryExpressionSyntax ||
node is DocumentationCommentTriviaSyntax ||
node is RecordDeclarationSyntax ||
node is YieldStatementSyntax)
{
result.Add(new ApiCall("Kind", "SyntaxKind." + node.Kind().ToString()));
@ -384,23 +393,38 @@ namespace RoslynQuoter
return codeBlock;
}
private ApiCall QuoteToken(SyntaxToken value, string name)
private ApiCall QuoteToken(SyntaxToken token, string name)
{
if (value == default(SyntaxToken) || value.Kind() == SyntaxKind.None)
var tokenKind = token.Kind();
var tokenText = token.Text;
var tokenValueText = token.ValueText;
bool tokenIsMissing = token.IsMissing;
if (token == default || tokenKind == SyntaxKind.None)
{
return null;
}
var arguments = new List<object>();
string methodName = SyntaxFactoryMethod("Token");
bool verbatim =
value.Text.StartsWith("@") ||
value.Text.Contains("\r") ||
value.Text.Contains("\n");
string escapedTokenValueText = EscapeAndQuote(value.ToString(), verbatim);
object leading = GetLeadingTrivia(value);
object actualValue;
object trailing = GetTrailingTrivia(value);
bool verbatimText =
(tokenKind == SyntaxKind.StringLiteralToken ||
tokenKind == SyntaxKind.InterpolatedStringTextToken) &&
(tokenText.StartsWith("@") ||
tokenText.StartsWith("$@") ||
tokenText.Contains("\r") ||
tokenText.Contains("\n"));
bool verbatimLiteralText =
(tokenKind == SyntaxKind.StringLiteralToken ||
tokenKind == SyntaxKind.InterpolatedStringTextToken) &&
(tokenValueText.Contains("\r") ||
tokenValueText.Contains("\n"));
string escapedTokenText = EscapeAndQuote(tokenText, verbatimText);
string escapedTokenValueText = EscapeAndQuote(tokenValueText, verbatimLiteralText);
object leading = GetLeadingTrivia(token);
object trailing = GetTrailingTrivia(token);
if (leading != null || trailing != null)
{
@ -408,65 +432,71 @@ namespace RoslynQuoter
trailing = trailing ?? GetEmptyTrivia("TrailingTrivia");
}
if (value.Kind() == SyntaxKind.IdentifierToken && !value.IsMissing)
if (tokenKind == SyntaxKind.IdentifierToken && !tokenIsMissing)
{
methodName = SyntaxFactoryMethod("Identifier");
if (value.IsMissing)
{
methodName = SyntaxFactoryMethod("MissingToken");
}
if (value.IsMissing)
if (verbatimText)
{
actualValue = value.Kind();
leading = leading ?? GetEmptyTrivia("LeadingTrivia");
trailing = trailing ?? GetEmptyTrivia("TrailingTrivia");
arguments.Add(leading);
arguments.Add(tokenKind);
arguments.Add(escapedTokenText);
arguments.Add(escapedTokenValueText);
arguments.Add(trailing);
}
else if (SyntaxFacts.GetContextualKeywordKind(tokenValueText) is var contextualKeyWord
&& contextualKeyWord != SyntaxKind.None)
{
leading = leading ?? GetEmptyTrivia("LeadingTrivia");
trailing = trailing ?? GetEmptyTrivia("TrailingTrivia");
arguments.Add(leading);
arguments.Add(contextualKeyWord);
arguments.Add(escapedTokenText);
arguments.Add(escapedTokenValueText);
arguments.Add(trailing);
}
else
{
actualValue = escapedTokenValueText;
AddIfNotNull(arguments, leading);
arguments.Add(escapedTokenText);
AddIfNotNull(arguments, trailing);
}
AddIfNotNull(arguments, leading);
arguments.Add(actualValue);
AddIfNotNull(arguments, trailing);
}
else if (value.Kind() == SyntaxKind.InterpolatedStringTextToken && !value.IsMissing)
else if (tokenKind == SyntaxKind.InterpolatedStringTextToken && !tokenIsMissing)
{
leading = leading ?? GetEmptyTrivia("LeadingTrivia");
trailing = trailing ?? GetEmptyTrivia("TrailingTrivia");
AddIfNotNull(arguments, leading);
arguments.Add(value.Kind());
arguments.Add(escapedTokenValueText);
arguments.Add(tokenKind);
arguments.Add(escapedTokenText);
arguments.Add(escapedTokenValueText);
AddIfNotNull(arguments, trailing);
}
else if ((value.Kind() == SyntaxKind.XmlTextLiteralToken ||
value.Kind() == SyntaxKind.XmlTextLiteralNewLineToken ||
value.Kind() == SyntaxKind.XmlEntityLiteralToken) && !value.IsMissing)
else if ((tokenKind == SyntaxKind.XmlTextLiteralToken ||
tokenKind == SyntaxKind.XmlTextLiteralNewLineToken ||
tokenKind == SyntaxKind.XmlEntityLiteralToken) && !tokenIsMissing)
{
methodName = SyntaxFactoryMethod("XmlTextLiteral");
if (value.Kind() == SyntaxKind.XmlTextLiteralNewLineToken)
if (tokenKind == SyntaxKind.XmlTextLiteralNewLineToken)
{
methodName = SyntaxFactoryMethod("XmlTextNewLine");
}
else if (value.Kind() == SyntaxKind.XmlEntityLiteralToken)
else if (tokenKind == SyntaxKind.XmlEntityLiteralToken)
{
methodName = SyntaxFactoryMethod("XmlEntity");
}
arguments.Add(leading ?? GetEmptyTrivia("LeadingTrivia"));
arguments.Add(escapedTokenValueText);
arguments.Add(escapedTokenText);
arguments.Add(escapedTokenValueText);
arguments.Add(trailing ?? GetEmptyTrivia("TrailingTrivia"));
}
else if ((value.Parent is LiteralExpressionSyntax ||
value.Kind() == SyntaxKind.StringLiteralToken ||
value.Kind() == SyntaxKind.NumericLiteralToken) &&
value.Kind() != SyntaxKind.TrueKeyword &&
value.Kind() != SyntaxKind.FalseKeyword &&
value.Kind() != SyntaxKind.NullKeyword &&
value.Kind() != SyntaxKind.ArgListKeyword &&
value.Kind() != SyntaxKind.DefaultKeyword &&
!value.IsMissing)
else if ((tokenKind == SyntaxKind.CharacterLiteralToken ||
tokenKind == SyntaxKind.StringLiteralToken ||
tokenKind == SyntaxKind.NumericLiteralToken) && !tokenIsMissing)
{
methodName = SyntaxFactoryMethod("Literal");
bool shouldAddTrivia = leading != null || trailing != null;
@ -475,26 +505,38 @@ namespace RoslynQuoter
arguments.Add(leading ?? GetEmptyTrivia("LeadingTrivia"));
}
string escapedText = EscapeAndQuote(value.Text);
string escapedValue = EscapeAndQuote(value.ValueText);
bool needsFullOverload = shouldAddTrivia;
if (value.Kind() == SyntaxKind.CharacterLiteralToken)
string simpleOverloadText = tokenKind switch
{
escapedValue = EscapeAndQuote(value.ValueText, "'");
}
else if (value.Kind() != SyntaxKind.StringLiteralToken)
SyntaxKind.StringLiteralToken => SyntaxFactory.Literal((string)token.Value).ToString(),
SyntaxKind.CharacterLiteralToken => SyntaxFactory.Literal((char)token.Value).ToString(),
SyntaxKind.NumericLiteralToken => GetNumericLiteralText(token.Value),
_ => token.ToString()
};
if (token.ToString() != simpleOverloadText)
{
escapedValue = value.ValueText;
needsFullOverload = true;
}
if (shouldAddTrivia ||
(value.Kind() == SyntaxKind.StringLiteralToken &&
value.ToString() != Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal(value.ValueText).ToString()))
if (tokenKind == SyntaxKind.CharacterLiteralToken)
{
arguments.Add(escapedText);
escapedTokenValueText = EscapeAndQuote(tokenValueText, verbatim: false, "'");
}
else if (tokenKind == SyntaxKind.NumericLiteralToken)
{
escapedTokenValueText = tokenText;
}
arguments.Add(escapedValue);
if (needsFullOverload)
{
arguments.Add(escapedTokenText);
arguments.Add(escapedTokenValueText);
}
else
{
arguments.Add(tokenText);
}
if (shouldAddTrivia)
{
@ -503,23 +545,23 @@ namespace RoslynQuoter
}
else
{
if (value.IsMissing)
if (tokenIsMissing)
{
methodName = SyntaxFactoryMethod("MissingToken");
}
if (value.Kind() == SyntaxKind.BadToken)
if (tokenKind == SyntaxKind.BadToken)
{
methodName = SyntaxFactoryMethod("BadToken");
leading = leading ?? GetEmptyTrivia("LeadingTrivia");
trailing = trailing ?? GetEmptyTrivia("TrailingTrivia");
}
object tokenValue = value.Kind();
object tokenValue = tokenKind;
if (value.Kind() == SyntaxKind.BadToken)
if (tokenKind == SyntaxKind.BadToken)
{
tokenValue = escapedTokenValueText;
tokenValue = escapedTokenText;
}
AddIfNotNull(arguments, leading);
@ -530,6 +572,28 @@ namespace RoslynQuoter
return new ApiCall(name, methodName, arguments);
}
private static string GetNumericLiteralText(object value)
{
SyntaxToken token = value switch
{
int int32 => SyntaxFactory.Literal(int32),
uint uint32 => SyntaxFactory.Literal(uint32),
long int64 => SyntaxFactory.Literal(int64),
ulong uint64 => SyntaxFactory.Literal(uint64),
float single => SyntaxFactory.Literal(single),
double double8 => SyntaxFactory.Literal(double8),
decimal d => SyntaxFactory.Literal(d),
_ => default
};
if (token == default)
{
return null;
}
return token.ToString();
}
private static void AddIfNotNull(List<object> arguments, object value)
{
if (value != null)
@ -576,14 +640,14 @@ namespace RoslynQuoter
string factoryMethodName = SyntaxFactoryMethod("Trivia");
string text = syntaxTrivia.ToString();
if (syntaxTrivia.FullSpan.Length == 0 ||
(syntaxTrivia.Kind() == SyntaxKind.WhitespaceTrivia && UseDefaultFormatting))
(syntaxTrivia.IsKind(SyntaxKind.WhitespaceTrivia) && UseDefaultFormatting))
{
return null;
}
PropertyInfo triviaFactoryProperty = null;
if (triviaFactoryProperties.TryGetValue(syntaxTrivia.ToString(), out triviaFactoryProperty) &&
((SyntaxTrivia)triviaFactoryProperty.GetValue(null)).Kind() == syntaxTrivia.Kind())
((SyntaxTrivia)triviaFactoryProperty.GetValue(null)).IsKind(syntaxTrivia.Kind()))
{
if (UseDefaultFormatting)
{
@ -595,7 +659,7 @@ namespace RoslynQuoter
if (!string.IsNullOrEmpty(text) &&
string.IsNullOrWhiteSpace(text) &&
syntaxTrivia.Kind() == SyntaxKind.WhitespaceTrivia)
syntaxTrivia.IsKind(SyntaxKind.WhitespaceTrivia))
{
if (UseDefaultFormatting)
{
@ -605,23 +669,23 @@ namespace RoslynQuoter
factoryMethodName = SyntaxFactoryMethod("Whitespace");
}
if (syntaxTrivia.Kind() == SyntaxKind.SingleLineCommentTrivia ||
syntaxTrivia.Kind() == SyntaxKind.MultiLineCommentTrivia)
if (syntaxTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia) ||
syntaxTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia))
{
factoryMethodName = SyntaxFactoryMethod("Comment");
}
if (syntaxTrivia.Kind() == SyntaxKind.PreprocessingMessageTrivia)
if (syntaxTrivia.IsKind(SyntaxKind.PreprocessingMessageTrivia))
{
factoryMethodName = SyntaxFactoryMethod("PreprocessingMessage");
}
if (syntaxTrivia.Kind() == SyntaxKind.DisabledTextTrivia)
if (syntaxTrivia.IsKind(SyntaxKind.DisabledTextTrivia))
{
factoryMethodName = SyntaxFactoryMethod("DisabledText");
}
if (syntaxTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
if (syntaxTrivia.IsKind(SyntaxKind.DocumentationCommentExteriorTrivia))
{
factoryMethodName = SyntaxFactoryMethod("DocumentationCommentExterior");
}
@ -759,65 +823,40 @@ namespace RoslynQuoter
/// <summary>
/// Escapes strings to be included within "" using C# escaping rules
/// </summary>
public static string Escape(string text, bool escapeVerbatim = false)
public static string Escape(string text, bool escapeVerbatim = false, string quoteChar = "\"")
{
var sb = new StringBuilder();
for (int i = 0; i < text.Length; i++)
if (text.Length == 1 && quoteChar == "'")
{
string toAppend = text[i].ToString();
if (text[i] == '"')
{
if (escapeVerbatim)
{
toAppend = "\"\"";
}
else
{
toAppend = "\\\"";
}
}
else if (text[i] == '\\' && !escapeVerbatim)
{
toAppend = "\\\\";
}
sb.Append(toAppend);
var charLiteralToken = SyntaxFactory.Literal(text[0]);
var escapedChar = charLiteralToken.Text;
escapedChar = escapedChar.Substring(1, escapedChar.Length - 2);
return escapedChar;
}
return sb.ToString();
}
string escaped = text;
public static string EscapeAndQuote(string text, string quoteChar = "\"")
{
bool verbatim = text.Contains("\n") || text.Contains("\r");
return EscapeAndQuote(text, verbatim, quoteChar);
if (escapeVerbatim)
{
escaped = escaped.Replace("\"", "\"\"");
}
else
{
var literalToken = SyntaxFactory.Literal(escaped);
escaped = literalToken.Text;
escaped = escaped.Substring(1, escaped.Length - 2);
}
return escaped;
}
public static string ParseStringLiteral(string text)
{
bool verbatim = false;
if (text.StartsWith("@"))
{
text = text.Substring(1);
verbatim = true;
}
if (text.StartsWith("\"") && text.EndsWith("\""))
{
text = text.Substring(1, text.Length - 2);
}
text = Unescape(text, verbatim);
return text;
var token = SyntaxFactory.ParseToken(text);
return token.ValueText;
}
public static string Unescape(string text, bool verbatim)
{
if (text == "Environment.NewLine")
{
return Environment.NewLine;
}
if (verbatim)
{
return text.Replace("\"\"", "\"");
@ -878,12 +917,7 @@ namespace RoslynQuoter
return "Environment.NewLine";
}
if (text == "\n")
{
return "\"\\n\"";
}
text = Escape(text, verbatim);
text = Escape(text, verbatim, quoteChar);
text = SurroundWithQuotes(text, quoteChar);
if (verbatim)
{
@ -1047,6 +1081,13 @@ namespace RoslynQuoter
}
}
if (node is RecordDeclarationSyntax)
{
// for records, pick the overload that specifies the SyntaxKind,
// see https://github.com/KirillOsenkov/RoslynQuoter/issues/82
minParameterCount = 3;
}
MethodInfo factory = null;
if ((node is BaseTypeDeclarationSyntax ||
@ -1264,9 +1305,9 @@ namespace RoslynQuoter
return methodCall.Arguments.Select(a => InterpretApiCall((ApiCall)a)).ToArray();
}
if (instance is CompilationUnitSyntax compilationUnit && name == "NormalizeWhitespace")
if (instance is SyntaxNode n && name == "NormalizeWhitespace")
{
return compilationUnit.NormalizeWhitespace();
return n.NormalizeWhitespace();
}
string genericArgument;
@ -1283,7 +1324,9 @@ namespace RoslynQuoter
var (candidate, arguments) = PickCandidateMethod(name, methodCall.Arguments, candidates, genericArgumentType);
if (candidate == null)
{
throw new Exception("Can't pick a method to call for " + methodCall.Name);
throw new Exception(
$@"Can't pick a method to call for {methodCall.Name}.
If the first parameter is of type SyntaxKind, please add an exception for this node type in QuotePropertyValues().");
}
var node = candidate.Invoke(instance, arguments);
@ -1531,21 +1574,73 @@ namespace RoslynQuoter
}
else if (argument is string str)
{
var token = SyntaxFactory.ParseToken(str);
// WARNING: the order of these checks matters, because
// we're effectively emulating overload resolution here.
// We have a list of 9 overloads of SyntaxFactory.Literal()
// and we need to pick the right overload given the literal
// type.
if (parameterType == typeof(string))
{
return (ParseStringLiteral(str), true);
if (str == "null")
{
return (null, true);
}
if (str == "Environment.NewLine")
{
return (Environment.NewLine, true);
}
// a non-null string literal needs to contain the quote
if (!str.Contains("\""))
{
return (argument, false);
}
if (token.IsKind(SyntaxKind.StringLiteralToken) ||
token.IsKind(SyntaxKind.SingleLineRawStringLiteralToken) ||
token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken))
{
return (token.ValueText, true);
}
}
else if (parameterType == typeof(int) && int.TryParse(str, out int int32))
else if (
parameterType == typeof(int))
{
return (int32, true);
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is int)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(double) && double.TryParse(str, out double dbl))
else if (parameterType == typeof(double))
{
return (dbl, true);
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is double)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(char) && str.StartsWith("'") && str.EndsWith("'") && char.TryParse(str.Trim('\''), out char ch))
else if (parameterType == typeof(float))
{
return (ch, true);
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is float)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(decimal))
{
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is decimal)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(char))
{
if (token.IsKind(SyntaxKind.CharacterLiteralToken) && token.Value is char)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(bool))
{
@ -1558,6 +1653,27 @@ namespace RoslynQuoter
return (false, true);
}
}
else if (parameterType == typeof(uint))
{
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is uint)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(ulong))
{
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is ulong)
{
return (token.Value, true);
}
}
else if (parameterType == typeof(long))
{
if (token.IsKind(SyntaxKind.NumericLiteralToken) && token.Value is long)
{
return (token.Value, true);
}
}
}
else if (argument != null && parameterType.IsAssignableFrom(argument.GetType()))
{
@ -1774,35 +1890,38 @@ namespace RoslynQuoter
/// </summary>
private static readonly string[] nonStructuralProperties =
{
"AllowsAnyExpression",
"Arity",
"ContainsAnnotations",
"ContainsDiagnostics",
"ContainsDirectives",
"ContainsSkippedText",
"DirectiveNameToken",
"FullSpan",
"HasLeadingTrivia",
"HasTrailingTrivia",
"HasStructuredTrivia",
"HasStructure",
"IsConst",
"IsDirective",
"IsElastic",
"IsFixed",
"IsMissing",
"IsStructuredTrivia",
"IsUnboundGenericName",
"IsUnmanaged",
"IsVar",
"Kind",
"Language",
"Parent",
"ParentTrivia",
"PlainName",
"Span",
"SyntaxTree",
};
"AllowsAnyExpression",
"Arity",
"ContainsAnnotations",
"ContainsDiagnostics",
"ContainsDirectives",
"ContainsSkippedText",
"DirectiveNameToken",
"FullSpan",
"HasLeadingTrivia",
"HasStructure",
"HasStructuredTrivia",
"HasTrailingTrivia",
"IsConst",
"IsDirective",
"IsElastic",
"IsFixed",
"IsMissing",
"IsNint",
"IsNotNull",
"IsNuint",
"IsStructuredTrivia",
"IsUnboundGenericName",
"IsUnmanaged",
"IsVar",
"Kind",
"Language",
"Parent",
"ParentTrivia",
"PlainName",
"Span",
"SyntaxTree",
};
/// <summary>
/// "Stringly typed" representation of a C# property or method invocation expression, with a
@ -1921,6 +2040,7 @@ namespace RoslynQuoter
public enum NodeKind
{
CompilationUnit,
Script,
MemberDeclaration,
Statement,
Expression

Просмотреть файл

@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>RoslynQuoter</AssemblyName>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<DebugType>embedded</DebugType>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
@ -11,7 +13,7 @@
<PackageId>RoslynQuoter</PackageId>
<Authors>Kirill Osenkov</Authors>
<Company>Microsoft</Company>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Description>A Roslyn tool that for a given C# program shows the syntax factory API calls to construct its syntax tree.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/KirillOsenkov/RoslynQuoter</PackageProjectUrl>
@ -24,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.7.0" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

167
src/uno/.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,167 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
# This file is the top-most EditorConfig file
root = true
##########################################
# Common Settings
##########################################
[*]
indent_style = space
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
##########################################
# File Extension Settings
##########################################
[*.{yml,yaml}]
indent_size = 2
[.vsconfig]
indent_size = 2
end_of_line = lf
[*.sln]
indent_style = tab
indent_size = 2
[*.{csproj,proj,projitems,shproj}]
indent_size = 4
[*.{json,slnf}]
indent_size = 2
end_of_line = lf
[*.{props,targets}]
indent_size = 4
[*.xaml]
indent_size = 4
charset = utf-8-bom
[*.xml]
indent_size = 4
end_of_line = lf
[*.plist]
indent_size = 4
indent_style = tab
end_of_line = lf
[*.manifest]
indent_size = 4
[*.appxmanifest]
indent_size = 4
[*.{json,css,webmanifest}]
indent_size = 2
end_of_line = lf
[web.config]
indent_size = 4
end_of_line = lf
[*.sh]
indent_size = 2
end_of_line = lf
[*.cs]
# EOL should be normalized by Git. See https://github.com/dotnet/format/issues/1099
end_of_line = unset
# See https://github.com/dotnet/roslyn/issues/20356#issuecomment-310143926
trim_trailing_whitespace = false
tab_width = 4
indent_size = 4
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

405
src/uno/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,405 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
# Single Target Config
solution-config.props
# Publish Profiles
!**/Properties/PublishProfiles/*.pubxml

3
src/uno/.run/Readme.md Normal file
Просмотреть файл

@ -0,0 +1,3 @@
# About the `.run` folder
This folder is present to add support for the [Rider IDE](https://aka.platform.uno/rider-getstarted). You can remove this folder safely if you're not using Rider.

Просмотреть файл

@ -0,0 +1,62 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="RoslynQuoter (Desktop)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/RoslynQuoter/RoslynQuoter.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-desktop" />
<option name="LAUNCH_PROFILE_NAME" value="RoslynQuoter (Desktop)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="RoslynQuoter (WebAssembly IIS Express)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/RoslynQuoter/RoslynQuoter.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-browserwasm" />
<option name="LAUNCH_PROFILE_NAME" value="RoslynQuoter (WebAssembly IIS Express)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="RoslynQuoter (WebAssembly)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/RoslynQuoter/RoslynQuoter.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-browserwasm" />
<option name="LAUNCH_PROFILE_NAME" value="RoslynQuoter (WebAssembly)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration default="false" name="RoslynQuoter (WinAppSDK Unpackaged)" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/RoslynQuoter/RoslynQuoter.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0-windows10.0.26100.0" />
<option name="LAUNCH_PROFILE_NAME" value="RoslynQuoter (WinAppSDK Unpackaged)" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>

5
src/uno/.vscode/extensions.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,5 @@
{
"recommendations": [
"unoplatform.vscode"
],
}

56
src/uno/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,56 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": "Uno Platform Mobile Debug",
"type": "Uno",
"request": "launch",
// any Uno* task will do, this is simply to satisfy vscode requirement when a launch.json is present
"preLaunchTask": "Uno: android | Debug | android-x64"
},
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": "Uno Platform WebAssembly Debug (Chrome)",
"type": "chrome",
"request": "launch",
"url": "http://localhost:5000",
"webRoot": "${workspaceFolder}/RoslynQuoter",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"timeout": 30000,
"preLaunchTask": "build-wasm",
"server": {
"runtimeExecutable": "dotnet",
"program": "run",
"args": ["--no-build","-f","net8.0-browserwasm","--launch-profile", "RoslynQuoter (WebAssembly)"],
"outputCapture": "std",
"timeout": 30000,
"cwd": "${workspaceFolder}/RoslynQuoter"
}
},
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": "Uno Platform Desktop Debug",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-desktop",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/RoslynQuoter/bin/Debug/net8.0-desktop/RoslynQuoter.dll",
"args": [],
"launchSettingsProfile": "RoslynQuoter (Desktop)",
"env": {
"DOTNET_MODIFIABLE_ASSEMBLIES": "debug"
},
"cwd": "${workspaceFolder}/RoslynQuoter",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
]
}

10
src/uno/.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,10 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.xaml": "$(capture).xaml.cs"
},
"files.associations": {
"global.json": "jsonc"
}
}

57
src/uno/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,57 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build-wasm",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/RoslynQuoter/RoslynQuoter.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-browserwasm",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish-wasm",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/RoslynQuoter/RoslynQuoter.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-browserwasm",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build-desktop",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/RoslynQuoter/RoslynQuoter.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-desktop",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish-desktop",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/RoslynQuoter/RoslynQuoter.csproj",
"/property:GenerateFullPaths=true",
"/property:TargetFramework=net8.0-desktop",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

34
src/uno/.vsconfig Normal file
Просмотреть файл

@ -0,0 +1,34 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.NetCore.Component.SDK",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.NetCore.Component.Web",
"Microsoft.VisualStudio.Component.IISExpress",
"Component.Microsoft.Web.LibraryManager",
"Microsoft.VisualStudio.ComponentGroup.Web",
"Microsoft.VisualStudio.Component.Web",
"Microsoft.VisualStudio.ComponentGroup.Web.Client",
"Microsoft.VisualStudio.Workload.NetWeb",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Component.Xamarin.RemotedSimulator",
"Microsoft.VisualStudio.Component.MonoDebugger",
"Microsoft.VisualStudio.ComponentGroup.Maui.All",
"Component.Android.SDK34",
"Component.OpenJDK",
"Microsoft.VisualStudio.Workload.NetCrossPlat",
"Microsoft.VisualStudio.Workload.NetCoreTools"
],
"extensions": [
"https://marketplace.visualstudio.com/items?itemName=unoplatform.uno-platform-addin-2022"
]
}

Просмотреть файл

@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!--
Adding NoWarn to remove build warnings
NU1507: Warning when there are multiple package sources when using CPM with no source mapping
NETSDK1201: Warning that specifying RID won't create self containing app
PRI257: Ignore default language (en) not being one of the included resources (eg en-us, en-uk)
-->
<NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257</NoWarn>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,2 @@
<Project>
</Project>

Просмотреть файл

@ -1,8 +0,0 @@
<Application
x:Class="RoslynQuoter.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RoslynQuoter"
RequestedTheme="Light">
</Application>

Просмотреть файл

@ -1,106 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace RoslynQuoter
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
// this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Windows.UI.Xaml.Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Windows.UI.Xaml.Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Windows.UI.Xaml.Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Просмотреть файл

@ -1,88 +0,0 @@
<Page x:Class="RoslynQuoter.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:xamarin="http://uno/xamarin"
xmlns:wasm="http://uno/wasm"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RoslynQuoter"
xmlns:banner="using:Uno.UI.Sample.Banner"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="xamarin wasm">
<banner:BannerControl
LinkToUnoPlatformApp="https://github.com/nventive/Uno.RoslynQuoter"
LinkToOriginalApp="https://github.com/KirillOsenkov/RoslynQuoter"
AppName="Roslyn Quoter"
AppAuthor="Kirill Osenkov">
<banner:BannerControl.AboutContent>
This application is running the Roslyn Quoter tool locally on your machine.
</banner:BannerControl.AboutContent>
<Grid>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<TextBox AcceptsReturn="true"
Grid.Row="1"
ScrollViewer.VerticalScrollBarVisibility="Auto"
x:Name="inputCode"
FontFamily="Courier New"
PlaceholderText="Input some C# code"
TextChanged="OnCodeChanged"
Margin="0,0,10,10" />
<StackPanel Grid.Row="2">
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="Generate"
Click="OnGenerateCode"
HorizontalAlignment="Left"
Margin="0,0,0,0"
VerticalAlignment="Center" />
<Button Content="Generate LINQPad File"
Click="OnGenerateLinqPadCode"
HorizontalAlignment="Left"
Margin="0,0,0,0"
VerticalAlignment="Center" />
</StackPanel>
<ComboBox x:Name="comboParseAs"
Header="Parse as:">
</ComboBox>
<CheckBox x:Name="checkBoxOpenParenthesis"
Content="Open parenthesis on a new line" />
<CheckBox x:Name="checkBoxCloseParenthesis"
Content="Closing parenthesis on a new line " />
<CheckBox x:Name="checkBoxPreserveWhiteSpace"
Content="Preserve original whitespace " />
<CheckBox x:Name="checkBoxKeepRedundant"
Content="Keep redundant API calls " />
<CheckBox x:Name="checkBoxNoSyntaxFactory"
Content="Do not require 'using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;' " />
</StackPanel>
<TextBox x:Name="result"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="3"
AcceptsReturn="True"
FontFamily="Courier New"
Grid.ColumnSpan="2" />
</Grid>
<Image Source="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"
Stretch="None"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Tapped="OnForkMe" />
</Grid>
</banner:BannerControl>
</Page>

Просмотреть файл

@ -1,206 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace RoslynQuoter
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
private const string SDKResourcePrefix = "mono_sdk";
private readonly NodeKind[] _kinds;
public MainPage()
{
this.InitializeComponent();
_kinds = new[] {
NodeKind.CompilationUnit,
NodeKind.Statement,
NodeKind.Expression
};
comboParseAs.ItemsSource = _kinds;
comboParseAs.SelectedIndex = 0;
}
private void OnCodeChanged(object sender, TextChangedEventArgs e)
{
}
private void OnGenerateCode(object sender, RoutedEventArgs e)
{
result.Text = GenerateCode();
}
private async void OnGenerateLinqPadCode(object sender, RoutedEventArgs e)
{
var linqpadFile = $@"<Query Kind=""Expression"">
<NuGetReference>Microsoft.CodeAnalysis.Compilers</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference>
<Namespace>static Microsoft.CodeAnalysis.CSharp.SyntaxFactory</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp.Syntax</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp</Namespace>
<Namespace>Microsoft.CodeAnalysis</Namespace>
</Query>
{GenerateCode()}
";
#if !__WASM__
try
{
var savePicker = new Windows.Storage.Pickers.FileSavePicker();
savePicker.SuggestedStartLocation =
Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
savePicker.FileTypeChoices.Add("LINQPad File", new List<string>() { ".linq" });
savePicker.SuggestedFileName = "Quoter";
Windows.Storage.StorageFile file = await savePicker.PickSaveFileAsync();
// Prevent updates to the remote version of the file until
// we finish making changes and call CompleteUpdatesAsync.
Windows.Storage.CachedFileManager.DeferUpdates(file);
// write to file
await Windows.Storage.FileIO.WriteTextAsync(file, linqpadFile);
// Let Windows know that we're finished changing the file so
// the other app can update the remote version of the file.
// Completing updates may require Windows to ask for user input.
Windows.Storage.Provider.FileUpdateStatus status =
await Windows.Storage.CachedFileManager.CompleteUpdatesAsync(file);
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
#else
SaveFileAs("Quoter.linq", linqpadFile);
#endif
}
#if __WASM__
private static void SaveFileAs(string fileName, string content)
{
var data = Encoding.UTF8.GetBytes(content);
GCHandle gch = GCHandle.Alloc(data, GCHandleType.Pinned);
var pinnedData = gch.AddrOfPinnedObject();
try
{
Console.WriteLine("Invoking saveAs...");
Uno.Foundation.WebAssemblyRuntime.InvokeJS($@"fileSaveAs('{fileName}', {pinnedData}, {data.Length})");
}
finally
{
gch.Free();
}
}
#endif
private string GenerateCode()
{
string responseText = "";
try
{
string sourceText = inputCode.Text;
var nodeKind = _kinds[comboParseAs.SelectedIndex];
bool openCurlyOnNewLine = checkBoxOpenParenthesis.IsChecked ?? false;
bool closeCurlyOnNewLine = checkBoxCloseParenthesis.IsChecked ?? false;
bool preserveOriginalWhitespace = checkBoxPreserveWhiteSpace.IsChecked ?? false;
bool keepRedundantApiCalls = checkBoxKeepRedundant.IsChecked ?? false;
bool avoidUsingStatic = checkBoxNoSyntaxFactory.IsChecked ?? false;
if (string.IsNullOrEmpty(sourceText))
{
responseText = "Please specify the source text.";
}
else
{
ExtractSDK();
var quoter = new Quoter
{
OpenParenthesisOnNewLine = openCurlyOnNewLine,
ClosingParenthesisOnNewLine = closeCurlyOnNewLine,
UseDefaultFormatting = !preserveOriginalWhitespace,
RemoveRedundantModifyingCalls = !keepRedundantApiCalls,
ShortenCodeWithUsingStatic = !avoidUsingStatic
};
responseText = quoter.QuoteText(sourceText, nodeKind);
}
}
catch (Exception ex)
{
responseText = "Congratulations! You've found a bug in Quoter! Please open an issue " +
"at https://github.com/KirillOsenkov/RoslynQuoter/issues/new and " +
"paste the code you've typed above and this stack:";
responseText += ex.ToString();
}
return responseText;
}
[Conditional("__WASM__")]
private void ExtractSDK()
{
var sdkFiles = this.GetType().Assembly.GetManifestResourceNames().Where(f => f.Contains(SDKResourcePrefix));
foreach(var sdkFile in sdkFiles)
{
var fileNameStart = sdkFile.IndexOf(SDKResourcePrefix) + (SDKResourcePrefix + ".").Length;
var outputFile = sdkFile.Substring(fileNameStart);
if (!File.Exists(outputFile))
{
using (var s = this.GetType().Assembly.GetManifestResourceStream(sdkFile))
{
Console.WriteLine($"Writing {outputFile}");
using (var output = File.OpenWrite(outputFile))
{
s.CopyTo(output);
}
}
}
}
}
private async void OnForkMe(object sender, TappedRoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("https://github.com/nventive/Uno.RoslynQuoter"));
}
}
}

Просмотреть файл

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>6279c845-92f8-4333-ab99-3d213163593c</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>RoslynQuoter.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Include="$(MSBuildThisFileDirectory)App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UnoPlatformShell.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="$(MSBuildThisFileDirectory)MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UnoPlatformShell.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Assets\GithubLogo.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\lockscreenlogo.scale-200.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\SplashScreen.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\square150x150logo.scale-200.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\square44x44logo.scale-200.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\square44x44logo.targetsize-24_altform-unplated.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\storelogo.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\TwitterLogo.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\UnoLogo.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\UnoLogo_small.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\wide310x150logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<PRIResource Include="$(MSBuildThisFileDirectory)Strings\en\Resources.resw" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>6279c845-92f8-4333-ab99-3d213163593c</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="RoslynQuoter.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,184 +0,0 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace RoslynQuoter
{
public partial class UnoPlatformShell : Control
{
private Button _UnoButton;
private Button _appButton;
private Button _authorButton;
private Button _TwitterButton;
private Button _GithubButton;
private Button _openAboutButton;
private Button _closeAboutButton;
private Button _softDismissAboutButton;
private Button _visitUnoWebsiteButton;
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
_UnoButton = GetTemplateChild("UnoButton") as Button;
_UnoButton.Click += openUnoWebsite;
_appButton = GetTemplateChild("appButton") as Button;
_appButton.Click += openOriginalGitHubProject;
_authorButton = GetTemplateChild("authorButton") as Button;
_authorButton.Click += openAuthorGitHubProfile;
_TwitterButton = GetTemplateChild("TwitterButton") as Button;
_TwitterButton.Click += openTwitterLink;
_GithubButton = GetTemplateChild("GithubButton") as Button;
_GithubButton.Click += openUnoGitHubProject;
_openAboutButton = GetTemplateChild("openAboutButton") as Button;
_openAboutButton.Click += showAbout;
_closeAboutButton = GetTemplateChild("closeAboutButton") as Button;
_closeAboutButton.Click += hideAbout;
_softDismissAboutButton = GetTemplateChild("softDismissAboutButton") as Button;
_softDismissAboutButton.Click += hideAbout;
_visitUnoWebsiteButton = GetTemplateChild("visitUnoWebsiteButton") as Button;
_visitUnoWebsiteButton.Click += openUnoWebsite;
}
// openOriginalGitHubProject
private async void openOriginalGitHubProject(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(LinkToOriginalApp));
}
// openUnoGitHubProject
private async void openUnoGitHubProject(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(LinkToUnoPlatformApp));
}
// openAuthorGitHubProfile
private async void openAuthorGitHubProfile(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(LinkToAppAuthor));
}
// openTwitterLink
private async void openTwitterLink(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("https://twitter.com/UnoPlatform"));
}
// showAbout
private void showAbout(object sender, RoutedEventArgs e)
{
AboutVisibility = Visibility.Visible;
}
// hideAbout
private void hideAbout(object sender, RoutedEventArgs e)
{
AboutVisibility = Visibility.Collapsed;
}
// openUnoWebsite
private async void openUnoWebsite(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("https://platform.uno"));
}
// App Name
public string AppName
{
get { return (string)GetValue(AppNameProperty); }
set { SetValue(AppNameProperty, value); }
}
public static readonly DependencyProperty AppNameProperty =
DependencyProperty.Register("AppName", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// App Author
public string AppAuthor
{
get { return (string)GetValue(AppAuthorProperty); }
set { SetValue(AppAuthorProperty, value); }
}
public static readonly DependencyProperty AppAuthorProperty =
DependencyProperty.Register("AppAuthor", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// Link to Original App
public string LinkToOriginalApp
{
get { return (string)GetValue(LinkToOriginalAppProperty); }
set { SetValue(LinkToOriginalAppProperty, value); }
}
public static readonly DependencyProperty LinkToOriginalAppProperty =
DependencyProperty.Register("LinkToOriginalApp", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// Link to Original App
public string LinkToAppAuthor
{
get { return (string)GetValue(LinkToAppAuthorProperty); }
set { SetValue(LinkToAppAuthorProperty, value); }
}
public static readonly DependencyProperty LinkToAppAuthorProperty =
DependencyProperty.Register("LinkToAppAuthor", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// Link to Uno Platforml App
public string LinkToUnoPlatformApp
{
get { return (string)GetValue(LinkToUnoPlatformAppProperty); }
set { SetValue(LinkToUnoPlatformAppProperty, value); }
}
public static readonly DependencyProperty LinkToUnoPlatformAppProperty =
DependencyProperty.Register("LinkToUnoPlatformApp", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// VersionNumber
public string VersionNumber
{
get { return (string)GetValue(VersionNumberProperty); }
set { SetValue(VersionNumberProperty, value); }
}
public static readonly DependencyProperty VersionNumberProperty =
DependencyProperty.Register("VersionNumber", typeof(string), typeof(UnoPlatformShell), new PropertyMetadata(null));
// About Content
public object AboutContent
{
get { return (object)GetValue(AboutContentProperty); }
set { SetValue(AboutContentProperty, value); }
}
public static readonly DependencyProperty AboutContentProperty =
DependencyProperty.Register("AboutContent", typeof(object), typeof(UnoPlatformShell), new PropertyMetadata(null));
// App Content
public object AppContent
{
get { return (object)GetValue(AppContentProperty); }
set { SetValue(AppContentProperty, value); }
}
public static readonly DependencyProperty AppContentProperty =
DependencyProperty.Register("AppContent", typeof(object), typeof(UnoPlatformShell), new PropertyMetadata(null));
// AboutIsVisible
public Visibility AboutVisibility
{
get { return (Visibility)GetValue(AboutVisibilityProperty); }
set { SetValue(AboutVisibilityProperty, value); }
}
public static readonly DependencyProperty AboutVisibilityProperty =
DependencyProperty.Register("AboutVisibility", typeof(Visibility), typeof(UnoPlatformShell), new PropertyMetadata(Visibility.Collapsed));
}
}

Просмотреть файл

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="20f64aa7-d240-49d8-bc35-578e322c7279" Publisher="CN=com.example" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="1897f84c-689e-44d3-a8b7-c521a62818ae" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>RoslynQuoter</DisplayName>
<PublisherDisplayName>RoslynQuoter</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="RoslynQuoter.exe" EntryPoint="UnoQuickStart.App">
<uap:VisualElements DisplayName="RoslynQuoter" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="RoslynQuoter" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#242424" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

Просмотреть файл

@ -1,29 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnoQuickStart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnoQuickStart")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Просмотреть файл

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.2</Version>
</PackageReference>
<PackageReference Include="Uno.UI.Sample.Banner">
<Version>1.44.0-dev.23</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{20F64AA7-D240-49D8-BC35-578E322C7279}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RoslynQuoter</RootNamespace>
<AssemblyName>RoslynQuoter</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>RoslynQuoter.Uwp_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<ProjectReference Include="..\..\Quoter\Quoter.csproj">
<Project>{927ab47f-479c-423a-b21f-5dec48533e1d}</Project>
<Name>Quoter</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="RoslynQuoter.UWP_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
</ItemGroup>
<Import Project="..\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems" Label="Shared" Condition="Exists('..\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems')" />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1,19 +0,0 @@
<linker>
<assembly fullname="Microsoft.CodeAnalysis"/>
<assembly fullname="Microsoft.CodeAnalysis.CSharp"/>
<assembly fullname="System.ComponentModel.Composition"/>
<assembly fullname="Microsoft.CodeAnalysis.Scripting"/>
<assembly fullname="mscorlib"/>
<assembly fullname="System"/>
<assembly fullname="System.Runtime"/>
<assembly fullname="System.Runtime.Extensions"/>
<assembly fullname="System.Collections"/>
<assembly fullname="System.Core"/>
<assembly fullname="Uno.UI"/>
<assembly fullname="WebAssembly.Bindings" />
<assembly fullname="System.Core">
<!-- This is required by JSon.NET and any expression.Compile caller -->
<type fullname="System.Linq.Expressions*" />
</assembly>
</linker>

Просмотреть файл

@ -1,15 +0,0 @@
using System;
using Windows.UI.Xaml;
namespace RoslynQuoter.Wasm
{
public class Program
{
private static App _app;
static void Main(string[] args)
{
Application.Start(_ => _app = new App());
}
}
}

Просмотреть файл

@ -1,27 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61100/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"RoslynQuoter.Wasm": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:61101/"
}
}
}

Просмотреть файл

@ -1,45 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<UseAOT Condition="$([MSBuild]::IsOsPlatform('Linux')) or ( $([MSBuild]::IsOsPlatform('Windows')) and '$(SkipWasmBuild)'=='' )">true</UseAOT>
<WasmShellMonoRuntimeExecutionMode Condition="'$(UseAOT)'!=''">InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode>
<!--<WasmShellEnableEmccProfiling>true</WasmShellEnableEmccProfiling>-->
<!--<WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile>-->
</PropertyGroup>
<ItemGroup Condition="'$(UseAOT)'!=''">
<WasmShellEnableAotProfile Include="aot-full.profile" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\*.js" />
<EmbeddedResource Include="mono-sdk\*.dll" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="3.0.0-dev.135" />
<PackageReference Include="Uno.UI.Sample.Banner" Version="1.44.0-dev.23" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.3.0-dev.12" />
<PackageReference Include="Uno.Wasm.Bootstrap.Devserver" Version="1.3.0-dev.12" />
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="2.8.3" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="2.8.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Quoter\Quoter.csproj" />
</ItemGroup>
<Import Project="..\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems" Label="Shared" Condition="Exists('..\RoslynQuoter.Shared\RoslynQuoter.Shared.projitems')" />
</Project>

Просмотреть файл

@ -1,4 +0,0 @@
@font-face {
font-family: "Symbols";
src: url("Fonts/winjs-symbols.woff2") format('woff');
}

Просмотреть файл

@ -1,7 +0,0 @@
var UnoAppManifest = {
splashScreenImage: "Assets/SplashScreen.png",
splashScreenColor: "#242424",
displayName: "Roslyn Quoter"
}

Просмотреть файл

@ -1,21 +0,0 @@

function fileSaveAs(fileName, dataPtr, size) {
var buffer = new Uint8Array(size); // data length
for (var i = 0; i < size; i++) {
buffer[i] = Module.getValue(dataPtr + i, "i8");
}
var a = window.document.createElement('a');
var blob = new Blob([buffer]);
a.href = window.URL.createObjectURL(blob);
a.download = fileName;
// Append anchor to body.
document.body.appendChild(a);
a.click();
// Remove anchor from body
document.body.removeChild(a);
}

Двоичные данные
src/uno/RoslynQuoter.Wasm/aot-full.profile

Двоичный файл не отображается.

Двоичные данные
src/uno/RoslynQuoter.Wasm/mono-sdk/I18N.CJK.dll

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичные данные
src/uno/RoslynQuoter.Wasm/mono-sdk/I18N.Rare.dll

Двоичный файл не отображается.

Двоичные данные
src/uno/RoslynQuoter.Wasm/mono-sdk/I18N.West.dll

Двоичный файл не отображается.

Двоичные данные
src/uno/RoslynQuoter.Wasm/mono-sdk/I18N.dll

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше