更新了设置。
This commit is contained in:
parent
ed58936ee2
commit
6b89071ea1
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -35,6 +35,7 @@ bld/
|
|||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
.vscode/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
|
|
|
@ -9,8 +9,4 @@
|
|||
MinWidth="500"
|
||||
MinHeight="500"
|
||||
PersistenceId="MainWindow"
|
||||
mc:Ignorable="d">
|
||||
<Window.SystemBackdrop>
|
||||
<MicaBackdrop />
|
||||
</Window.SystemBackdrop>
|
||||
</windowex:WindowEx>
|
||||
mc:Ignorable="d" />
|
||||
|
|
|
@ -6,12 +6,15 @@ namespace RustTools;
|
|||
|
||||
public sealed partial class MainWindow : WindowEx
|
||||
{
|
||||
private Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
|
||||
private readonly Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
|
||||
public static MainWindow Main;
|
||||
|
||||
private UISettings settings;
|
||||
private readonly UISettings settings;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
Main = this;
|
||||
gj.SetBackTheme(this);
|
||||
InitializeComponent();
|
||||
//AppWindow.SetIcon("Assets/tool.png");
|
||||
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
||||
|
@ -22,16 +25,15 @@ public sealed partial class MainWindow : WindowEx
|
|||
dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
|
||||
settings = new UISettings();
|
||||
settings.ColorValuesChanged += Settings_ColorValuesChanged; // cannot use FrameworkElement.ActualThemeChanged event
|
||||
|
||||
//gj.sc(Directory.GetCurrentDirectory());
|
||||
if(wj.cz(wj.FILE.UUID))
|
||||
{
|
||||
gj.sc(wj.dqwb(wj.FILE.UUID));
|
||||
}
|
||||
else
|
||||
{
|
||||
wj.xrwb("win.uuid", gj.GetUUID());
|
||||
}
|
||||
//settings.Color
|
||||
//if(wj.cz(wj.FILE.UUID))
|
||||
//{
|
||||
// gj.sc(wj.dqwb(wj.FILE.UUID));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// wj.xrwb("win.uuid", gj.GetUUID());
|
||||
//}
|
||||
}
|
||||
|
||||
// this handles updating the caption button colors correctly when indows system theme is changed
|
||||
|
|
|
@ -19,16 +19,6 @@
|
|||
<DefaultLanguage>zh-cn</DefaultLanguage>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Assets\新文件夹1\**" />
|
||||
<Compile Remove="Assets\新文件夹\**" />
|
||||
<Content Remove="Assets\新文件夹1\**" />
|
||||
<Content Remove="Assets\新文件夹\**" />
|
||||
<EmbeddedResource Remove="Assets\新文件夹1\**" />
|
||||
<EmbeddedResource Remove="Assets\新文件夹\**" />
|
||||
<None Remove="Assets\新文件夹1\**" />
|
||||
<None Remove="Assets\新文件夹\**" />
|
||||
<Page Remove="Assets\新文件夹1\**" />
|
||||
<Page Remove="Assets\新文件夹\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\image\image_106.svg" />
|
||||
|
@ -98,14 +88,6 @@
|
|||
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PRIResource Remove="Assets\新文件夹1\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PRIResource Remove="Assets\新文件夹\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="Assets\image\image_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24 (1).svg" />
|
||||
<Content Remove="Assets\创意工坊.svg" />
|
||||
|
|
25
RustTools/RustTools.sln
Normal file
25
RustTools/RustTools.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.002.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RustTools", "RustTools.csproj", "{8DF8C262-AA0A-47CA-A6E2-168104D5157C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8DF8C262-AA0A-47CA-A6E2-168104D5157C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8DF8C262-AA0A-47CA-A6E2-168104D5157C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8DF8C262-AA0A-47CA-A6E2-168104D5157C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8DF8C262-AA0A-47CA-A6E2-168104D5157C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {49E81B7B-34A9-40C7-8712-B0A6447EAE0D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -62,5 +62,4 @@ public partial class HomePageViewModel : ObservableRecipient
|
|||
|
||||
|
||||
public string lunbo = "{\r\n \"code\": 0,\r\n \"message\": \"获取成功,共1条记录\",\r\n \"data\": [\r\n {\r\n \"id\": \"67\",\r\n \"title\": \"博客\",\r\n \"owner\": \"coldmint\",\r\n \"picture\": \"https://rust.coldmint.top/resources/banner/1183ea9fe031b0787d07e7bdf4e28b3ef503ea0971.jpg\",\r\n \"link\": \"@link{https://coldmint.top/}\",\r\n \"createTime\": \"2023-05-13 10:38:01\",\r\n \"expirationTime\": \"2027-05-13 10:38:01\"\r\n }\r\n ]\r\n}";
|
||||
public string str = "{\r\n \"code\": 0,\r\n \"message\": \"获取成功,共6条记录\",\r\n \"data\": [\r\n {\r\n \"id\": \"csj_shi_ji\",\r\n \"name\": \"创世纪\",\r\n \"describe\": \"创世纪已经运行了3个月(发布铁锈盒子)禁止进行盗素材行为,素材均已得到绘画者许可。\",\r\n \"icon\": \"../user/lanxing/mods/csj_shi_ji/icon.png\",\r\n \"developer\": \"lanxing\",\r\n \"downloadNumber\": null,\r\n \"updateTime\": \"2024-07-19 09:03:17\",\r\n \"coinNumber\": \"0\",\r\n \"unitNumber\": \"203\",\r\n \"versionNumber\": \"1\"\r\n },\r\n {\r\n \"id\": \"tie_xiu_za_jiao_ban\",\r\n \"name\": \"铁锈杂交版\",\r\n \"describe\": \"原版单位融合 by虚谷\",\r\n \"icon\": \"\",\r\n \"developer\": \"chrwow\",\r\n \"downloadNumber\": \"1\",\r\n \"updateTime\": \"2024-07-18 14:29:36\",\r\n \"coinNumber\": \"0\",\r\n \"unitNumber\": \"5\",\r\n \"versionNumber\": \"1\"\r\n },\r\n {\r\n \"id\": \"xi_wang_an_quan\",\r\n \"name\": \"希望安全\",\r\n \"describe\": \"实验性位移系统;\\n三抗:\\n抗血量提取;抗运输槽删除;抗渗透回收;\\n复杂的全局保险机制;\\n计划重写一些铁锈的功能,来方便完成自己离谱需求,预计有:\\n位移,队伍\\n随便把之前mod没有完成的目标填坑。\\n至于BSJ倾向,则是为了告诉自己,活着,至少,还行;尽管无法与火和挺立的树相比;不要问曾经经历过什么。\",\r\n \"icon\": \"../user/Compulsory_registrat/mods/xi_wang_an_quan/icon.png\",\r\n \"developer\": \"Compulsory_registrat\",\r\n \"downloadNumber\": \"1\",\r\n \"updateTime\": \"2024-07-18 12:04:37\",\r\n \"coinNumber\": \"0\",\r\n \"unitNumber\": \"10\",\r\n \"versionNumber\": \"1\"\r\n },\r\n {\r\n \"id\": \"mod_xing\",\r\n \"name\": \"无尽星空-星海乐章(公测版0.1.3)\",\r\n \"describe\": \"\\\"星空浩瀚无比,征途永无止境.\\\"\\n-经历了十个版本内测,星海乐章公测版终于出炉啦!\\n-感谢『12rwmod』和其他小伙伴提出的各种改进建议\\n-模组背景音乐: Caught Adrift - Another Day, Strings For A Queen (Original Mix), Faster Than Light, The Remnant, Daylight. (排序不分先后)\\n-模组系列:『无尽星空』,单部:『星海乐章』\\n-作者是『幻梦星璃(星)』\\n-模组交流群『✨蓝星方舟中控部✨』(群号:757914038)\\n-建议用自定义地图里的太空玩哦.\\n-温馨提示:想玩这个模组需要用1.15的铁锈战争哦(没有的话,没关系,进群拿.)\\n-对了,人机可能会有一点点强哦,建议从低难度开始慢慢来.\\n@qqGroup{757914038}\",\r\n \"icon\": \"https://rust.coldmint.top/user/7854399/mods/mod_xing/icons/8222d5e5-b53f-5186-489d-a680b338ca5f.png\",\r\n \"developer\": \"7854399\",\r\n \"downloadNumber\": \"1226\",\r\n \"updateTime\": \"2024-07-17 19:14:02\",\r\n \"coinNumber\": \"59\",\r\n \"unitNumber\": \"228\",\r\n \"versionNumber\": \"69\"\r\n },\r\n {\r\n \"id\": \"shi_kong_jun_zhu\",\r\n \"name\": \"时空君主:魔法战争-人族1.7\",\r\n \"describe\": \"伟大永恒而无聊的时空君主,你加入了其他时空君主们的游戏,本次游戏中你们将召唤一个个来自魔法世界工业科技时代的士兵,为你们找点乐子!附注:建议标准4000开局。拒绝搬运,反对外传,禁止盗用,侵权必究!by.小小的工作室,可加群:411238064交流,当前仅在QQ群411238064正式发布,绝对免费,如有其他途径发现,不要购买,就是对作者最大的支持!\",\r\n \"icon\": \"\",\r\n \"developer\": \"18234474931\",\r\n \"downloadNumber\": \"1\",\r\n \"updateTime\": \"2024-07-16 08:06:14\",\r\n \"coinNumber\": \"0\",\r\n \"unitNumber\": \"21\",\r\n \"versionNumber\": \"1\"\r\n },\r\n {\r\n \"id\": \"yuanban_danwei_kuozhan\",\r\n \"name\": \"原版单位扩展(by:未开智物种)\",\r\n \"describe\": \"平衡小调整\",\r\n \"icon\": \"https://rust.coldmint.top/user/wls20081024/mods/yuanban_danwei_kuozhan/icon.png\",\r\n \"developer\": \"wls20081024\",\r\n \"downloadNumber\": \"24\",\r\n \"updateTime\": \"2024-07-13 15:53:21\",\r\n \"coinNumber\": \"2\",\r\n \"unitNumber\": \"26\",\r\n \"versionNumber\": \"5\"\r\n }\r\n ]\r\n}";
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ using RustTools.Contracts.Services;
|
|||
using RustTools.Helpers;
|
||||
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.Storage;
|
||||
|
||||
namespace RustTools.ViewModels;
|
||||
|
||||
|
@ -28,6 +31,7 @@ public partial class SettingsViewModel : ObservableRecipient
|
|||
get;
|
||||
}
|
||||
|
||||
|
||||
public SettingsViewModel(IThemeSelectorService themeSelectorService)
|
||||
{
|
||||
_themeSelectorService = themeSelectorService;
|
||||
|
@ -43,6 +47,8 @@ public partial class SettingsViewModel : ObservableRecipient
|
|||
await _themeSelectorService.SetThemeAsync(param);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static string GetVersionDescription()
|
||||
|
@ -62,4 +68,5 @@ public partial class SettingsViewModel : ObservableRecipient
|
|||
|
||||
return $"{"AppDisplayName".GetLocalized()} - {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@
|
|||
<Image
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
PointerPressed="Image_PointerPressed"
|
||||
Source="{Binding picture}"
|
||||
Stretch="UniformToFill" />
|
||||
Stretch="UniformToFill"
|
||||
Tapped="Image_Tapped" />
|
||||
</DataTemplate>
|
||||
</FlipView.ItemTemplate>
|
||||
</FlipView>
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using RustTools.DataList;
|
||||
using RustTools.muqing;
|
||||
using RustTools.Services;
|
||||
using RustTools.ViewModels;
|
||||
using Windows.UI.WindowManagement;
|
||||
using System.Threading;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using System.Text.RegularExpressions;
|
||||
using RustTools.WindowUI;
|
||||
namespace RustTools.Views;
|
||||
public sealed partial class HomePage : Page
|
||||
{
|
||||
|
@ -119,4 +113,37 @@ public sealed partial class HomePage : Page
|
|||
|
||||
[GeneratedRegex("\\{(.+?)\\}")]
|
||||
private static partial Regex MyRegex();
|
||||
|
||||
private void Image_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)
|
||||
{
|
||||
// 获取点击的 Image 控件
|
||||
var image = sender as Image;
|
||||
if (image != null)
|
||||
{
|
||||
|
||||
// 获取 Image 控件的绑定数据上下文
|
||||
var item = image.DataContext as HomeBanner.Data;
|
||||
var link1 = item?.link;
|
||||
if (link1 != null)
|
||||
{
|
||||
// 使用正则表达式匹配大括号内的内容
|
||||
var match = MyRegex().Match(link1);
|
||||
if (match.Success)
|
||||
{
|
||||
var link = match.Groups[1].Value;
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = link,
|
||||
UseShellExecute = true,
|
||||
Verb = "open"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("No match found.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,64 +10,93 @@
|
|||
<Page.Resources>
|
||||
<helpers:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
|
||||
</Page.Resources>
|
||||
<Grid>
|
||||
<StackPanel x:Name="ContentArea">
|
||||
<TextBlock x:Uid="Settings_Personalization" Style="{ThemeResource SubtitleTextBlockStyle}" />
|
||||
<StackPanel Margin="{StaticResource SmallTopBottomMargin}">
|
||||
<TextBlock x:Uid="Settings_Theme" />
|
||||
<ScrollView HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
|
||||
<Grid>
|
||||
<StackPanel x:Name="ContentArea">
|
||||
<TextBlock x:Uid="Settings_Personalization" Style="{ThemeResource SubtitleTextBlockStyle}" />
|
||||
<StackPanel Margin="{StaticResource SmallTopBottomMargin}">
|
||||
<TextBlock x:Uid="Settings_Theme" />
|
||||
|
||||
<StackPanel Margin="{StaticResource XSmallTopMargin}" Orientation="Horizontal">
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Light"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Light</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Dark"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Dark</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Default"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Default</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
<RadioButtons
|
||||
x:Name="BackgroundRadioButtons"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
Header="窗口背景材质"
|
||||
MaxColumns="4">
|
||||
<x:String>None</x:String>
|
||||
<x:String>Blur</x:String>
|
||||
<x:String>AcrylicBlur</x:String>
|
||||
<x:String>Mica</x:String>
|
||||
</RadioButtons>
|
||||
|
||||
<StackPanel Margin="{StaticResource XSmallTopMargin}">
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Light"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Light</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Dark"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Dark</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Uid="Settings_Theme_Default"
|
||||
Command="{x:Bind ViewModel.SwitchThemeCommand}"
|
||||
FontSize="15"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=OneWay}">
|
||||
<RadioButton.CommandParameter>
|
||||
<xaml:ElementTheme>Default</xaml:ElementTheme>
|
||||
</RadioButton.CommandParameter>
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Uid="Settings_About" Style="{ThemeResource SubtitleTextBlockStyle}" />
|
||||
|
||||
<StackPanel Margin="{StaticResource XSmallTopMargin}">
|
||||
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.VersionDescription, Mode=OneWay}" />
|
||||
|
||||
<TextBlock
|
||||
x:Uid="Settings_AboutDescription"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
Style="{ThemeResource BodyTextBlockStyle}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||
Text="基础配只因" />
|
||||
<StackPanel Margin="{StaticResource SmallTopBottomMargin}">
|
||||
<TextBlock Text="模组路径" />
|
||||
|
||||
<HyperlinkButton
|
||||
Margin="0,4,26,0"
|
||||
Content="开源地址"
|
||||
NavigateUri="https://git.coldmint.top/muqing" />
|
||||
<HyperlinkButton x:Uid="SettingsPage_PrivacyTermsLink" Margin="{StaticResource SettingsPageHyperlinkButtonMargin}" />
|
||||
<AutoSuggestBox
|
||||
x:Name="ModFileUrlText"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
LostFocus="ModFileUrlText_LostFocus"
|
||||
PlaceholderText="输入或者搜索路径(Enter/回车保存)"
|
||||
QueryIcon="Find"
|
||||
QuerySubmitted="AutoSuggestBox_ModFileUrl" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Uid="Settings_About" Style="{ThemeResource SubtitleTextBlockStyle}" />
|
||||
|
||||
<StackPanel Margin="{StaticResource XSmallTopMargin}">
|
||||
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.VersionDescription, Mode=OneWay}" />
|
||||
|
||||
<TextBlock
|
||||
x:Uid="Settings_AboutDescription"
|
||||
Margin="{StaticResource XSmallTopMargin}"
|
||||
Style="{ThemeResource BodyTextBlockStyle}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<HyperlinkButton
|
||||
Margin="0,4,26,0"
|
||||
Content="开源地址"
|
||||
NavigateUri="https://git.coldmint.top/muqing" />
|
||||
<HyperlinkButton x:Uid="SettingsPage_PrivacyTermsLink" Margin="{StaticResource SettingsPageHyperlinkButtonMargin}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</ScrollView>
|
||||
</Page>
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Composition.SystemBackdrops;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using RustTools.muqing;
|
||||
using RustTools.ViewModels;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.Storage;
|
||||
using WinUIEx;
|
||||
|
||||
namespace RustTools.Views;
|
||||
|
||||
|
@ -11,10 +20,107 @@ public sealed partial class SettingsPage : Page
|
|||
{
|
||||
get;
|
||||
}
|
||||
public enum SystemBackdropEmnu
|
||||
{
|
||||
None,
|
||||
}
|
||||
|
||||
public SettingsPage()
|
||||
{
|
||||
//this.windowEx = windowEx;
|
||||
ViewModel = App.GetService<SettingsViewModel>();
|
||||
InitializeComponent();
|
||||
|
||||
//BackgroundRadioButtons
|
||||
var iniHelper = new IniHelper();
|
||||
iniHelper.Load(IniHelper.FILE.Config);
|
||||
var v = iniHelper.GetValue(IniHelper.CODE.Settings, IniHelper.KEY.SystemBackdrop);
|
||||
switch (v)
|
||||
{
|
||||
case "None":
|
||||
BackgroundRadioButtons.SelectedIndex = 0;
|
||||
break;
|
||||
case "Blur":
|
||||
BackgroundRadioButtons.SelectedIndex = 1;
|
||||
break;
|
||||
case "AcrylicBlur":
|
||||
BackgroundRadioButtons.SelectedIndex = 2;
|
||||
break;
|
||||
case "Mica":
|
||||
BackgroundRadioButtons.SelectedIndex = 3;
|
||||
break;
|
||||
}
|
||||
BackgroundRadioButtons.SelectionChanged += BackgroundColor_SelectionChanged;
|
||||
ModFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
||||
}
|
||||
private bool Backone = false;
|
||||
private void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (Backone)
|
||||
{
|
||||
if (MainWindow.Main != null && sender is RadioButtons rb)
|
||||
{
|
||||
var colorName = rb.SelectedItem as string;
|
||||
var iniHelper = new IniHelper();
|
||||
iniHelper.Load(IniHelper.FILE.Config);
|
||||
#pragma warning disable CS8604 // 引用类型参数可能为 null。
|
||||
iniHelper.SetValue(IniHelper.CODE.Settings, IniHelper.KEY.SystemBackdrop, colorName);
|
||||
iniHelper.Save();
|
||||
gj.SetBackTheme(MainWindow.Main);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Backone = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void AutoSuggestBox_ModFileUrl(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
{
|
||||
var dialog = new ContentDialog();
|
||||
dialog.XamlRoot = this.XamlRoot;
|
||||
|
||||
//dialog.Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style;
|
||||
dialog.Title = "选择搜索模式";
|
||||
dialog.SecondaryButtonText = "手动选择";
|
||||
dialog.CloseButtonText = "自动搜索";
|
||||
dialog.Content = "自动搜索利用助手专属搜索引擎进行全盘搜索游戏文件夹,直到找到 Rusted Warfare 文件夹为止 途中可选择中断。";
|
||||
//dialog.DefaultButton = ContentDialogButton.Primary;
|
||||
dialog.SecondaryButtonClick += Dialog_SecondaryButtonClick;
|
||||
dialog.CloseButtonClick += Dialog_CloseButtonClick;
|
||||
await dialog.ShowAsync();
|
||||
|
||||
}
|
||||
|
||||
private void Dialog_CloseButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args){
|
||||
var mod = new mod();
|
||||
ModFileUrlText.Text = mod.FileDir;
|
||||
}
|
||||
|
||||
private async void Dialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args){
|
||||
|
||||
var openPicker = new FolderPicker();
|
||||
var window = App.MainWindow;
|
||||
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
|
||||
WinRT.Interop.InitializeWithWindow.Initialize(openPicker, hWnd);
|
||||
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;
|
||||
openPicker.FileTypeFilter.Add("*");
|
||||
var folder = await openPicker.PickSingleFolderAsync();
|
||||
if (folder != null)
|
||||
{
|
||||
//StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
|
||||
ModFileUrlText.Text = folder.Path;
|
||||
}
|
||||
}
|
||||
|
||||
private void ModFileUrlText_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
// 获取 AutoSuggestBox 的当前文本
|
||||
var text = ModFileUrlText.Text;
|
||||
var iniHelper = new IniHelper();
|
||||
iniHelper.Load(IniHelper.FILE.Config);
|
||||
iniHelper.SetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl, text);
|
||||
iniHelper.Save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<windowex:WindowEx
|
||||
x:Class="RustTools.Views.ModulePage"
|
||||
x:Class="RustTools.WindowUI.ModulePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
@ -12,9 +12,6 @@
|
|||
Closed="WindowEx_Closed"
|
||||
SizeChanged="WindowEx_SizeChanged"
|
||||
mc:Ignorable="d">
|
||||
<Window.SystemBackdrop>
|
||||
<DesktopAcrylicBackdrop />
|
||||
</Window.SystemBackdrop>
|
||||
<Grid x:Name="grid" Padding="16,36,16,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
|
@ -17,11 +17,10 @@ using Newtonsoft.Json;
|
|||
using RustTools.DataList;
|
||||
using RustTools.Core.Helpers;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace RustTools.Views;
|
||||
namespace RustTools.WindowUI;
|
||||
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
|
@ -34,6 +33,7 @@ public sealed partial class ModulePage : WindowEx
|
|||
public ModInfo.Data Mod { get; set; } = new();
|
||||
public ModulePage(string v)
|
||||
{
|
||||
gj.SetBackTheme(this);
|
||||
InitializeComponent();
|
||||
ExtendsContentIntoTitleBar = true;
|
||||
init(v);
|
147
RustTools/muqing/IniHelper.cs
Normal file
147
RustTools/muqing/IniHelper.cs
Normal file
|
@ -0,0 +1,147 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
public class IniHelper
|
||||
{
|
||||
private readonly Dictionary<string, Dictionary<string, string>> _sections = new();
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
public class FILE
|
||||
{
|
||||
public const string Config = "config.ini";
|
||||
}
|
||||
/// <summary>
|
||||
/// 节
|
||||
/// </summary>
|
||||
public class CODE
|
||||
{
|
||||
public const string Settings = "Settings";
|
||||
public const string Rust = "Rust";
|
||||
}
|
||||
|
||||
public class KEY
|
||||
{
|
||||
public const string SystemBackdrop = "SystemBackdrop";
|
||||
public const string ModFileUrl = "ModFileUrl";//模组路径
|
||||
}
|
||||
|
||||
private string filePath;
|
||||
|
||||
public IniHelper()
|
||||
{
|
||||
_sections = new Dictionary<string, Dictionary<string, string>>();
|
||||
/*用法
|
||||
//IniHelper iniHelper = new IniHelper();
|
||||
// 设置配置数据 节 key value
|
||||
iniHelper.SetValue("Settings", "ExampleKey", "ExampleValue");
|
||||
|
||||
// 保存配置文件
|
||||
string filePath = "config.ini"; // 可以更改文件路径
|
||||
iniHelper.Save(filePath);
|
||||
|
||||
// 加载配置文件
|
||||
iniHelper.Load(filePath);
|
||||
|
||||
// 读取配置数据
|
||||
string value = iniHelper.GetValue("Settings", "ExampleKey");
|
||||
Console.WriteLine($"Loaded value: {value}");
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载配置文件
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <exception cref="FileNotFoundException"></exception>
|
||||
public void Load(string filePath)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
throw new FileNotFoundException("The specified file does not exist.", filePath);
|
||||
}
|
||||
|
||||
var lines = File.ReadAllLines(filePath);
|
||||
string? currentSection = null;
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line) || line.StartsWith(";"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.StartsWith("[") && line.EndsWith("]"))
|
||||
{
|
||||
currentSection = line.Substring(1, line.Length - 2).Trim();
|
||||
_sections[currentSection] = new Dictionary<string, string>();
|
||||
}
|
||||
else if (currentSection != null)
|
||||
{
|
||||
var parts = line.Split('=');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
var key = parts[0].Trim();
|
||||
var value = parts[1].Trim();
|
||||
_sections[currentSection][key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存配置文件
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
if (filePath==null) {
|
||||
throw new FileNotFoundException("不存在或者filePath没有定义");
|
||||
}
|
||||
|
||||
using var sw = new StreamWriter(filePath);
|
||||
foreach (var section in _sections)
|
||||
{
|
||||
sw.WriteLine($"[{section.Key}]");
|
||||
foreach (var keyValue in section.Value)
|
||||
{
|
||||
sw.WriteLine($"{keyValue.Key}={keyValue.Value}");
|
||||
}
|
||||
sw.WriteLine(); // Add an empty line for readability
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取配置数据
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public string GetValue(string section, string key)
|
||||
{
|
||||
if (_sections.TryGetValue(section, out var values) && values.TryGetValue(key, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置配置数据
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public void SetValue(string section, string key, string value)
|
||||
{
|
||||
if (!_sections.ContainsKey(section))
|
||||
{
|
||||
_sections[section] = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
_sections[section][key] = value;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,12 @@
|
|||
using System.Diagnostics;
|
||||
namespace RustTools.muqing;
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Management;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Composition.SystemBackdrops;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
class gj
|
||||
{
|
||||
public static void sc(object obj)
|
||||
|
@ -31,4 +36,45 @@ class gj
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置window窗口适配器 主题颜色
|
||||
/// </summary>
|
||||
public static void SetBackTheme(WindowEx windowEx)
|
||||
{
|
||||
var iniHelper = new IniHelper();
|
||||
iniHelper.Load(IniHelper.FILE.Config);
|
||||
var v = iniHelper.GetValue(IniHelper.CODE.Settings, IniHelper.KEY.SystemBackdrop);
|
||||
switch (v)
|
||||
{
|
||||
case "None":
|
||||
windowEx.SystemBackdrop = new MicaBackdrop();
|
||||
break;
|
||||
case "Blur":
|
||||
var micaBackdrop = new MicaBackdrop
|
||||
{
|
||||
Kind = MicaKind.BaseAlt
|
||||
};
|
||||
windowEx.SystemBackdrop = micaBackdrop;
|
||||
|
||||
break;
|
||||
case "AcrylicBlur":
|
||||
windowEx.SystemBackdrop = new DesktopAcrylicBackdrop();
|
||||
break;
|
||||
case "Mica":
|
||||
windowEx.SystemBackdrop = new MicaBackdrop()
|
||||
{
|
||||
Kind = MicaKind.Base
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum BackTheme
|
||||
{
|
||||
None, BaseAlt, AcrylicBlur, Mica
|
||||
}
|
||||
|
|
209
RustTools/muqing/mod.cs
Normal file
209
RustTools/muqing/mod.cs
Normal file
|
@ -0,0 +1,209 @@
|
|||
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
public class mod
|
||||
{
|
||||
|
||||
//开始计时
|
||||
private static DateTime StartTime;
|
||||
/// <summary>
|
||||
/// 统计运行耗时
|
||||
/// </summary>
|
||||
private static void EndTime()
|
||||
{
|
||||
Console.WriteLine("执行时间:" + (DateTime.Now - StartTime).TotalMilliseconds + "ms");
|
||||
}
|
||||
|
||||
private readonly bool Isdot = true;//是否排除.开头的文件夹
|
||||
//排除的文件夹
|
||||
private readonly List<string> ExcludeFile = new(){
|
||||
"Android", "androidword", "Java",
|
||||
"Linux", "linuxword", "Mac",
|
||||
"Windows", "Windows 10", "Steam",
|
||||
"Genshin Impact Game", "Godot", "Gradle",
|
||||
"WeGame", "Mental Omega", "WeGameApps",
|
||||
"ramboplayGame", "QQ", "QQWORD"
|
||||
};
|
||||
//游戏位置
|
||||
public string FileDir = "";
|
||||
public mod()
|
||||
{
|
||||
StartTime = DateTime.Now;
|
||||
Console.WriteLine("开始执行文件搜索引擎");
|
||||
//先找steam中的位置
|
||||
var steamPath = GetSteamInstallPath();
|
||||
if (!string.IsNullOrEmpty(steamPath))
|
||||
{
|
||||
Console.WriteLine("已经找到steam安装位置" + steamPath);
|
||||
var b = Directory.Exists(steamPath + "\\steamapps\\common\\Rusted Warfare");
|
||||
if (b)
|
||||
{
|
||||
//结束计时
|
||||
Console.WriteLine("已找到游戏文件路径 " + steamPath + "\\steamapps\\common\\Rusted Warfare");
|
||||
FileDir = steamPath+ "\\steamapps\\common\\Rusted Warfare";
|
||||
EndTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("未找到游戏文件路径");
|
||||
init();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("找不到steam的安装位置");
|
||||
init();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
|
||||
DriveInfo[] allDrives = DriveInfo.GetDrives();
|
||||
foreach (DriveInfo d in allDrives)
|
||||
{
|
||||
Console.WriteLine();
|
||||
// Console.WriteLine(" Drive type: {0}", d.DriveType);
|
||||
if (d.IsReady == true)
|
||||
{
|
||||
var name = d.Name;
|
||||
if (ExcludeFile.Contains(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//只要不是C盘
|
||||
if (name.Equals("C:\\"))
|
||||
{
|
||||
Console.WriteLine("在C盘快速找游戏文件路径");
|
||||
FileSearch(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("在其他盘中快速找游戏文件路径");
|
||||
// steam\steamapps\common\Rusted Warfare
|
||||
// new FileSearch(name).Search();
|
||||
if (Directory.Exists(name + "/Rusted Warfare"))
|
||||
{
|
||||
Console.WriteLine("找到游戏文件路径");
|
||||
EndTime();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileSearch(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
//是否找到游戏位置
|
||||
bool IsFind = false;
|
||||
private void FileSearch(string path)
|
||||
{
|
||||
if (IsFind)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("开始遍历文件夹" + path);
|
||||
try
|
||||
{
|
||||
// 遍历文件夹
|
||||
foreach (var file in Directory.EnumerateDirectories(path))
|
||||
{
|
||||
if (IsFind)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//排除特殊符号的文件夹
|
||||
// if (file.contains("$"))
|
||||
// {
|
||||
// Console.WriteLine("排除特殊符号开头的文件夹" + file);
|
||||
// continue;
|
||||
// }
|
||||
//排除.开头的文件
|
||||
var name = Path.GetFileName(file);
|
||||
if (Isdot && name.StartsWith("."))
|
||||
{
|
||||
Console.WriteLine("排除。开头的文件夹" + file);
|
||||
continue;
|
||||
}
|
||||
//排除掉列表中的文件夹
|
||||
if (ExcludeFile.Contains(name))
|
||||
{
|
||||
Console.WriteLine("排除列表中的文件夹" + file);
|
||||
continue;
|
||||
}
|
||||
if (name.Equals("Rusted Warfare"))
|
||||
{
|
||||
IsFind = true;
|
||||
Console.WriteLine("找到游戏文件路径" + file);
|
||||
EndTime();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileSearch(file);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// 如果访问被拒绝,跳过该文件夹并记录信息
|
||||
Console.WriteLine($"Access denied for: {path}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 捕获其他可能的异常
|
||||
Console.WriteLine($"Error accessing directory '{path}': {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string GetSteamInstallPath()
|
||||
{
|
||||
string installPath = GetInstallPathFromKey(@"Software\Valve\Steam");
|
||||
|
||||
if (string.IsNullOrEmpty(installPath))
|
||||
{
|
||||
// 如果在当前用户下找不到,再试一下所有用户
|
||||
installPath = GetInstallPathFromKey(@"SOFTWARE\Wow6432Node\Valve\Steam");
|
||||
}
|
||||
|
||||
return installPath;
|
||||
|
||||
string GetInstallPathFromKey(string subKey)
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(subKey))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
object path = key.GetValue("InstallPath");
|
||||
if (path != null)
|
||||
{
|
||||
return (string)path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subKey))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
object path = key.GetValue("InstallPath");
|
||||
if (path != null)
|
||||
{
|
||||
return (string)path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,16 +6,20 @@ namespace RustTools.muqing;
|
|||
class wj
|
||||
{
|
||||
//存储主要文件的路径
|
||||
public static string CD = "D:\\抓包";
|
||||
public const string CD = "D:\\抓包";
|
||||
//缓存路径
|
||||
public static string? Cache;
|
||||
public const string Cache = "";
|
||||
|
||||
//不知道为什么会保存到这里的路径
|
||||
//C:\Users\账号\AppData\Local\VirtualStore\Windows\SysWOW64
|
||||
public const string CachePath= "C:/Users/19669/AppData/Local/VirtualStore/Windows/SysWOW64";
|
||||
|
||||
/// <summary>
|
||||
/// 存储文件名字的路径
|
||||
/// </summary>
|
||||
public class FILE
|
||||
{
|
||||
public static string UUID = "win.uuid";
|
||||
public const string UUID = "win.uuid";
|
||||
}
|
||||
|
||||
public static bool xrwb(string name,string str)
|
||||
|
|
Loading…
Reference in New Issue
Block a user