1.WPF UI - 現(xiàn)代化設(shè)計的開源 WPF 框架
WPF UI 是一個基于 C# 開發(fā)的, 擁有 4k star 的開源 UI 框架。WPF UI 在 WPF 的基礎(chǔ)上,提供了更多的現(xiàn)代化,流利的,直觀的設(shè)計和組件。重要的是,WPF UI 完全免費!
如果你對 WPF 比較熟悉,那么可以很快的上手這個 UI 框架,并集成中項目中去。WPF UI 提供了完善的使用文檔,對新手非常友好。
截圖
如何使用
-
使用 Visual Studio 中的 Nuget 包管理器,安裝 WPF-UI。
-
更新 App.xaml 文件,如下
<Application xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ui:ThemesDictionary Theme="Dark" /> <ui:ControlsDictionary /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
-
試試 WPF-UI 的按鈕, 盡情使用吧!
<ui:UiWindow ... xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> <Grid> <ui:Button Content="Hello World" Icon="Fluent24"/> </Grid> </ui:UiWindow>
項目地址: https://wpfui.lepo.co/
2.開源力作!使用 Blazor 和 C# 構(gòu)建 K8s Dashboard
blazor-k8s
blazor-k8s 是一個開源項目,它使用了 blazor 和 C# 構(gòu)建了 k8s dashboard。允許用戶在界面上直接操作 k8s,進(jìn)行資源管理。
部署
1 k8s部署體驗
一鍵安裝
kubectl apply -f https://raw.githubusercontent.com/weibaohui/blazork8s/main/deploy/deployment.yaml
訪問
默認(rèn)使用了nodePort開放,請訪問31999端口 http://NodePortIP:31999
docker 體驗
啟動服務(wù)器
docker run -d --name blazork8s -v ~/.kube/:/root/.kube/ -p 4001:443 -p 4000:80 ghcr.io/weibaohui/blazork8s:latest
界面預(yù)覽
項目地址:https://github.com/weibaohui/blazork8s
3. Dotnet 加解密算法庫
CryptoNet
CryptoNet 是一個簡單、快速且輕量級的非對稱和對稱加密 NuGet 庫,支持跨平臺 Windows、Linux。不依賴其他庫, 100% C# 實現(xiàn)。
CryptoNet 可以通過兩種方式使用:
- 對稱方式
- 非對稱方式
對稱方式
您使用相同的密鑰進(jìn)行加密和解密。
非對稱方式
通過非對稱方式,CryptoNet 可以使用自己生成的 RSA 密鑰對(私鑰/公鑰)來加密和解密內(nèi)容。
您可以將私鑰存儲在一臺或多臺機(jī)器上。公鑰可以輕松分發(fā)給所有客戶端。
使用示例
1.使用對稱密鑰加密和解密內(nèi)容
在下面示例中,CryptoNetAes 生成隨機(jī)的密鑰和 iv。
ICryptoNet cryptoNet = new CryptoNetAes();
var key = cryptoNet.ExportKey();
ICryptoNet encryptClient = new CryptoNetAes(key);
var encrypt = encryptClient.EncryptFromString(ConfidentialDummyData);
ICryptoNet decryptClient = new CryptoNetAes(key);
var decrypt = decryptClient.DecryptToString(encrypt);
Debug.Assert(ConfidentialDummyData == decrypt);
2.使用導(dǎo)出和導(dǎo)入, 自己生成的對稱密鑰,來加密和解密內(nèi)容
ICryptoNet cryptoNet = new CryptoNetAes();
var file = new FileInfo(SymmetricKeyFile);
cryptoNet.ExportKeyAndSave(file);
Debug.Assert(File.Exists(file.FullName));
var encrypt = cryptoNet.EncryptFromString(ConfidentialDummyData);
ICryptoNet cryptoNetKeyImport = new CryptoNetAes(file);
var decrypt = cryptoNetKeyImport.DecryptToString(encrypt);
Debug.Assert(ConfidentialDummyData == decrypt);
3. 生成非對稱 Rsa 密鑰對,導(dǎo)出私鑰和公鑰,使用公鑰加密和使用私鑰解密
ICryptoNet cryptoNet = new CryptoNetRsa();
cryptoNet.ExportKeyAndSave(new FileInfo(PrivateKeyFile), true);
cryptoNet.ExportKeyAndSave(new FileInfo(PublicKeyFile), false);
Debug.Assert(File.Exists(new FileInfo(PrivateKeyFile).FullName));
Debug.Assert(File.Exists(new FileInfo(PublicKeyFile).FullName));
ICryptoNet cryptoNetPubKey = new CryptoNetRsa(new FileInfo(PublicKeyFile));
var encrypt = cryptoNetPubKey.EncryptFromString(ConfidentialDummyData);
ICryptoNet cryptoNetPriKey = new CryptoNetRsa(new FileInfo(PrivateKeyFile));
var decrypt = cryptoNetPriKey.DecryptToString(encrypt);
Debug.Assert(ConfidentialDummyData == decrypt);
4. 使用 X509 證書用公鑰加密,然后用私鑰解密文章來源:http://www.zghlxwxcb.cn/news/detail-418160.html
X509Certificate2? certificate = CryptoNetUtils.GetCertificateFromStore("CN=Maytham");
ICryptoNet cryptoNetWithPublicKey = new CryptoNetRsa(certificate, KeyType.PublicKey);
var encryptWithPublicKey = cryptoNetWithPublicKey.EncryptFromString(ConfidentialDummyData);
ICryptoNet cryptoNetWithPrivateKey = new CryptoNetRsa(certificate, KeyType.PrivateKey);
var decryptWithPrivateKey = cryptoNetWithPrivateKey.DecryptToString(encryptWithPublicKey);
Debug.Assert(ConfidentialDummyData == decryptWithPrivateKey);
項目地址: https://github.com/maythamfahmi/CryptoNet文章來源地址http://www.zghlxwxcb.cn/news/detail-418160.html
到了這里,關(guān)于【Dotnet 工具箱】WPF UI - 現(xiàn)代化設(shè)計的開源 WPF 框架的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!