添加vs code 支持
This commit is contained in:
parent
49c0f93b84
commit
a1f19d5d86
|
@ -52,10 +52,10 @@ public partial class App : Microsoft.UI.Xaml.Application
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (!Directory.Exists(wj.CD))
|
//if (!Directory.Exists(wj.CD))
|
||||||
{
|
//{
|
||||||
Directory.CreateDirectory(wj.CD);
|
// Directory.CreateDirectory(wj.CD);
|
||||||
}
|
//}
|
||||||
// 注册激活事件处理程序
|
// 注册激活事件处理程序
|
||||||
Host = Microsoft.Extensions.Hosting.Host.
|
Host = Microsoft.Extensions.Hosting.Host.
|
||||||
CreateDefaultBuilder().
|
CreateDefaultBuilder().
|
||||||
|
|
6
RustTools/Assets/image/folder.svg
Normal file
6
RustTools/Assets/image/folder.svg
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg t="1723031837806" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11589" width="50" height="50" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<path d="M409.6 409.6h460.8c56.32 0 102.4 46.08 102.4 102.4v307.2c0 56.32-46.08 102.4-102.4 102.4H409.6c-56.32 0-102.4-46.08-102.4-102.4v-307.2c0-56.32 46.08-102.4 102.4-102.4z" fill="#5AC8FA" p-id="11590"></path>
|
||||||
|
<path d="M153.6 153.6c-30.72 0-51.2 25.6-51.2 51.2v614.4c0 30.72 20.48 51.2 51.2 51.2h716.8c30.72 0 51.2-20.48 51.2-51.2V307.2c0-30.72-25.6-51.2-51.2-51.2h-337.92c-25.6 0-51.2-10.24-71.68-30.72L404.48 168.96c-10.24-10.24-25.6-15.36-35.84-15.36H153.6z m0-51.2h215.04c25.6 0 51.2 10.24 71.68 30.72l56.32 56.32c10.24 10.24 20.48 15.36 35.84 15.36H870.4c56.32 0 102.4 46.08 102.4 102.4v512c0 56.32-46.08 102.4-102.4 102.4H153.6c-56.32 0-102.4-46.08-102.4-102.4V204.8c0-56.32 46.08-102.4 102.4-102.4z" fill="" p-id="11591"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
5
RustTools/Assets/image/rwmod.svg
Normal file
5
RustTools/Assets/image/rwmod.svg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<svg t="1723033128339" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="17871" width="50" height="50">
|
||||||
|
<path d="M332.799002 686.081014m-332.799002 0a332.799002 332.799002 0 1 0 665.598003 0 332.799002 332.799002 0 1 0-665.598003 0Z" fill="#CCE4F2" p-id="17872"></path>
|
||||||
|
<path d="M883.19735 1024h-639.99808A141.055577 141.055577 0 0 1 102.399693 883.200422v-742.397772A141.055577 141.055577 0 0 1 243.19927 0.003072h516.350451a89.087733 89.087733 0 0 1 63.231811 25.599923l189.695431 189.695431A38.399885 38.399885 0 0 1 1023.996928 243.202342v639.99808a141.055577 141.055577 0 0 1-140.799578 140.799578zM243.19927 76.802842A63.999808 63.999808 0 0 0 179.199462 140.80265v742.397772A63.999808 63.999808 0 0 0 243.19927 947.20023h639.99808a63.999808 63.999808 0 0 0 63.999808-63.999808V259.074295l-179.199462-179.199463a12.799962 12.799962 0 0 0-8.447975-3.07199z" fill="#434260" p-id="17873"></path>
|
||||||
|
<path d="M251.391246 399.105875h40.959877L332.799002 513.281532c5.119985 15.103955 9.727971 30.463909 15.103954 45.823863h1.535996c5.119985-15.359954 9.471972-30.719908 14.847955-45.823863l40.959877-114.175657h41.215877v226.047322h-32.511903v-111.871665c0-20.223939 2.815992-49.407852 4.607986-70.143789l-18.175945 51.199846-39.423882 107.775677h-22.015934l-39.679881-107.775677-17.919946-51.199846c1.535995 20.479939 4.351987 49.663851 4.351987 70.143789v111.871665H251.391246zM483.838548 512.001536c0-72.703782 40.191879-116.479651 98.303706-116.479651s98.559704 43.519869 98.559704 116.479651-40.703878 117.247648-98.559704 117.247648S483.838548 583.93732 483.838548 512.001536z m160.25552 0c0-53.24784-25.599923-85.247744-61.951814-85.247744S520.446439 458.241697 520.446439 512.001536s24.319927 86.78374 61.695815 86.78374S644.094068 563.201382 644.094068 512.001536zM716.79785 399.105875h58.623824c69.375792 0 109.055673 38.399885 109.055673 112.127663s-39.679881 113.919658-106.495681 113.919659H716.79785z m56.319831 196.863409c48.383855 0 74.495777-28.671914 74.495776-84.735746s-25.599923-83.19975-74.495776-83.19975h-20.479939v167.935496z" fill="#434260" p-id="17874"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
|
@ -17,8 +17,6 @@ public sealed partial class MainWindow : WindowEx
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
gj.SetBackTheme(this);
|
gj.SetBackTheme(this);
|
||||||
//gj.sc("lujing"+ AppContext.BaseDirectory);
|
|
||||||
//Resources
|
|
||||||
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
||||||
//AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/Icon.ico"));
|
//AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/Icon.ico"));
|
||||||
Content = null;
|
Content = null;
|
||||||
|
|
|
@ -4,11 +4,13 @@
|
||||||
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
|
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
|
||||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||||
<RootNamespace>RustTools</RootNamespace>
|
<RootNamespace>RustTools</RootNamespace>
|
||||||
|
<Platform>x64</Platform>
|
||||||
<Platforms>x86;x64;arm64</Platforms>
|
<Platforms>x86;x64;arm64</Platforms>
|
||||||
|
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWinUI>true</UseWinUI>
|
<UseWinUI>true</UseWinUI>
|
||||||
<EnableMsixTooling>true</EnableMsixTooling>
|
<EnableMsixTooling>true</EnableMsixTooling>
|
||||||
<AssemblyName>RustTools</AssemblyName>
|
<AssemblyName>RustTools</AssemblyName>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
@ -16,8 +18,8 @@
|
||||||
<ApplicationIcon>Assets\WindowIcon.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\WindowIcon.ico</ApplicationIcon>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<DefaultLanguage>zh-cn</DefaultLanguage>
|
<DefaultLanguage>zh-cn</DefaultLanguage>
|
||||||
|
|
||||||
|
|
||||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||||
<PackageCertificateThumbprint>3386EC79D3BB9691D0A8DA634167500B242E109D</PackageCertificateThumbprint>
|
<PackageCertificateThumbprint>3386EC79D3BB9691D0A8DA634167500B242E109D</PackageCertificateThumbprint>
|
||||||
|
@ -29,20 +31,7 @@
|
||||||
<AppInstallerUri>C:\\RustTools</AppInstallerUri>
|
<AppInstallerUri>C:\\RustTools</AppInstallerUri>
|
||||||
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Assets\image\image_106.svg" />
|
|
||||||
<None Remove="Styles\ItemView.xaml" />
|
|
||||||
<None Remove="Styles\TitleSubtitleControlStyle.xaml" />
|
|
||||||
<None Remove="Views\ConcernPage.xaml" />
|
|
||||||
<None Remove="Views\HomePage.xaml" />
|
|
||||||
<None Remove="Views\ModulePage.xaml" />
|
|
||||||
<None Remove="Views\RankingPage.xaml" />
|
|
||||||
<None Remove="Views\UserPage.xaml" />
|
|
||||||
<None Remove="WindowUI\ImportModule.xaml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Page Remove="Themes\Generic.xaml" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="$(ApplicationManifest)" />
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
|
@ -58,19 +47,18 @@
|
||||||
<PackageReference Include="System.Management" Version="8.0.0" />
|
<PackageReference Include="System.Management" Version="8.0.0" />
|
||||||
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Assets\**">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
<Page Update="Views\ModulePage.xaml">
|
<Page Update="Views\ModulePage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Update="Styles\TitleSubtitleControlStyle.xaml">
|
<Page Update="Styles\TitleSubtitleControlStyle.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<None Update="Themes\Generic.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</None>
|
|
||||||
<Page Update="Styles\ItemView.xaml">
|
<Page Update="Styles\ItemView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -94,9 +82,10 @@
|
||||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||||
<ProjectCapability Include="Msix" />
|
<ProjectCapability Include="Msix" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||||
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,19 +0,0 @@
|
||||||
<ResourceDictionary
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="using:RustTools">
|
|
||||||
|
|
||||||
<Style TargetType="local2:CustomControl1" xmlns:local2="using:RustTools.Styles">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="local2:CustomControl1">
|
|
||||||
<Border
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}">
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
|
@ -1,9 +1,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using RustTools.muqing;
|
||||||
|
using RustTools.Views;
|
||||||
|
|
||||||
namespace RustTools.ViewModels;
|
namespace RustTools.ViewModels;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -11,8 +16,71 @@ namespace RustTools.ViewModels;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ModuleViewModel : ObservableRecipient
|
public class ModuleViewModel : ObservableRecipient
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public ObservableCollection<DataObject> ListMod = new();
|
||||||
public ModuleViewModel()
|
public ModuleViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var iniHelper = new IniHelper();
|
||||||
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
|
var v = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
||||||
|
if (v == string.Empty)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var subfolders = Directory.GetDirectories(v);
|
||||||
|
foreach (var item in subfolders)
|
||||||
|
{
|
||||||
|
var info = new DirectoryInfo(item);
|
||||||
|
ListMod.Add(new DataObject(info));
|
||||||
|
}
|
||||||
|
var files = Directory.GetFiles(v);
|
||||||
|
foreach (var item in files)
|
||||||
|
{
|
||||||
|
var info = new FileInfo(item);
|
||||||
|
if (info.Name.EndsWith(".rwmod"))
|
||||||
|
{
|
||||||
|
ListMod.Add(new DataObject(info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Button_Rwmod(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
var menuItem = sender as MenuFlyoutItem;
|
||||||
|
if (menuItem != null)
|
||||||
|
{
|
||||||
|
if (menuItem.DataContext is DataObject folderItem)
|
||||||
|
{
|
||||||
|
var filepath = Path.Combine(Path.GetDirectoryName(folderItem.Dri), folderItem.Name + ".rwmod");
|
||||||
|
if (File.Exists(filepath))
|
||||||
|
{
|
||||||
|
var show = await new ContentDialog()
|
||||||
|
{
|
||||||
|
XamlRoot = menuItem.XamlRoot,
|
||||||
|
Title = "警告",
|
||||||
|
Content = "已经存在必须覆盖",
|
||||||
|
PrimaryButtonText = "确定",
|
||||||
|
SecondaryButtonText = "取消"
|
||||||
|
}.ShowAsync();
|
||||||
|
if (show == ContentDialogResult.Primary)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 压缩zip
|
||||||
|
var v = wj.ZipExample(folderItem.Dri, folderItem.Name + ".rwmod");
|
||||||
|
if (v!=string.Empty)
|
||||||
|
{
|
||||||
|
ListMod.Remove(new DataObject(new FileInfo(filepath)));
|
||||||
|
ListMod.Insert(0,new DataObject(new FileInfo(v)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,15 @@ public sealed partial class HomePage : Page
|
||||||
Pictures.Add(item);
|
Pictures.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ViewModel.random();
|
|
||||||
ViewModel.Latest();
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ListA.ItemClick += ListAClick;
|
ListA.ItemClick += ListAClick;
|
||||||
ListB.ItemClick += ListAClick;
|
ListB.ItemClick += ListAClick;
|
||||||
|
//为了节省流量测试的时候不加载这些
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
ViewModel.random();
|
||||||
|
ViewModel.Latest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
|
|
@ -16,10 +16,15 @@
|
||||||
Click="Button_Click_RwmodItem"
|
Click="Button_Click_RwmodItem"
|
||||||
CornerRadius="9">
|
CornerRadius="9">
|
||||||
<Grid
|
<Grid
|
||||||
Width="160"
|
Width="130"
|
||||||
Height="190"
|
Height="160"
|
||||||
Padding="9">
|
Padding="9">
|
||||||
<FontIcon Glyph="" />
|
<Image
|
||||||
|
Width="50"
|
||||||
|
Height="50"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Source="/Assets/image/rwmod.svg" />
|
||||||
<Button
|
<Button
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
|
@ -28,31 +33,55 @@
|
||||||
<FontIcon Glyph="" />
|
<FontIcon Glyph="" />
|
||||||
</Button>
|
</Button>
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
||||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding Name}" />
|
<TextBlock
|
||||||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{Binding Info}" />
|
HorizontalAlignment="Center"
|
||||||
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
|
Text="{Binding Name}"
|
||||||
|
TextWrapping="NoWrap" />
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
|
Text="{Binding Info}"
|
||||||
|
TextWrapping="NoWrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<!-- 文件夹 -->
|
<!-- 文件夹 -->
|
||||||
<DataTemplate x:Key="FolderItem">
|
<DataTemplate x:Key="FolderItem">
|
||||||
<Button Background="{ThemeResource SystemColorWindowColor}" CornerRadius="9">
|
<Button
|
||||||
|
Background="{ThemeResource SystemColorWindowColor}"
|
||||||
|
CornerRadius="9"
|
||||||
|
ToolTipService.ToolTip="{Binding Info}">
|
||||||
<Button.Flyout>
|
<Button.Flyout>
|
||||||
<MenuFlyout>
|
<MenuFlyout>
|
||||||
<MenuFlyoutItem Text="打开" />
|
<MenuFlyoutItem Text="打开" />
|
||||||
<MenuFlyoutItem Text="打包" />
|
<MenuFlyoutItem Click="ViewModel.Button_Rwmod" Text="打包" />
|
||||||
<MenuFlyoutItem Text="发布" />
|
<MenuFlyoutItem Text="发布" />
|
||||||
<MenuFlyoutItem Click="Button_Delete" Text="删除" />
|
<MenuFlyoutItem Click="Button_Delete" Text="删除" />
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
</Button.Flyout>
|
</Button.Flyout>
|
||||||
<Grid
|
<Grid
|
||||||
Width="160"
|
Width="130"
|
||||||
Height="190"
|
Height="160"
|
||||||
Padding="9">
|
Padding="9">
|
||||||
<FontIcon Glyph="" />
|
<Image
|
||||||
|
Width="50"
|
||||||
|
Height="50"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Source="{Binding Icon}" />
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
||||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding Name}" />
|
<TextBlock
|
||||||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{Binding Info}" />
|
HorizontalAlignment="Center"
|
||||||
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
|
Text="{Binding Name}"
|
||||||
|
TextWrapping="NoWrap" />
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
|
Text="{Binding Info}"
|
||||||
|
TextWrapping="NoWrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -65,6 +94,7 @@
|
||||||
Label="分享"
|
Label="分享"
|
||||||
ToolTipService.ToolTip="分享" />
|
ToolTipService.ToolTip="分享" />
|
||||||
<AppBarButton
|
<AppBarButton
|
||||||
|
Click="Button_Delete"
|
||||||
Icon="Delete"
|
Icon="Delete"
|
||||||
Label="删除"
|
Label="删除"
|
||||||
ToolTipService.ToolTip="删除" />
|
ToolTipService.ToolTip="删除" />
|
||||||
|
@ -74,16 +104,16 @@
|
||||||
</CommandBarFlyout>
|
</CommandBarFlyout>
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
<Grid Margin="16">
|
<Grid Margin="16">
|
||||||
|
|
||||||
<GridView
|
<GridView
|
||||||
x:Name="BasicGridView"
|
x:Name="BasicGridView"
|
||||||
IsItemClickEnabled="False"
|
IsItemClickEnabled="False"
|
||||||
ItemsSource="{x:Bind ListMod}"
|
ItemsSource="{x:Bind ViewModel.ListMod}"
|
||||||
SelectionMode="None">
|
SelectionMode="None">
|
||||||
<GridView.ItemTemplateSelector>
|
<GridView.ItemTemplateSelector>
|
||||||
<local:MyItemTemplateSelector Template1="{StaticResource RwmodItem}" Template2="{StaticResource FolderItem}" />
|
<local:MyItemTemplateSelector Template1="{StaticResource RwmodItem}" Template2="{StaticResource FolderItem}" />
|
||||||
</GridView.ItemTemplateSelector>
|
</GridView.ItemTemplateSelector>
|
||||||
</GridView>
|
</GridView>
|
||||||
<ContentDialog Name="AAAA" Title="aaaa" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
@ -7,13 +8,14 @@ using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
|
using static IniHelper;
|
||||||
|
using static System.Collections.Specialized.BitVector32;
|
||||||
namespace RustTools.Views;
|
namespace RustTools.Views;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模组碎片
|
/// 模组碎片
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DataObject
|
public class DataObject
|
||||||
{
|
{
|
||||||
//路径
|
|
||||||
public string Dri
|
public string Dri
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -30,61 +32,67 @@ public class DataObject
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
public DataObject()
|
public string Icon
|
||||||
{
|
{
|
||||||
IsRwmod = true;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is DataObject other)
|
||||||
|
{
|
||||||
|
return Dri == other.Dri;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||||
public DataObject(FileInfo fileInfo)
|
public DataObject(FileInfo fileInfo)
|
||||||
{
|
{
|
||||||
Name = fileInfo.Name;
|
Name = Path.GetFileNameWithoutExtension(fileInfo.Name);
|
||||||
IsRwmod=true;
|
//Name = fileInfo.Name;
|
||||||
Info = $"文件大小:{wj.FormatFileSize(fileInfo.Length)}";
|
IsRwmod = true;
|
||||||
|
Info = $"大小:{wj.FormatFileSize(fileInfo.Length)}";
|
||||||
Dri = fileInfo.FullName;
|
Dri = fileInfo.FullName;
|
||||||
}
|
}
|
||||||
public DataObject(DirectoryInfo fileInfo)
|
public DataObject(DirectoryInfo fileInfo)
|
||||||
{
|
{
|
||||||
Name = fileInfo.Name;
|
Name = fileInfo.Name;
|
||||||
IsRwmod = false;
|
IsRwmod = false;
|
||||||
Info = $"创建时间:{fileInfo.CreationTime}";
|
Info = $"{fileInfo.CreationTime}";
|
||||||
Dri = fileInfo.FullName;
|
Dri = fileInfo.FullName;
|
||||||
|
Icon = File.Exists(Path.Combine(Dri, "icon.png")) ? Path.Combine(Dri, "icon.png") : "/Assets/image/folder.svg";
|
||||||
|
var modinfo = Path.Combine(Dri, "mod-info.txt");
|
||||||
|
if (File.Exists(modinfo))
|
||||||
|
{
|
||||||
|
var dictionary = gj.IniInfo(modinfo);
|
||||||
|
if (dictionary.TryGetValue("mod", out var sectionValues))
|
||||||
|
{
|
||||||
|
gj.sc(sectionValues);
|
||||||
|
Name =sectionValues.TryGetValue("title", out var value) ? value : Name;
|
||||||
|
gj.sc(value);
|
||||||
|
Info = sectionValues.TryGetValue("description", out var description) ? description : Info;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ... Methods ...
|
|
||||||
}
|
}
|
||||||
public sealed partial class ModulePage : Page
|
public sealed partial class ModulePage : Page
|
||||||
{
|
{
|
||||||
public ObservableCollection<DataObject> ListMod = new();
|
public ModuleViewModel ViewModel
|
||||||
public ModuleViewModel ViewModel { get; set; }
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
public ModulePage()
|
public ModulePage()
|
||||||
{
|
{
|
||||||
ViewModel = App.GetService<ModuleViewModel>();
|
ViewModel = App.GetService<ModuleViewModel>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
var iniHelper = new IniHelper();
|
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
|
||||||
var v = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
|
||||||
|
|
||||||
var subfolders = Directory.GetDirectories(v);
|
|
||||||
foreach (var item in subfolders)
|
|
||||||
{
|
|
||||||
var info = new DirectoryInfo(item);
|
|
||||||
ListMod.Add(new DataObject(info));
|
|
||||||
}
|
|
||||||
var files = Directory.GetFiles(v);
|
|
||||||
foreach (var item in files)
|
|
||||||
{
|
|
||||||
var info = new FileInfo(item);
|
|
||||||
if (info.Name.EndsWith(".rwmod"))
|
|
||||||
{
|
|
||||||
ListMod.Add(new DataObject(info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void ShowMenu(bool isTransient, GridViewItem dataTemplate)
|
|
||||||
{
|
|
||||||
FlyoutShowOptions myOption = new FlyoutShowOptions();
|
|
||||||
myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
|
|
||||||
CommandBarFlyout1.ShowAt(dataTemplate, myOption);
|
|
||||||
}
|
}
|
||||||
|
//private void ShowMenu(bool isTransient, GridViewItem dataTemplate)
|
||||||
|
//{
|
||||||
|
// FlyoutShowOptions myOption = new FlyoutShowOptions();
|
||||||
|
// myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
|
||||||
|
// CommandBarFlyout1.ShowAt(dataTemplate, myOption);
|
||||||
|
//}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -103,18 +111,22 @@ public sealed partial class ModulePage : Page
|
||||||
}
|
}
|
||||||
private void Button_Delete(object sender, RoutedEventArgs e)
|
private void Button_Delete(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
var menuItem = sender as ButtonBase;
|
||||||
|
|
||||||
MenuFlyoutItem menuItem = sender as MenuFlyoutItem;
|
|
||||||
if (menuItem != null)
|
if (menuItem != null)
|
||||||
{
|
{
|
||||||
// 获取相关的文件夹项
|
if (menuItem.DataContext is DataObject folderItem)
|
||||||
var folderItem = menuItem.DataContext as DataObject; // 假设你的文件夹项类型为 FolderItem
|
|
||||||
if (folderItem != null)
|
|
||||||
{
|
{
|
||||||
// 这里可以添加删除文件夹逻辑
|
if (Directory.Exists(folderItem.Dri))
|
||||||
gj.sc("删除文件夹"+folderItem.Dri);
|
{
|
||||||
Directory.Delete(folderItem.Dri,true);
|
// 删除文件夹
|
||||||
|
Directory.Delete(folderItem.Dri, true);
|
||||||
|
}
|
||||||
|
else if (File.Exists(folderItem.Dri))
|
||||||
|
{
|
||||||
|
//删除文件
|
||||||
|
File.Delete(folderItem.Dri);
|
||||||
|
}
|
||||||
|
ViewModel.ListMod.Remove(folderItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,16 +135,15 @@ public sealed partial class ModulePage : Page
|
||||||
private async void Button_Click_RwmodItem(object sender, RoutedEventArgs e)
|
private async void Button_Click_RwmodItem(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ContentDialog dialog = new ContentDialog();
|
ContentDialog dialog = new ContentDialog();
|
||||||
dialog.XamlRoot=XamlRoot;
|
dialog.XamlRoot = XamlRoot;
|
||||||
dialog.Title = "解压";
|
dialog.Title = "提示";
|
||||||
//dialog. = "你可以在本次解压中选择是否删除源文件";
|
dialog.PrimaryButtonText = "确定";
|
||||||
dialog.PrimaryButtonText = "确定";
|
dialog.SecondaryButtonText = "取消";
|
||||||
dialog.SecondaryButtonText = "取消";
|
|
||||||
dialog.Content = CreateCheckboxContent();
|
dialog.Content = CreateCheckboxContent();
|
||||||
var contentDialogResult = await dialog.ShowAsync();
|
var contentDialogResult = await dialog.ShowAsync();
|
||||||
if (contentDialogResult == ContentDialogResult.Primary)
|
if (contentDialogResult == ContentDialogResult.Primary)
|
||||||
{
|
{
|
||||||
|
|
||||||
var button = sender as Button;
|
var button = sender as Button;
|
||||||
if (button != null)
|
if (button != null)
|
||||||
{
|
{
|
||||||
|
@ -143,20 +154,18 @@ public sealed partial class ModulePage : Page
|
||||||
if (checkbox.IsChecked == true)
|
if (checkbox.IsChecked == true)
|
||||||
{
|
{
|
||||||
File.Delete(dataItem.Dri);
|
File.Delete(dataItem.Dri);
|
||||||
ListMod.Remove(dataItem);
|
ViewModel.ListMod.Remove(dataItem);
|
||||||
}
|
}
|
||||||
gj.sc("确定");
|
|
||||||
// 获取文件的名称(不包括扩展名)
|
|
||||||
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(dataItem.Dri);
|
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(dataItem.Dri);
|
||||||
var GetDirectoryName = Path.GetDirectoryName(dataItem.Dri);
|
var GetDirectoryName = Path.GetDirectoryName(dataItem.Dri);
|
||||||
if (Directory.Exists(GetDirectoryName)&& fileNameWithoutExtension!=null)
|
if (Directory.Exists(GetDirectoryName) && fileNameWithoutExtension != null)
|
||||||
{
|
{
|
||||||
var targetDirectory = Path.Combine(GetDirectoryName, fileNameWithoutExtension);
|
var targetDirectory = Path.Combine(GetDirectoryName, fileNameWithoutExtension);
|
||||||
var v = wj.UnzipFile(dataItem.Dri, targetDirectory);
|
var v = wj.UnzipFile(dataItem.Dri, targetDirectory);
|
||||||
gj.sc(v);
|
gj.sc(v);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
ListMod.Add(new DataObject(new DirectoryInfo(targetDirectory)));
|
ViewModel.ListMod.Add(new DataObject(new DirectoryInfo(targetDirectory)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,25 +176,24 @@ public sealed partial class ModulePage : Page
|
||||||
|
|
||||||
private FrameworkElement CreateCheckboxContent()
|
private FrameworkElement CreateCheckboxContent()
|
||||||
{
|
{
|
||||||
// 创建 CheckBox
|
|
||||||
var checkbox = new CheckBox
|
var checkbox = new CheckBox
|
||||||
{
|
{
|
||||||
Content = "删除源文件",
|
Content = "是否删除源文件",
|
||||||
IsChecked = false, // 默认未选中
|
IsChecked = false,
|
||||||
Margin=new Thickness(0,16,0,0),
|
Margin = new Thickness(0, 16, 0, 0),
|
||||||
|
|
||||||
};
|
};
|
||||||
var text = new TextBlock
|
var text = new TextBlock
|
||||||
{
|
{
|
||||||
Text = "你可以在本次解压中选择是否删除源文件",
|
Text = "解压模组到目录",
|
||||||
};
|
};
|
||||||
|
|
||||||
// 创建 StackPanel 作为容器
|
|
||||||
var stackPanel = new StackPanel();
|
var stackPanel = new StackPanel();
|
||||||
stackPanel.Children.Add(text);
|
stackPanel.Children.Add(text);
|
||||||
stackPanel.Children.Add(checkbox);
|
stackPanel.Children.Add(checkbox);
|
||||||
return stackPanel;
|
return stackPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public class MyItemTemplateSelector : DataTemplateSelector
|
public class MyItemTemplateSelector : DataTemplateSelector
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,14 +18,15 @@ public sealed partial class SettingsPage : Page
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsPage()
|
public SettingsPage()
|
||||||
{
|
{
|
||||||
//this.windowEx = windowEx;
|
|
||||||
ViewModel = App.GetService<SettingsViewModel>();
|
ViewModel = App.GetService<SettingsViewModel>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Init();
|
||||||
|
|
||||||
//BackgroundRadioButtons
|
}
|
||||||
|
private async void Init()
|
||||||
|
{
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
var v = iniHelper.GetValue(IniHelper.CODE.Settings, IniHelper.KEY.SystemBackdrop);
|
var v = iniHelper.GetValue(IniHelper.CODE.Settings, IniHelper.KEY.SystemBackdrop);
|
||||||
|
@ -47,10 +48,10 @@ public sealed partial class SettingsPage : Page
|
||||||
}
|
}
|
||||||
BackgroundRadioButtons.SelectionChanged += BackgroundColor_SelectionChanged;
|
BackgroundRadioButtons.SelectionChanged += BackgroundColor_SelectionChanged;
|
||||||
ModFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
ModFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
||||||
MapsFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust,IniHelper.KEY.MapsFileUrl);
|
MapsFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.MapsFileUrl);
|
||||||
}
|
}
|
||||||
private bool Backone = false;
|
private bool Backone = false;
|
||||||
private void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private async void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Backone)
|
if (Backone)
|
||||||
{
|
{
|
||||||
|
@ -121,20 +122,20 @@ public sealed partial class SettingsPage : Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveModAndMaps()
|
private async void SaveModAndMaps()
|
||||||
{
|
{
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
iniHelper.SetValue(IniHelper.CODE.Rust, IniHelper.KEY.MapsFileUrl, MapsFileUrlText.Text);
|
iniHelper.SetValue(IniHelper.CODE.Rust, IniHelper.KEY.MapsFileUrl, MapsFileUrlText.Text);
|
||||||
iniHelper.SetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl, ModFileUrlText.Text);
|
iniHelper.SetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl, ModFileUrlText.Text);
|
||||||
iniHelper.Save();
|
iniHelper.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModFileUrlText_LostFocus(object sender, RoutedEventArgs e)
|
private async void ModFileUrlText_LostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var a=(AutoSuggestBox) sender;
|
var a=(AutoSuggestBox) sender;
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
if (a.Name.Equals("MapsFileUrlText"))
|
if (a.Name.Equals("MapsFileUrlText"))
|
||||||
{
|
{
|
||||||
var Url = MapsFileUrlText.Text;
|
var Url = MapsFileUrlText.Text;
|
||||||
|
|
|
@ -31,12 +31,14 @@
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<PersonPicture
|
<Border
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Width="86"
|
Width="86"
|
||||||
Height="86"
|
Height="86"
|
||||||
HorizontalContentAlignment="Right"
|
Background="BlanchedAlmond"
|
||||||
ProfilePicture="/Assets/tool.png" />
|
CornerRadius="16">
|
||||||
|
<Image Source="http://q1.qlogo.cn/g?b=qq&nk=2923268971&s=100" />
|
||||||
|
</Border>
|
||||||
<StackPanel Grid.Column="1" Margin="16,0,0,0">
|
<StackPanel Grid.Column="1" Margin="16,0,0,0">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="0,9,0,0"
|
Margin="0,9,0,0"
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace RustTools.WindowUI;
|
||||||
public sealed partial class ImportModule : WindowEx
|
public sealed partial class ImportModule : WindowEx
|
||||||
{
|
{
|
||||||
private readonly FileInfo? fileInfo;
|
private readonly FileInfo? fileInfo;
|
||||||
private readonly string ImpUrl= string.Empty;
|
private string ImpUrl= string.Empty;
|
||||||
public ImportModule(string file)
|
public ImportModule(string file)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -21,22 +21,22 @@ public sealed partial class ImportModule : WindowEx
|
||||||
}
|
}
|
||||||
fileInfo = new FileInfo(file);
|
fileInfo = new FileInfo(file);
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
|
||||||
ImpUrl = string.Empty;
|
|
||||||
if (file.EndsWith(".rwmod"))
|
|
||||||
{
|
|
||||||
var l = " | ";
|
|
||||||
var formattedSize = wj.FormatFileSize(fileInfo.Length);
|
|
||||||
MessageText.Text="类型:模组"+ l+ "大小"+ formattedSize;
|
|
||||||
ImpUrl = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
|
||||||
InfoText.Text = string.Format("原位置 {0} --> {1} \n在处理的时候请不要关闭此窗口 导成功后会自动关闭 失败则会提示权限等错误问题",
|
|
||||||
file,ImpUrl);
|
|
||||||
}
|
|
||||||
NameText.Text =
|
|
||||||
fileInfo.Name;
|
|
||||||
|
|
||||||
GridView.Loaded += GridView_Loaded;
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
// 添加 Loaded 事件处理程序
|
if (file.EndsWith(".rwmod"))
|
||||||
|
{
|
||||||
|
var l = " | ";
|
||||||
|
var formattedSize = wj.FormatFileSize(fileInfo.Length);
|
||||||
|
MessageText.Text = "类型:模组" + l + "大小" + formattedSize;
|
||||||
|
ImpUrl = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.ModFileUrl);
|
||||||
|
InfoText.Text = string.Format("原位置 {0} --> {1} \n在处理的时候请不要关闭此窗口 导成功后会自动关闭 失败则会提示权限等错误问题",
|
||||||
|
file, ImpUrl);
|
||||||
|
}
|
||||||
|
NameText.Text =
|
||||||
|
fileInfo.Name;
|
||||||
|
|
||||||
|
GridView.Loaded += GridView_Loaded;
|
||||||
|
// 添加 Loaded 事件处理程序
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GridView_Loaded(object sender, RoutedEventArgs e)
|
private void GridView_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -12,50 +12,57 @@
|
||||||
Closed="WindowEx_Closed"
|
Closed="WindowEx_Closed"
|
||||||
SizeChanged="WindowEx_SizeChanged"
|
SizeChanged="WindowEx_SizeChanged"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid x:Name="grid" Padding="16,36,16,10">
|
<Grid x:Name="grid"
|
||||||
|
Padding="16,36,16,10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions />
|
<Grid.ColumnDefinitions/>
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
<StackPanel Grid.Row="0"
|
||||||
|
Orientation="Horizontal">
|
||||||
<Border
|
<Border
|
||||||
Width="106"
|
Width="106"
|
||||||
Height="106"
|
Height="106"
|
||||||
CornerRadius="9">
|
CornerRadius="9">
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<ImageBrush ImageSource="{Binding Mod.IconUrl}" Stretch="UniformToFill" />
|
<ImageBrush ImageSource="{Binding Mod.IconUrl}"
|
||||||
|
Stretch="UniformToFill"/>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Margin="16,3,9,3" Orientation="Vertical">
|
<StackPanel Margin="16,3,9,3"
|
||||||
<TextBlock Style="{StaticResource TitleLargeTextBlockStyle}" Text="{Binding Mod.Name}" />
|
Orientation="Vertical">
|
||||||
|
<TextBlock Style="{StaticResource TitleLargeTextBlockStyle}"
|
||||||
|
Text="{Binding Mod.Name}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="title_b"
|
x:Name="title_b"
|
||||||
Margin="0,3,0,0"
|
Margin="0,3,0,0"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="加载中" />
|
Text="加载中"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="title_c"
|
x:Name="title_c"
|
||||||
Margin="0,9,0,0"
|
Margin="0,9,0,0"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="加载中" />
|
Text="加载中"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ScrollView Grid.Row="1">
|
<ScrollView Grid.Row="1">
|
||||||
<StackPanel Margin="0,26,0,0" Orientation="Vertical">
|
<StackPanel Margin="0,26,0,0"
|
||||||
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="介绍" />
|
Orientation="Vertical">
|
||||||
|
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}"
|
||||||
|
Text="介绍"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="DescriptionText"
|
x:Name="DescriptionText"
|
||||||
Padding="6,6,6,6"
|
Padding="6,6,6,6"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="{Binding Mod.Description}"
|
Text="{Binding Mod.Description}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="fliptext"
|
x:Name="fliptext"
|
||||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||||
Text="截图"
|
Text="截图"
|
||||||
Visibility="Collapsed" />
|
Visibility="Collapsed"/>
|
||||||
<FlipView
|
<FlipView
|
||||||
x:Name="flipview"
|
x:Name="flipview"
|
||||||
MaxWidth="600"
|
MaxWidth="600"
|
||||||
|
@ -66,7 +73,8 @@
|
||||||
Visibility="Collapsed">
|
Visibility="Collapsed">
|
||||||
<FlipView.ItemTemplate>
|
<FlipView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="x:String">
|
<DataTemplate x:DataType="x:String">
|
||||||
<Image Source="{x:Bind Mode=OneTime}" Stretch="Uniform" />
|
<Image Source="{x:Bind Mode=OneTime}"
|
||||||
|
Stretch="Uniform"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</FlipView.ItemTemplate>
|
</FlipView.ItemTemplate>
|
||||||
</FlipView>
|
</FlipView>
|
||||||
|
@ -83,19 +91,19 @@
|
||||||
Name="ReportButton"
|
Name="ReportButton"
|
||||||
Click="AppBarButton_Click"
|
Click="AppBarButton_Click"
|
||||||
Icon="ReportHacked"
|
Icon="ReportHacked"
|
||||||
Label="举报" />
|
Label="举报"/>
|
||||||
<AppBarSeparator />
|
<AppBarSeparator/>
|
||||||
<AppBarButton
|
<AppBarButton
|
||||||
Name="LikeButton"
|
Name="LikeButton"
|
||||||
Click="AppBarButton_Click"
|
Click="AppBarButton_Click"
|
||||||
Icon="Like"
|
Icon="Like"
|
||||||
Label="支持" />
|
Label="支持"/>
|
||||||
<AppBarSeparator />
|
<AppBarSeparator/>
|
||||||
<AppBarButton
|
<AppBarButton
|
||||||
Name="DownLoadButton"
|
Name="DownLoadButton"
|
||||||
Click="AppBarButton_Click"
|
Click="AppBarButton_Click"
|
||||||
Icon="Download"
|
Icon="Download"
|
||||||
Label="下载" />
|
Label="下载"/>
|
||||||
</CommandBar.PrimaryCommands>
|
</CommandBar.PrimaryCommands>
|
||||||
</CommandBar>
|
</CommandBar>
|
||||||
<TeachingTip
|
<TeachingTip
|
||||||
|
@ -107,15 +115,17 @@
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementMargin="20"
|
PlacementMargin="20"
|
||||||
PreferredPlacement="Auto"
|
PreferredPlacement="Auto"
|
||||||
Subtitle="消息" />
|
Subtitle="消息"/>
|
||||||
|
|
||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Name="DownloadDialog"
|
x:Name="DownloadDialog"
|
||||||
Title="下载中"
|
Title="下载中"
|
||||||
SecondaryButtonText="取消">
|
SecondaryButtonText="取消">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Name="DownloadDialogText" Text="下载完成后会自动导入到你配置的模组路径,请勿取消" />
|
<TextBlock Name="DownloadDialogText"
|
||||||
<ProgressBar Margin="0,6,0,0" IsIndeterminate="True" />
|
Text="下载完成后会自动导入到你配置的模组路径,请勿取消"/>
|
||||||
|
<ProgressBar Margin="0,6,0,0"
|
||||||
|
IsIndeterminate="True"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ContentDialog>
|
</ContentDialog>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class IniHelper
|
||||||
|
|
||||||
public IniHelper()
|
public IniHelper()
|
||||||
{
|
{
|
||||||
_sections = new Dictionary<string, Dictionary<string, string>>();
|
|
||||||
/*用法
|
/*用法
|
||||||
//IniHelper iniHelper = new IniHelper();
|
//IniHelper iniHelper = new IniHelper();
|
||||||
// 设置配置数据 节 key value
|
// 设置配置数据 节 key value
|
||||||
|
@ -62,12 +61,13 @@ public class IniHelper
|
||||||
/// <exception cref="FileNotFoundException"></exception>
|
/// <exception cref="FileNotFoundException"></exception>
|
||||||
public void Load(string a)
|
public void Load(string a)
|
||||||
{
|
{
|
||||||
filePath = Path.Combine(wj.CD,a);
|
|
||||||
|
filePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, a);
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
{
|
{// 使用 File.Create 创建文件并立即关闭
|
||||||
File.Create(filePath);
|
using var fs = File.Create(filePath);
|
||||||
|
// 文件创建成功,但在这里不做任何操作 文件已经关闭
|
||||||
return;
|
return;
|
||||||
//throw new FileNotFoundException("The specified file does not exist.", filePath);
|
|
||||||
}
|
}
|
||||||
if (filePath == null || filePath == string.Empty)
|
if (filePath == null || filePath == string.Empty)
|
||||||
{
|
{
|
||||||
|
@ -107,8 +107,8 @@ public class IniHelper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
if (filePath==null) {
|
if (filePath==null||filePath==string.Empty) {
|
||||||
throw new FileNotFoundException("不存在或者filePath没有定义");
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var sw = new StreamWriter(filePath);
|
using var sw = new StreamWriter(filePath);
|
||||||
|
|
|
@ -12,12 +12,16 @@ using Windows.UI.ViewManagement;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using Windows.UI;
|
using Windows.UI;
|
||||||
class gj
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
||||||
|
#pragma warning disable IDE1006 // 命名样式
|
||||||
|
public class gj
|
||||||
{
|
{
|
||||||
public static void sc(object? obj)
|
public static void sc(object? obj)
|
||||||
{
|
{
|
||||||
obj ??= "null";
|
obj ??= "null";
|
||||||
Debug.WriteLine(obj);
|
Debug.WriteLine("Debug:" + obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,12 +29,10 @@ class gj
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var searcher = new ManagementObjectSearcher("select UUID from Win32_ComputerSystemProduct"))
|
using var searcher = new ManagementObjectSearcher("select UUID from Win32_ComputerSystemProduct");
|
||||||
|
foreach (var obj in searcher.Get().Cast<ManagementObject>())
|
||||||
{
|
{
|
||||||
foreach (ManagementObject obj in searcher.Get())
|
return obj["UUID"] != null ? (string)obj["UUID"] : "";
|
||||||
{
|
|
||||||
return obj["UUID"].ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -38,7 +40,7 @@ class gj
|
||||||
Console.WriteLine($"An error occurred while retrieving the UUID: {ex.Message}");
|
Console.WriteLine($"An error occurred while retrieving the UUID: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +87,7 @@ class gj
|
||||||
|
|
||||||
public static void SetBackColor(WindowEx windowEx)
|
public static void SetBackColor(WindowEx windowEx)
|
||||||
{
|
{
|
||||||
UISettings uISettings = new UISettings();
|
var uISettings = new UISettings();
|
||||||
// 获取当前的背景颜色
|
// 获取当前的背景颜色
|
||||||
var backgroundColor = uISettings.GetColorValue(UIColorType.Background);
|
var backgroundColor = uISettings.GetColorValue(UIColorType.Background);
|
||||||
|
|
||||||
|
@ -178,6 +180,47 @@ class gj
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
|
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 简单的ini读取器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Dictionary<string, Dictionary<string, string>> IniInfo(string filePath)
|
||||||
|
{
|
||||||
|
|
||||||
|
var sections=new Dictionary<string, Dictionary<string, string>>();
|
||||||
|
using (var reader = new StreamReader(filePath))
|
||||||
|
{
|
||||||
|
string? line;
|
||||||
|
string? currentSection = null;
|
||||||
|
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
if (line.StartsWith("[") && line.EndsWith("]"))
|
||||||
|
{
|
||||||
|
// New section found
|
||||||
|
currentSection = line.Trim('[', ']');
|
||||||
|
sections[currentSection] = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(line) && currentSection != null)
|
||||||
|
{
|
||||||
|
// Key-value pair found
|
||||||
|
var delimiterIndex = line.IndexOf(':');
|
||||||
|
if (delimiterIndex > 0)
|
||||||
|
{
|
||||||
|
var key = line.Substring(0, delimiterIndex).Trim();
|
||||||
|
var value = line.Substring(delimiterIndex + 1).Trim();
|
||||||
|
sections[currentSection][key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BackTheme
|
public enum BackTheme
|
||||||
|
|
|
@ -3,17 +3,20 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using Windows.Storage.Streams;
|
||||||
namespace RustTools.muqing;
|
namespace RustTools.muqing;
|
||||||
|
|
||||||
class wj
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
||||||
|
#pragma warning disable IDE1006 // 命名样式
|
||||||
|
public class wj
|
||||||
{
|
{
|
||||||
//存储主要文件的路径
|
//存储主要文件的路径
|
||||||
public static string CD = "C:\\RustTools";
|
public static string CD = "";
|
||||||
//缓存路径
|
//缓存路径
|
||||||
public const string Cache = "";
|
public const string Cache = "";
|
||||||
|
|
||||||
//不知道为什么会保存到这里的路径 废弃了 , 找到了新的文件夹路径
|
//不知道为什么会保存到这里的路径 废弃了 , 找到了新的文件夹路径
|
||||||
//public const string CachePath= "C:/Users/账号/AppData/Local/VirtualStore/Windows/SysWOW64";
|
//public const string CachePath= "C:/Users/19669/AppData/Local/VirtualStore/Windows/SysWOW64";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 存储文件名字的路径
|
/// 存储文件名字的路径
|
||||||
|
@ -91,4 +94,44 @@ class wj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 压缩zip
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folderPath"></param>
|
||||||
|
/// <param name="zipFileName"></param>
|
||||||
|
public static string ZipExample(string folderPath, string zipFileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
zipFileName = Path.Combine(Path.Combine(Path.GetDirectoryName(folderPath), zipFileName));
|
||||||
|
// 创建一个新的 Zip 文件
|
||||||
|
|
||||||
|
using (FileStream fs = File.Create(zipFileName))
|
||||||
|
{
|
||||||
|
using (ZipArchive archive = new ZipArchive(fs, ZipArchiveMode.Create, true))
|
||||||
|
{
|
||||||
|
string[] files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
string relativePath = file.Substring(folderPath.Length + 1);
|
||||||
|
|
||||||
|
ZipArchiveEntry entry = archive.CreateEntry(relativePath);
|
||||||
|
using (FileStream sourceStream = File.OpenRead(file))
|
||||||
|
using (Stream entryStream = entry.Open())
|
||||||
|
{
|
||||||
|
sourceStream.CopyTo(entryStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return zipFileName;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
using System.Threading;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
namespace RustTools.muqing;
|
namespace RustTools.muqing;
|
||||||
|
|
||||||
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
||||||
class wl
|
class wl
|
||||||
{
|
{
|
||||||
public static string api = "https://rust.coldmint.top";
|
public static string api = "https://rust.coldmint.top";
|
||||||
|
@ -102,4 +104,5 @@ class wl
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user