Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,11 @@ MigrationBackup/
lib/

out/
node_modules/
.vscode-test/
*.vsix

.idea/

**/wwwroot/js/**/*.js

nupkg/
Expand All @@ -368,4 +369,6 @@ temp/

**/RunOnBuild/Client/models/

**/VSCodeExtension/server/

**/CSharpToTypeScript.Blazor/wwwroot/dist/
94 changes: 94 additions & 0 deletions CSharpToTypeScript.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Core", "src\CSharpToTypeScript.Core\CSharpToTypeScript.Core.csproj", "{264FD6CF-F507-4C4B-A9C5-61B187AFFB4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Blazor", "src\CSharpToTypeScript.Blazor\CSharpToTypeScript.Blazor.csproj", "{DB70529D-FB49-493C-91A8-99ED04BAE641}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.CLITool", "src\CSharpToTypeScript.CLITool\CSharpToTypeScript.CLITool.csproj", "{F113BC43-BAF3-482F-BBC8-5B65CEB72CF3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Web", "src\CSharpToTypeScript.Web\CSharpToTypeScript.Web.csproj", "{A02C0A8F-57B3-43FB-B053-58169447EFB4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{6DABF802-E441-4F98-8005-2352708DDEF3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Blazor.Tests", "test\CSharpToTypeScript.Blazor.Tests\CSharpToTypeScript.Blazor.Tests.csproj", "{CE274DB6-45AC-411F-AD8D-15592793B855}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.CLITool.Tests", "test\CSharpToTypeScript.CLITool.Tests\CSharpToTypeScript.CLITool.Tests.csproj", "{4A167344-ED65-43A3-8F50-A929154CA1DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Core.Tests", "test\CSharpToTypeScript.Core.Tests\CSharpToTypeScript.Core.Tests.csproj", "{37A29A59-DEE9-475A-9AD5-F6040CED5D1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Web.Tests", "test\CSharpToTypeScript.Web.Tests\CSharpToTypeScript.Web.Tests.csproj", "{450916C6-B398-4709-97E4-7F3F4C178BDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunOnBuild", "samples\RunOnBuild\RunOnBuild.csproj", "{305AFB70-C404-41F1-8706-D9E32BC95A5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.VSCodeExtension.Tests", "test\CSharpToTypeScript.VSCodeExtension.Server.Tests\CSharpToTypeScript.VSCodeExtension.Tests.csproj", "{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VSCodeExtension", "VSCodeExtension", "{229B2ED0-5BC5-4450-8CFA-B498E5B04A0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.Server", "src\CSharpToTypeScript.VSCodeExtension\CSharpToTypeScript.Server\CSharpToTypeScript.Server.csproj", "{5497320E-B39E-412C-A0B1-BC3565FB58F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpToTypeScript.VSCodeExtension", "src\CSharpToTypeScript.VSCodeExtension\VSCodeExtension\CSharpToTypeScript.VSCodeExtension.esproj", "{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6}"
EndProject
Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DB70529D-FB49-493C-91A8-99ED04BAE641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB70529D-FB49-493C-91A8-99ED04BAE641}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB70529D-FB49-493C-91A8-99ED04BAE641}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB70529D-FB49-493C-91A8-99ED04BAE641}.Release|Any CPU.Build.0 = Release|Any CPU
{F113BC43-BAF3-482F-BBC8-5B65CEB72CF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F113BC43-BAF3-482F-BBC8-5B65CEB72CF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F113BC43-BAF3-482F-BBC8-5B65CEB72CF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F113BC43-BAF3-482F-BBC8-5B65CEB72CF3}.Release|Any CPU.Build.0 = Release|Any CPU
{264FD6CF-F507-4C4B-A9C5-61B187AFFB4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{264FD6CF-F507-4C4B-A9C5-61B187AFFB4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{264FD6CF-F507-4C4B-A9C5-61B187AFFB4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{264FD6CF-F507-4C4B-A9C5-61B187AFFB4A}.Release|Any CPU.Build.0 = Release|Any CPU
{A02C0A8F-57B3-43FB-B053-58169447EFB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A02C0A8F-57B3-43FB-B053-58169447EFB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A02C0A8F-57B3-43FB-B053-58169447EFB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A02C0A8F-57B3-43FB-B053-58169447EFB4}.Release|Any CPU.Build.0 = Release|Any CPU
{CE274DB6-45AC-411F-AD8D-15592793B855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE274DB6-45AC-411F-AD8D-15592793B855}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE274DB6-45AC-411F-AD8D-15592793B855}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE274DB6-45AC-411F-AD8D-15592793B855}.Release|Any CPU.Build.0 = Release|Any CPU
{4A167344-ED65-43A3-8F50-A929154CA1DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A167344-ED65-43A3-8F50-A929154CA1DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A167344-ED65-43A3-8F50-A929154CA1DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A167344-ED65-43A3-8F50-A929154CA1DB}.Release|Any CPU.Build.0 = Release|Any CPU
{37A29A59-DEE9-475A-9AD5-F6040CED5D1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37A29A59-DEE9-475A-9AD5-F6040CED5D1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37A29A59-DEE9-475A-9AD5-F6040CED5D1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37A29A59-DEE9-475A-9AD5-F6040CED5D1B}.Release|Any CPU.Build.0 = Release|Any CPU
{450916C6-B398-4709-97E4-7F3F4C178BDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{450916C6-B398-4709-97E4-7F3F4C178BDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{450916C6-B398-4709-97E4-7F3F4C178BDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{450916C6-B398-4709-97E4-7F3F4C178BDA}.Release|Any CPU.Build.0 = Release|Any CPU
{305AFB70-C404-41F1-8706-D9E32BC95A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{305AFB70-C404-41F1-8706-D9E32BC95A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{305AFB70-C404-41F1-8706-D9E32BC95A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{305AFB70-C404-41F1-8706-D9E32BC95A5D}.Release|Any CPU.Build.0 = Release|Any CPU
{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC}.Release|Any CPU.Build.0 = Release|Any CPU
{5497320E-B39E-412C-A0B1-BC3565FB58F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5497320E-B39E-412C-A0B1-BC3565FB58F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5497320E-B39E-412C-A0B1-BC3565FB58F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5497320E-B39E-412C-A0B1-BC3565FB58F4}.Release|Any CPU.Build.0 = Release|Any CPU
{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CE274DB6-45AC-411F-AD8D-15592793B855} = {6DABF802-E441-4F98-8005-2352708DDEF3}
{4A167344-ED65-43A3-8F50-A929154CA1DB} = {6DABF802-E441-4F98-8005-2352708DDEF3}
{37A29A59-DEE9-475A-9AD5-F6040CED5D1B} = {6DABF802-E441-4F98-8005-2352708DDEF3}
{450916C6-B398-4709-97E4-7F3F4C178BDA} = {6DABF802-E441-4F98-8005-2352708DDEF3}
{11BA1E9E-A7C5-4ACF-A0BF-201B45F4F5CC} = {6DABF802-E441-4F98-8005-2352708DDEF3}
{5497320E-B39E-412C-A0B1-BC3565FB58F4} = {229B2ED0-5BC5-4450-8CFA-B498E5B04A0C}
{5ED3BDC2-2BC3-44D1-B608-C9BD246D34B6} = {229B2ED0-5BC5-4450-8CFA-B498E5B04A0C}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions samples/RunOnBuild/DTOs/Item.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace MyProject.DTOs
{
Expand All @@ -22,7 +22,7 @@ public class Item : BaseItem
[JsonIgnore]
public string IgnoreMe { get; set; }

[JsonProperty("new_name")]
[JsonPropertyName("new_name")]
public string RenameMe { get; set; }
}

Expand Down
3 changes: 2 additions & 1 deletion samples/RunOnBuild/RunOnBuild.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
24 changes: 13 additions & 11 deletions src/CSharpToTypeScript.Blazor/CSharpToTypeScript.Blazor.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net6.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview2.20160.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview2.20160.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview2.20160.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.7" PrivateAssets="all" />
<PackageReference Include="morelinq" Version="3.3.2" />
</ItemGroup>

<!-- When publishing, swap service-worker.published.js in place of service-worker.js -->
<ItemGroup Condition="'$(DesignTimeBuild)' != 'true'">
<Content Remove="wwwroot\service-worker.js" />
<Content Update="wwwroot\service-worker.published.js" Link="wwwroot\service-worker.js" />
<!-- &lt;!&ndash; When publishing, swap service-worker.published.js in place of service-worker.js &ndash;&gt;-->
<!-- <ItemGroup Condition="'$(DesignTimeBuild)' != 'true'">-->
<!-- <Content Remove="wwwroot\service-worker.js" />-->
<!-- <Content Update="wwwroot\service-worker.published.js" Link="wwwroot\service-worker.js" />-->
<!-- </ItemGroup>-->

<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CSharpToTypeScript.Blazor/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class Constants
("Azure", "https://csharptotypescript.azurewebsites.net")
};

public static IReadOnlyList<(string DisplayName, string Name)> Themes = new List<(string, string)>
public static readonly IReadOnlyList<(string DisplayName, string Name)> Themes = new List<(string, string)>
{
("Visual Studio Dark", "vs-dark"),
("Oceanic Next", "oceanic-next"),
Expand Down
2 changes: 1 addition & 1 deletion src/CSharpToTypeScript.Blazor/Models/SettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public SettingsModel Clone()
=> (SettingsModel)MemberwiseClone();

public CodeConversionOptions MapToCodeConversionOptions()
=> new CodeConversionOptions(Export, UseTabs, TabSize, ConvertDatesTo, ConvertNullablesTo, ToCamelCase, RemoveInterfacePrefix,
=> new(Export, UseTabs, TabSize, ConvertDatesTo, ConvertNullablesTo, ToCamelCase, RemoveInterfacePrefix,
GenerateImports ? ImportGenerationMode.Simple : ImportGenerationMode.None,
UseKebabCase, AppendModelSuffix, QuotationMark, AppendNewLine, StringEnums, EnumStringToCamelCase, OutputType);

Expand Down
2 changes: 1 addition & 1 deletion src/CSharpToTypeScript.Blazor/Pages/Index.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private async Task OnSetRandomThemeClick()

var steps = new Random().Next(1, Constants.Themes.Count);

for (int i = 0; i < steps; i++)
for (var i = 0; i < steps; i++)
{
if (i != 0)
{
Expand Down
29 changes: 12 additions & 17 deletions src/CSharpToTypeScript.Blazor/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System;
using System.Net.Http;
using CSharpToTypeScript.Core.DependencyInjection;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
using CSharpToTypeScript.Blazor.Pages;

namespace CSharpToTypeScript.Blazor
{
public static class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
var builder = WebAssemblyHostBuilder.CreateDefault(args);

builder.RootComponents.Add<CSharpToTypeScript.Blazor.Pages.Index>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.RootComponents.Add<Index>("app");
builder.Services.AddCSharpToTypeScript();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

builder.Services.AddCSharpToTypeScript();
builder.Services.AddBaseAddressHttpClient();
var app = builder.Build();

await builder.Build().RunAsync();
}
}
}
await app.RunAsync();
7 changes: 5 additions & 2 deletions src/CSharpToTypeScript.Blazor/Scripts/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ import { themes, visualStudioDarkBackgroundColor } from './themes';
?.data.colors['editor.background'] ?? visualStudioDarkBackgroundColor;
}

window.addEventListener('resize', () => {
window.addEventListener('resize', resize);
resize();

function resize() {
const dimensions = {
width: window.innerWidth / 2,
height: Math.max(window.innerHeight - navbar.offsetHeight, 100)
};

inputEditor.layout(dimensions);
outputEditor.layout(dimensions);
});
}
}
Loading