Browse Source

Migration to .NET 6 (#791)

* Migration to .NET 6

* Get telemetry back.

* Fix with code files.

* More asserts.

* Fixed asset and added logging.

* Use configuration.

* Fix wait variable.

* A little bit of cleanup.

* Another fix.

* Fix server URL.
pull/797/head
Sebastian Stehle 4 years ago
committed by GitHub
parent
commit
78c9de7bbf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 224
      .drone.yml
  2. 2
      .github/workflows/dev.yml
  3. 2
      .github/workflows/release.yml
  4. 4
      Dockerfile
  5. 1
      backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs
  6. 1
      backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs
  7. 1
      backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverSeverityLogAppender.cs
  8. 3
      backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs
  9. 1
      backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs
  10. 2
      backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs
  11. 2
      backend/extensions/Squidex.Extensions/Actions/ClientPool.cs
  12. 2
      backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs
  13. 3
      backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs
  14. 1
      backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs
  15. 4
      backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs
  16. 1
      backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs
  17. 3
      backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs
  18. 2
      backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs
  19. 4
      backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs
  20. 6
      backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs
  21. 5
      backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs
  22. 4
      backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs
  23. 3
      backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs
  24. 3
      backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs
  25. 4
      backend/extensions/Squidex.Extensions/Actions/RuleHelper.cs
  26. 2
      backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs
  27. 1
      backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRAction.cs
  28. 8
      backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs
  29. 1
      backend/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs
  30. 4
      backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs
  31. 3
      backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs
  32. 1
      backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
  33. 7
      backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
  34. 4
      backend/extensions/Squidex.Extensions/Assets/Azure/AzureMetadataSource.cs
  35. 1
      backend/extensions/Squidex.Extensions/Samples/AssetStore/MemoryAssetStorePlugin.cs
  36. 2
      backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs
  37. 1
      backend/extensions/Squidex.Extensions/Samples/Middleware/TemplateInstance.cs
  38. 2
      backend/extensions/Squidex.Extensions/Samples/Middleware/TemplateMiddleware.cs
  39. 34
      backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj
  40. 3
      backend/extensions/Squidex.Extensions/Text/Azure/AzureIndexDefinition.cs
  41. 5
      backend/extensions/Squidex.Extensions/Text/Azure/AzureTextIndex.cs
  42. 1
      backend/extensions/Squidex.Extensions/Text/Azure/AzureTextPlugin.cs
  43. 2
      backend/extensions/Squidex.Extensions/Text/Azure/CommandFactory.cs
  44. 1
      backend/extensions/Squidex.Extensions/Text/ElasticSearch/CommandFactory.cs
  45. 5
      backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchIndexDefinition.cs
  46. 5
      backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs
  47. 1
      backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextPlugin.cs
  48. 3
      backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs
  49. 2
      backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs
  50. 10
      backend/i18n/translator/Squidex.Translator/Commands.cs
  51. 4
      backend/i18n/translator/Squidex.Translator/Extensions.cs
  52. 10
      backend/i18n/translator/Squidex.Translator/Processes/Backend.cs
  53. 4
      backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs
  54. 10
      backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs
  55. 4
      backend/i18n/translator/Squidex.Translator/Processes/Frontend.cs
  56. 6
      backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs
  57. 1
      backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs
  58. 1
      backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs
  59. 6
      backend/i18n/translator/Squidex.Translator/Processes/Helper.cs
  60. 2
      backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs
  61. 28
      backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs
  62. 2
      backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs
  63. 1
      backend/i18n/translator/Squidex.Translator/Program.cs
  64. 22
      backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj
  65. 2
      backend/i18n/translator/Squidex.Translator/State/Old/OldTranslatedText.cs
  66. 2
      backend/i18n/translator/Squidex.Translator/State/Old/OldTranslationState.cs
  67. 2
      backend/i18n/translator/Squidex.Translator/State/TranslatedTexts.cs
  68. 20
      backend/i18n/translator/Squidex.Translator/State/TranslationService.cs
  69. 2
      backend/i18n/translator/Squidex.Translator/State/TranslationTodos.cs
  70. 2
      backend/i18n/translator/Squidex.Translator/State/TranslationsToIgnore.cs
  71. 3
      backend/src/Migrations/MigrationPath.cs
  72. 7
      backend/src/Migrations/Migrations.csproj
  73. 2
      backend/src/Migrations/Migrations/ClearRules.cs
  74. 2
      backend/src/Migrations/Migrations/ClearSchemas.cs
  75. 3
      backend/src/Migrations/Migrations/ConvertEventStore.cs
  76. 4
      backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs
  77. 2
      backend/src/Migrations/Migrations/CreateAssetSlugs.cs
  78. 6
      backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs
  79. 4
      backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs
  80. 3
      backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs
  81. 2
      backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs
  82. 2
      backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs
  83. 2
      backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs
  84. 2
      backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs
  85. 2
      backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs
  86. 2
      backend/src/Migrations/Migrations/RebuildApps.cs
  87. 2
      backend/src/Migrations/Migrations/RebuildAssetFolders.cs
  88. 2
      backend/src/Migrations/Migrations/RebuildAssets.cs
  89. 2
      backend/src/Migrations/Migrations/RebuildContents.cs
  90. 2
      backend/src/Migrations/Migrations/RebuildRules.cs
  91. 2
      backend/src/Migrations/Migrations/RebuildSchemas.cs
  92. 2
      backend/src/Migrations/Migrations/RebuildSnapshots.cs
  93. 2
      backend/src/Migrations/Migrations/StartEventConsumers.cs
  94. 2
      backend/src/Migrations/Migrations/StopEventConsumers.cs
  95. 1
      backend/src/Migrations/OldEvents/AppClientChanged.cs
  96. 2
      backend/src/Migrations/OldEvents/AppClientPermission.cs
  97. 1
      backend/src/Migrations/OldEvents/AppClientUpdated.cs
  98. 1
      backend/src/Migrations/OldEvents/AppContributorAssigned.cs
  99. 2
      backend/src/Migrations/OldEvents/AppContributorPermission.cs
  100. 3
      backend/src/Migrations/OldEvents/AppPatternAdded.cs

224
.drone.yml

@ -1,224 +0,0 @@
---
kind: pipeline
name: default
steps:
- name: build_dev
image: docker
commands:
- docker build -t squidex --build-arg SQUIDEX__VERSION=4.0.0-dev-$${DRONE_BUILD_NUMBER} .
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- push
- pull_request
branch:
- master
- release/*
- name: build_release
image: docker
commands:
- docker build -t squidex --build-arg SQUIDEX__VERSION=$${DRONE_TAG} .
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- tag
- name: test_start
image: docker/compose
commands:
- cd backend/tests
- docker-compose up -d
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- tag
- push
- pull_request
branch:
- master
- release/*
- name: test_run
image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim
environment:
CONFIG__SERVER__URL: http://localhost:8080
CONFIG__WAIT: 60
commands:
- dotnet test backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj --filter Category!=NotAutomated
network_mode: host
when:
event:
- tag
- push
- pull_request
branch:
- master
- release/*
- name: test_cleanup
image: docker/compose
commands:
- cd backend/tests
- docker-compose down
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
status:
- failure
- success
event:
- tag
- push
- pull_request
branch:
- master
- release/*
- name: push_dev
image: docker
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag squidex squidex/squidex:dev
- docker tag squidex squidex/squidex:dev-$${DRONE_BUILD_NUMBER}
- docker push squidex/squidex:dev
- docker push squidex/squidex:dev-$${DRONE_BUILD_NUMBER}
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
when:
event:
- push
branch:
- master
- release/*
- name: push_release
image: docker
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag squidex squidex/squidex:latest
- docker tag squidex squidex/squidex:$${DRONE_TAG}
- docker tag squidex squidex/squidex:$${DRONE_TAG:0:1}
- docker push squidex/squidex:latest
- docker push squidex/squidex:$${DRONE_TAG}
- docker push squidex/squidex:$${DRONE_TAG:0:1}
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
when:
event:
- tag
- name: build_binaries
image: docker
commands:
- docker create --name squidex-container squidex
- docker cp squidex-container:/app/. /build
volumes:
- name: build
path: /build
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- tag
- name: binaries_zip
image: kramos/alpine-zip
commands:
- cd /build && zip -r /release/binaries.zip .
volumes:
- name: build
path: /build
- name: release
path: /release
when:
event:
- tag
- name: binaries_publish
image: plugins/github-release
settings:
api_key:
from_secret: GITHUB_TOKEN
files:
- /release/binaries.zip
volumes:
- name: release
path: /release
when:
event:
- tag
- name: binaries_cleanup
image: docker
commands:
- docker rm squidex-container
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
status:
- failure
- success
event:
- tag
volumes:
- name: build
temp: {}
- name: release
temp: {}
- name: docker1
host:
path: /var/run/docker.sock
- name: docker2
host:
path: /var/lib/docker
---
kind: secret
name: GITHUB_TOKEN
data: ug4jjv04VM8v6+j18pGC/xVcnhB55AQI+F6Raz3mmZ7JRWYwDcu7x1PryHhkFBErtGrQHMHvr5EhAqwMaun7WurKUnI=
---
kind: secret
name: DOCKER_USERNAME
data: BRJUSatZx7X0MCxVq1QboS2DBeye7jnPoeuDi7ejkPDq8EDrrCVT9D2DuQ==
---
kind: secret
name: DOCKER_PASSWORD
data: 2JITndCjHwdCyJ/m/onZNnUlXxIJ5FhECC+gnY3klV9PIQYIyLwQ

2
.github/workflows/dev.yml

@ -102,7 +102,7 @@ jobs:
- name: RUN TEST
uses: kohlerdominik/docker-run-action@v1.0.0
with:
image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim
image: mcr.microsoft.com/dotnet/sdk:6.0
environment: |
CONFIG__WAIT=60
CONFIG__SERVER__URL=http://localhost:8080

2
.github/workflows/release.yml

@ -85,7 +85,7 @@ jobs:
- name: RUN TEST
uses: kohlerdominik/docker-run-action@v1.0.0
with:
image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim
image: mcr.microsoft.com/dotnet/sdk:6.0
environment: |
CONFIG__WAIT=60
CONFIG__SERVER__URL=http://localhost:8080

4
Dockerfile

@ -1,7 +1,7 @@
#
# Stage 1, Build Backend
#
FROM mcr.microsoft.com/dotnet/sdk:5.0 as backend
FROM mcr.microsoft.com/dotnet/sdk:6.0 as backend
ARG SQUIDEX__VERSION=5.0.0
@ -64,7 +64,7 @@ RUN cp -a build /build/
#
# Stage 3, Build runtime
#
FROM mcr.microsoft.com/dotnet/aspnet:5.0.0-buster-slim
FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-bullseye-slim
# Curl for debugging and libc-dev for Protobuf
RUN apt-get update \

1
backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry.Trace;

1
backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Google.Cloud.Diagnostics.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;

1
backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverSeverityLogAppender.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Squidex.Log;
namespace Squidex.Extensions.APM.Stackdriver

3
backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Algolia.Search.Clients;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

1
backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using Squidex.Domain.Apps.Core.HandleRules;

2
backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Squidex.Domain.Apps.Core.HandleRules;

2
backend/extensions/Squidex.Extensions/Actions/ClientPool.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;

2
backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Domain.Apps.Entities.Comments.Commands;

3
backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;

1
backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules;

4
backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs

@ -5,11 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;

1
backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules;

3
backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core.HandleRules;

2
backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MailKit.Net.Smtp;
using MimeKit;
using MimeKit.Text;

4
backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Infrastructure;

6
backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
@ -78,7 +74,7 @@ namespace Squidex.Extensions.Actions.Kafka
if (indexEqual > 0 && indexEqual < line.Length - 1)
{
var key = line.Substring(0, indexEqual);
var key = line[..indexEqual];
var val = line[(indexEqual + 1)..];
val = await FormatAsync(val, @event);

5
backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs

@ -5,12 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Avro;
using Avro.Generic;
using Confluent.Kafka;

4
backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs

@ -5,11 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Infrastructure.Http;

3
backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Domain.Apps.Entities.Comments.Commands;

3
backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs

@ -5,10 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;

4
backend/extensions/Squidex.Extensions/Actions/RuleHelper.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Domain.Apps.Core.Scripting;

2
backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Domain.Apps.Core.Scripting;

1
backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using Squidex.Domain.Apps.Core.HandleRules;

8
backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Azure.SignalR.Management;
using Squidex.Domain.Apps.Core.HandleRules;
@ -16,12 +14,12 @@ namespace Squidex.Extensions.Actions.SignalR
{
public sealed class SignalRActionHandler : RuleActionHandler<SignalRAction, SignalRJob>
{
private readonly ClientPool<(string ConnectionString, string HubName), IServiceManager> clients;
private readonly ClientPool<(string ConnectionString, string HubName), ServiceManager> clients;
public SignalRActionHandler(RuleEventFormatter formatter)
: base(formatter)
{
clients = new ClientPool<(string ConnectionString, string HubName), IServiceManager>(key =>
clients = new ClientPool<(string ConnectionString, string HubName), ServiceManager>(key =>
{
var serviceManager = new ServiceManagerBuilder()
.WithOptions(option =>
@ -29,7 +27,7 @@ namespace Squidex.Extensions.Actions.SignalR
option.ConnectionString = key.ConnectionString;
option.ServiceTransportType = ServiceTransportType.Transient;
})
.Build();
.BuildServiceManager();
return serviceManager;
});

1
backend/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules;

4
backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs

@ -5,11 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;

3
backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using CoreTweet;
using Microsoft.Extensions.Options;
using Squidex.Domain.Apps.Core.HandleRules;

1
backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules;

7
backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs

@ -5,12 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Infrastructure;
@ -78,7 +73,7 @@ namespace Squidex.Extensions.Actions.Webhook
if (indexEqual > 0 && indexEqual < line.Length - 1)
{
var headerKey = line.Substring(0, indexEqual);
var headerKey = line[..indexEqual];
var headerValue = line[(indexEqual + 1)..];
headerValue = await FormatAsync(headerValue, @event);

4
backend/extensions/Squidex.Extensions/Assets/Azure/AzureMetadataSource.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;
using Microsoft.Extensions.Options;

1
backend/extensions/Squidex.Extensions/Samples/AssetStore/MemoryAssetStorePlugin.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;

2
backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Linq;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Entities.Contents;
using Squidex.Domain.Apps.Entities.Contents.Commands;

1
backend/extensions/Squidex.Extensions/Samples/Middleware/TemplateInstance.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Domain.Apps.Entities.Apps.Templates;
using Squidex.Domain.Apps.Entities.Apps.Templates.Builders;

2
backend/extensions/Squidex.Extensions/Samples/Middleware/TemplateMiddleware.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Domain.Apps.Entities;
using Squidex.Domain.Apps.Entities.Apps.Commands;

34
backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj

@ -1,36 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Squidex.Domain.Apps.Core.Operations\Squidex.Domain.Apps.Core.Operations.csproj" />
<ProjectReference Include="..\..\src\Squidex.Web\Squidex.Web.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Algolia.Search" Version="6.10.1" />
<PackageReference Include="Algolia.Search" Version="6.12.0" />
<PackageReference Include="Azure.Search.Documents" Version="11.3.0" />
<PackageReference Include="Confluent.Apache.Avro" Version="1.7.7.7" />
<PackageReference Include="Confluent.Kafka" Version="1.7.0" />
<PackageReference Include="Confluent.Kafka" Version="1.8.2" />
<PackageReference Include="Confluent.SchemaRegistry.Serdes" Version="1.3.0" />
<PackageReference Include="CoreTweet" Version="1.0.0.483" />
<PackageReference Include="Elasticsearch.Net" Version="7.14.1" />
<PackageReference Include="Google.Cloud.Diagnostics.Common" Version="4.0.0" />
<PackageReference Include="Google.Cloud.Logging.V2" Version="3.3.0" />
<PackageReference Include="Meziantou.Analyzer" Version="1.0.670">
<PackageReference Include="Elasticsearch.Net" Version="7.15.2" />
<PackageReference Include="Google.Cloud.Diagnostics.Common" Version="4.3.1" />
<PackageReference Include="Google.Cloud.Logging.V2" Version="3.4.0" />
<PackageReference Include="Meziantou.Analyzer" Version="1.0.676">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.0" />
<PackageReference Include="Microsoft.Azure.SignalR.Management" Version="1.9.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.OData.Core" Version="7.9.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.1" />
<PackageReference Include="Microsoft.Azure.SignalR.Management" Version="1.13.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.OData.Core" Version="7.9.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NodaTime" Version="3.0.5" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0-beta.2" />
<PackageReference Include="NodaTime" Version="3.0.9" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0-beta.3" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.1.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.2.0-alpha1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc7" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.2.0-beta1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc8" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.OpenTelemetry.Exporter.Stackdriver" Version="0.0.0-alpha.0.97" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />

3
backend/extensions/Squidex.Extensions/Text/Azure/AzureIndexDefinition.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Azure.Search.Documents.Indexes.Models;

5
backend/extensions/Squidex.Extensions/Text/Azure/AzureTextIndex.cs

@ -5,11 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Search.Documents;
using Azure.Search.Documents.Indexes;

1
backend/extensions/Squidex.Extensions/Text/Azure/AzureTextPlugin.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Squidex.Domain.Apps.Entities.Contents.Text;

2
backend/extensions/Squidex.Extensions/Text/Azure/CommandFactory.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Text;
using Azure.Search.Documents.Models;
using GeoJSON.Net.Geometry;

1
backend/extensions/Squidex.Extensions/Text/ElasticSearch/CommandFactory.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using GeoJSON.Net.Geometry;
using Squidex.Domain.Apps.Entities.Contents.Text;

5
backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchIndexDefinition.cs

@ -5,11 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Elasticsearch.Net;
namespace Squidex.Extensions.Text.ElasticSearch

5
backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs

@ -5,12 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Newtonsoft.Json;
using Squidex.Domain.Apps.Entities.Apps;

1
backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextPlugin.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Squidex.Domain.Apps.Entities.Contents.Text;

3
backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Core.Schemas;

2
backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using Squidex.Domain.Apps.Core.ValidateContent;
using Squidex.Domain.Apps.Entities.Contents.Repositories;

10
backend/i18n/translator/Squidex.Translator/Commands.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using CommandDotNet;
using FluentValidation;
using FluentValidation.Attributes;
@ -92,7 +88,7 @@ namespace Squidex.Translator
[Command(Name = "clean-backend", Description = "Clean the backend translations.")]
public void CleanBackend(TranslateArguments arguments)
{
var (folder, service) = Setup(arguments, "backend");
var (_, service) = Setup(arguments, "backend");
Helper.CleanOtherLocales(service);
@ -102,7 +98,7 @@ namespace Squidex.Translator
[Command(Name = "clean-frontend", Description = "Clean the frontend translations.")]
public void CleanFrontend(TranslateArguments arguments)
{
var (folder, service) = Setup(arguments, "frontend");
var (_, service) = Setup(arguments, "frontend");
Helper.CleanOtherLocales(service);
@ -141,7 +137,7 @@ namespace Squidex.Translator
{
if (!Directory.Exists(arguments.Folder))
{
throw new ArgumentException("Folder does not exist.");
throw new ArgumentException("Folder does not exist.", nameof(arguments));
}
var supportedLocales = new string[] { "en", "nl", "it", "zh" };

4
backend/i18n/translator/Squidex.Translator/Extensions.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Linq;
namespace Squidex.Translator
{
public static class Extensions
@ -18,7 +16,7 @@ namespace Squidex.Translator
public static bool IsPotentialMultiWordText(this string text)
{
return text.Contains(' ') && text.IsPotentialText();
return text.Contains(' ', StringComparison.Ordinal) && text.IsPotentialText();
}
}
}

10
backend/i18n/translator/Squidex.Translator/Processes/Backend.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Squidex.Translator.Processes
{
public static class Backend
@ -28,7 +24,8 @@ namespace Squidex.Translator.Processes
{
var relativeName = Helper.RelativeName(file, folder);
if (relativeName.Contains("/obj/") || relativeName.Contains("/bin/"))
if (relativeName.Contains("/obj/", StringComparison.Ordinal) ||
relativeName.Contains("/bin/", StringComparison.Ordinal))
{
continue;
}
@ -45,7 +42,8 @@ namespace Squidex.Translator.Processes
{
var relativeName = Helper.RelativeName(file, folder);
if (relativeName.Contains("/obj/") || relativeName.Contains("/bin/"))
if (relativeName.Contains("/obj/", StringComparison.Ordinal) ||
relativeName.Contains("/bin/", StringComparison.Ordinal))
{
continue;
}

4
backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Squidex.Translator.State;
@ -36,7 +34,7 @@ namespace Squidex.Translator.Processes
void AddTranslations(string regex)
{
var matches = Regex.Matches(content, regex, RegexOptions.Singleline);
var matches = Regex.Matches(content, regex, RegexOptions.Singleline | RegexOptions.ExplicitCapture);
foreach (Match match in matches)
{

10
backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Squidex.Translator.State;
@ -58,7 +56,7 @@ namespace Squidex.Translator.Processes
service.Save();
}
private HashSet<string> GetTranslationsInTemplate(FileInfo file)
private static HashSet<string> GetTranslationsInTemplate(FileInfo file)
{
var content = File.ReadAllText(file.FullName);
@ -66,7 +64,7 @@ namespace Squidex.Translator.Processes
void AddTranslations(string regex)
{
var matches = Regex.Matches(content, regex, RegexOptions.Singleline);
var matches = Regex.Matches(content, regex, RegexOptions.Singleline | RegexOptions.ExplicitCapture);
foreach (Match match in matches)
{
@ -81,7 +79,7 @@ namespace Squidex.Translator.Processes
return translations;
}
private HashSet<string> GetTranslationsInTypescript(FileInfo file)
private static HashSet<string> GetTranslationsInTypescript(FileInfo file)
{
var content = File.ReadAllText(file.FullName);
@ -89,7 +87,7 @@ namespace Squidex.Translator.Processes
void AddTranslations(string regex)
{
var matches = Regex.Matches(content, regex, RegexOptions.Singleline);
var matches = Regex.Matches(content, regex, RegexOptions.Singleline | RegexOptions.ExplicitCapture);
foreach (Match match in matches)
{

4
backend/i18n/translator/Squidex.Translator/Processes/Frontend.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.IO;
namespace Squidex.Translator.Processes
{
public static class Frontend

6
backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.IO;
using System.Resources.NetStandard;
using System.Text.RegularExpressions;
using Squidex.Translator.State;
@ -58,8 +56,8 @@ namespace Squidex.Translator.Processes
var text = File.ReadAllText(fullName);
text = text.Replace("System.Resources.NetStandard.ResXResourceReader, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
text = text.Replace("System.Resources.NetStandard.ResXResourceWriter, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
text = text.Replace("System.Resources.NetStandard.ResXResourceReader, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", StringComparison.Ordinal);
text = text.Replace("System.Resources.NetStandard.ResXResourceWriter, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", StringComparison.Ordinal);
File.WriteAllText(fullName, text);
}

1
backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.IO;
using Squidex.Translator.State;
namespace Squidex.Translator.Processes

1
backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.IO;
using Squidex.Translator.State;
namespace Squidex.Translator.Processes

6
backend/i18n/translator/Squidex.Translator/Processes/Helper.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Squidex.Translator.State;
namespace Squidex.Translator.Processes
@ -17,7 +13,7 @@ namespace Squidex.Translator.Processes
{
public static string RelativeName(FileInfo file, DirectoryInfo folder)
{
return file.FullName[folder.FullName.Length..].Replace("\\", "/");
return file.FullName[folder.FullName.Length..].Replace("\\", "/", StringComparison.Ordinal);
}
public static void CheckOtherLocales(TranslationService service)

2
backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.IO;
using System.Text.RegularExpressions;
using Squidex.Translator.State;

28
backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs

@ -5,16 +5,10 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using HtmlAgilityPack;
using Squidex.Translator.State;
#pragma warning disable SA1025 // Code should not contain multiple whitespace in a row
namespace Squidex.Translator.Processes
{
public class TranslateTemplates
@ -100,12 +94,12 @@ namespace Squidex.Translator.Processes
while (trimmed.StartsWith(whitespace, StringComparison.OrdinalIgnoreCase))
{
trimmed = trimmed.Substring(whitespace.Length);
trimmed = trimmed[whitespace.Length..];
}
while (trimmed.EndsWith(whitespace, StringComparison.OrdinalIgnoreCase))
{
trimmed = trimmed.Substring(0, trimmed.Length - whitespace.Length);
trimmed = trimmed[..^whitespace.Length];
}
if (!string.IsNullOrWhiteSpace(trimmed) && !IsTranslated(trimmed) && !IsVariable(trimmed))
@ -115,8 +109,8 @@ namespace Squidex.Translator.Processes
// Extract prefix and suffix to keep our original indentation.
var originalIndex = text.IndexOf(trimmed, StringComparison.Ordinal);
var originalPrefix = text.Substring(0, originalIndex);
var originalSuffix = text.Substring(originalIndex + trimmed.Length);
var originalPrefix = text[..originalIndex];
var originalSuffix = text[(originalIndex + trimmed.Length)..];
var originText = $"text in {textNode.ParentNode.Name}";
@ -153,7 +147,7 @@ namespace Squidex.Translator.Processes
}
else
{
if (attribute.Name.Contains("["))
if (attribute.Name.Contains('[', StringComparison.Ordinal))
{
node.SetAttributeValue(attribute.Name, $"{{{{ '{key}' | sqxTranslate }}}}");
}
@ -177,20 +171,20 @@ namespace Squidex.Translator.Processes
private static bool IsPipe(HtmlAttribute attribute)
{
return attribute.Value.Contains("{");
return attribute.Value.Contains('{', StringComparison.Ordinal);
}
private bool IsTranslatedAttribute(string text)
private static bool IsTranslatedAttribute(string text)
{
return text.Contains("i18n:");
return text.Contains("i18n:", StringComparison.Ordinal);
}
private bool IsTranslated(string text)
private static bool IsTranslated(string text)
{
return text.Contains("| sqxTranslate");
return text.Contains("| sqxTranslate", StringComparison.Ordinal);
}
private bool IsVariable(string text)
private static bool IsVariable(string text)
{
return text.StartsWith("{{", StringComparison.Ordinal) && Regex.Matches(text, "\\}\\}").Count == 1;
}

2
backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.IO;
using System.Text.RegularExpressions;
using Squidex.Translator.State;

1
backend/i18n/translator/Squidex.Translator/Program.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using CommandDotNet;
using CommandDotNet.FluentValidation;

22
backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj

@ -2,16 +2,24 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>NU1608</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.24" />
<PackageReference Include="CommandDotNet" Version="3.6.0" />
<PackageReference Include="CommandDotNet.FluentValidation" Version="2.0.2" />
<PackageReference Include="CommandDotNet.IoC.MicrosoftDependencyInjection" Version="2.0.1" />
<PackageReference Include="ConsoleTables" Version="2.4.1" />
<PackageReference Include="CoreTweet" Version="1.0.0.483" />
<PackageReference Include="FluentValidation" Version="10.3.4" />
<PackageReference Include="FluentValidation.ValidatorAttribute" Version="8.6.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.38" />
<PackageReference Include="CommandDotNet" Version="5.0.1" />
<PackageReference Include="CommandDotNet.FluentValidation" Version="5.0.0" />
<PackageReference Include="CommandDotNet.IoC.MicrosoftDependencyInjection" Version="4.0.1" />
<PackageReference Include="ConsoleTables" Version="2.4.2" />
<PackageReference Include="Meziantou.Analyzer" Version="1.0.676">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="ResXResourceReader.NetStandard" Version="1.0.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />

2
backend/i18n/translator/Squidex.Translator/State/Old/OldTranslatedText.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Translator.State.Old
{
public class OldTranslatedText

2
backend/i18n/translator/Squidex.Translator/State/Old/OldTranslationState.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Translator.State.Old
{
public class OldTranslationState

2
backend/i18n/translator/Squidex.Translator/State/TranslatedTexts.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Translator.State
{
public sealed class TranslatedTexts : SortedDictionary<string, string>

20
backend/i18n/translator/Squidex.Translator/State/TranslationService.cs

@ -5,10 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Globalization;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
@ -175,7 +172,7 @@ namespace Squidex.Translator.State
public void Translate(string fileName, string text, string originText, Action<string> handler, bool silent = false)
{
if (onlySingleWords && text.Contains(' '))
if (onlySingleWords && text.Contains(' ', StringComparison.Ordinal))
{
return;
}
@ -205,7 +202,7 @@ namespace Squidex.Translator.State
if (string.IsNullOrWhiteSpace(key))
{
key = $"common.{text.ToLower()}";
key = $"common.{text.ToLower(CultureInfo.InvariantCulture)}";
if (translations.TryGetValue(key, out var existing))
{
@ -221,21 +218,22 @@ namespace Squidex.Translator.State
break;
}
else if (key.Equals("s", StringComparison.OrdinalIgnoreCase) == true)
if (key.Equals("s", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Skipped");
}
else if (key.Equals("i", StringComparison.OrdinalIgnoreCase) == true)
else if (key.Equals("i", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Ignored");
AddIgnore(fileName, text);
}
else if (key.Equals("f", StringComparison.OrdinalIgnoreCase) == true)
else if (key.Equals("f", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Ignored File");
AddIgnore(fileName, "*");
}
else if (key.Equals("t", StringComparison.OrdinalIgnoreCase) == true)
else if (key.Equals("t", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("ToDo");
AddTodo(fileName, text);
@ -244,7 +242,7 @@ namespace Squidex.Translator.State
}
else
{
if (!key.Contains("."))
if (!key.Contains('.', StringComparison.Ordinal))
{
if (previousPrefix != null)
{

2
backend/i18n/translator/Squidex.Translator/State/TranslationTodos.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Translator.State
{
public sealed class TranslationTodos : SortedDictionary<string, SortedSet<string>>

2
backend/i18n/translator/Squidex.Translator/State/TranslationsToIgnore.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Translator.State
{
public sealed class TranslationsToIgnore : SortedDictionary<string, SortedSet<string>>

3
backend/src/Migrations/MigrationPath.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Migrations.Migrations;
using Migrations.Migrations.MongoDb;

7
backend/src/Migrations/Migrations.csproj

@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="1.0.670">
<PackageReference Include="Meziantou.Analyzer" Version="1.0.676">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

2
backend/src/Migrations/Migrations/ClearRules.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Entities.Rules.DomainObject;
using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.States;

2
backend/src/Migrations/Migrations/ClearSchemas.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Entities.Schemas.DomainObject;
using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.States;

3
backend/src/Migrations/Migrations/ConvertEventStore.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.EventSourcing;

4
backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure;

2
backend/src/Migrations/Migrations/CreateAssetSlugs.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Entities.Assets;
using Squidex.Domain.Apps.Entities.Assets.DomainObject;
using Squidex.Infrastructure;

6
backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs

@ -5,11 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using MongoDB.Bson;
using MongoDB.Driver;
@ -72,7 +68,7 @@ namespace Migrations.Migrations.MongoDb
indexOfId = indexOfOldId + 2;
}
var domainType = eventStream.Substring(0, indexOfType);
var domainType = eventStream[..indexOfType];
var domainId = eventStream[indexOfId..];
var newDomainId = DomainId.Combine(DomainId.Create(appId), DomainId.Create(domainId)).ToString();

4
backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs

@ -5,10 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using MongoDB.Bson;
using MongoDB.Driver;

3
backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildApps.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildAssetFolders.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildAssets.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildContents.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildRules.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildSchemas.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/RebuildSnapshots.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/StartEventConsumers.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/Migrations/StopEventConsumers.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Migrations;

1
backend/src/Migrations/OldEvents/AppClientChanged.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Squidex.Domain.Apps.Events;
using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations;

2
backend/src/Migrations/OldEvents/AppClientPermission.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
namespace Migrations.OldEvents
{
[Obsolete("New Event introduced")]

1
backend/src/Migrations/OldEvents/AppClientUpdated.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Events;
using Squidex.Infrastructure.EventSourcing;

1
backend/src/Migrations/OldEvents/AppContributorAssigned.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Events;
using Squidex.Infrastructure.EventSourcing;

2
backend/src/Migrations/OldEvents/AppContributorPermission.cs

@ -5,8 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
namespace Migrations.OldEvents
{
[Obsolete("New Event introduced")]

3
backend/src/Migrations/OldEvents/AppPatternAdded.cs

@ -5,9 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Entities.Apps.DomainObject;
using Squidex.Domain.Apps.Events;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save