更新发布功能
This commit is contained in:
parent
636c673282
commit
03c697b2b6
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AppInstaller Uri="{AppInstallerUri}"
|
||||
Version="{Version}"
|
||||
xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2">
|
||||
|
||||
<!-- Read more about updating settings with Package.appinstaller at https://docs.microsoft.com/windows/msix/app-installer/update-settings -->
|
||||
|
||||
<MainBundle Name="{Name}"
|
||||
Version="{Version}"
|
||||
Publisher="{Publisher}"
|
||||
Uri="{MainPackageUri}"/>
|
||||
<UpdateSettings>
|
||||
<OnLaunch HoursBetweenUpdateChecks="0" />
|
||||
</UpdateSettings>
|
||||
|
||||
</AppInstaller>
|
|
@ -1,66 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<RootNamespace>RustTools</RootNamespace>
|
||||
<Platform>x64</Platform>
|
||||
<Platforms>x86;x64;arm64</Platforms>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
<AssemblyName>RustTools</AssemblyName>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<PackageIcon>tool.png</PackageIcon>
|
||||
<ApplicationIcon>Assets\WindowIcon.ico</ApplicationIcon>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<DefaultLanguage>zh-cn</DefaultLanguage>
|
||||
|
||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||
<PackageCertificateThumbprint>3386EC79D3BB9691D0A8DA634167500B242E109D</PackageCertificateThumbprint>
|
||||
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
||||
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
|
||||
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
|
||||
<GenerateTestArtifacts>True</GenerateTestArtifacts>
|
||||
<AppxBundle>Never</AppxBundle>
|
||||
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.240109" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
|
||||
<PackageReference Include="RestClient" Version="3.1024.23771" />
|
||||
<PackageReference Include="RestSharp" Version="111.4.0" />
|
||||
<PackageReference Include="System.Management" Version="8.0.0" />
|
||||
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
||||
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240227000" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
|
||||
|
||||
<Manifest Include="$(ApplicationManifest)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TextControlBox\TextControlBox.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -7,8 +7,6 @@
|
|||
<Platform>x64</Platform>
|
||||
<Platforms>x86;x64;arm64</Platforms>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
|
||||
<!--<WindowsPackageType>None</WindowsPackageType>-->
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -22,25 +20,7 @@
|
|||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<DefaultLanguage>zh-cn</DefaultLanguage>
|
||||
|
||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||
<PackageCertificateThumbprint>3386EC79D3BB9691D0A8DA634167500B242E109D</PackageCertificateThumbprint>
|
||||
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
||||
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
|
||||
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
|
||||
<GenerateTestArtifacts>True</GenerateTestArtifacts>
|
||||
<AppxBundle>Never</AppxBundle>
|
||||
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--<Target Name="RemoveFoldersWithMuiFiles" AfterTargets="Build">
|
||||
<ItemGroup>
|
||||
<RemovingFiles Include="$(OutDir)*\*.mui" Exclude="$(OutDir)en-us\*.mui" />
|
||||
<RemovingFolders Include="@(RemovingFiles->'%(RootDir)%(Directory)')" />
|
||||
</ItemGroup>
|
||||
<RemoveDir Directories="@(RemovingFolders)" />
|
||||
</Target>-->
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
|
@ -53,6 +33,7 @@
|
|||
<PackageReference Include="RestSharp" Version="111.4.0" />
|
||||
<PackageReference Include="squirrel.windows" Version="2.0.1" />
|
||||
<PackageReference Include="System.Management" Version="8.0.0" />
|
||||
<PackageReference Include="TinyPinyin" Version="1.1.0" />
|
||||
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
||||
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
|
||||
|
|
|
@ -1,14 +1,153 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="RustTools.Themes.PostRwmod"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:RustTools.Themes"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:RustTools.Themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<ScrollView Padding="0,0,9,0">
|
||||
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Padding="9"
|
||||
Background="{StaticResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="9">
|
||||
<TextBlock Text="必填" />
|
||||
<StackPanel>
|
||||
<TextBox
|
||||
Name="TextBoxID"
|
||||
ui:TextBoxExtensions.Regex="^\s*\+?\s*([0-9][\s-]*){9,}$"
|
||||
Header="输入模组的唯一ID" />
|
||||
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}">
|
||||
<Run Text="只支持英文和数字包括下划线: " />
|
||||
<Run FontWeight="SemiBold" Text="{Binding (ui:TextBoxExtensions.IsValid), ElementName=TextBoxID}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel>
|
||||
<TextBox Name="TextBoxName" Header="输入模组的名称" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox
|
||||
Name="TextBoxInfo"
|
||||
AcceptsReturn="True"
|
||||
Header="模组的描述"
|
||||
IsSpellCheckEnabled="True"
|
||||
SelectionHighlightColor="Green"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox Name="TextBoxVersion" Header="版本号(0.0.0)" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox Name="TextBoxYouxiVersion" Header="最低支持的游戏版本" />
|
||||
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}">
|
||||
<Run Text="可留空" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox Name="TextBoxTab" Header="标签" />
|
||||
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}">
|
||||
<Run Text="请用,分开" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,9,0,0"
|
||||
Padding="9"
|
||||
Background="{StaticResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="9">
|
||||
<TextBlock Text="可选" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="模组图标" />
|
||||
<Border
|
||||
Width="56"
|
||||
Height="56"
|
||||
Margin="16,0,0,0"
|
||||
Background="{ThemeResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="13">
|
||||
<Image Source="/Assets/tool.png" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,6,0,0" Orientation="Vertical">
|
||||
<TextBlock VerticalAlignment="Center" Text="截图列表" />
|
||||
<FlipView Height="270" MaxWidth="400">
|
||||
<Image Source="/Assets/tool.png" />
|
||||
<Button
|
||||
Width="56"
|
||||
Height="56"
|
||||
Margin="16,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="{ThemeResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="13">
|
||||
<FontIcon Glyph="" />
|
||||
</Button>
|
||||
</FlipView>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Margin="0,9,0,0"
|
||||
Padding="9"
|
||||
Background="{StaticResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="9">
|
||||
<TextBlock Text="模组" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="模组文件" Visibility="Collapsed" />
|
||||
<Button Margin="6" Content="打包" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="3"
|
||||
Margin="0,9,0,0"
|
||||
Padding="9"
|
||||
Background="{StaticResource SystemFillColorSolidAttentionBackgroundBrush}"
|
||||
CornerRadius="9">
|
||||
<TextBlock Text="动态" />
|
||||
<CheckBox
|
||||
Margin="6"
|
||||
Content="同时进行动态发布"
|
||||
IsChecked="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4" Margin="0,13,0,0">
|
||||
<CommandBar
|
||||
Background="Transparent"
|
||||
DefaultLabelPosition="Right"
|
||||
IsOpen="False"
|
||||
OverflowButtonVisibility="Collapsed">
|
||||
<AppBarButton
|
||||
Margin="0,0,21,0"
|
||||
HorizontalAlignment="Right"
|
||||
Click="AppBarButton_Click"
|
||||
Icon="Clear"
|
||||
Label="取消"
|
||||
Tag="取消" />
|
||||
<AppBarButton
|
||||
HorizontalAlignment="Right"
|
||||
Background="{StaticResource SystemFillColorAttentionBrush}"
|
||||
Click="AppBarButton_Click"
|
||||
Icon="Send"
|
||||
Label="提交"
|
||||
Tag="提交" />
|
||||
</CommandBar>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollView>
|
||||
</UserControl>
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
using System.Globalization;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using RustTools.muqing;
|
||||
using SharpCompress.Common;
|
||||
using TinyPinyin;
|
||||
using static IniHelper;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
@ -19,8 +12,89 @@ using Windows.Foundation.Collections;
|
|||
namespace RustTools.Themes;
|
||||
public sealed partial class PostRwmod : UserControl
|
||||
{
|
||||
public PostRwmod()
|
||||
private readonly ContentDialog contentDialog;
|
||||
public PostRwmod(ContentDialog contentDialog)
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.contentDialog = contentDialog;
|
||||
InitializeComponent();
|
||||
}
|
||||
Dictionary<string, Dictionary<string, string>> IniInfo = new();
|
||||
string path;
|
||||
public void Init(string path)
|
||||
{
|
||||
this.path = path;
|
||||
var directoryInfo = new DirectoryInfo(path);
|
||||
//
|
||||
var id = PinyinHelper.GetPinyin(directoryInfo.Name, "_");
|
||||
//读取
|
||||
var v = Path.Combine(directoryInfo.FullName, "mod-info.txt");
|
||||
|
||||
if (File.Exists(v))
|
||||
{
|
||||
var fileInfo = new FileInfo(v);
|
||||
IniInfo = gj.IniInfo(v);
|
||||
if(IniInfo.TryGetValue("mod",out var mod))
|
||||
{
|
||||
var Name = mod.TryGetValue("title", out var value) ? value : fileInfo.Name;
|
||||
TextBoxName.Text= Name;
|
||||
//\n
|
||||
var Info = mod.TryGetValue("description", out var description) ? description : "无描述信息";
|
||||
TextBoxInfo.AcceptsReturn = true;
|
||||
TextBoxInfo.Text= Info.Replace("\\n", "\n");
|
||||
|
||||
|
||||
if(mod.TryGetValue("minVersion", out var minVersion))
|
||||
{
|
||||
TextBoxYouxiVersion.Text= minVersion;
|
||||
}
|
||||
|
||||
//Version
|
||||
TextBoxVersion.Text = mod.TryGetValue("Version", out var version) ? version : "1.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
TextBoxID.Text = id;
|
||||
|
||||
}
|
||||
|
||||
private void AppBarButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (sender is AppBarButton button)
|
||||
{
|
||||
contentDialog.Closing -= Dialog.DialogNotEsc;
|
||||
switch (button.Tag)
|
||||
{
|
||||
case "取消":
|
||||
contentDialog.Hide();
|
||||
break;
|
||||
case "提交":
|
||||
var modstr = "mod";
|
||||
if (!IniInfo.TryGetValue(modstr, out var value))
|
||||
{
|
||||
value = new Dictionary<string, string>();
|
||||
IniInfo[modstr] = value;
|
||||
}
|
||||
|
||||
value["title"] = TextBoxName.Text;
|
||||
value["description"] = TextBoxInfo.Text.ToString().Replace("\n", "\n");
|
||||
gj.sc(TextBoxInfo.Text.ToString().Replace("\n", "\\n"));
|
||||
value["minVersion"] = TextBoxYouxiVersion.Text;
|
||||
using (var sw = new StreamWriter(Path.Combine(path, "mod-info.txt")))
|
||||
{
|
||||
foreach (var section in IniInfo)
|
||||
{
|
||||
sw.WriteLine($"[{section.Key}]");
|
||||
foreach (var keyValue in section.Value)
|
||||
{
|
||||
sw.WriteLine($"{keyValue.Key}:{keyValue.Value}");
|
||||
}
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
contentDialog.Hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
Text="打开"
|
||||
ToolTipService.ToolTip="制作中···" />
|
||||
<MenuFlyoutItem Click="Button_Rwmod" Text="打包" />
|
||||
<MenuFlyoutItem Text="发布" />
|
||||
<MenuFlyoutItem Click="Button_PostRwmod" Text="发布" />
|
||||
<MenuFlyoutItem Click="Button_Delete" Text="删除" />
|
||||
</MenuFlyout>
|
||||
</Grid.ContextFlyout>
|
||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.UI.Xaml.Controls.Primitives;
|
|||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
using RustTools.muqing;
|
||||
using RustTools.Themes;
|
||||
using RustTools.ViewModels;
|
||||
using SharpCompress.Common;
|
||||
namespace RustTools.Views;
|
||||
|
@ -274,6 +275,41 @@ public sealed partial class ModulePage : Page
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发布模组
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Button_PostRwmod(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is MenuFlyoutItem item)
|
||||
{
|
||||
if (item.DataContext is not DataObject dataObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//folderItem.IsRwmod = false;
|
||||
var contentDialog = new ContentDialog()
|
||||
{
|
||||
XamlRoot = XamlRoot,
|
||||
Title = "发布",
|
||||
};
|
||||
var postRwmod = new PostRwmod(contentDialog)
|
||||
{
|
||||
XamlRoot = XamlRoot
|
||||
};
|
||||
var h= ((Panel) Content).ActualHeight;
|
||||
postRwmod.Height =h-50;
|
||||
contentDialog.Content = postRwmod;
|
||||
// 订阅 Closing 事件
|
||||
contentDialog.Closing += Dialog.DialogNotEsc;
|
||||
|
||||
postRwmod.Init(dataObject.Dri);
|
||||
await contentDialog.ShowAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public class MyItemTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Windows.UI.Popups;
|
||||
|
||||
namespace RustTools.muqing;
|
||||
|
@ -67,4 +68,13 @@ public class Dialog
|
|||
};
|
||||
return await contentDialog.ShowAsync();
|
||||
}
|
||||
|
||||
|
||||
public static void DialogNotEsc(ContentDialog sender, ContentDialogClosingEventArgs e)
|
||||
{
|
||||
if (e.Result == ContentDialogResult.None)
|
||||
{
|
||||
e.Cancel = true; // 阻止关闭,除非是通过按钮手动关闭
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public class Mod
|
|||
|
||||
string GetInstallPathFromKey(string subKey)
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(subKey))
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(subKey))
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user