├── LICENSE ├── LuYao.Toolkit.Core ├── AppHelper.cs ├── BuildFunctionsReport.linq ├── Channels │ ├── Channel.Converts.cs │ ├── Channel.CrossBorder.cs │ ├── Channel.Encodings.cs │ ├── Channel.Files.cs │ ├── Channel.Gens.cs │ ├── Channel.Images.cs │ ├── Channel.Networks.cs │ ├── Channel.Other.cs │ ├── Channel.Texts.cs │ ├── Channel.cs │ ├── FunctionItem.cs │ └── 重新生成 Channel.linq ├── Entities │ ├── ChannelItemSession.Biz.cs │ ├── ChannelItemSession.cs │ ├── Log │ │ ├── 2022_07_27.log │ │ ├── 2022_08_04.log │ │ ├── 2022_08_08.log │ │ ├── 2022_09_13.log │ │ └── 2023_01_14.log │ ├── LuYao.Toolkit.xml │ ├── PortProxyRule.Biz.cs │ ├── PortProxyRule.cs │ ├── RdpConnection.Biz.cs │ ├── RdpConnection.cs │ ├── RdpGroup.Biz.cs │ ├── RdpGroup.cs │ ├── ViewModelState.Biz.cs │ └── ViewModelState.cs ├── Events │ ├── EntityCreatedEvent.cs │ ├── EntityDeletedEvent.cs │ ├── EntityUpdatedEvent.cs │ ├── OpenFunctionItemEvent.cs │ ├── OpenFunctionItemEventPayload.cs │ ├── OpenTabEvent.cs │ ├── PreviewFileAsStringEvent.cs │ ├── PreviewFileAsStringEventPayload.cs │ ├── ThemeChangedEvent.cs │ ├── ViewFileContentAsStringEvent.cs │ └── ViewFileContentAsStringEventPayload.cs ├── IClipboardAware.cs ├── IFileDragDropTarget.cs ├── IO │ └── TempHelper.cs ├── Icons.cs ├── LuYao.Toolkit.Core.csproj ├── Regions │ └── RegionNames.cs ├── Resources │ ├── AppResources.cs │ ├── AppResources.g.cs │ ├── BuildAppResources.linq │ ├── LuYao.Toolkit.dat │ └── TestAppResources.linq ├── Services │ ├── ClipboardService.cs │ ├── FileDialogService.cs │ ├── FileService.cs │ ├── GoogleService.cs │ ├── IOpenFileDialog.cs │ ├── ISaveFileDialog.cs │ ├── IServiceProvider.cs │ ├── IWatchToken.cs │ ├── MessageBoxService.cs │ ├── NotifyService.cs │ ├── NullServiceProvider.cs │ ├── ServiceProviderContainer.cs │ ├── SoundService.cs │ ├── TongjiService.cs │ ├── WatchFileService.cs │ └── WatchToken.cs ├── Tabs │ ├── Navs │ │ ├── BuildFromWebsite.linq │ │ ├── NavGroup.cs │ │ ├── NavGroup.g.cs │ │ └── NavItem.cs │ └── Tab.cs ├── Themes │ └── ThemeMode.cs ├── Update │ └── UpdateConfig.cs ├── Validators │ ├── Extensions.cs │ ├── IPAddressValidator.cs │ └── NetworkPortValidator.cs └── Views │ ├── ViewNameAttribute.cs │ └── ViewNames.cs ├── LuYao.Toolkit.Extensions ├── LuYao.Toolkit.Extensions.csproj ├── LuYao │ └── Toolkit │ │ ├── PortProxy │ │ ├── CmdRunner.cs │ │ ├── CmdUtil.cs │ │ └── ProxyType.cs │ │ └── Rdm │ │ ├── AudioRedirection.cs │ │ ├── AuthenticationLevel.cs │ │ ├── ColorDepth.cs │ │ ├── DesktopSize.cs │ │ ├── Events │ │ ├── AddRdpConnectionEvent.cs │ │ ├── AfterRdmSettingEvent.cs │ │ ├── EditRdpConnectionEvent.cs │ │ ├── EditRdpConnectionEventPayload.cs │ │ ├── OpenRdmSettingEvent.cs │ │ ├── OpenRdpConnectionEvent.cs │ │ ├── OpenRdpConnectionEventPayload.cs │ │ └── RdpConnectionChangedEvent.cs │ │ ├── IRdpConnection.cs │ │ ├── KeyboardRedirection.cs │ │ └── RdpConnectionValidator.cs ├── Newtonsoft │ └── Json │ │ └── Linq │ │ └── JsonFlattenExtensions.cs └── Youdao │ ├── YoudaoDictionary.cs │ ├── YoudaoPhonetic.cs │ ├── YoudaoSuggestItem.cs │ └── YoudaoWord.cs ├── LuYao.Toolkit.ViewModels ├── Channels │ ├── Converts │ │ ├── ColorConverterViewModel.cs │ │ ├── HexConvertViewModel.cs │ │ ├── IndentJsonViewModel.cs │ │ ├── IndentXmlViewModel.cs │ │ ├── JsonToCSharp.res.js │ │ ├── JsonToCSharpDemo.res.json │ │ ├── JsonToCSharpViewModel.cs │ │ ├── JsonToCsv.res.js │ │ ├── JsonToCsvDemo.res.json │ │ ├── JsonToCsvViewModel.cs │ │ ├── PostmanConverterViewModel.cs │ │ ├── RsaKeyConvertViewModel.cs │ │ ├── TranslateJsonByJsViewModel.cs │ │ ├── TranslateJsonByLiquidViewModel.cs │ │ ├── TranslateXmlByXslViewModel.cs │ │ ├── UnixTimestampViewModel.cs │ │ └── YamlToJsonViewModel.cs │ ├── CrossBorder │ │ └── MercadoToWorldFirstViewModel.cs │ ├── Encodings │ │ ├── Ascii85EncodeViewModel.cs │ │ ├── Base16EncodeViewModel.cs │ │ ├── Base62EncodeViewModel.cs │ │ ├── Base64EncodeViewModel.cs │ │ ├── EncodingViewModelBase.cs │ │ ├── HtmlEncodeViewModel.cs │ │ ├── StringZipperViewModel.cs │ │ └── UrlEncodeViewModel.cs │ ├── Files │ │ ├── CrackingMdbPasswordViewModel.cs │ │ ├── DetectFileEncodeingViewModel.cs │ │ └── HashFileViewModel.cs │ ├── Gens │ │ ├── GenAesKeyViewModel.cs │ │ ├── GenGuidViewModel.cs │ │ ├── GenLinesByRangeViewModel.cs │ │ ├── GenPasswordViewModel.cs │ │ ├── GenRsaKeyViewModel.cs │ │ ├── GenXCodeEntityViewModel.cs │ │ └── RsaKeyFormat.cs │ ├── Images │ │ ├── Base64ToImageViewModel.cs │ │ ├── GifSplitterViewModel.cs │ │ ├── ImageToBase64ViewModel.cs │ │ └── ImageToIconViewModel.cs │ ├── Networks │ │ ├── HttpProxyCheckerViewModel.cs │ │ ├── IPLookupViewModel.cs │ │ ├── PingViewModel.cs │ │ ├── PortProxy │ │ │ ├── DetailViewModel.cs │ │ │ ├── IndexViewModel.cs │ │ │ ├── PortProxyItem.cs │ │ │ └── PortProxyItemValidator.cs │ │ ├── RemoteDesktopManagerViewModel.cs │ │ ├── TrafficMonitorViewModel.GetAllTcpConnections.cs │ │ ├── TrafficMonitorViewModel.cs │ │ ├── UrlAnalyzerViewModel.cs │ │ ├── UserAgentParserViewModel.cs │ │ └── WhoisViewModel.cs │ └── Texts │ │ ├── CsvReaderViewModel.cs │ │ ├── FullHalfConvertViewModel.cs │ │ ├── GoogleTranslateViewModel.cs │ │ ├── HashCalculatorViewModel.cs │ │ ├── LogReaderViewModel.cs │ │ ├── RegexEvaluatorViewModel.cs │ │ ├── TextJoinViewModel.cs │ │ └── YoudaoDictionaryViewModel.cs ├── Drawing │ └── IconFactory.cs ├── LuYao.Toolkit.ViewModels.csproj ├── MainWindowViewModel.cs ├── Rdm │ ├── RdpConnection.cs │ ├── RdpConnectionBase.cs │ ├── RdpConnectionCsvMap.cs │ ├── RdpGroup.cs │ └── RdpGroupValidator.cs ├── TabItem.cs ├── Tabs │ ├── Explorer │ │ └── IndexViewModel.cs │ ├── Navs │ │ └── IndexViewModel.cs │ ├── Rdp │ │ └── IndexViewModel.cs │ └── Session │ │ ├── ChannelItemSessionItem.cs │ │ └── IndexViewModel.cs ├── UI │ ├── DetailViewModelBase.cs │ ├── IMasterDetailViewModel.cs │ └── MasterDetailViewModelBase.cs ├── ViewModelBase.cs └── ViewStates │ ├── IViewStateHost.cs │ ├── ViewStateBag.cs │ ├── ViewStateItem.cs │ └── WatchViewStateAttribute.cs ├── LuYao.Toolkit.sln ├── LuYao.Toolkit ├── App.config ├── App.ico ├── App.xaml ├── App.xaml.cs ├── AppRegisterTypes.cs ├── AppRegisterTypes.linq ├── AppRegisterTypes.liquid ├── AssemblyInfo.cs ├── Attaches │ ├── ComboBoxAttach.cs │ ├── FileDragDropAttach.cs │ ├── TextBoxAttach.cs │ └── UniformSpacingPanelAttach.cs ├── Behaviors │ ├── AvalonEditBehaviour.cs │ ├── ListBoxScrollIntoNewAddBehaviour.cs │ └── UIElementBehaviour.cs ├── Channels │ ├── Converts │ │ ├── ColorConverter.xaml │ │ ├── ColorConverter.xaml.cs │ │ ├── HexConvert.xaml │ │ ├── HexConvert.xaml.cs │ │ ├── IndentJson.xaml │ │ ├── IndentJson.xaml.cs │ │ ├── IndentXml.xaml │ │ ├── IndentXml.xaml.cs │ │ ├── JsonToCSharp.xaml │ │ ├── JsonToCSharp.xaml.cs │ │ ├── JsonToCsv.xaml │ │ ├── JsonToCsv.xaml.cs │ │ ├── PostmanConverter.xaml │ │ ├── PostmanConverter.xaml.cs │ │ ├── RsaKeyConvert.xaml │ │ ├── RsaKeyConvert.xaml.cs │ │ ├── TranslateJsonByJs.xaml │ │ ├── TranslateJsonByJs.xaml.cs │ │ ├── TranslateJsonByLiquid.xaml │ │ ├── TranslateJsonByLiquid.xaml.cs │ │ ├── TranslateXmlByXsl.xaml │ │ ├── TranslateXmlByXsl.xaml.cs │ │ ├── UnixTimestamp.xaml │ │ ├── UnixTimestamp.xaml.cs │ │ ├── YamlToJson.xaml │ │ └── YamlToJson.xaml.cs │ ├── CrossBorder │ │ ├── MercadoToWorldFirst.xaml │ │ └── MercadoToWorldFirst.xaml.cs │ ├── Encodings │ │ ├── Ascii85Encode.xaml │ │ ├── Ascii85Encode.xaml.cs │ │ ├── Base16Encode.xaml │ │ ├── Base16Encode.xaml.cs │ │ ├── Base62Encode.xaml │ │ ├── Base62Encode.xaml.cs │ │ ├── Base64Encode.xaml │ │ ├── Base64Encode.xaml.cs │ │ ├── HtmlEncode.xaml │ │ ├── HtmlEncode.xaml.cs │ │ ├── StringZipper.xaml │ │ ├── StringZipper.xaml.cs │ │ ├── UrlEncode.xaml │ │ └── UrlEncode.xaml.cs │ ├── Files │ │ ├── DetectFileEncodeing.xaml │ │ ├── DetectFileEncodeing.xaml.cs │ │ ├── HashFile.xaml │ │ └── HashFile.xaml.cs │ ├── Gens │ │ ├── GenAesKey.xaml │ │ ├── GenAesKey.xaml.cs │ │ ├── GenGuid.xaml │ │ ├── GenGuid.xaml.cs │ │ ├── GenLinesByRange.xaml │ │ ├── GenLinesByRange.xaml.cs │ │ ├── GenPassword.xaml │ │ ├── GenPassword.xaml.cs │ │ ├── GenRsaKey.xaml │ │ ├── GenRsaKey.xaml.cs │ │ ├── GenXCodeEntity.xaml │ │ └── GenXCodeEntity.xaml.cs │ ├── Images │ │ ├── Base64ToImage.xaml │ │ ├── Base64ToImage.xaml.cs │ │ ├── GifSplitter.xaml │ │ ├── GifSplitter.xaml.cs │ │ ├── ImageToBase64.xaml │ │ ├── ImageToBase64.xaml.cs │ │ ├── ImageToIcon.xaml │ │ └── ImageToIcon.xaml.cs │ ├── Networks │ │ ├── HttpProxyChecker.xaml │ │ ├── HttpProxyChecker.xaml.cs │ │ ├── IPLookup.xaml │ │ ├── IPLookup.xaml.cs │ │ ├── Ping.xaml │ │ ├── Ping.xaml.cs │ │ ├── PortProxy │ │ │ ├── Detail.xaml │ │ │ ├── Detail.xaml.cs │ │ │ ├── Index.xaml │ │ │ └── Index.xaml.cs │ │ ├── RemoteDesktopManager.xaml │ │ ├── RemoteDesktopManager.xaml.cs │ │ ├── TrafficMonitor.xaml │ │ ├── TrafficMonitor.xaml.cs │ │ ├── UrlAnalyzer.xaml │ │ ├── UrlAnalyzer.xaml.cs │ │ ├── UserAgentParser.xaml │ │ ├── UserAgentParser.xaml.cs │ │ ├── Whois.xaml │ │ └── Whois.xaml.cs │ ├── Other │ │ ├── SystemToolkit.xaml │ │ └── SystemToolkit.xaml.cs │ └── Texts │ │ ├── CsvReader.xaml │ │ ├── CsvReader.xaml.cs │ │ ├── FullHalfConvert.xaml │ │ ├── FullHalfConvert.xaml.cs │ │ ├── GoogleTranslate.xaml │ │ ├── GoogleTranslate.xaml.cs │ │ ├── HashCalculator.xaml │ │ ├── HashCalculator.xaml.cs │ │ ├── LogReader.xaml │ │ ├── LogReader.xaml.cs │ │ ├── RegexEvaluator.xaml │ │ ├── RegexEvaluator.xaml.cs │ │ ├── TextJoin.xaml │ │ ├── TextJoin.xaml.cs │ │ ├── YoudaoDictionary.xaml │ │ └── YoudaoDictionary.xaml.cs ├── Controls │ ├── AvalonEdit │ │ ├── Highlighting │ │ │ ├── CSharp-Mode-Dark.xshd │ │ │ ├── CSharp-Mode-Default.xshd │ │ │ ├── Defines.cs │ │ │ ├── Json-Mode-Dark.xshd │ │ │ ├── Json-Mode-Default.xshd │ │ │ ├── Log.xshd │ │ │ ├── XML-Mode-Dark.xshd │ │ │ └── XML-Mode-Default.xshd │ │ ├── HighlightingHelper.cs │ │ ├── JsonFoldingStrategy.cs │ │ ├── SearchPanel.xaml │ │ └── TruncateLongLinesElementGenerator.cs │ ├── CodeEditor.Commands.cs │ ├── CodeEditor.Context.cs │ ├── CodeEditor.Highlighting.cs │ ├── CodeEditor.xaml │ ├── CodeEditor.xaml.cs │ ├── DirectorySelector.xaml │ ├── DirectorySelector.xaml.cs │ ├── FileSelector.xaml │ ├── FileSelector.xaml.cs │ ├── FormItemContainer.cs │ ├── MasterDetailLayout.cs │ ├── TextBlockWithIconBox.cs │ ├── Utils │ │ └── Boxes.cs │ └── WindowToolbox.cs ├── Converters │ ├── ByteCountToDisplaySizeConverter.cs │ ├── DateTimeToRelativeConverter.cs │ ├── EnumToBooleanConverter.cs │ ├── EnumToDescriptionConverter.cs │ ├── EnumToVisibilityConverter.cs │ ├── FunctionBackgroundConverter.cs │ ├── FunctionBackgroundConverter.linq │ ├── LanguageCodeToNameConverter.cs │ ├── PathToFileNameConverter.cs │ ├── PathToIconConverter.cs │ ├── RegexMatchPositionConverter.cs │ ├── SingleLineConverter.cs │ ├── StringIsNotNullOrEmptyConverter.cs │ └── TruncateStringConverter.cs ├── Dialogs │ ├── DialogWindow.xaml │ ├── DialogWindow.xaml.cs │ ├── MultiboxingDialog.xaml │ ├── MultiboxingDialog.xaml.cs │ ├── MultiboxingDialogViewModel.cs │ ├── MultiboxingDialogWindow.xaml │ ├── MultiboxingDialogWindow.xaml.cs │ ├── PreviewFileAsStringDialog.xaml │ ├── PreviewFileAsStringDialog.xaml.cs │ ├── PreviewFileAsStringDialogViewModel.cs │ ├── ToolkitSettingsDialog.xaml │ ├── ToolkitSettingsDialog.xaml.cs │ └── ToolkitSettingsDialogViewModel.cs ├── Helpers │ └── ComboBoxHelper.cs ├── IO │ ├── FileType.cs │ ├── FileTypeExtensions.cs │ └── FileTypeExtensionsAttribute.cs ├── IPLookup.dat ├── LuYao.Toolkit.csproj ├── LuYao.Toolkit.csproj.user ├── LuYaoCommands.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── ProcessManager.cs ├── Rdm │ ├── Dialogs │ │ ├── RdmSettingDialog.xaml │ │ ├── RdmSettingDialog.xaml.cs │ │ ├── RdmSettingViewModel.cs │ │ ├── RdpConnectionDetailDialog.xaml │ │ ├── RdpConnectionDetailDialog.xaml.cs │ │ ├── RdpConnectionDetailViewModel.cs │ │ ├── RdpGroupDetailDialog.xaml │ │ ├── RdpGroupDetailDialog.xaml.cs │ │ └── RdpGroupDetailViewModel.cs │ ├── IMsRdpClient.cs │ ├── IMsRdpClientHandler.cs │ ├── MsRdpClientFactory.cs │ ├── RdpConnectStatus.cs │ ├── RdpSession.Designer.cs │ ├── RdpSession.cs │ ├── RdpSession.resx │ └── StatusChangedEventArgs.cs ├── Resources │ ├── JetBrainsMono.ttf │ ├── SystemToolkit │ │ ├── calc.ico │ │ ├── certmgr.ico │ │ ├── cmd.ico │ │ ├── credential.ico │ │ ├── datetime.ico │ │ ├── deskicon.ico │ │ ├── devmgr.ico │ │ ├── disks.ico │ │ ├── env.ico │ │ ├── eventlog.ico │ │ ├── firewall.ico │ │ ├── gpedit.ico │ │ ├── hosts.ico │ │ ├── ipv4.ico │ │ ├── ipv6.ico │ │ ├── killexplorer.ico │ │ ├── netconnections.ico │ │ ├── pcname.ico │ │ ├── performance.ico │ │ ├── perfsettings.ico │ │ ├── powercfg.ico │ │ ├── poweroff.ico │ │ ├── powershell.ico │ │ ├── program.ico │ │ ├── proxy.ico │ │ ├── reboot.ico │ │ ├── recyclebin.png │ │ ├── regedit.ico │ │ ├── resetexplorer.ico │ │ ├── resmon.ico │ │ ├── route.ico │ │ ├── secpolicy.ico │ │ ├── services.ico │ │ ├── share.ico │ │ ├── systeminfo.ico │ │ ├── taskmgr.ico │ │ ├── tasksch.ico │ │ ├── uac.ico │ │ ├── users.ico │ │ ├── version.ico │ │ ├── wallpaper.ico │ │ └── wsl.ico │ ├── Toolbox.png │ ├── Update.png │ └── find.png ├── Services │ ├── IGrowlTokenProvider.cs │ ├── ServiceProvider.cs │ └── TongjiServiceProvider.cs ├── Tabs │ ├── Explorer │ │ ├── Index.xaml │ │ └── Index.xaml.cs │ ├── Navs │ │ ├── Index.xaml │ │ └── Index.xaml.cs │ ├── Rdp │ │ ├── Controls │ │ │ ├── RdpTabItem.cs │ │ │ └── RdpTabItemHeader.cs │ │ ├── Index.xaml │ │ └── Index.xaml.cs │ └── Session │ │ ├── Index.xaml │ │ └── Index.xaml.cs ├── Themes │ ├── Basic │ │ ├── Converters.xaml │ │ ├── Geometries.xaml │ │ └── MaterialToGeometry.linq │ ├── Controls │ │ ├── DataGrid.xaml │ │ ├── FormItemContainer.xaml │ │ ├── MasterDetailLayout.xaml │ │ ├── RdpTabItemHeader.xaml │ │ ├── TextBlockWithIconBox.xaml │ │ ├── TextEditor.xaml │ │ └── Window.xaml │ ├── Generic.txt │ ├── Generic.xaml │ ├── SkinDark.xaml │ ├── SkinDefault.xaml │ ├── Theme.xaml │ ├── ThemeManager.cs │ └── XamlCombine.exe ├── ToolkitConfig.cs └── Update │ ├── FindNewVersionDialog.xaml │ ├── FindNewVersionDialog.xaml.cs │ ├── FindNewVersionDialogViewModel.cs │ ├── Update.xaml │ ├── Update.xaml.cs │ └── UpdateViewModel.cs ├── README.md ├── common.props ├── delete-bin-obj-folders.bat └── libs ├── AxInterop.MSTSCLib.dll ├── Interop.MSTSCLib.dll ├── LuYao.Common.deps.json ├── LuYao.Common.dll ├── LuYao.Common.pdb └── LuYao.Common.xml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 landv coderbusy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/AppHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace LuYao.Toolkit 5 | { 6 | public static class AppHelper 7 | { 8 | public static Type ViewModelTypeResolver(Type viewType, params Assembly[] assemblies) 9 | { 10 | var name = $"{viewType.FullName}ViewModel"; 11 | foreach (var assembly in assemblies) 12 | { 13 | var type = assembly.GetType(name); 14 | if (type != null) return type; 15 | } 16 | return null; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Channels/Channel.CrossBorder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Channels; 4 | 5 | public partial class Channel 6 | { 7 | public static CrossBorderChannel CrossBorder { get; } = new CrossBorderChannel(); 8 | public class CrossBorderChannel : Channel 9 | { 10 | public FunctionItem MercadoToWorldFirst { get; } 11 | 12 | public CrossBorderChannel() : base(nameof(CrossBorder), "跨境电商", Icons.Shopping) 13 | { 14 | this.MercadoToWorldFirst = new FunctionItem(this, Guid.Parse("846209761E14421BB59B068225443F31"), nameof(MercadoToWorldFirst)) 15 | { 16 | Title = "美客多转万里汇", 17 | Icon = Icons.MicrosoftExcel, 18 | Description = "将美客多订单报表转为万里汇所需 Excel", 19 | View = Views.ViewNames.Channels.CrossBorder.MercadoToWorldFirst, 20 | IsNew = true, 21 | UseNetwork = false, 22 | IsDocument = false, 23 | Multiboxing = true, 24 | Keywords = new string[] { "MeiKeDuo", "MKD", "Mercado", "WanLiHui", "WLH" }, 25 | }; 26 | 27 | this.Items = new[] 28 | { 29 | MercadoToWorldFirst, 30 | }; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Channels/Channel.Other.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Channels; 4 | 5 | public partial class Channel 6 | { 7 | public static OtherChannel Other { get; } = new OtherChannel(); 8 | public class OtherChannel : Channel 9 | { 10 | public FunctionItem SystemToolkit { get; } 11 | 12 | public OtherChannel() : base(nameof(Other), "其他工具", Icons.Puzzle) 13 | { 14 | this.SystemToolkit = new FunctionItem(this, Guid.Parse("D8F1C1B5B3674EB6AE1BDB05EF15BC16"), nameof(SystemToolkit)) 15 | { 16 | Title = "系统工具", 17 | Icon = Icons.MicrosoftWindows, 18 | Description = "Windows 系统工具", 19 | View = Views.ViewNames.Channels.Other.SystemToolkit, 20 | IsNew = true, 21 | UseNetwork = false, 22 | IsDocument = false, 23 | Multiboxing = false, 24 | Keywords = new string[] { "XiTongGongJu", "XTGJ" }, 25 | }; 26 | 27 | this.Items = new[] 28 | { 29 | SystemToolkit, 30 | }; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Channels/Channel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace LuYao.Toolkit.Channels; 5 | 6 | public partial class Channel 7 | { 8 | public static bool TryGetItem(Guid id, out FunctionItem item) 9 | { 10 | return FunctionItem._maps.TryGetValue(id, out item); 11 | } 12 | static Channel() 13 | { 14 | Channels = new Channel[] 15 | { 16 | Gens, 17 | Networks, 18 | Converts, 19 | Texts, 20 | Encodings, 21 | Files, 22 | Images, 23 | CrossBorder, 24 | Other 25 | }; 26 | } 27 | private Channel(string name, string title, string icon) 28 | { 29 | Name = name; 30 | Title = title; 31 | Icon = icon; 32 | } 33 | 34 | public string Name { get; } 35 | public string Title { get; } 36 | public string Icon { get; } 37 | public IReadOnlyList Items { get; private set; } 38 | public static IReadOnlyList Channels { get; } 39 | } 40 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Entities/Log/2022_07_27.log: -------------------------------------------------------------------------------- 1 | 14:15:45.514 4 N T 实体缓存(24)总次数 2 [LuYao.Toolkit.Entities.ViewModelState] 2 | 14:15:45.514 4 N T 实体缓存(36)总次数 1 [LuYao.Toolkit.Entities.FunctionViewItem] 3 | 18:15:45.532 4 N T 实体缓存(24)总次数 3 [LuYao.Toolkit.Entities.ViewModelState] 4 | 18:15:45.533 4 N T 实体缓存(36)总次数 3 [LuYao.Toolkit.Entities.FunctionViewItem] 5 | 19:48:32.100 4 N T 慢SQL[1,180ms] [LuYao.Toolkit] Update ViewModelState Set Value='{"UseNumber":true,"UseSymbols":true,"Length":80}' Where Id=1 6 | 19:48:32.101 4 N T 任务 [7]<>c.<.cctor>b__0_0 (2147483647ms) 耗时过长 1,198ms,建议使用异步任务Async=true 7 | 20:15:45.535 4 N T 实体缓存(24)总次数 3 [LuYao.Toolkit.Entities.ViewModelState] 8 | 20:15:45.535 4 N T 实体缓存(36)总次数 4 [LuYao.Toolkit.Entities.FunctionViewItem] 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Entities/Log/2022_08_08.log: -------------------------------------------------------------------------------- 1 | 19:34:37.489 1 N - 导入模型:D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit.Core\Entities\LuYao.Toolkit.xml 2 | 19:34:37.547 1 N - 生成实体类 D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit.Core\Entities 3 | 19:34:37.550 1 N - 生成 ViewModelState ViewModelState {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 4 | 19:34:37.562 1 N - 生成 ViewModelState ViewModelState {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 5 | 19:34:37.578 1 N - 生成 ChannelItemSession ChannelItemSession {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 6 | 19:34:37.578 1 N - 生成 ChannelItemSession ChannelItemSession {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 7 | 19:34:37.579 1 N - 生成 RdoIdCard RdoIdCard {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 8 | 19:34:37.579 1 N - 生成 RdoIdCard RdoIdCard {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 9 | 19:34:37.579 1 N - 生成 RdoFolder RdoFolder {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 10 | 19:34:37.583 1 N - 生成 RdoFolder RdoFolder {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 11 | 19:34:37.583 1 N - 生成 RdoConnection RdoConnection {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 12 | 19:34:37.584 1 N - 生成 RdoConnection RdoConnection {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 13 | 19:34:38.871 7 Y EQ [LuYao.Toolkit] Update ChannelItemSession Set LastClick='2022-08-08 19:34:35' Where Id='629fe6ac-3488-4045-9f46-fb59e195fa47' 14 | 19:37:04.218 10 N T 实体缓存(23)总次数 2 [LuYao.Toolkit.Entities.ChannelItemSession] 15 | 19:37:04.218 10 N T 实体缓存(14)总次数 37,命中 27(72.97%) [LuYao.Toolkit.Entities.ViewModelState] 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Entities/Log/2022_09_13.log: -------------------------------------------------------------------------------- 1 | 11:36:01.101 1 N - 导入模型:D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit.Core\Entities\LuYao.Toolkit.xml 2 | 11:36:01.187 1 N - 生成实体类 D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit.Core\Entities 3 | 11:36:01.190 1 N - 生成 ViewModelState ViewModelState {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 4 | 11:36:01.202 1 N - 生成 ViewModelState ViewModelState {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 5 | 11:36:01.216 1 N - 生成 ChannelItemSession ChannelItemSession {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 6 | 11:36:01.217 1 N - 生成 ChannelItemSession ChannelItemSession {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 7 | 11:36:01.217 1 N - 生成 RdpConnection RdpConnection {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 8 | 11:36:01.226 1 N - 生成 RdpConnection RdpConnection {"BaseClass":"Entity","Namespace":"LuYao.Toolkit.Entities"} 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/EntityCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using XCode; 3 | 4 | namespace LuYao.Toolkit.Events; 5 | 6 | public class EntityCreatedEvent : PubSubEvent where TEntity : IEntity 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/EntityDeletedEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using XCode; 3 | 4 | namespace LuYao.Toolkit.Events; 5 | 6 | public class EntityDeletedEvent : PubSubEvent where TEntity : IEntity 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/EntityUpdatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using XCode; 8 | 9 | namespace LuYao.Toolkit.Events; 10 | 11 | public class EntityUpdatedEvent : PubSubEvent where TEntity : IEntity 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/OpenFunctionItemEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Events 4 | { 5 | public class OpenFunctionItemEvent : PubSubEvent { } 6 | } 7 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/OpenFunctionItemEventPayload.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Channels; 2 | 3 | namespace LuYao.Toolkit.Events; 4 | 5 | public class OpenFunctionItemEventPayload 6 | { 7 | public FunctionItem Item { get; } 8 | 9 | public OpenFunctionItemEventPayload(FunctionItem item) 10 | { 11 | Item = item; 12 | } 13 | public bool IsNewSession { get; set; } 14 | public bool IsMultiboxing { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/OpenTabEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Events 4 | { 5 | public class OpenTabEvent : PubSubEvent { } 6 | } 7 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/PreviewFileAsStringEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace LuYao.Toolkit.Events; 7 | 8 | public class PreviewFileAsStringEvent : PubSubEvent 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/PreviewFileAsStringEventPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LuYao.Toolkit.Events; 6 | 7 | public class PreviewFileAsStringEventPayload 8 | { 9 | public PreviewFileAsStringEventPayload(string fullName, Encoding encoding) 10 | { 11 | FullName = fullName; 12 | Encoding = encoding; 13 | } 14 | 15 | public string FullName { get; } 16 | public Encoding Encoding { get; } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/ThemeChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Themes; 2 | using Prism.Events; 3 | 4 | namespace LuYao.Toolkit.Events; 5 | 6 | public class ThemeChangedEvent : PubSubEvent 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/ViewFileContentAsStringEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace LuYao.Toolkit.Events; 7 | 8 | public class ViewFileContentAsStringEvent : PubSubEvent 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Events/ViewFileContentAsStringEventPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace LuYao.Toolkit.Events; 7 | 8 | public class ViewFileContentAsStringEventPayload 9 | { 10 | public ViewFileContentAsStringEventPayload(string path, Encoding encoding) 11 | { 12 | this.Path = path; 13 | this.Encoding = encoding; 14 | } 15 | public string Path { get; } 16 | public Encoding Encoding { get; } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/IClipboardAware.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit; 2 | 3 | public interface IClipboardAware 4 | { 5 | void OnPaste(); 6 | } 7 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/IFileDragDropTarget.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit; 2 | 3 | public interface IFileDragDropTarget 4 | { 5 | void OnFilesDropped(string group, string[] filepaths); 6 | } 7 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/LuYao.Toolkit.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net7.0 6 | LuYao.Toolkit 7 | latest 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | ..\libs\LuYao.Common.dll 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Regions/RegionNames.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LuYao.Toolkit.Regions; 6 | 7 | public static class RegionNames 8 | { 9 | public static string MainRegion => nameof(MainRegion); 10 | public static string WorkingRegion => nameof(WorkingRegion); 11 | public static string PortProxyDetailRegion => nameof(PortProxyDetailRegion); 12 | } 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Resources/AppResources.g.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Resources; 2 | 3 | // Build Time : 2023-02-01T14:48:31.0333983+08:00 4 | // Version : 1675234111 5 | partial class AppResources 6 | { 7 | public static string Channels_Converts_JsonToCSharp_JS => Get(0); 8 | public static string Channels_Converts_JsonToCSharpDemo_JSON => Get(1); 9 | public static string Channels_Converts_JsonToCsv_JS => Get(2); 10 | public static string Channels_Converts_JsonToCsvDemo_JSON => Get(3); 11 | } 12 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Resources/LuYao.Toolkit.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit.Core/Resources/LuYao.Toolkit.dat -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Resources/TestAppResources.linq: -------------------------------------------------------------------------------- 1 | 2 | D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit\bin\Debug\net7.0-windows\LuYao.Common.dll 3 | D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit\bin\Debug\net7.0-windows\LuYao.Toolkit.Core.dll 4 | LuYao.Toolkit.Services 5 | System.IO.Compression 6 | LuYao.Toolkit.Resources 7 | 8 | 9 | for (int i = 0; i < AppResources.Count; i++) 10 | { 11 | AppResources.Get(i).Length.Dump(); 12 | } 13 | AppResources.Version.Dump(); -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/ClipboardService.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Services; 2 | public static class ClipboardService 3 | { 4 | public static void CopyText(string text) 5 | { 6 | if (string.IsNullOrWhiteSpace(text)) return; 7 | ServiceProviderContainer.Provider.CopyTextToClipboard(text); 8 | } 9 | public static string GetText() => ServiceProviderContainer.Provider.GetClipboardText(); 10 | public static string GetImage() => ServiceProviderContainer.Provider.GetClipboardImage(); 11 | } 12 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/FileDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Services; 2 | 3 | public static class FileDialogService 4 | { 5 | public static IOpenFileDialog CreateOpenFileDialog() => ServiceProviderContainer.Provider.CreateOpenFileDialog(); 6 | public static ISaveFileDialog CreateSaveFileDialog() => ServiceProviderContainer.Provider.CreateSaveFileDialog(); 7 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/FileService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using UtfUnknown; 8 | 9 | namespace LuYao.Toolkit.Services; 10 | 11 | public static class FileService 12 | { 13 | public static Encoding GetEncoding(string filePath) 14 | { 15 | var result = CharsetDetector.DetectFromFile(filePath); 16 | var encoding = Encoding.UTF8; 17 | if (result.Detected != null && result.Detected.Encoding != null) { encoding = result.Detected.Encoding; } 18 | return encoding; 19 | } 20 | public static async Task ReadAllTextAsync(string filePath) 21 | { 22 | var encoding = GetEncoding(filePath); 23 | using (var fs = File.OpenRead(filePath)) 24 | { 25 | using (var sr = new StreamReader(fs, encoding)) 26 | { 27 | return await sr.ReadToEndAsync(); 28 | } 29 | } 30 | } 31 | 32 | public static string ReadAllText(string filePath) 33 | { 34 | var encoding = GetEncoding(filePath); 35 | using (var fs = File.OpenRead(filePath)) 36 | { 37 | using (var sr = new StreamReader(fs, encoding)) 38 | { 39 | return sr.ReadToEnd(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/IOpenFileDialog.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Services; 2 | 3 | public interface IOpenFileDialog 4 | { 5 | string Title { get; set; } 6 | string Filter { get; set; } 7 | bool Multiselect { get; set; } 8 | bool ShowDialog(); 9 | string FileName { get; set; } 10 | string[] FileNames { get; } 11 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/ISaveFileDialog.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Services 2 | { 3 | public interface ISaveFileDialog 4 | { 5 | string Title { get; set; } 6 | 7 | string InitialDirectory { get; set; } 8 | 9 | string Filter { get; set; } 10 | 11 | bool AddExtension { get; set; } 12 | 13 | string FileName { get; set; } 14 | string DefaultExt { get; set; } 15 | 16 | 17 | bool ShowDialog(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/IServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace LuYao.Toolkit.Services; 4 | 5 | public interface IServiceProvider 6 | { 7 | void CopyTextToClipboard(string text); 8 | string GetClipboardText(); 9 | string GetClipboardImage(); 10 | IOpenFileDialog CreateOpenFileDialog(); 11 | ISaveFileDialog CreateSaveFileDialog(); 12 | void NotifyQuickTip(string msg); 13 | void NotifySuccess(string msg); 14 | void NotifyInfo(string msg); 15 | void NotifyWarning(string msg); 16 | void NotifyFail(string msg); 17 | void NotifyClear(); 18 | bool MessageBoxConfirm(string message, string title); 19 | void MessageBoxAlert(string message, string title); 20 | void Tongji(string url); 21 | Task PlaySound(string url); 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/IWatchToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace LuYao.Toolkit.Services; 5 | 6 | public interface IWatchToken : IDisposable 7 | { 8 | event EventHandler Changed; 9 | string FullName { get; } 10 | } 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/MessageBoxService.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Services; 2 | 3 | public static class MessageBoxService 4 | { 5 | 6 | public static bool Confirm(string message, string title) => ServiceProviderContainer.Provider.MessageBoxConfirm(message, title); 7 | public static bool Confirm(string message) => Confirm(message, "确认"); 8 | public static void Alert(string message, string title) => ServiceProviderContainer.Provider.MessageBoxAlert(message, title); 9 | public static void Alert(string message) => Alert(message, "提示"); 10 | } 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/NotifyService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Services; 4 | 5 | public static class NotifyService 6 | { 7 | public static void QuickTip(string msg) => ServiceProviderContainer.Provider.NotifyQuickTip(msg); 8 | public static void Success(string msg) => ServiceProviderContainer.Provider.NotifySuccess(msg); 9 | public static void Info(string msg) => ServiceProviderContainer.Provider.NotifyInfo(msg); 10 | public static void Warning(string msg) => ServiceProviderContainer.Provider.NotifyWarning(msg); 11 | public static void Warning(Exception e) => ServiceProviderContainer.Provider.NotifyWarning(e.Message); 12 | public static void Fail(string msg) => ServiceProviderContainer.Provider.NotifyFail(msg); 13 | public static void Fail(Exception e) => ServiceProviderContainer.Provider.NotifyFail(e.Message); 14 | public static void Clear() => ServiceProviderContainer.Provider.NotifyClear(); 15 | } 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/ServiceProviderContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Services; 4 | 5 | public static class ServiceProviderContainer 6 | { 7 | public static IServiceProvider Provider { get; private set; } = new NullServiceProvider(); 8 | public static void SetProvider(IServiceProvider provider) 9 | { 10 | Provider = provider ?? throw new ArgumentNullException(nameof(provider)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/SoundService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace LuYao.Toolkit.Services 4 | { 5 | public static class SoundService 6 | { 7 | public static async Task Play(string url) 8 | { 9 | if (string.IsNullOrWhiteSpace(url)) return; 10 | await ServiceProviderContainer.Provider.PlaySound(url); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/TongjiService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Services; 4 | 5 | public static class TongjiService 6 | { 7 | public static void Tongji(string url) 8 | { 9 | ServiceProviderContainer.Provider.Tongji(url); 10 | } 11 | public static void Tongji(string url, object args) 12 | { 13 | var qs = System.Web.HttpUtility.ParseQueryString(string.Empty); 14 | if (args != null) 15 | { 16 | var type = args.GetType(); 17 | foreach (var o in type.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public)) 18 | { 19 | if (o.CanRead == false) continue; 20 | var value = o.GetValue(args); 21 | if (value != null) qs[o.Name] = value.ToString(); 22 | } 23 | } 24 | ServiceProviderContainer.Provider.Tongji($"{url}?{qs}"); 25 | } 26 | public static void Tongji(Type type) 27 | { 28 | ServiceProviderContainer.Provider.Tongji(type.FullName); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Services/WatchFileService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace LuYao.Toolkit.Services; 5 | 6 | public static class WatchFileService 7 | { 8 | public static IWatchToken Watch(string file, NotifyFilters filter = NotifyFilters.LastWrite | NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.Size, int delay = 500) 9 | { 10 | if (string.IsNullOrWhiteSpace(file)) throw new ArgumentNullException(nameof(file)); 11 | 12 | var watch = new FileSystemWatcher 13 | { 14 | NotifyFilter = filter, 15 | Path = Path.GetDirectoryName(file), 16 | Filter = Path.GetFileName(file), 17 | }; 18 | 19 | return new WatchToken(watch, file, delay); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Tabs/Navs/NavGroup.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace LuYao.Toolkit.Tabs.Navs; 5 | 6 | public partial class NavGroup 7 | { 8 | public string Title { get; set; } 9 | public NavItem[] Items { get; set; } 10 | public static IReadOnlyCollection GetAll() => JsonConvert.DeserializeObject>(StringZipper.Unzip(Data)); 11 | } 12 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Tabs/Navs/NavItem.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Tabs.Navs; 2 | 3 | public class NavItem 4 | { 5 | public string Title { get; set; } 6 | public string Icon { get; set; } 7 | public string Url { get; set; } 8 | public string Favicon { get; set; } 9 | public string Description { get; set; } 10 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Tabs/Tab.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | 3 | namespace LuYao.Toolkit.Tabs; 4 | 5 | public class Tab 6 | { 7 | public string Icon { get; } 8 | public string IconArchived { get; } 9 | public string Title { get; } 10 | public string View { get; } 11 | private Tab(string view, string title, string icon, string archived = null) 12 | { 13 | View = view; 14 | Title = title; 15 | Icon = IconArchived = icon; 16 | if (!string.IsNullOrWhiteSpace(archived)) IconArchived = archived; 17 | } 18 | public static Tab Explorer { get; } = new Tab(ViewNames.Tabs.Explorer.Index, "浏览", Icons.Apps); 19 | public static Tab Session { get; } = new Tab(ViewNames.Tabs.Session.Index, "会话", Icons.Chat); 20 | public static Tab Navs { get; } = new Tab(ViewNames.Tabs.Navs.Index, "导航", Icons.Web); 21 | public static Tab Rdp { get; } = new Tab(ViewNames.Tabs.Rdp.Index, "远程", Icons.RemoteDesktop); 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Themes/ThemeMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LuYao.Toolkit.Themes; 6 | 7 | public enum ThemeMode 8 | { 9 | Light = 1, 10 | Dark = 2, 11 | } 12 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Update/UpdateConfig.cs: -------------------------------------------------------------------------------- 1 | using LuYao.IO.Updating; 2 | using NewLife.Configuration; 3 | using System; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | 7 | namespace LuYao.Toolkit.Update; 8 | 9 | public class UpdateConfig : Config 10 | { 11 | public UpdateConfig() => NextCheckUpdate = DateTime.Now; 12 | public static string Endpoint => "https://luyao.coderbusy.com/update"; 13 | public DateTime NextCheckUpdate { get; set; } 14 | public string GetDataUrl() 15 | { 16 | return $"{Endpoint.Trim('/')}/data.xml?t={DateTimeOffset.Now.ToUnixTimeSeconds()}"; 17 | } 18 | public async Task GetLastVersion() 19 | { 20 | using (var http = new HttpClient()) 21 | { 22 | var xml = await http.GetStringAsync(GetDataUrl()); 23 | return UpdatePackageHelper.Deserialize(xml); 24 | } 25 | } 26 | public void ResetNextCheckTime() 27 | { 28 | NextCheckUpdate = DateTime.Now.AddDays(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Validators/Extensions.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using System; 3 | 4 | namespace LuYao.Toolkit.Validators; 5 | public static class Extensions 6 | { 7 | public static IRuleBuilderOptions IPAddress(this IRuleBuilder ruleBuilder) 8 | { 9 | return ruleBuilder.SetValidator(new IPAddressValidator()); 10 | } 11 | public static IRuleBuilderOptions NetworkPort(this IRuleBuilder ruleBuilder) 12 | { 13 | return ruleBuilder.SetValidator(new NetworkPortValidator()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Validators/IPAddressValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using FluentValidation.Validators; 3 | using System.Net; 4 | 5 | namespace LuYao.Toolkit.Validators; 6 | 7 | public class IPAddressValidator : PropertyValidator 8 | { 9 | public override string Name => "IPAddressValidator"; 10 | 11 | public override bool IsValid(ValidationContext context, string value) 12 | { 13 | if (value == null) return true; 14 | if (IPAddress.TryParse(value, out IPAddress ipAddress)) return true; 15 | return false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Validators/NetworkPortValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using FluentValidation.Validators; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace LuYao.Toolkit.Validators; 10 | 11 | public class NetworkPortValidator : PropertyValidator 12 | { 13 | public override string Name => "NetworkPortValidator"; 14 | 15 | public override bool IsValid(ValidationContext context, string value) 16 | { 17 | if (value == null) return true; 18 | if (int.TryParse(value, out var port) == false) return false; 19 | if (port < 1 || port > 65535) return false; 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Core/Views/ViewNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Views; 4 | 5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 6 | public class ViewNameAttribute : Attribute 7 | { 8 | public string Name { get; } 9 | 10 | public ViewNameAttribute(string name) 11 | { 12 | Name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao.Toolkit.Extensions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net7.0 6 | 7 | latest 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | ..\libs\LuYao.Common.dll 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/PortProxy/CmdRunner.cs: -------------------------------------------------------------------------------- 1 | using NewLife; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | 6 | namespace LuYao.Toolkit.PortProxy; 7 | 8 | public static class CmdRunner 9 | { 10 | public static string Execute(string cmd) 11 | { 12 | var proc = Process.Start(new ProcessStartInfo 13 | { 14 | FileName = "cmd", 15 | UseShellExecute = false, 16 | RedirectStandardInput = true, 17 | RedirectStandardOutput = true, 18 | CreateNoWindow = true, 19 | }); 20 | proc.Start(); 21 | 22 | proc.StandardInput.WriteLine($"{cmd} & exit"); 23 | var output = proc.StandardOutput.ReadToEnd(); 24 | 25 | return output; 26 | } 27 | 28 | public static void Run(List cmd) 29 | { 30 | if (cmd == null || cmd.Count <= 0) return; 31 | var proc = Process.Start(new ProcessStartInfo 32 | { 33 | FileName = "cmd.exe", 34 | Arguments = $"/C {cmd.Join("&")}", 35 | UseShellExecute = true, 36 | CreateNoWindow = false, 37 | WindowStyle = ProcessWindowStyle.Normal, 38 | Verb = "runas", 39 | }); 40 | if (proc != null) proc.WaitForExit(); 41 | } 42 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/PortProxy/ProxyType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LuYao.Toolkit.PortProxy; 8 | 9 | public class ProxyType 10 | { 11 | public ProxyType(string from, string to) 12 | { 13 | From = from; 14 | To = to; 15 | } 16 | 17 | public string From { get; set; } 18 | public string To { get; set; } 19 | public string Type 20 | { 21 | get 22 | { 23 | if (From == "ipv4" && To == "ipv4") return "v4tov4"; 24 | if (From == "ipv4" && To == "ipv6") return "v4tov6"; 25 | if (From == "ipv6" && To == "ipv4") return "v6tov4"; 26 | if (From == "ipv6" && To == "ipv6") return "v6tov6"; 27 | throw new NotSupportedException(); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/AudioRedirection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public enum AudioRedirection 11 | { 12 | [Description("在此计算机上播放")] 13 | PlayOnClient, 14 | [Description("在远程计算机上播放")] 15 | PlayOnRemote, 16 | [Description("不要播放")] 17 | PlayNoSound 18 | } 19 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/AuthenticationLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public enum AuthenticationLevel 11 | { 12 | [Description("链接并且不显示警告")] 13 | Connect, 14 | [Description("不链接")] 15 | DoNotConnect, 16 | [Description("显示警告")] 17 | WarnMe 18 | } 19 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/ColorDepth.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public enum ColorDepth 11 | { 12 | [Description("256色")] 13 | Depth8Bit = 8, 14 | [Description("增强色(15位)")] 15 | Depth15Bit = 0xF, 16 | [Description("增强色(16位)")] 17 | Depth16Bit = 0x10, 18 | [Description("真彩色(24位)")] 19 | Depth24Bit = 24, 20 | [Description("最高质量(32位)")] 21 | Depth32Bit = 0x20 22 | } 23 | 24 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/DesktopSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public enum DesktopSize 11 | { 12 | [Description("640 x 480")] 13 | X640Y480, 14 | [Description("800 x 600")] 15 | X800Y600, 16 | [Description("1024 x 768")] 17 | X1024Y768, 18 | [Description("1280 x 1024")] 19 | X1280Y1024, 20 | [Description("自定义")] 21 | Custom 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/AddRdpConnectionEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Rdm.Events; 4 | public class AddRdpConnectionEvent : PubSubEvent { } 5 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/AfterRdmSettingEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Rdm.Events; 4 | 5 | public class AfterRdmSettingEvent : PubSubEvent { } 6 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/EditRdpConnectionEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Rdm.Events; 4 | 5 | public class EditRdpConnectionEvent : PubSubEvent { } 6 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/EditRdpConnectionEventPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LuYao.Toolkit.Rdm.Events; 6 | 7 | public class EditRdpConnectionEventPayload 8 | { 9 | public EditRdpConnectionEventPayload(Guid id) 10 | { 11 | this.Id = id; 12 | } 13 | public Guid Id { get; } 14 | } 15 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/OpenRdmSettingEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace LuYao.Toolkit.Rdm.Events; 7 | 8 | public class OpenRdmSettingEvent : PubSubEvent { } 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/OpenRdpConnectionEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm.Events; 9 | 10 | public class OpenRdpConnectionEvent : PubSubEvent 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/OpenRdpConnectionEventPayload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Rdm.Events; 4 | 5 | public class OpenRdpConnectionEventPayload 6 | { 7 | public OpenRdpConnectionEventPayload(Guid id) => this.Id = id; 8 | public Guid Id { get; } 9 | } 10 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/Events/RdpConnectionChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using Prism.Events; 2 | 3 | namespace LuYao.Toolkit.Rdm.Events; 4 | 5 | public class RdpConnectionChangedEvent : PubSubEvent { } 6 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/IRdpConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Rdm; 4 | 5 | public interface IRdpConnection 6 | { 7 | string Name { get; } 8 | //常规 9 | String Host { get; } 10 | Int32 Port { get; } 11 | String Domain { get; } 12 | String Username { get; } 13 | String Password { get; } 14 | Boolean ConnectToConsole { get; } 15 | 16 | //显示 17 | Int32 DisplayWidth { get; } 18 | Int32 DisplayHeight { get; } 19 | Boolean AutoExpand { get; } 20 | Boolean SmartSizing { get; } 21 | ColorDepth ColorDepth { get; } 22 | 23 | //本地资源 24 | AudioRedirection AudioSetting { get; } 25 | KeyboardRedirection KeyboardSetting { get; } 26 | Boolean RedirectDisks { get; } 27 | Boolean RedirectPorts { get; } 28 | Boolean RedirectPrinters { get; } 29 | Boolean RedirectSmartCards { get; } 30 | 31 | //体验 32 | Boolean BitmapCaching { get; } 33 | Boolean AllowWallpaper { get; } 34 | Boolean AllowThemes { get; } 35 | Boolean AllowContents { get; } 36 | Boolean AllowAnimation { get; } 37 | 38 | //高级 39 | AuthenticationLevel AuthenticationLevel { get; } 40 | Boolean EnableCredSspSupport { get; } 41 | } 42 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/KeyboardRedirection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public enum KeyboardRedirection 11 | { 12 | [Description("在这台计算机上")] 13 | OnLocal, 14 | [Description("在远程计算机上")] 15 | OnRemote 16 | } 17 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/LuYao/Toolkit/Rdm/RdpConnectionValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public class RdpConnectionValidator : AbstractValidator 11 | { 12 | public static RdpConnectionValidator Instance { get; } = new RdpConnectionValidator(); 13 | public RdpConnectionValidator() 14 | { 15 | RuleFor(i => i.Name).NotEmpty().WithName("连接名称"); 16 | RuleFor(i => i.Host).NotEmpty().WithName("主机"); 17 | RuleFor(i => i.Port).GreaterThan(0).LessThan(65535).WithName("端口"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/Youdao/YoudaoPhonetic.cs: -------------------------------------------------------------------------------- 1 | namespace Youdao; 2 | 3 | public class YoudaoPhonetic 4 | { 5 | public string Type { get; set; } 6 | public string Text { get; set; } 7 | public string Source { get; set; } 8 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/Youdao/YoudaoSuggestItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Youdao; 6 | 7 | public class YouDaoSuggestItem 8 | { 9 | public string Title { get; set; } 10 | public string Explain { get; set; } 11 | public int ResultNum { get; set; } 12 | public override string ToString() => this.Title; 13 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.Extensions/Youdao/YoudaoWord.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Youdao; 6 | public class YoudaoWord 7 | { 8 | public YoudaoWord(string word) 9 | { 10 | Word = string.IsNullOrWhiteSpace(word) ? throw new ArgumentNullException(nameof(word)) : word; 11 | } 12 | public bool IsEmpty => Paraphrase.Count == 0; 13 | public string Word { get; } 14 | public List Paraphrase { get; } = new List(); 15 | public List Variant { get; } = new List(); 16 | public List Phonetic { get; } = new List(); 17 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Converts/JsonToCSharp.res.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit.ViewModels/Channels/Converts/JsonToCSharp.res.js -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Converts/JsonToCSharpDemo.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "animals": { 3 | "dog": [ 4 | { 5 | "name": "Rufus", 6 | "breed": "labrador", 7 | "count": 1, 8 | "twoFeet": false 9 | }, 10 | { 11 | "name": "Marty", 12 | "breed": "whippet", 13 | "count": 1, 14 | "twoFeet": false 15 | } 16 | ], 17 | "cat": { 18 | "name": "Matilda" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Converts/JsonToCsvDemo.res.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "album": "The White Stripes", 4 | "year": 1999, 5 | "US_peak_chart_post": "-" 6 | }, 7 | { 8 | "album": "De Stijl", 9 | "year": 2000, 10 | "US_peak_chart_post": "-" 11 | }, 12 | { 13 | "album": "White Blood Cells", 14 | "year": 2001, 15 | "US_peak_chart_post": 61 16 | }, 17 | { 18 | "album": "Elephant", 19 | "year": 2003, 20 | "US_peak_chart_post": 6 21 | }, 22 | { 23 | "album": "Get Behind Me Satan", 24 | "year": 2005, 25 | "US_peak_chart_post": 3 26 | }, 27 | { 28 | "album": "Icky Thump", 29 | "year": 2007, 30 | "US_peak_chart_post": 2 31 | }, 32 | { 33 | "album": "Under Great White Northern Lights", 34 | "year": 2010, 35 | "US_peak_chart_post": 11 36 | }, 37 | { 38 | "album": "Live in Mississippi", 39 | "year": 2011, 40 | "US_peak_chart_post": "-" 41 | }, 42 | { 43 | "album": "Live at the Gold Dollar", 44 | "year": 2012, 45 | "US_peak_chart_post": "-" 46 | }, 47 | { 48 | "album": "Nine Miles from the White City", 49 | "year": 2013, 50 | "US_peak_chart_post": "-" 51 | } 52 | ] -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Converts/YamlToJsonViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Converters; 5 | using System.Dynamic; 6 | using System.IO; 7 | using YamlDotNet.Serialization; 8 | 9 | namespace LuYao.Toolkit.Channels.Converts; 10 | 11 | public partial class YamlToJsonViewModel : ViewModelBase 12 | { 13 | [ObservableProperty] 14 | [NotifyCanExecuteChangedFor(nameof(YamlToJsonCommand))] 15 | [NotifyCanExecuteChangedFor(nameof(JsonToYamlCommand))] 16 | private string input; 17 | 18 | [ObservableProperty] 19 | private string output; 20 | 21 | private bool CanExecute() => !string.IsNullOrWhiteSpace(this.Input); 22 | 23 | [RelayCommand(CanExecute = nameof(CanExecute))] 24 | private void YamlToJson() 25 | { 26 | using var r = new StringReader(this.Input); 27 | var deserializer = new DeserializerBuilder().Build(); 28 | var yamlObject = deserializer.Deserialize(r); 29 | this.Output = JsonConvert.SerializeObject(yamlObject, Formatting.Indented); 30 | } 31 | 32 | [RelayCommand(CanExecute = nameof(CanExecute))] 33 | private void JsonToYaml() 34 | { 35 | var serializer = new SerializerBuilder().Build(); 36 | var dyn = JsonConvert.DeserializeObject(this.Input, new ExpandoObjectConverter()); 37 | this.Output = serializer.Serialize(dyn); 38 | } 39 | 40 | [RelayCommand] 41 | private void Clear() 42 | { 43 | this.Output = this.Input = string.Empty; 44 | } 45 | 46 | [RelayCommand] 47 | private void Copy() 48 | { 49 | Services.ClipboardService.CopyText(this.Output); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/Ascii85EncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Input; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Channels.Encodings; 9 | 10 | public partial class Ascii85EncodeViewModel : EncodingViewModelBase 11 | { 12 | [RelayCommand] 13 | private void Encode() 14 | { 15 | if (string.IsNullOrWhiteSpace(this.Input)) 16 | { 17 | this.Output = string.Empty; 18 | } 19 | else 20 | { 21 | var encoding = this.GetEncoding(); 22 | var bytes = encoding.GetBytes(this.Input); 23 | this.Output = StringZipper.Ascii85.Encode(bytes); 24 | } 25 | } 26 | 27 | [RelayCommand] 28 | private void Decode() 29 | { 30 | if (string.IsNullOrWhiteSpace(this.Input)) 31 | { 32 | this.Output = string.Empty; 33 | } 34 | else 35 | { 36 | var encoding = this.GetEncoding(); 37 | try 38 | { 39 | var bytes = StringZipper.Ascii85.Decode(this.Input); 40 | this.Output = encoding.GetString(bytes); 41 | } 42 | catch (Exception e) 43 | { 44 | this.Output = e.Message; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/Base16EncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Input; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Channels.Encodings; 9 | 10 | public partial class Base16EncodeViewModel : EncodingViewModelBase 11 | { 12 | [RelayCommand] 13 | private void Encode() 14 | { 15 | if (string.IsNullOrWhiteSpace(this.Input)) 16 | { 17 | this.Output = string.Empty; 18 | } 19 | else 20 | { 21 | var encoding = this.GetEncoding(); 22 | var bytes = encoding.GetBytes(this.Input); 23 | this.Output = StringZipper.Base16.Encode(bytes); 24 | } 25 | } 26 | 27 | [RelayCommand] 28 | private void Decode() 29 | { 30 | if (string.IsNullOrWhiteSpace(this.Input)) 31 | { 32 | this.Output = string.Empty; 33 | } 34 | else 35 | { 36 | var encoding = this.GetEncoding(); 37 | try 38 | { 39 | var bytes = StringZipper.Base16.Decode(this.Input); 40 | this.Output = encoding.GetString(bytes); 41 | } 42 | catch (Exception e) 43 | { 44 | this.Output = e.Message; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/Base62EncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Input; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Channels.Encodings; 9 | 10 | public partial class Base62EncodeViewModel : EncodingViewModelBase 11 | { 12 | [RelayCommand] 13 | private void Encode() 14 | { 15 | if (string.IsNullOrWhiteSpace(this.Input)) 16 | { 17 | this.Output = string.Empty; 18 | } 19 | else 20 | { 21 | var encoding = this.GetEncoding(); 22 | var bytes = encoding.GetBytes(this.Input); 23 | this.Output = StringZipper.Base62.Encode(bytes); 24 | } 25 | } 26 | 27 | [RelayCommand] 28 | private void Decode() 29 | { 30 | if (string.IsNullOrWhiteSpace(this.Input)) 31 | { 32 | this.Output = string.Empty; 33 | } 34 | else 35 | { 36 | var encoding = this.GetEncoding(); 37 | try 38 | { 39 | var bytes = StringZipper.Base62.Decode(this.Input); 40 | this.Output = encoding.GetString(bytes); 41 | } 42 | catch (Exception e) 43 | { 44 | this.Output = e.Message; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/Base64EncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace LuYao.Toolkit.Channels.Encodings; 10 | 11 | public partial class Base64EncodeViewModel : EncodingViewModelBase 12 | { 13 | 14 | [RelayCommand] 15 | private void Encode() 16 | { 17 | if (string.IsNullOrWhiteSpace(this.Input)) 18 | { 19 | this.Output = string.Empty; 20 | } 21 | else 22 | { 23 | var encoding = this.GetEncoding(); 24 | var bytes = encoding.GetBytes(this.Input); 25 | this.Output = Convert.ToBase64String(bytes); 26 | } 27 | } 28 | 29 | [RelayCommand] 30 | private void Decode() 31 | { 32 | if (string.IsNullOrWhiteSpace(this.Input)) 33 | { 34 | this.Output = string.Empty; 35 | } 36 | else 37 | { 38 | var encoding = this.GetEncoding(); 39 | try 40 | { 41 | var bytes = Convert.FromBase64String(this.Input); 42 | this.Output = encoding.GetString(bytes); 43 | } 44 | catch (Exception e) 45 | { 46 | this.Output = e.Message; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/EncodingViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace LuYao.Toolkit.Channels.Encodings; 10 | 11 | public partial class EncodingViewModelBase : ViewModelBase 12 | { 13 | public IReadOnlyCollection Encodings { get; } = new string[] { "UTF-8", "GB2312" }; 14 | 15 | [ObservableProperty] 16 | [ViewStates.WatchViewState(nameof(Encoding))] 17 | protected string _encoding = "UTF-8"; 18 | 19 | protected Encoding GetEncoding() => System.Text.Encoding.GetEncoding(this.Encoding); 20 | 21 | [ObservableProperty] 22 | private string _input; 23 | [ObservableProperty] 24 | private string _output; 25 | 26 | [RelayCommand] 27 | protected virtual void Copy() 28 | { 29 | Services.ClipboardService.CopyText(this.Output); 30 | } 31 | 32 | [RelayCommand] 33 | protected virtual void Clear() 34 | { 35 | this.Output = this.Input = String.Empty; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/HtmlEncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Input; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Channels.Encodings; 9 | 10 | public partial class HtmlEncodeViewModel : EncodingViewModelBase 11 | { 12 | [RelayCommand] 13 | private void Encode() 14 | { 15 | if (string.IsNullOrWhiteSpace(this.Input)) 16 | { 17 | this.Output = string.Empty; 18 | } 19 | else 20 | { 21 | this.Output = System.Web.HttpUtility.HtmlEncode(this.Input); 22 | } 23 | } 24 | 25 | [RelayCommand] 26 | private void Decode() 27 | { 28 | if (string.IsNullOrWhiteSpace(this.Input)) 29 | { 30 | this.Output = string.Empty; 31 | } 32 | else 33 | { 34 | this.Output = System.Web.HttpUtility.HtmlDecode(this.Input); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Encodings/UrlEncodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace LuYao.Toolkit.Channels.Encodings; 8 | 9 | public partial class UrlEncodeViewModel : EncodingViewModelBase 10 | { 11 | [RelayCommand] 12 | private void Encode() 13 | { 14 | if (string.IsNullOrWhiteSpace(this.Input)) 15 | { 16 | this.Output = string.Empty; 17 | } 18 | else 19 | { 20 | this.Output = Uri.EscapeDataString(this.Input); 21 | } 22 | } 23 | 24 | [RelayCommand] 25 | private void Decode() 26 | { 27 | if (string.IsNullOrWhiteSpace(this.Input)) 28 | { 29 | this.Output = string.Empty; 30 | } 31 | else 32 | { 33 | this.Output = Uri.UnescapeDataString(this.Input); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Files/CrackingMdbPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Channels.Files; 9 | 10 | public partial class CrackingMdbPasswordViewModel : ViewModelBase 11 | { 12 | private string GetPassword(string file) 13 | { 14 | // 未加密的文件0x42开始至0x61之前的每间隔一字节的数值 15 | byte[] baseByte = { 0xbe, 0xec, 0x65, 0x9c, 0xfe, 0x28, 0x2b, 0x8a, 0x6c, 0x7b, 0xcd, 0xdf, 0x4f, 0x13, 0xf7, 0xb1 }; 16 | byte flagByte = 0x0c; // 标志 0x62 处的数值 17 | 18 | using (var fs = File.OpenRead(file)) 19 | { 20 | if (fs.Length == 0) 21 | { 22 | return "文件为空"; 23 | } 24 | var password = string.Empty; 25 | fs.Seek(0x14, SeekOrigin.Begin); 26 | var ver = (byte)fs.ReadByte(); // 取得版本, 1为Access2000, 0为Access97 27 | fs.Seek(0x42, SeekOrigin.Begin); 28 | var bs = new byte[33]; 29 | if (fs.Read(bs, 0, 33) != 33) return "数据库格式不正确"; 30 | 31 | var flag = (byte)(bs[32] ^ flagByte); 32 | for (var i = 0; i < 16; i++) 33 | { 34 | var b = (byte)(baseByte[i] ^ bs[i * 2]); 35 | if (i % 2 == 0 && ver == 1) 36 | { 37 | b ^= flag; //Access 2000 38 | } 39 | 40 | if (b > 0) 41 | { 42 | password += (char)b; 43 | } 44 | } 45 | 46 | return password; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Gens/RsaKeyFormat.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Channels.Gens; 2 | 3 | public enum RsaKeyFormat { PKCS8, PKCS1, XML } 4 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Networks/PortProxy/PortProxyItemValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using LuYao.Toolkit.Validators; 3 | 4 | namespace LuYao.Toolkit.Channels.Networks.PortProxy; 5 | public class PortProxyItemValidator : AbstractValidator 6 | { 7 | public static PortProxyItemValidator Instance { get; } = new PortProxyItemValidator(); 8 | public PortProxyItemValidator() 9 | { 10 | RuleFor(i => i.ListenOn) 11 | .NotEmpty() 12 | .WithName("监听地址"); 13 | 14 | RuleFor(i => i.ListenPort) 15 | .NotEmpty() 16 | .NetworkPort() 17 | .WithName("监听端口"); 18 | 19 | RuleFor(i => i.ConnectTo) 20 | .NotEmpty() 21 | .IPAddress() 22 | .NotEqual(i => i.ListenOn) 23 | .WithName("转发地址"); 24 | 25 | RuleFor(i => i.ConnectPort) 26 | .NotEmpty() 27 | .NetworkPort() 28 | .WithName("转发端口"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Channels/Texts/YoudaoDictionaryViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using System; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using Youdao; 7 | 8 | namespace LuYao.Toolkit.Channels.Texts; 9 | 10 | public partial class YoudaoDictionaryViewModel : ViewModelBase 11 | { 12 | private static HttpClient _http = new HttpClient(); 13 | 14 | [ObservableProperty] 15 | [NotifyCanExecuteChangedFor(nameof(QueryCommand))] 16 | private string _input; 17 | 18 | [ObservableProperty] 19 | private YoudaoWord _result; 20 | 21 | private bool CanQuery() => !string.IsNullOrWhiteSpace(this.Input); 22 | 23 | [RelayCommand(CanExecute = nameof(CanQuery))] 24 | private async Task Query() 25 | { 26 | using (this.Busy()) 27 | { 28 | if (string.IsNullOrWhiteSpace(this.Input)) throw new ArgumentNullException("英文单词不能为空"); 29 | this.Result = null; 30 | this.Result = await YoudaoDictionary.QueryAsync(_http, this.Input); 31 | } 32 | } 33 | 34 | [RelayCommand] 35 | private async void Play(YoudaoPhonetic phonetic) 36 | { 37 | if (phonetic == null) return; 38 | if (string.IsNullOrWhiteSpace(phonetic.Source)) return; 39 | await Services.SoundService.Play(phonetic.Source); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/LuYao.Toolkit.ViewModels.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | net7.0-windows 6 | LuYao.Toolkit 7 | latest 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ..\libs\LuYao.Common.dll 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Rdm/RdpConnectionBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | [INotifyPropertyChanged] 11 | public partial class RdpConnectionBase 12 | { 13 | [ObservableProperty] 14 | private Guid id; 15 | [ObservableProperty] 16 | private string name; 17 | [ObservableProperty] 18 | private string host; 19 | [ObservableProperty] 20 | private int port; 21 | [ObservableProperty] 22 | private string username; 23 | [ObservableProperty] 24 | private Guid _groupId; 25 | [ObservableProperty] 26 | private string groupName; 27 | [ObservableProperty] 28 | private DateTime _updatedAt; 29 | public RdpConnectionBase() { } 30 | public RdpConnectionBase(Entities.RdpConnection e) : this() 31 | { 32 | this.Id = e.Id; 33 | this.Name = e.Name; 34 | this.Host = e.Host; 35 | this.Port = e.Port; 36 | this.Username = e.Username; 37 | this.GroupId = e.GroupId; 38 | this.GroupName = e.GroupName; 39 | this.UpdatedAt = e.UpdatedAt; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Rdm/RdpGroup.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System; 3 | 4 | namespace LuYao.Toolkit.Rdm; 5 | 6 | [INotifyPropertyChanged] 7 | public partial class RdpGroup 8 | { 9 | public static RdpGroup All { get; } = new RdpGroup { Id = Guid.Empty, Name = "全部分组", Rank = int.MinValue }; 10 | public static RdpGroup None { get; } = new RdpGroup { Id = Guid.Empty, Name = "无", Rank = int.MaxValue }; 11 | public RdpGroup() { } 12 | public RdpGroup(Entities.RdpGroup e) : this() 13 | { 14 | this.Id = e.Id; 15 | this.Name = e.Name; 16 | this.Rank = e.Rank; 17 | } 18 | [ObservableProperty] 19 | private Guid _id; 20 | [ObservableProperty] 21 | private string _name; 22 | [ObservableProperty] 23 | private int _rank; 24 | } 25 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Rdm/RdpGroupValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace LuYao.Toolkit.Rdm; 9 | 10 | public class RdpGroupValidator : AbstractValidator 11 | { 12 | public static RdpGroupValidator Instance { get; } = new RdpGroupValidator(); 13 | public RdpGroupValidator() 14 | { 15 | this.RuleFor(i => i.Name).NotEmpty().WithName("分组名称"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/TabItem.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using LuYao.Toolkit.Tabs; 3 | 4 | namespace LuYao.Toolkit; 5 | 6 | public partial class TabItem : ObservableObject 7 | { 8 | private Tab _tab; 9 | public Tab Tab => _tab; 10 | [ObservableProperty] 11 | private bool _isSelected; 12 | 13 | public TabItem(Tab tab) 14 | { 15 | _tab = tab; 16 | } 17 | public string Icon => _tab.Icon; 18 | public string IconArchived => _tab.IconArchived; 19 | public string Title => _tab.Title; 20 | public string View => _tab.View; 21 | } 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Tabs/Explorer/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using LuYao.Toolkit.Channels; 4 | using Prism.Events; 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace LuYao.Toolkit.Tabs.Explorer; 9 | 10 | public partial class IndexViewModel : ViewModelBase 11 | { 12 | public IndexViewModel(IEventAggregator eventAggregator) 13 | { 14 | _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator)); 15 | this.Selected = Channels[0]; 16 | } 17 | private IEventAggregator _eventAggregator; 18 | public IReadOnlyList Channels => Channel.Channels; 19 | [ObservableProperty] 20 | private Channel _selected; 21 | 22 | [RelayCommand] 23 | void OpenItem(FunctionItem item) 24 | { 25 | if (item == null) return; 26 | _eventAggregator.GetEvent().Publish(new Events.OpenFunctionItemEventPayload(item) 27 | { 28 | IsNewSession = true 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Tabs/Navs/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.Input; 2 | using NewLife.Reflection; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | 7 | namespace LuYao.Toolkit.Tabs.Navs; 8 | 9 | public partial class IndexViewModel : ViewModelBase 10 | { 11 | public IndexViewModel() 12 | { 13 | this.Groups = NavGroup.GetAll(); 14 | } 15 | 16 | public IReadOnlyCollection Groups { get; } 17 | 18 | [RelayCommand] 19 | private void Open(NavItem item) 20 | { 21 | if (string.IsNullOrWhiteSpace(item.Url)) return; 22 | var builder = new UriBuilder(item.Url); 23 | var qs = System.Web.HttpUtility.ParseQueryString(builder.Query); 24 | qs["from"] = "LuYao.Toolkit"; 25 | qs["ver"] = AssemblyX.Entry.Version; 26 | builder.Query = qs.ToString(); 27 | Start(builder.ToString()); 28 | Services.TongjiService.Tongji(Views.ViewNames.Tabs.Navs.Index + "?jump=" + Uri.EscapeDataString(item.Title)); 29 | } 30 | 31 | public static void Start(string url) // 调用系统默认的浏览器 32 | { 33 | try 34 | { 35 | var p = Process.Start(new ProcessStartInfo 36 | { 37 | FileName = url, 38 | UseShellExecute = true 39 | }); 40 | } 41 | catch (Exception ex) 42 | { 43 | Debug.WriteLine(ex); 44 | if (url.StartsWith("http")) throw new Exception($"系统默认浏览器未设置好,请设置后重试![{ex.Message}]"); 45 | throw new Exception($"系统未找到能打开{url}文件的应用程序![{ex.Message}]"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Tabs/Rdp/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using LuYao.Toolkit.Rdm; 4 | using LuYao.Toolkit.Rdm.Events; 5 | using Prism.Events; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using XCode; 10 | 11 | namespace LuYao.Toolkit.Tabs.Rdp; 12 | 13 | public partial class IndexViewModel : ViewModelBase 14 | { 15 | } 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/Tabs/Session/ChannelItemSessionItem.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using LuYao.Toolkit.Channels; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace LuYao.Toolkit.Tabs.Session; 8 | 9 | [INotifyPropertyChanged] 10 | public partial class ChannelItemSessionItem 11 | { 12 | public ChannelItemSessionItem(FunctionItem item) 13 | { 14 | Item = item ?? throw new ArgumentNullException(nameof(item)); 15 | } 16 | public FunctionItem Item { get; } 17 | [ObservableProperty] 18 | private int _isFavorite; 19 | [ObservableProperty] 20 | private DateTime _lastClick; 21 | } 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/UI/DetailViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using Prism.Regions; 2 | using System; 3 | 4 | namespace LuYao.Toolkit.UI; 5 | 6 | public abstract partial class DetailViewModelBase : ViewModelBase, INavigationAware 7 | { 8 | private IMasterDetailViewModel _masterDetailViewModel; 9 | public abstract bool IsNavigationTarget(NavigationContext navigationContext); 10 | 11 | public abstract void OnNavigatedFrom(NavigationContext navigationContext); 12 | 13 | public virtual void OnNavigatedTo(NavigationContext navigationContext) 14 | { 15 | _masterDetailViewModel = null; 16 | if (navigationContext.Parameters.TryGetValue("MasterDetailViewModel", out var vm)) _masterDetailViewModel = vm; 17 | } 18 | protected IMasterDetailViewModel MasterDetailViewModel => _masterDetailViewModel ?? throw new ArgumentNullException(); 19 | } 20 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/UI/IMasterDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.UI; 2 | 3 | public interface IMasterDetailViewModel 4 | { 5 | bool IsShowDetail { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/UI/MasterDetailViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using Prism.Regions; 3 | 4 | namespace LuYao.Toolkit.UI; 5 | 6 | public partial class MasterDetailViewModelBase : ViewModelBase, IMasterDetailViewModel 7 | { 8 | [ObservableProperty] 9 | private bool _isShowDetail = false; 10 | 11 | protected NavigationParameters CreateNavigationParameters() 12 | { 13 | var p = new NavigationParameters 14 | { 15 | { "MasterDetailViewModel", this } 16 | }; 17 | return p; 18 | } 19 | partial void OnIsShowDetailChanged(bool value) 20 | { 21 | if (value) OnShowDetail(); 22 | else OnHideDetail(); 23 | } 24 | protected virtual void OnShowDetail() { } 25 | protected virtual void OnHideDetail() { } 26 | } 27 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using LuYao.Toolkit.ViewStates; 3 | using Prism.Navigation; 4 | using System; 5 | using System.Collections.Concurrent; 6 | 7 | namespace LuYao.Toolkit; 8 | 9 | public partial class ViewModelBase : ObservableObject, IDestructible, IViewStateHost 10 | { 11 | private static readonly ConcurrentDictionary _count = new ConcurrentDictionary(); 12 | private int instanceId; 13 | public ViewModelBase() 14 | { 15 | this.instanceId = _count.AddOrUpdate(this.GetType(), 1, (t, x) => x + 1); 16 | this.ViewState = new ViewStateBag(this); 17 | } 18 | [ObservableProperty] 19 | [NotifyPropertyChangedFor(nameof(IsNotBusy))] 20 | private bool _isBusy = false; 21 | public bool IsNotBusy => _isBusy == false; 22 | 23 | int IViewStateHost.InstanceId => this.instanceId; 24 | 25 | protected ViewStateBag ViewState { get; } 26 | public virtual void Destroy() 27 | { 28 | _count.AddOrUpdate(this.GetType(), 0, (t, x) => x - 1); 29 | } 30 | 31 | protected IDisposable Busy() 32 | { 33 | this.IsBusy = true; 34 | return new DisposeAction(() => this.IsBusy = false); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/ViewStates/IViewStateHost.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LuYao.Toolkit.ViewStates 4 | { 5 | public interface IViewStateHost : INotifyPropertyChanged 6 | { 7 | public int InstanceId { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/ViewStates/ViewStateItem.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace LuYao.Toolkit.ViewStates; 5 | 6 | public class ViewStateItem 7 | { 8 | public string Type { get; set; } 9 | public string Json { get; set; } 10 | public object Read(Type type) 11 | { 12 | return JsonConvert.DeserializeObject(Json, type); 13 | } 14 | public void Write(object value) 15 | { 16 | if (value == null) throw new ArgumentNullException(nameof(value)); 17 | Type = value.GetType().FullName; 18 | Json = JsonConvert.SerializeObject(value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LuYao.Toolkit.ViewModels/ViewStates/WatchViewStateAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.ViewStates; 4 | 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public class WatchViewStateAttribute : Attribute 7 | { 8 | public string Property { get; } 9 | public WatchViewStateAttribute(string property) 10 | { 11 | if (string.IsNullOrWhiteSpace(property)) throw new ArgumentOutOfRangeException(nameof(property)); 12 | Property = property; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /LuYao.Toolkit/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LuYao.Toolkit/App.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/App.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | pack://application:,,,/LuYao.Toolkit;component/Resources/#JetBrains Mono 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LuYao.Toolkit/AppRegisterTypes.linq: -------------------------------------------------------------------------------- 1 | 2 | D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit\bin\Debug\net7.0-windows\LuYao.Toolkit.Core.dll 3 | D:\src\coderbusy\luyao\src\toolkit\LuYao.Toolkit\bin\Debug\net7.0-windows\LuYao.Toolkit.dll 4 | Fluid.Core 5 | LuYao.Toolkit 6 | LuYao.Toolkit.Views 7 | Fluid 8 | 9 | 10 | var assembly = typeof(MainWindow).Assembly; 11 | var types = assembly.GetTypes(); 12 | var dic = new SortedDictionary(); 13 | foreach (var item in types) 14 | { 15 | if (item.IsAbstract) continue; 16 | if (item.IsGenericType) continue; 17 | var attr = item.GetCustomAttribute(); 18 | if (attr == null) continue; 19 | var key = item.FullName; 20 | var view = attr.Name; 21 | dic[key] = view; 22 | } 23 | var dir = Path.GetDirectoryName(Util.CurrentQueryPath); 24 | var parser = new FluidParser(); 25 | var model = new { Types = dic.Select(i => new { Type = i.Key, View = i.Value }).ToList() }; 26 | var source = File.ReadAllText(Path.Combine(dir, "AppRegisterTypes.liquid")); 27 | if (parser.TryParse(source, out var template, out var error)) 28 | { 29 | var context = new TemplateContext(model); 30 | context.Options.MemberAccessStrategy = new UnsafeMemberAccessStrategy(); 31 | var output = template.Render(context); 32 | Console.WriteLine(output); 33 | File.WriteAllText(Path.Combine(dir, "AppRegisterTypes.cs"), output, Encoding.UTF8); 34 | } 35 | else 36 | { 37 | Console.WriteLine($"Error: {error}"); 38 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/AppRegisterTypes.liquid: -------------------------------------------------------------------------------- 1 | using Prism.Ioc; 2 | 3 | namespace LuYao.Toolkit; 4 | static class AppRegisterTypes 5 | { 6 | public static void RegisterViews(IContainerRegistry containerRegistry) 7 | { 8 | {%- for item in Types %} 9 | containerRegistry.RegisterForNavigation(typeof({{item.Type}}), {{item.View | json}}); 10 | {%- endfor %} 11 | } 12 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Attaches/ComboBoxAttach.cs: -------------------------------------------------------------------------------- 1 | using NewLife; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace LuYao.Toolkit.Attaches; 11 | 12 | public static class ComboBoxAttach 13 | { 14 | 15 | public static readonly DependencyProperty BindEnumProperty = 16 | DependencyProperty.RegisterAttached("BindEnum", typeof(Type), typeof(ComboBoxAttach), new PropertyMetadata(null, OnBindEnumChanged)); 17 | public static void SetBindEnum(DependencyObject element, Type value) 18 | { 19 | element.SetValue(BindEnumProperty, value); 20 | } 21 | 22 | public static Type GetBindEnum(DependencyObject element) 23 | { 24 | return (Type)element.GetValue(BindEnumProperty); 25 | } 26 | private static void OnBindEnumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 27 | { 28 | if (d is ComboBox combo && e.NewValue is Type type && type.IsEnum) 29 | { 30 | var values = Enum.GetValues(type); 31 | combo.DisplayMemberPath = "Display"; 32 | combo.SelectedValuePath = "Value"; 33 | combo.Items.Clear(); 34 | foreach (Enum item in values) 35 | { 36 | var desc = item.GetDescription(); 37 | if (string.IsNullOrWhiteSpace(desc)) desc = item.ToString(); 38 | var dto = new 39 | { 40 | Display = desc, 41 | Value = item 42 | }; 43 | combo.Items.Add(dto); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Attaches/TextBoxAttach.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace LuYao.Toolkit.Attaches; 4 | 5 | public static class TextBoxAttach 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Behaviors/ListBoxScrollIntoNewAddBehaviour.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xaml.Behaviors; 2 | using System.Collections.Specialized; 3 | using System.Windows.Controls; 4 | 5 | namespace LuYao.Toolkit.Behaviors; 6 | public class ListBoxScrollIntoNewAddBehaviour : Behavior 7 | { 8 | protected override void OnAttached() 9 | { 10 | if (this.AssociatedObject.Items is INotifyCollectionChanged notify) 11 | { 12 | notify.CollectionChanged += Notify_CollectionChanged; 13 | } 14 | } 15 | 16 | private void Notify_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 17 | { 18 | if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Count > 0) 19 | { 20 | var item = e.NewItems[0]; 21 | this.AssociatedObject.ScrollIntoView(item); 22 | } 23 | } 24 | 25 | protected override void OnDetaching() 26 | { 27 | if (this.AssociatedObject.Items is INotifyCollectionChanged notify) 28 | { 29 | notify.CollectionChanged -= Notify_CollectionChanged; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/ColorConverter.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// ColorConverter.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.ColorConverter)] 22 | public partial class ColorConverter : UserControl 23 | { 24 | public ColorConverter() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/HexConvert.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// HexConvert.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.HexConvert)] 22 | public partial class HexConvert : UserControl 23 | { 24 | public HexConvert() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/IndentJson.xaml.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Folding; 2 | using ICSharpCode.AvalonEdit.Search; 3 | using LuYao.Toolkit.Controls.AvalonEdit; 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace LuYao.Toolkit.Channels.Converts; 9 | 10 | /// 11 | /// IndentJson.xaml 的交互逻辑 12 | /// 13 | [Views.ViewName(Views.ViewNames.Channels.Converters.IndentJson)] 14 | public partial class IndentJson : UserControl 15 | { 16 | public IndentJson() 17 | { 18 | InitializeComponent(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/IndentXml.xaml.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Folding; 2 | using ICSharpCode.AvalonEdit.Search; 3 | using LuYao.Toolkit.Controls.AvalonEdit; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Data; 12 | using System.Windows.Documents; 13 | using System.Windows.Input; 14 | using System.Windows.Media; 15 | using System.Windows.Media.Imaging; 16 | using System.Windows.Navigation; 17 | using System.Windows.Shapes; 18 | 19 | namespace LuYao.Toolkit.Channels.Converts 20 | { 21 | /// 22 | /// IndentXml.xaml 的交互逻辑 23 | /// 24 | [Views.ViewName(Views.ViewNames.Channels.Converters.IndentXml)] 25 | public partial class IndentXml : UserControl 26 | { 27 | public IndentXml() 28 | { 29 | InitializeComponent(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/JsonToCSharp.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// JsonToCSharp.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.JsonToCSharp)] 22 | public partial class JsonToCSharp : UserControl 23 | { 24 | public JsonToCSharp() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/JsonToCsv.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace LuYao.Toolkit.Channels.Converts 4 | { 5 | /// 6 | /// JsonToCsv.xaml 的交互逻辑 7 | /// 8 | [Views.ViewName(Views.ViewNames.Channels.Converters.JsonToCsv)] 9 | public partial class JsonToCsv : UserControl 10 | { 11 | public JsonToCsv() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/PostmanConverter.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// PostmanConverter.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.PostmanConverter)] 22 | public partial class PostmanConverter : UserControl 23 | { 24 | public PostmanConverter() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/RsaKeyConvert.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// RsaKeyConvert.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.RsaKeyConvert)] 22 | public partial class RsaKeyConvert : UserControl 23 | { 24 | public RsaKeyConvert() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/TranslateJsonByJs.xaml.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Search; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Converts 18 | { 19 | /// 20 | /// TranslateJsonByJs.xaml 的交互逻辑 21 | /// 22 | [Views.ViewName(Views.ViewNames.Channels.Converters.TranslateJsonByJs)] 23 | public partial class TranslateJsonByJs : UserControl 24 | { 25 | public TranslateJsonByJs() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/TranslateJsonByLiquid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// TranslateJsonByLiquid.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.TranslateJsonByLiquid)] 22 | public partial class TranslateJsonByLiquid : UserControl 23 | { 24 | public TranslateJsonByLiquid() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/TranslateXmlByXsl.xaml.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Search; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Converts 18 | { 19 | /// 20 | /// TranslateXmlByXslt.xaml 的交互逻辑 21 | /// 22 | [Views.ViewName(Views.ViewNames.Channels.Converters.TranslateXmlByXsl)] 23 | public partial class TranslateXmlByXsl : UserControl 24 | { 25 | public TranslateXmlByXsl() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/UnixTimestamp.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// UnixTimestamp.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.UnixTimestamp)] 22 | public partial class UnixTimestamp : UserControl 23 | { 24 | public UnixTimestamp() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Converts/YamlToJson.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Converts 17 | { 18 | /// 19 | /// YamlToJson.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Converters.YamlToJson)] 22 | public partial class YamlToJson : UserControl 23 | { 24 | public YamlToJson() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/CrossBorder/MercadoToWorldFirst.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.CrossBorder 18 | { 19 | /// 20 | /// MercadoToWorldFirst.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.CrossBorder.MercadoToWorldFirst)] 23 | public partial class MercadoToWorldFirst : UserControl 24 | { 25 | public MercadoToWorldFirst() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/Ascii85Encode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// Ascii85Encode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.Ascii85Encode)] 22 | public partial class Ascii85Encode : UserControl 23 | { 24 | public Ascii85Encode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/Base16Encode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// Base16Encode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.Base16Encode)] 22 | public partial class Base16Encode : UserControl 23 | { 24 | public Base16Encode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/Base62Encode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// Base62Encode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.Base62Encode)] 22 | public partial class Base62Encode : UserControl 23 | { 24 | public Base62Encode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/Base64Encode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// Base64Encode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.Base64Encode)] 22 | public partial class Base64Encode : UserControl 23 | { 24 | public Base64Encode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/HtmlEncode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// HtmlEncode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.HtmlEncode)] 22 | public partial class HtmlEncode : UserControl 23 | { 24 | public HtmlEncode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/StringZipper.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// StringZipper.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.StringZipper)] 22 | public partial class StringZipper : UserControl 23 | { 24 | public StringZipper() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Encodings/UrlEncode.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Encodings 17 | { 18 | /// 19 | /// UrlEncode.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Encodings.UrlEncode)] 22 | public partial class UrlEncode : UserControl 23 | { 24 | public UrlEncode() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Files/DetectFileEncodeing.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Files 18 | { 19 | /// 20 | /// DetectFileEncodeing.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Files.DetectFileEncodeing)] 23 | public partial class DetectFileEncodeing : UserControl 24 | { 25 | public DetectFileEncodeing() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Files/HashFile.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Files 18 | { 19 | /// 20 | /// HashFile.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Files.HashFile)] 23 | public partial class HashFile : UserControl 24 | { 25 | public HashFile() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenAesKey.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Gens 18 | { 19 | /// 20 | /// GenAesKey.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Gens.GenAesKey)] 23 | public partial class GenAesKey : UserControl 24 | { 25 | public GenAesKey() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenGuid.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Gens 18 | { 19 | /// 20 | /// GenGuid.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Gens.GenGuid)] 23 | public partial class GenGuid : UserControl 24 | { 25 | public GenGuid() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenLinesByRange.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Gens 18 | { 19 | /// 20 | /// GenLinesByRange.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Gens.GenLinesByRange)] 23 | public partial class GenLinesByRange : UserControl 24 | { 25 | public GenLinesByRange() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenPassword.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System.Windows.Controls; 3 | 4 | namespace LuYao.Toolkit.Channels.Gens 5 | { 6 | /// 7 | /// GenPassword.xaml 的交互逻辑 8 | /// 9 | [ViewName(ViewNames.Channels.Gens.GenPassword)] 10 | public partial class GenPassword : UserControl 11 | { 12 | public GenPassword() 13 | { 14 | InitializeComponent(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenRsaKey.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Gens 18 | { 19 | /// 20 | /// GenRsaKey.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Gens.GenRsaKey)] 23 | public partial class GenRsaKey : UserControl 24 | { 25 | public GenRsaKey() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Gens/GenXCodeEntity.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Gens 17 | { 18 | /// 19 | /// GenXCodeEntity.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Gens.GenXCodeEntity)] 22 | public partial class GenXCodeEntity : UserControl 23 | { 24 | public GenXCodeEntity() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Images/Base64ToImage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Images 17 | { 18 | /// 19 | /// Base64ToImage.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Images.Base64ToImage)] 22 | public partial class Base64ToImage : UserControl 23 | { 24 | public Base64ToImage() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Images/GifSplitter.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Images 17 | { 18 | /// 19 | /// GifSplitter.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Images.GifSplitter)] 22 | public partial class GifSplitter : UserControl 23 | { 24 | public GifSplitter() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Images/ImageToBase64.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Helpers; 2 | using NewLife.Log; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | 18 | namespace LuYao.Toolkit.Channels.Images 19 | { 20 | /// 21 | /// ImageToBase64.xaml 的交互逻辑 22 | /// 23 | [Views.ViewName(Views.ViewNames.Channels.Images.ImageToBase64)] 24 | public partial class ImageToBase64 : UserControl 25 | { 26 | public ImageToBase64() 27 | { 28 | InitializeComponent(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Images/ImageToIcon.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Images 17 | { 18 | /// 19 | /// ImageToIcon.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Images.ImageToIcon)] 22 | public partial class ImageToIcon : UserControl 23 | { 24 | public ImageToIcon() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/HttpProxyChecker.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Networks 18 | { 19 | /// 20 | /// HttpProxyChecker.xaml 的交互逻辑 21 | /// 22 | [ViewName(Views.ViewNames.Channels.Networks.HttpProxyChecker)] 23 | public partial class HttpProxyChecker : UserControl 24 | { 25 | public HttpProxyChecker() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/IPLookup.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// IPLookup.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.IPLookup)] 22 | public partial class IPLookup : UserControl 23 | { 24 | public IPLookup() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/Ping.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/Ping.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// Ping.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.Ping)] 22 | public partial class Ping : UserControl 23 | { 24 | public Ping() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/PortProxy/Detail.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks.PortProxy 17 | { 18 | [Views.ViewName(Views.ViewNames.Channels.Networks.PortProxy.Detail)] 19 | public partial class Detail : UserControl 20 | { 21 | public Detail() 22 | { 23 | InitializeComponent(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/PortProxy/Index.xaml.cs: -------------------------------------------------------------------------------- 1 | using Prism.Ioc; 2 | using Prism.Regions; 3 | using Prism.Regions.Behaviors; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Data; 12 | using System.Windows.Documents; 13 | using System.Windows.Input; 14 | using System.Windows.Media; 15 | using System.Windows.Media.Imaging; 16 | using System.Windows.Navigation; 17 | using System.Windows.Shapes; 18 | using System.Xml.Linq; 19 | 20 | namespace LuYao.Toolkit.Channels.Networks.PortProxy 21 | { 22 | /// 23 | /// PortProxy.xaml 的交互逻辑 24 | /// 25 | [Views.ViewName(Views.ViewNames.Channels.Networks.PortProxy.Index)] 26 | public partial class Index : UserControl 27 | { 28 | public Index() 29 | { 30 | InitializeComponent(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/TrafficMonitor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// TrafficMonitor.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.TrafficMonitor)] 22 | public partial class TrafficMonitor : UserControl 23 | { 24 | public TrafficMonitor() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/UrlAnalyzer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// UrlAnalyzer.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.UrlAnalyzer)] 22 | public partial class UrlAnalyzer : UserControl 23 | { 24 | public UrlAnalyzer() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/UserAgentParser.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// UserAgentParser.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.UserAgentParser)] 22 | public partial class UserAgentParser : UserControl 23 | { 24 | public UserAgentParser() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Networks/Whois.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Networks 17 | { 18 | /// 19 | /// Whois.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Networks.Whois)] 22 | public partial class Whois : UserControl 23 | { 24 | public Whois() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/CsvReader.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/CsvReader.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Texts 17 | { 18 | /// 19 | /// CsvReader.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Texts.CsvReader)] 22 | public partial class CsvReader : UserControl 23 | { 24 | public CsvReader() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | private void MainDataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) 30 | { 31 | if (e.Column is DataGridBoundColumn dataGridBoundColumn) 32 | { 33 | if (e.PropertyName.Contains('.')) 34 | { 35 | dataGridBoundColumn.Binding = new Binding("[" + e.PropertyName + "]"); 36 | } 37 | dataGridBoundColumn.MaxWidth = 200; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/FullHalfConvert.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Texts 17 | { 18 | /// 19 | /// FullHalfConvert.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Texts.FullHalfConvert)] 22 | public partial class FullHalfConvert : UserControl 23 | { 24 | public FullHalfConvert() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/HashCalculator.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Channels.Texts 18 | { 19 | /// 20 | /// HashCalculator.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Channels.Texts.HashCalculator)] 23 | public partial class HashCalculator : UserControl 24 | { 25 | public HashCalculator() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/LogReader.xaml: -------------------------------------------------------------------------------- 1 |  16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/LogReader.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Texts 17 | { 18 | /// 19 | /// LogReader.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Texts.LogReader)] 22 | public partial class LogReader : UserControl 23 | { 24 | public LogReader() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/TextJoin.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Texts; 17 | 18 | /// 19 | /// TextJoin.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Texts.TextJoin)] 22 | public partial class TextJoin : UserControl 23 | { 24 | public TextJoin() 25 | { 26 | InitializeComponent(); 27 | Attaches.ComboBoxAttach.SetBindEnum(this.SplitComboBox, typeof(TextJoinViewModel.SplitBy)); 28 | Attaches.ComboBoxAttach.SetBindEnum(this.EscapeComboBox, typeof(TextJoinViewModel.EscapeType)); 29 | Attaches.ComboBoxAttach.SetBindEnum(this.JoinComboBox, typeof(TextJoinViewModel.JoinBy)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Channels/Texts/YoudaoDictionary.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Channels.Texts; 17 | 18 | /// 19 | /// YoudaoDictionary.xaml 的交互逻辑 20 | /// 21 | [Views.ViewName(Views.ViewNames.Channels.Texts.YoudaoDictionary)] 22 | public partial class YoudaoDictionary : UserControl 23 | { 24 | public YoudaoDictionary() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/AvalonEdit/Highlighting/Defines.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Highlighting.Xshd; 2 | using ICSharpCode.AvalonEdit.Highlighting; 3 | using System.IO; 4 | using System.Xml; 5 | 6 | namespace LuYao.Toolkit.Controls.AvalonEdit.Highlighting; 7 | 8 | public static class Defines 9 | { 10 | static Defines() 11 | { 12 | var type = typeof(Defines); 13 | using (Stream s = type.Assembly.GetManifestResourceStream($"{type.Namespace}.Log.xshd")) 14 | { 15 | using (XmlReader reader = new XmlTextReader(s)) 16 | { 17 | Log = HighlightingLoader.Load(reader, HighlightingManager.Instance); 18 | } 19 | } 20 | } 21 | public static IHighlightingDefinition Log { get; } 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/AvalonEdit/TruncateLongLinesElementGenerator.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Document; 2 | using ICSharpCode.AvalonEdit.Rendering; 3 | 4 | namespace LuYao.Toolkit.Controls.AvalonEdit; 5 | 6 | public class TruncateLongLinesElementGenerator : VisualLineElementGenerator 7 | { 8 | const int maxLength = 256; 9 | const string ellipsis = "......"; 10 | const int charactersAfterEllipsis = 50; 11 | 12 | public override int GetFirstInterestedOffset(int startOffset) 13 | { 14 | DocumentLine line = CurrentContext.VisualLine.LastDocumentLine; 15 | if (line.Length > maxLength) 16 | { 17 | int ellipsisOffset = line.Offset + maxLength - charactersAfterEllipsis - ellipsis.Length; 18 | if (startOffset <= ellipsisOffset) 19 | return ellipsisOffset; 20 | } 21 | return -1; 22 | } 23 | 24 | public override VisualLineElement ConstructElement(int offset) 25 | { 26 | var fmt = new FormattedTextElement(ellipsis, CurrentContext.VisualLine.LastDocumentLine.EndOffset - offset - charactersAfterEllipsis); 27 | return fmt; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/CodeEditor.Context.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.AvalonEdit.Document; 2 | using ICSharpCode.AvalonEdit.Folding; 3 | 4 | namespace LuYao.Toolkit.Controls; 5 | 6 | public partial class CodeEditor 7 | { 8 | private class EditorContext 9 | { 10 | public Highlighting SyntaxHighlighting { get; } 11 | public IFoldingStrategy FoldingStrategy { get; } 12 | 13 | public EditorContext(Highlighting syntaxHighlighting) 14 | { 15 | SyntaxHighlighting = syntaxHighlighting; 16 | } 17 | public EditorContext(Highlighting syntaxHighlighting, IFoldingStrategy foldingStrategy) : this(syntaxHighlighting) 18 | { 19 | this.FoldingStrategy = foldingStrategy; 20 | } 21 | } 22 | private interface IFoldingStrategy 23 | { 24 | void UpdateFoldings(FoldingManager manager, TextDocument document); 25 | } 26 | 27 | private class XmlFoldingStrategy : global::ICSharpCode.AvalonEdit.Folding.XmlFoldingStrategy, IFoldingStrategy { } 28 | 29 | private class JsonFoldingStrategy : AvalonEdit.JsonFoldingStrategy, IFoldingStrategy { } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/CodeEditor.Highlighting.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Controls; 2 | 3 | public partial class CodeEditor 4 | { 5 | public enum Highlighting 6 | { 7 | Unset, 8 | CSharp, 9 | Json, 10 | Log, 11 | Xml 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/TextBlockWithIconBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Controls 17 | { 18 | public class TextBlockWithIconBox : Control 19 | { 20 | static TextBlockWithIconBox() 21 | { 22 | DefaultStyleKeyProperty.OverrideMetadata(typeof(TextBlockWithIconBox), new FrameworkPropertyMetadata(typeof(TextBlockWithIconBox))); 23 | } 24 | 25 | 26 | public ImageSource Icon 27 | { 28 | get { return (ImageSource)GetValue(IconProperty); } 29 | set { SetValue(IconProperty, value); } 30 | } 31 | 32 | public static readonly DependencyProperty IconProperty = 33 | DependencyProperty.Register("Icon", typeof(ImageSource), typeof(TextBlockWithIconBox), new PropertyMetadata(null)); 34 | 35 | public string Text 36 | { 37 | get { return (string)GetValue(TextProperty); } 38 | set { SetValue(TextProperty, value); } 39 | } 40 | 41 | public static readonly DependencyProperty TextProperty = 42 | DependencyProperty.Register("Text", typeof(string), typeof(TextBlockWithIconBox), new PropertyMetadata(string.Empty)); 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Controls/Utils/Boxes.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Controls.Utils; 2 | 3 | internal static class Boxes 4 | { 5 | public static readonly object True = true; 6 | 7 | public static readonly object False = false; 8 | 9 | public static object Box(bool value) 10 | { 11 | if (!value) 12 | { 13 | return False; 14 | } 15 | 16 | return True; 17 | } 18 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/ByteCountToDisplaySizeConverter.cs: -------------------------------------------------------------------------------- 1 | using LuYao.IO; 2 | using NewLife.Data; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Data; 10 | 11 | namespace LuYao.Toolkit.Converters 12 | { 13 | [ValueConversion(typeof(int), typeof(string))] 14 | [ValueConversion(typeof(long), typeof(string))] 15 | public class ByteCountToDisplaySizeConverter : IValueConverter 16 | { 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (value is int || value is long || value is uint || value is ulong) 20 | { 21 | var len = System.Convert.ToInt64(value); 22 | return FileUtil.ByteCountToDisplaySize(len); 23 | } 24 | 25 | return null; 26 | } 27 | 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/DateTimeToRelativeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace LuYao.Toolkit.Converters; 6 | 7 | public class DateTimeToRelativeConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | if (value is DateTime time) return DateTimeUtils.GetRelative(time); 12 | return string.Empty; 13 | } 14 | 15 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/EnumToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows; 5 | 6 | namespace LuYao.Toolkit.Converters; 7 | 8 | public class EnumToBooleanConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var ParameterString = parameter as string; 13 | if (ParameterString == null) return DependencyProperty.UnsetValue; 14 | 15 | if (Enum.IsDefined(value.GetType(), value) == false) return DependencyProperty.UnsetValue; 16 | 17 | object paramvalue = Enum.Parse(value.GetType(), ParameterString); 18 | return paramvalue.Equals(value); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | var ParameterString = parameter as string; 24 | var valueAsBool = (bool)value; 25 | 26 | if (ParameterString == null || !valueAsBool) 27 | { 28 | try 29 | { 30 | return Enum.Parse(targetType, "0"); 31 | } 32 | catch (Exception) 33 | { 34 | return DependencyProperty.UnsetValue; 35 | } 36 | } 37 | return Enum.Parse(targetType, ParameterString); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/EnumToDescriptionConverter.cs: -------------------------------------------------------------------------------- 1 | using NewLife; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | 10 | namespace LuYao.Toolkit.Converters; 11 | 12 | public class EnumToDescriptionConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (value is Enum e) 17 | { 18 | return e.GetDescription(); 19 | } 20 | return string.Empty; 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/EnumToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace LuYao.Toolkit.Converters 7 | { 8 | public class EnumToVisibilityConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var ParameterString = parameter as string; 13 | if (ParameterString == null) return DependencyProperty.UnsetValue; 14 | 15 | if (Enum.IsDefined(value.GetType(), value) == false) return DependencyProperty.UnsetValue; 16 | 17 | object paramvalue = Enum.Parse(value.GetType(), ParameterString); 18 | return paramvalue.Equals(value) ? Visibility.Visible : Visibility.Collapsed; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/FunctionBackgroundConverter.linq: -------------------------------------------------------------------------------- 1 | 2 | System.Drawing 3 | 4 | 5 | var colors = new string[] { 6 | "#006266","#007B43","#009432","#0094C8","#0095D9","#00A3AF","#00A497","#00a8ff","#00b5cc","#00b894","#00cec9","#019875","#01a3a4","#03c9a9","#0652DD","#0984e3","#0abde3","#10ac84","#1289A7","#22a6b3","#273c75","#2792C3","#2CA9E1","#2e86de","#2ed573","#341f97","#349e69","#38A1DB","#38B48B","#47585C","#4834d4","#487eb0","#4cd137","#4d05e8","#4ecdc4","#595857","#6ab04c","#6c5ce7","#6F1E51","#71808E","#7f8fa6","#833471","#8395a7","#913d88","#9980FA","#9c88ff","#A3CB38","#a537fd","#B53471","#be2edd","#D3381C","#d63031","#D9333F","#D980FA","#e17055","#E17B34","#E60033","#e84118","#e84393","#E95295","#EA2027","#EA5506","#eb4d4b","#EB6238","#ED4C67","#ee5253","#EE5A24","#f0932b","#f368e0","#f52443","#f5ab35","#f62459","#F79F1F","#f7ca18","#fbc531","#fd79a8","#fdcb6e","#ff47d1","#ff6b81","#ff9f43","blue" 7 | }; 8 | var converter = new ColorConverter(); 9 | var list = new SortedSet(); 10 | foreach (var color in colors) 11 | { 12 | var item =(Color) converter.ConvertFrom(color); 13 | list.Add(item.ToArgb()); 14 | } 15 | foreach (var i in list) 16 | { 17 | var item = Color.FromArgb(i); 18 | Console.WriteLine("new SolidColorBrush(Color.FromArgb({0},{1},{2},{3})),",item.A,item.R,item.G,item.B); 19 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/PathToFileNameConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using System.Windows.Data; 5 | 6 | namespace LuYao.Toolkit.Converters; 7 | 8 | [ValueConversion(typeof(string), typeof(string))] 9 | public class PathToFileNameConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if (value is string str) return Path.GetFileName(str); 14 | return null; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/RegexMatchPositionConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.RegularExpressions; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | 10 | namespace LuYao.Toolkit.Converters; 11 | 12 | public class RegexMatchPositionConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (value is Match m) 17 | { 18 | return $"({m.Index},{m.Length})"; 19 | } 20 | if (value is Group g) 21 | { 22 | return $"({g.Index},{g.Length})"; 23 | } 24 | if (value is Capture c) 25 | { 26 | return $"({c.Index},{c.Length})"; 27 | } 28 | return string.Empty; 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/SingleLineConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace LuYao.Toolkit.Converters; 6 | 7 | public class SingleLineConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | if (value is string str && !string.IsNullOrWhiteSpace(str)) 12 | { 13 | return str 14 | .Replace("\n", string.Empty) 15 | .Replace("\r", string.Empty) 16 | .Trim(); 17 | } 18 | 19 | return null; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/StringIsNotNullOrEmptyConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace LuYao.Toolkit.Converters; 6 | 7 | [ValueConversion(typeof(string), typeof(bool))] 8 | public class StringIsNotNullOrEmptyConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (value is string str) 13 | { 14 | return !string.IsNullOrWhiteSpace(str); 15 | } 16 | 17 | return null; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Converters/TruncateStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace LuYao.Toolkit.Converters; 6 | 7 | public class TruncateStringConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | var max = 500; 12 | if (parameter is int i) max = i; 13 | if (max <= 0) max = 500; 14 | if (value is string str) 15 | { 16 | if (str.Length > max) return str.Substring(0, max); 17 | return str; 18 | } 19 | return value; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/DialogWindow.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/DialogWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using Prism.Services.Dialogs; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Dialogs; 18 | 19 | /// 20 | /// DialogWindow.xaml 的交互逻辑 21 | /// 22 | public partial class DialogWindow : IDialogWindow 23 | { 24 | public DialogWindow() 25 | { 26 | InitializeComponent(); 27 | this.Loaded += DialogWindow_Loaded; 28 | } 29 | 30 | private void DialogWindow_Loaded(object sender, RoutedEventArgs e) 31 | { 32 | Debug.WriteLine(this.Title); 33 | } 34 | 35 | /// 36 | /// The of the dialog. 37 | /// 38 | public IDialogResult Result { get; set; } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/MultiboxingDialog.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/MultiboxingDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Services; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Dialogs 18 | { 19 | /// 20 | /// MultiboxingDialog.xaml 的交互逻辑 21 | /// 22 | public partial class MultiboxingDialog : UserControl, IGrowlTokenProvider 23 | { 24 | public MultiboxingDialog() 25 | { 26 | InitializeComponent(); 27 | this.GrowlToken = $"growl_{Math.Abs(this.GetHashCode())}"; 28 | this.GrowlStackPanel.SetValue(HandyControl.Controls.Growl.TokenProperty, this.GrowlToken); 29 | } 30 | 31 | public string GrowlToken { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/MultiboxingDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Channels; 2 | using Prism.Regions; 3 | using Prism.Services.Dialogs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace LuYao.Toolkit.Dialogs; 11 | 12 | public partial class MultiboxingDialogViewModel : ViewModelBase, IDialogAware 13 | { 14 | private IRegionManager _regionManager; 15 | public string RegionName { get; } 16 | public MultiboxingDialogViewModel(IRegionManager regionManager) 17 | { 18 | this._regionManager = regionManager ?? throw new ArgumentNullException(nameof(regionManager)); 19 | this.RegionName = $"dialog_{Math.Abs(this.GetHashCode())}"; 20 | } 21 | 22 | public string Title { set; get; } 23 | 24 | public event Action RequestClose; 25 | 26 | public bool CanCloseDialog() 27 | { 28 | return true; 29 | } 30 | 31 | public void OnDialogClosed() 32 | { 33 | this._regionManager.Regions.Remove(this.RegionName); 34 | } 35 | 36 | public void OnDialogOpened(IDialogParameters parameters) 37 | { 38 | var func = parameters.GetValue("Function"); 39 | if (func == null) return; 40 | this.Title = func.Title; 41 | this._regionManager.RegisterViewWithRegion(this.RegionName, func.View); 42 | } 43 | protected virtual void OnRequestClose(IDialogResult obj) 44 | { 45 | RequestClose?.Invoke(obj); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/MultiboxingDialogWindow.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/MultiboxingDialogWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Services; 2 | using Prism.Services.Dialogs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Dialogs 18 | { 19 | /// 20 | /// DialogWindow.xaml 的交互逻辑 21 | /// 22 | public partial class MultiboxingDialogWindow : IDialogWindow, IGrowlTokenProvider 23 | { 24 | public MultiboxingDialogWindow() 25 | { 26 | InitializeComponent(); 27 | this.Loaded += DialogWindow_Loaded; 28 | } 29 | 30 | private void DialogWindow_Loaded(object sender, RoutedEventArgs e) 31 | { 32 | this.Owner = null; 33 | } 34 | 35 | public IDialogResult Result { get; set; } 36 | 37 | public string GrowlToken => GetGrowlName(); 38 | private string GetGrowlName() 39 | { 40 | if (this.Content is IGrowlTokenProvider provider) return provider.GrowlToken; 41 | return nameof(MainWindow); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/PreviewFileAsStringDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Dialogs 17 | { 18 | /// 19 | /// PreviewFileAsStringDialog.xaml 的交互逻辑 20 | /// 21 | public partial class PreviewFileAsStringDialog : UserControl 22 | { 23 | public PreviewFileAsStringDialog() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/ToolkitSettingsDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Helpers; 2 | using LuYao.Toolkit.Rdm; 3 | using LuYao.Toolkit.Themes; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Data; 12 | using System.Windows.Documents; 13 | using System.Windows.Input; 14 | using System.Windows.Media; 15 | using System.Windows.Media.Imaging; 16 | using System.Windows.Navigation; 17 | using System.Windows.Shapes; 18 | 19 | namespace LuYao.Toolkit.Dialogs 20 | { 21 | /// 22 | /// ToolkitSettingsDialog.xaml 的交互逻辑 23 | /// 24 | public partial class ToolkitSettingsDialog : UserControl 25 | { 26 | public ToolkitSettingsDialog() 27 | { 28 | InitializeComponent(); 29 | ComboBoxHelper.BindEnum(ThemesComboBox); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Dialogs/ToolkitSettingsDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using LuYao.Toolkit.Events; 4 | using Prism.Events; 5 | using Prism.Services.Dialogs; 6 | using System; 7 | 8 | namespace LuYao.Toolkit.Dialogs; 9 | 10 | public partial class ToolkitSettingsDialogViewModel : ViewModelBase, IDialogAware 11 | { 12 | private IEventAggregator eventAggregator; 13 | 14 | public ToolkitSettingsDialogViewModel(IEventAggregator eventAggregator) 15 | { 16 | this.eventAggregator = eventAggregator; 17 | } 18 | 19 | public string Title => "设置"; 20 | 21 | public event Action RequestClose; 22 | 23 | public bool CanCloseDialog() 24 | { 25 | return true; 26 | } 27 | 28 | public void OnDialogClosed() 29 | { 30 | ToolkitConfig.Current = null; 31 | } 32 | 33 | public void OnDialogOpened(IDialogParameters parameters) 34 | { 35 | this.Config = ToolkitConfig.Current; 36 | } 37 | 38 | [ObservableProperty] 39 | private ToolkitConfig _config; 40 | 41 | [RelayCommand] 42 | private void Save() 43 | { 44 | this.Config.Save(); 45 | eventAggregator.GetEvent().Publish(this.Config.Theme); 46 | this.RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Helpers/ComboBoxHelper.cs: -------------------------------------------------------------------------------- 1 | using NewLife; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Controls; 8 | 9 | namespace LuYao.Toolkit.Helpers; 10 | 11 | public static class ComboBoxHelper 12 | { 13 | public static void BindEnum(T combo) where TEnum : Enum where T : ComboBox 14 | { 15 | var values = Enum.GetValues(typeof(TEnum)); 16 | combo.DisplayMemberPath = "Display"; 17 | combo.SelectedValuePath = "Value"; 18 | combo.Items.Clear(); 19 | foreach (TEnum item in values) 20 | { 21 | var desc = item.GetDescription(); 22 | if (string.IsNullOrWhiteSpace(desc)) desc = item.ToString(); 23 | var dto = new 24 | { 25 | Display = desc, 26 | Value = item 27 | }; 28 | combo.Items.Add(dto); 29 | } 30 | } 31 | public static void BindEnum(this ComboBox combo) where TEnum : Enum 32 | { 33 | BindEnum(combo); 34 | } 35 | public static void BindEnum(this HandyControl.Controls.ComboBox combo) where TEnum : Enum 36 | { 37 | BindEnum(combo); 38 | } 39 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/IO/FileType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace LuYao.Toolkit.IO; 5 | 6 | [Flags] 7 | public enum FileType 8 | { 9 | [Description("全部文件")] 10 | All = -1, 11 | 12 | [Description("文件")] 13 | Customer = 0, 14 | 15 | [Description("位图文件")] 16 | [FileTypeExtensions(".jpg", ".png", ".bmp", ".gif", ".webp")] 17 | Image = 1, 18 | 19 | [Description("文本文件")] 20 | [FileTypeExtensions(".txt")] 21 | Text = 2, 22 | 23 | [Description("Word文件")] 24 | [FileTypeExtensions(".doc", ".docx")] 25 | Word = 4, 26 | 27 | [Description("Excel文件")] 28 | [FileTypeExtensions(".xls", ".xlsx")] 29 | Excel = 8, 30 | 31 | [Description("压缩文件")] 32 | [FileTypeExtensions(".zip", ".rar", ".gz", ".7z")] 33 | Zip = 16, 34 | 35 | [Description("XML文件")] 36 | [FileTypeExtensions(".xml")] 37 | Xml = 32, 38 | 39 | [Description("可执行文件")] 40 | [FileTypeExtensions(".exe")] 41 | Exe = 64, 42 | 43 | [Description("XSL文件")] 44 | [FileTypeExtensions(".xsl", ".xslt")] 45 | Xsl = 128, 46 | 47 | [FileTypeExtensions(".json", ".js", ".txt")] 48 | [Description("JSON")] 49 | Json = 256, 50 | 51 | [FileTypeExtensions(".js")] 52 | [Description("JavaScript")] 53 | JavaScript = 512, 54 | 55 | [Description("日志")] 56 | [FileTypeExtensions(".log", ".txt")] 57 | Log = 1024, 58 | 59 | [Description("Liquid")] 60 | [FileTypeExtensions(".liquid")] 61 | Liquid = 2048, 62 | 63 | [Description("矢量图")] 64 | [FileTypeExtensions(".svg")] 65 | Svg = 4096, 66 | } 67 | -------------------------------------------------------------------------------- /LuYao.Toolkit/IO/FileTypeExtensionsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace LuYao.Toolkit.IO; 6 | 7 | public class FileTypeExtensionsAttribute : Attribute 8 | { 9 | public FileTypeExtensionsAttribute(params string[] extensions) 10 | { 11 | this.Extensions = extensions ?? throw new ArgumentNullException(nameof(extensions)); 12 | if (this.Extensions.Count <= 0) throw new ArgumentOutOfRangeException(nameof(extensions)); 13 | this.FilterValue = string.Join( 14 | ";", 15 | extensions.Order(StringComparer.InvariantCultureIgnoreCase) 16 | .Distinct() 17 | .Select(str => $"*{str}") 18 | ); 19 | } 20 | public IReadOnlyCollection Extensions { get; } 21 | public string FilterValue { get; } 22 | } 23 | -------------------------------------------------------------------------------- /LuYao.Toolkit/IPLookup.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/IPLookup.dat -------------------------------------------------------------------------------- /LuYao.Toolkit/LuYaoCommands.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | 3 | namespace LuYao.Toolkit; 4 | 5 | public static class LuYaoCommands 6 | { 7 | static LuYaoCommands() 8 | { 9 | CloseDetailCommand = new RoutedCommand(nameof(CloseDetailCommand), typeof(LuYaoCommands)); 10 | } 11 | public static RoutedCommand CloseDetailCommand { get; private set; } 12 | } 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/Dialogs/RdmSettingDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Rdm.Dialogs 17 | { 18 | /// 19 | /// RdmSettingDialog.xaml 的交互逻辑 20 | /// 21 | public partial class RdmSettingDialog : UserControl 22 | { 23 | public RdmSettingDialog() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/Dialogs/RdpGroupDetailDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace LuYao.Toolkit.Rdm.Dialogs 17 | { 18 | /// 19 | /// RdpGroupDetailDialog.xaml 的交互逻辑 20 | /// 21 | public partial class RdpGroupDetailDialog : UserControl 22 | { 23 | public RdpGroupDetailDialog() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/IMsRdpClient.cs: -------------------------------------------------------------------------------- 1 | using MSTSCLib; 2 | using System; 3 | using System.ComponentModel; 4 | using System.Windows.Forms; 5 | 6 | namespace LuYao.Toolkit.Rdm; 7 | 8 | public interface IMsRdpClient : IDisposable, ISupportInitialize 9 | { 10 | void Update(IRdpConnection connection); 11 | Control Control { get; } 12 | void Attach(IMsRdpClientHandler handler); 13 | void Detach(IMsRdpClientHandler handler); 14 | void Connect(); 15 | void Disconnect(); 16 | string GetErrorDescription(uint disconnectReason, uint extendedDisconnectReason); 17 | ExtendedDisconnectReasonCode ExtendedDisconnectReason { get; } 18 | } 19 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/IMsRdpClientHandler.cs: -------------------------------------------------------------------------------- 1 | using AxMSTSCLib; 2 | using System; 3 | 4 | namespace LuYao.Toolkit.Rdm; 5 | 6 | public interface IMsRdpClientHandler 7 | { 8 | void OnConnecting(object sender, EventArgs e); 9 | 10 | void OnLoginComplete(object sender, EventArgs e); 11 | 12 | void OnDisconnected(object sender, IMsTscAxEvents_OnDisconnectedEvent e); 13 | 14 | void OnConnected(object sender, EventArgs e); 15 | } 16 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/RdpConnectStatus.cs: -------------------------------------------------------------------------------- 1 | namespace LuYao.Toolkit.Rdm; 2 | 3 | public enum RdpConnectStatus { Pending, Connecting, Connected, Disconnected, Fail } 4 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Rdm/StatusChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LuYao.Toolkit.Rdm; 4 | 5 | public class StatusChangedEventArgs : EventArgs 6 | { 7 | public RdpConnectStatus Status { get; } 8 | 9 | public StatusChangedEventArgs(RdpConnectStatus status) => Status = status; 10 | } 11 | 12 | public delegate void StatusChangedEventHandler(object sender, StatusChangedEventArgs e); -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/JetBrainsMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/JetBrainsMono.ttf -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/calc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/calc.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/certmgr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/certmgr.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/cmd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/cmd.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/credential.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/credential.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/datetime.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/datetime.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/deskicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/deskicon.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/devmgr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/devmgr.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/disks.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/disks.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/env.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/env.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/eventlog.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/eventlog.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/firewall.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/firewall.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/gpedit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/gpedit.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/hosts.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/hosts.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/ipv4.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/ipv4.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/ipv6.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/ipv6.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/killexplorer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/killexplorer.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/netconnections.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/netconnections.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/pcname.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/pcname.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/performance.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/performance.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/perfsettings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/perfsettings.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/powercfg.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/powercfg.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/poweroff.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/poweroff.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/powershell.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/powershell.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/program.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/program.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/proxy.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/proxy.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/reboot.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/reboot.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/recyclebin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/recyclebin.png -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/regedit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/regedit.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/resetexplorer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/resetexplorer.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/resmon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/resmon.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/route.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/route.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/secpolicy.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/secpolicy.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/services.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/services.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/share.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/share.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/systeminfo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/systeminfo.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/taskmgr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/taskmgr.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/tasksch.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/tasksch.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/uac.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/uac.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/users.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/users.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/version.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/version.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/wallpaper.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/wallpaper.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/SystemToolkit/wsl.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/SystemToolkit/wsl.ico -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/Toolbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/Toolbox.png -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/Update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/Update.png -------------------------------------------------------------------------------- /LuYao.Toolkit/Resources/find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Resources/find.png -------------------------------------------------------------------------------- /LuYao.Toolkit/Services/IGrowlTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LuYao.Toolkit.Services; 8 | 9 | public interface IGrowlTokenProvider 10 | { 11 | string GrowlToken { get; } 12 | } 13 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Tabs/Explorer/Index.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System.Windows.Controls; 3 | 4 | namespace LuYao.Toolkit.Tabs.Explorer 5 | { 6 | /// 7 | /// Index.xaml 的交互逻辑 8 | /// 9 | [ViewName(ViewNames.Tabs.Explorer.Index)] 10 | public partial class Index : UserControl 11 | { 12 | public Index() 13 | { 14 | InitializeComponent(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Tabs/Navs/Index.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Views; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Tabs.Navs 18 | { 19 | /// 20 | /// Index.xaml 的交互逻辑 21 | /// 22 | [ViewName(ViewNames.Tabs.Navs.Index)] 23 | public partial class Index : UserControl 24 | { 25 | public Index() 26 | { 27 | InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Tabs/Rdp/Index.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Tabs/Rdp/Index.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Rdm; 2 | using LuYao.Toolkit.Rdm.Events; 3 | using LuYao.Toolkit.Tabs.Rdp.Controls; 4 | using LuYao.Toolkit.Views; 5 | using Prism.Events; 6 | using Prism.Services.Dialogs; 7 | using System; 8 | using System.Windows.Controls; 9 | 10 | namespace LuYao.Toolkit.Tabs.Rdp 11 | { 12 | /// 13 | /// Index.xaml 的交互逻辑 14 | /// 15 | [ViewName(ViewNames.Tabs.Rdp.Index)] 16 | public partial class Index : UserControl 17 | { 18 | public Index() 19 | { 20 | InitializeComponent(); 21 | OpenRdpConnection += Index_OpenRdpConnection; 22 | } 23 | 24 | private void Index_OpenRdpConnection(object sender, Guid id) 25 | { 26 | foreach (RdpTabItem item in SessionTabControl.Items) 27 | { 28 | if (item.Id == id) 29 | { 30 | this.SessionTabControl.SelectedItem = item; 31 | return; 32 | } 33 | } 34 | var e = Entities.RdpConnection.FindById(id); 35 | if (e == null) return; 36 | var rdp = new RdpConnection(e); 37 | var tab = new RdpTabItem(id, rdp); 38 | this.SessionTabControl.Items.Add(tab); 39 | this.SessionTabControl.SelectedItem = tab; 40 | tab.Connect(); 41 | } 42 | 43 | private static event EventHandler OpenRdpConnection; 44 | public static void Open(Guid id) 45 | { 46 | if (OpenRdpConnection == null) return; 47 | OpenRdpConnection.Invoke(null, id); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Basic/Converters.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Basic/Geometries.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Basic/MaterialToGeometry.linq: -------------------------------------------------------------------------------- 1 | 2 | MahApps.Metro.IconPacks.Material 3 | MahApps.Metro.IconPacks.Converter 4 | System.Windows.Data 5 | MahApps.Metro.IconPacks 6 | System.Windows.Media 7 | System.Globalization 8 | 9 | 10 | var idx = PackIconMaterialDataFactory.DataIndex.Value!; 11 | var names = Enum.GetNames(typeof(PackIconMaterialKind)); 12 | foreach (var n in names) 13 | { 14 | var kind = (PackIconMaterialKind)Enum.Parse(typeof(PackIconMaterialKind), n); 15 | if (idx.TryGetValue(kind, out var path)) 16 | { 17 | Console.WriteLine("{1}", n, path); 18 | } 19 | } -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Controls/DataGrid.xaml: -------------------------------------------------------------------------------- 1 |  4 | 11 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Controls/FormItemContainer.xaml: -------------------------------------------------------------------------------- 1 |  5 | 26 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Controls/TextBlockWithIconBox.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 21 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Controls/TextEditor.xaml: -------------------------------------------------------------------------------- 1 |  5 | 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Controls/Window.xaml: -------------------------------------------------------------------------------- 1 |  5 | 8 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Generic.txt: -------------------------------------------------------------------------------- 1 | Basic\Converters.xaml 2 | Basic\Geometries.xaml 3 | # -------------------------------------- 4 | Controls\DataGrid.xaml 5 | Controls\FormItemContainer.xaml 6 | Controls\RdpTabItemHeader.xaml 7 | Controls\TextEditor.xaml 8 | Controls\Window.xaml 9 | Controls\TextBlockWithIconBox.xaml 10 | Controls\MasterDetailLayout.xaml -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/SkinDark.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/SkinDefault.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/Theme.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Themes/XamlCombine.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/LuYao.Toolkit/Themes/XamlCombine.exe -------------------------------------------------------------------------------- /LuYao.Toolkit/ToolkitConfig.cs: -------------------------------------------------------------------------------- 1 | using LuYao.Toolkit.Themes; 2 | using NewLife.Xml; 3 | using System; 4 | 5 | namespace LuYao.Toolkit; 6 | 7 | public class ToolkitConfig : XmlConfig 8 | { 9 | public ThemeMode Theme { get; set; } = ThemeMode.Light; 10 | public bool CheckForUpdatesOnStartup { get; set; } = true; 11 | public bool CodeEditorShowLineNumbers { get; set; } = true; 12 | public bool CodeEditorWordWrap { get; set; } = false; 13 | 14 | public override void Save() 15 | { 16 | base.Save(); 17 | Saved?.Invoke(null, EventArgs.Empty); 18 | } 19 | 20 | public static event EventHandler Saved; 21 | } 22 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Update/FindNewVersionDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using HandyControl.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Update; 18 | 19 | /// 20 | /// FindNewVersionDialog.xaml 的交互逻辑 21 | /// 22 | public partial class FindNewVersionDialog : UserControl 23 | { 24 | public FindNewVersionDialog() 25 | { 26 | InitializeComponent(); 27 | this.Loaded += FindNewVersionDialog_Loaded; 28 | } 29 | 30 | private void FindNewVersionDialog_Loaded(object sender, RoutedEventArgs e) 31 | { 32 | Window.GetWindow(this).Topmost = true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Update/FindNewVersionDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | using LuYao.IO.Updating; 4 | using Prism.Services.Dialogs; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace LuYao.Toolkit.Update; 12 | 13 | public partial class FindNewVersionDialogViewModel : ViewModelBase, IDialogAware 14 | { 15 | public string Title => "发现新版本"; 16 | 17 | public event Action RequestClose; 18 | protected virtual void OnRequestClose(IDialogResult obj) 19 | { 20 | RequestClose?.Invoke(obj); 21 | } 22 | 23 | public bool CanCloseDialog() => true; 24 | 25 | public void OnDialogClosed() 26 | { 27 | } 28 | 29 | public void OnDialogOpened(IDialogParameters parameters) 30 | { 31 | var pkg = parameters.GetValue("UpdatePackage"); 32 | this.Description = pkg.Description; 33 | } 34 | 35 | [ObservableProperty] 36 | private string _description; 37 | 38 | [RelayCommand] 39 | private void Update() 40 | { 41 | OnRequestClose(new DialogResult(ButtonResult.Yes)); 42 | } 43 | 44 | [RelayCommand] 45 | private void Ignore() 46 | { 47 | OnRequestClose(new DialogResult(ButtonResult.Ignore)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /LuYao.Toolkit/Update/Update.xaml.cs: -------------------------------------------------------------------------------- 1 | using LuYao.IO.Updating; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace LuYao.Toolkit.Update; 18 | 19 | /// 20 | /// Update.xaml 的交互逻辑 21 | /// 22 | public partial class Update : UserControl 23 | { 24 | public Update(UpdatePackage package) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = new UpdateViewModel(package); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LuYao.Toolkit 2 | 3 | 路遥工具箱是笔者在学习 WPF 时练手所作的一个小工具,主要用于解决一些开发过程中常见的功能性需求,并将其自动化。截至目前,本工具已拥有十数项功能。 4 | 5 | https://www.coderbusy.com/luyao-toolkit 6 | 7 | ## 下载地址 8 | 9 | 🌐[LuYao.Toolkit.zip](https://luyao.coderbusy.com/LuYao.Toolkit.zip) 10 | 11 | ## 冰爷AV版本 12 | https://github.com/coderbusy/luyao-avalonia 13 | 14 | ### 数据生成 15 | 16 | - 生成 GUID 17 | - 生成密码 18 | - 生成 AES 密钥 19 | - 生成 RSA 密钥 20 | - 生成 XCode 实体 21 | - 模板批量生成 22 | 23 | ### 网络工具 24 | 25 | - IP 查询 26 | - Ping 检测 27 | - Whois 信息查询 28 | - User Agent 解析 29 | - URL 分析器 30 | - 远程桌面 31 | - 流量监控 32 | 33 | ### 格式转换 34 | 35 | - Unix 时间戳转换 36 | - RSA 密钥格式转换 37 | - JSON 格式化 38 | - XML 格式化 39 | - 进制转换 40 | - XSLT 转换 41 | - JSON 转换 42 | - Liquid 转换 43 | - RGB 颜色转换 44 | - JSON 转 C# 实体类 45 | - JSON 转 CSV 46 | - Postman 数据转换 47 | - Yaml 转 Json 48 | 49 | ### 文字工具 50 | 51 | - 谷歌翻译 52 | - 多行拼接 53 | - 日志查看器 54 | - 全角半角转换 55 | - CSV 查看器 56 | - 正则测试 57 | - 有道词典 58 | - 哈希计算器 59 | 60 | ### 编码互转 61 | 62 | - 文本压缩 63 | - URL 编码 64 | - HTML 编码 65 | - ASCII85 编码 66 | - BASE64 编码 67 | - BASE62 编码 68 | - BASE16 编码 69 | 70 | ### 文件处理 71 | 72 | - 编码识别 73 | - 文件校验 74 | 75 | ### 图片处理 76 | 77 | - 图片转图标 78 | - Gif 分割 79 | - 图片转 Base64 80 | - Base64 转图片 81 | -------------------------------------------------------------------------------- /common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.3.15.57 4 | 5 | -------------------------------------------------------------------------------- /delete-bin-obj-folders.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | cls 3 | 4 | ECHO Deleting all BIN and OBJ folders... 5 | ECHO. 6 | 7 | FOR /d /r . %%d in (bin,obj) DO ( 8 | IF EXIST "%%d" ( 9 | ECHO %%d | FIND /I "\node_modules\" > Nul && ( 10 | ECHO.Skipping: %%d 11 | ) || ( 12 | ECHO.Deleting: %%d 13 | rd /s/q "%%d" 14 | ) 15 | ) 16 | ) 17 | 18 | ECHO. 19 | ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit. 20 | pause > nul -------------------------------------------------------------------------------- /libs/AxInterop.MSTSCLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/libs/AxInterop.MSTSCLib.dll -------------------------------------------------------------------------------- /libs/Interop.MSTSCLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/libs/Interop.MSTSCLib.dll -------------------------------------------------------------------------------- /libs/LuYao.Common.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v7.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v7.0": { 9 | "LuYao.Common/1.1.14": { 10 | "dependencies": { 11 | "ConfigureAwait.Fody": "3.3.2", 12 | "Fody": "6.6.4" 13 | }, 14 | "runtime": { 15 | "LuYao.Common.dll": {} 16 | } 17 | }, 18 | "ConfigureAwait.Fody/3.3.2": { 19 | "dependencies": { 20 | "Fody": "6.6.4" 21 | } 22 | }, 23 | "Fody/6.6.4": {} 24 | } 25 | }, 26 | "libraries": { 27 | "LuYao.Common/1.1.14": { 28 | "type": "project", 29 | "serviceable": false, 30 | "sha512": "" 31 | }, 32 | "ConfigureAwait.Fody/3.3.2": { 33 | "type": "package", 34 | "serviceable": true, 35 | "sha512": "sha512-vzGcpFU7uY4SbdB1Q68sFqv52HU5V1l39bF1rw6BIb7Os/DRLZa5ObV1yf/CNuTXj8IZjqJQ7PnTzSUiI/W49A==", 36 | "path": "configureawait.fody/3.3.2", 37 | "hashPath": "configureawait.fody.3.3.2.nupkg.sha512" 38 | }, 39 | "Fody/6.6.4": { 40 | "type": "package", 41 | "serviceable": true, 42 | "sha512": "sha512-vLZS+oa+ndUHYPlx/8n9bBTT3dHkCF0riml4paKq4D663+cZd47x1uagQo32D/gKFZ/sfmV1oqKaLmH0elxq4A==", 43 | "path": "fody/6.6.4", 44 | "hashPath": "fody.6.6.4.nupkg.sha512" 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /libs/LuYao.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/libs/LuYao.Common.dll -------------------------------------------------------------------------------- /libs/LuYao.Common.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landv/LuYao.Toolkit/a6dcb977a2a8adca9745a0f93ab1d58c7be1da77/libs/LuYao.Common.pdb --------------------------------------------------------------------------------