diff --git a/.cursor/rules/blazor.mdc b/.cursor/rules/blazor.mdc new file mode 100644 index 00000000..81b79da8 --- /dev/null +++ b/.cursor/rules/blazor.mdc @@ -0,0 +1,75 @@ +--- +description: You are a senior Blazor and .NET developer, experienced in C#, ASP.NET Core, and Entity Framework Core. You also use Visual Studio Enterprise for running, debugging, and testing your Blazor applications. +globs: *.razor +alwaysApply: true +--- + + You are a senior Blazor and .NET developer, experienced in C#, ASP.NET Core, and Entity Framework Core. You also use Visual Studio Enterprise for running, debugging, and testing your Blazor applications. + + ## Workflow and Development Environment + - All running, debugging, and testing of the Blazor app should happen in Visual Studio Enterprise. + - Code editing, AI suggestions, and refactoring will be done within Cursor AI. + - Recognize that Visual Studio is installed and should be used for compiling and launching the app. + + ## Blazor Code Style and Structure + - Write idiomatic and efficient Blazor and C# code. + - Follow .NET and Blazor conventions. + - Use Razor Components appropriately for component-based UI development. + - Prefer inline functions for smaller components but separate complex logic into code-behind or service classes. + - Async/await should be used where applicable to ensure non-blocking UI operations. + + ## Naming Conventions + - Follow PascalCase for component names, method names, and public members. + - Use camelCase for private fields and local variables. + - Prefix interface names with "I" (e.g., IUserService). + + ## Blazor and .NET Specific Guidelines + - Utilize Blazor's built-in features for component lifecycle (e.g., OnInitializedAsync, OnParametersSetAsync). + - Use data binding effectively with @bind. + - Leverage Dependency Injection for services in Blazor. + - Structure Blazor components and services following Separation of Concerns. + - Use C# 10+ features like record types, pattern matching, and global usings. + + ## Error Handling and Validation + - Implement proper error handling for Blazor pages and API calls. + - Use logging for error tracking in the backend and consider capturing UI-level errors in Blazor with tools like ErrorBoundary. + - Implement validation using FluentValidation or DataAnnotations in forms. + + ## Blazor API and Performance Optimization + - Utilize Blazor server-side or WebAssembly optimally based on the project requirements. + - Use asynchronous methods (async/await) for API calls or UI actions that could block the main thread. + - Optimize Razor components by reducing unnecessary renders and using StateHasChanged() efficiently. + - Minimize the component render tree by avoiding re-renders unless necessary, using ShouldRender() where appropriate. + - Use EventCallbacks for handling user interactions efficiently, passing only minimal data when triggering events. + + ## Caching Strategies + - Implement in-memory caching for frequently used data, especially for Blazor Server apps. Use IMemoryCache for lightweight caching solutions. + - For Blazor WebAssembly, utilize localStorage or sessionStorage to cache application state between user sessions. + - Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state across multiple users or clients. + - Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user experience. + + ## State Management Libraries + - Use Blazor’s built-in Cascading Parameters and EventCallbacks for basic state sharing across components. + - Implement advanced state management solutions using libraries like Fluxor or BlazorState when the application grows in complexity. + - For client-side state persistence in Blazor WebAssembly, consider using Blazored.LocalStorage or Blazored.SessionStorage to maintain state between page reloads. + - For server-side Blazor, use Scoped Services and the StateContainer pattern to manage state within user sessions while minimizing re-renders. + + ## API Design and Integration + - Use HttpClient or other appropriate services to communicate with external APIs or your own backend. + - Implement error handling for API calls using try-catch and provide proper user feedback in the UI. + + ## Testing and Debugging in Visual Studio + - All unit testing and integration testing should be done in Visual Studio Enterprise. + - Test Blazor components and services using xUnit, NUnit, or MSTest. + - Use Moq or NSubstitute for mocking dependencies during tests. + - Debug Blazor UI issues using browser developer tools and Visual Studio’s debugging tools for backend and server-side issues. + - For performance profiling and optimization, rely on Visual Studio's diagnostics tools. + + ## Security and Authentication + - Implement Authentication and Authorization in the Blazor app where necessary using ASP.NET Identity or JWT tokens for API authentication. + - Use HTTPS for all web communication and ensure proper CORS policies are implemented. + + ## API Documentation and Swagger + - Use Swagger/OpenAPI for API documentation for your backend API services. + - Ensure XML documentation for models and API methods for enhancing Swagger documentation. + \ No newline at end of file diff --git a/.idea/.idea.CodeWF/.idea/.gitignore b/.idea/.idea.CodeWF/.idea/.gitignore new file mode 100644 index 00000000..7a60b42e --- /dev/null +++ b/.idea/.idea.CodeWF/.idea/.gitignore @@ -0,0 +1,13 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# Rider 忽略的文件 +/modules.xml +/contentModel.xml +/.idea.CodeWF.iml +/projectSettingsUpdater.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.CodeWF/.idea/.name b/.idea/.idea.CodeWF/.idea/.name new file mode 100644 index 00000000..932a8764 --- /dev/null +++ b/.idea/.idea.CodeWF/.idea/.name @@ -0,0 +1 @@ +CodeWF \ No newline at end of file diff --git a/.idea/.idea.CodeWF/.idea/encodings.xml b/.idea/.idea.CodeWF/.idea/encodings.xml new file mode 100644 index 00000000..df87cf95 --- /dev/null +++ b/.idea/.idea.CodeWF/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.CodeWF/.idea/indexLayout.xml b/.idea/.idea.CodeWF/.idea/indexLayout.xml new file mode 100644 index 00000000..7b08163c --- /dev/null +++ b/.idea/.idea.CodeWF/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.CodeWF/.idea/vcs.xml b/.idea/.idea.CodeWF/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/.idea.CodeWF/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md index db5dd1de..252095e1 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -187,7 +187,7 @@ CodeWF Toolbox 使用Avalonia开发的跨平台工具箱,使用了Prism做为 ## OpenAPI -https://localhost:5002//scalar/v1 +https://localhost:5002/scalar/v1 ## 赞助 diff --git a/src/CodeWF/Pages/Tool/Converter/IconConverter.razor b/src/CodeWF/Pages/Tool/Converter/IconConverter.razor index 7e555104..d4f73d70 100644 --- a/src/CodeWF/Pages/Tool/Converter/IconConverter.razor +++ b/src/CodeWF/Pages/Tool/Converter/IconConverter.razor @@ -2,152 +2,423 @@ 在线ICO转换器 - @SiteOptions.Value.AppTitle +
+
+

ICO 图标转换工具

+

将您的图片转换为多尺寸的 ICO 图标文件

+
+ +
+
+
+
+
+ +
+ + 浏览文件 + 未选择文件 +
+
支持的格式: PNG、JPG、JPEG、WEBP
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ + +
+ +
+
+ + + + 转换成功! 请点击下方按钮下载文件。 +
+ + + + + 下载文件 + +
+ + + + 请注意:生成的文件仅保留2分钟,请及时下载。 +
+
+
+
+
+ +
+
+
+

使用说明

+
+
+
    +
  1. 选择一个图片文件作为源文件
  2. +
  3. 选择需要的图标尺寸(建议至少包含16x16和32x32)
  4. +
  5. 点击"合并生成ICO"将所有尺寸合并到一个ICO文件中
  6. +
  7. 或点击"分别生成ICO"获取每个尺寸的单独文件
  8. +
+
+
网站图标引用代码
+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+
+
+
+
+
+
+ -
-
-
- - - 支持的格式: PNG、JPG、JPEG、WEBP -
+ .fluent-code-block { + background-color: #f3f2f1; + border-radius: 2px; + overflow: hidden; + width: 100%; + } -
- -
- - - - - - -
-
+ .fluent-code-title { + background-color: #edebe9; + padding: 8px 12px; + font-size: 13px; + font-weight: 600; + } -
- - -
+ .fluent-code-block pre { + margin: 0; + padding: 12px; + overflow-x: auto; + white-space: pre-wrap; + word-wrap: break-word; + } - -
+ .fluent-code-block code { + font-family: 'Cascadia Code', Consolas, monospace; + font-size: 13px; + color: #323130; + } -
-

使用说明

-

1. ICO图标文件可以包含多个不同尺寸的图像,建议至少包含16x16和32x32两种尺寸。

-

2. 网站图标引用代码示例:

-
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> -
-
-
+ /* 确保所有元素都使用border-box盒模型 */ + *, *::before, *::after { + box-sizing: border-box; + } + @code { public const string Slug = "ico"; @@ -155,6 +426,16 @@ \ No newline at end of file diff --git a/src/CodeWF/Pages/Tool/Converter/NuoChe.razor b/src/CodeWF/Pages/Tool/Converter/NuoChe.razor index d2f499f7..09a2fa6d 100644 --- a/src/CodeWF/Pages/Tool/Converter/NuoChe.razor +++ b/src/CodeWF/Pages/Tool/Converter/NuoChe.razor @@ -21,45 +21,45 @@ } } -Ų +挪车码
@if (string.IsNullOrWhiteSpace(P)) {
-

Ų

+

挪车码生成器

- - + +
- - + +
- +
- +
@@ -69,21 +69,21 @@
-

ʱͣ

+

临时停车,请挪车

-

ҵij谭ijͨУ·ť֪ͨң㾴½⡣

+

您的爱车临时停放在这里,请您挪车。

- 绰 + 联系车主 - ȥһŲ + 去生成一个挪车码
}