Compare commits

..

2 commits

10 changed files with 270 additions and 0 deletions

23
.gitignore vendored Normal file
View file

@ -0,0 +1,23 @@
# Visual Studio
.vs/
*.user
*.suo
*.userosscache
*.VC.db
# Build output
bin/
obj/
# Rider
.idea/
# NuGet
packages/
# Resharper
_ReSharper*/
# OS files
Thumbs.db
.DS_Store

9
App.xaml Normal file
View file

@ -0,0 +1,9 @@
<Application x:Class="MossyUpdater.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MossyUpdater"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

14
App.xaml.cs Normal file
View file

@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace MossyUpdater
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
AssemblyInfo.cs Normal file
View file

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

76
MainWindow.xaml Normal file
View file

@ -0,0 +1,76 @@
<Window x:Class="MossyUpdater.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MossyUpdater" Height="331" Width="500">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<!-- 0: label -->
<RowDefinition Height="Auto"/>
<!-- 1: URL textbox -->
<RowDefinition Height="Auto"/>
<!-- 2: folder picker -->
<RowDefinition Height="Auto"/>
<!-- 3: filename -->
<RowDefinition Height="Auto"/>
<!-- 4: download button -->
<RowDefinition Height="Auto"/>
<!-- 5: status text -->
<RowDefinition Height="*"/>
<!-- 6: image (fills rest) -->
</Grid.RowDefinitions>
<!-- 0 -->
<TextBlock Text="MosswartMassacre URL to DLL:" Grid.Row="0" Margin="0,0,0,5"/>
<!-- 1 -->
<TextBox x:Name="UrlTextBox"
Grid.Row="1"
Height="25"
Margin="0,0,0,10"
Text="https://git.snakedesert.se/SawatoMosswartsEnjoyersClub/MosswartMassacre/raw/branch/spawn-detection/MosswartMassacre/bin/Release/MosswartMassacre.dll"/>
<!-- 2 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,0,0,10">
<TextBox x:Name="FolderTextBox"
Width="350"
Height="25"
Margin="0,0,5,0"/>
<Button Content="Browse"
Width="75"
Click="Browse_Click"/>
</StackPanel>
<!-- 3 -->
<StackPanel Grid.Row="3" Orientation="Horizontal" Margin="0,0,0,10">
<TextBlock Text="Filename:"
VerticalAlignment="Center"
Margin="0,0,5,0"/>
<TextBox x:Name="FilenameTextBox"
Width="200"
Text="MosswartMassacre.dll"/>
</StackPanel>
<!-- 4 -->
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Download &amp; Unblock"
Width="150"
Click="Download_Click"/>
</StackPanel>
<!-- 5 -->
<TextBlock x:Name="StatusTextBlock"
Grid.Row="5"
Margin="0,10,0,10"
Foreground="Green"/>
<!-- 6: your image as embedded Resource -->
<Image Grid.Row="6"
Source="pack://application:,,,/MossyUpdater;component/Mosswart_Mask_Live.png"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,10,0,0"
Height="100"/>
</Grid>
</Window>

72
MainWindow.xaml.cs Normal file
View file

@ -0,0 +1,72 @@
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows;
using Ookii.Dialogs.Wpf; // ← add this
namespace MossyUpdater
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Browse_Click(object sender, RoutedEventArgs e)
{
var dlg = new VistaFolderBrowserDialog
{
Description = "Select a destination folder",
UseDescriptionForTitle = true
};
// ShowDialog returns true if the user clicked OK
if (dlg.ShowDialog() == true)
FolderTextBox.Text = dlg.SelectedPath;
}
private async void Download_Click(object sender, RoutedEventArgs e)
{
string url = UrlTextBox.Text.Trim();
string folder = FolderTextBox.Text.Trim();
string filename = FilenameTextBox.Text.Trim();
if (string.IsNullOrEmpty(url)
|| string.IsNullOrEmpty(folder)
|| string.IsNullOrEmpty(filename))
{
StatusTextBlock.Text = "Please fill in all fields.";
StatusTextBlock.Foreground = System.Windows.Media.Brushes.Red;
return;
}
string fullPath = Path.Combine(folder, filename);
try
{
using var client = new HttpClient();
var data = await client.GetByteArrayAsync(url);
await File.WriteAllBytesAsync(fullPath, data);
UnblockFile(fullPath);
StatusTextBlock.Text = $"Downloaded and unblocked:\n{fullPath}";
StatusTextBlock.Foreground = System.Windows.Media.Brushes.Green;
}
catch (Exception ex)
{
StatusTextBlock.Text = $"Error: {ex.Message}";
StatusTextBlock.Foreground = System.Windows.Media.Brushes.Red;
}
}
private void UnblockFile(string path)
{
var zone = path + ":Zone.Identifier";
if (File.Exists(zone))
File.Delete(zone);
}
}
}

BIN
Mosswart_Mask_Live.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

25
MossyUpdater.csproj Normal file
View file

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="Mosswart_Mask_Live.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
<PackageReference Include="System.Windows.Extensions" Version="9.0.5" />
</ItemGroup>
<ItemGroup>
<Resource Include="Mosswart_Mask_Live.png" />
</ItemGroup>
</Project>

25
MossyUpdater.sln Normal file
View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35931.197 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MossyUpdater", "MossyUpdater.csproj", "{B110060B-D3A6-44CB-86E1-EF2B65F1209D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B110060B-D3A6-44CB-86E1-EF2B65F1209D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B110060B-D3A6-44CB-86E1-EF2B65F1209D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B110060B-D3A6-44CB-86E1-EF2B65F1209D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B110060B-D3A6-44CB-86E1-EF2B65F1209D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF3977FA-6EF6-4AFF-9E27-19038F7BF519}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net8.0-windows\publish\win-x64\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>