Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
1.0.1 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceTimee committed Mar 5, 2022
1 parent 0cbc5ab commit e3e346f
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 56 deletions.
50 changes: 32 additions & 18 deletions MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
using System;
using System.IO;
using System.Windows.Forms;
using SheasCore;

namespace Sheas_Unlocker
{
public partial class MainForm : Form
internal partial class MainForm : Form
{
public MainForm()
internal MainForm()
{
InitializeComponent();
}

private void UnlockButton_Click(object sender, EventArgs e)
{
if (System.IO.Directory.Exists(PathTextBox.Text))
Text = "解锁中...";
else
try
{
Text = "文件路径错误";
return;
}
if (!Directory.Exists(PathBox.Text))
throw new Exception("文件路径错误");

string feedBack = "未知错误";
if (RecurseCheckBox.Checked)
feedBack = PowerShell.PowerShellRun(PathTextBox.Text, @"Get-ChildItem -Recurse | Unblock-File");
else
feedBack = PowerShell.PowerShellRun(PathTextBox.Text, @"Get-ChildItem | Unblock-File");
Text = "解锁中...";

if (feedBack == "")
Text = "解锁成功";
else
Text = "解锁失败"; //feedBack
PowerShell powerShell = new(this);
if (RecurseCheckBox.Checked)
powerShell.ShellRun(PathBox.Text, @"Get-ChildItem -Recurse | Unblock-File");
else
powerShell.ShellRun(PathBox.Text, @"Get-ChildItem | Unblock-File");
}
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); Text = "解锁失败"; return; }
}
private void NavigateButton_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
try
{
FolderBrowserDialog folderBrowserDialog = new();

#region 配置folderBrowserDialog的参数
folderBrowserDialog.Description = "Sheath Importer";
folderBrowserDialog.UseDescriptionForTitle = true; //修改标题
folderBrowserDialog.AutoUpgradeEnabled = true; //自动升级对话框样式
#endregion
#region 配置folderBrowserDialog的参数
folderBrowserDialog.Description = "Sheath Importer";
folderBrowserDialog.UseDescriptionForTitle = true; //修改标题
folderBrowserDialog.AutoUpgradeEnabled = true; //自动升级对话框样式
#endregion 配置folderBrowserDialog的参数

if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
PathTextBox.Text = folderBrowserDialog.SelectedPath; //路径
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
PathBox.Text = folderBrowserDialog.SelectedPath; //路径
}
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); Text = "浏览失败"; return; }
}
}
}
}
5 changes: 4 additions & 1 deletion MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<metadata name="UnlockButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PathTextBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="PathBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="NavigateButton.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand All @@ -69,6 +69,9 @@
<metadata name="RecurseCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IgnoreCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down
46 changes: 46 additions & 0 deletions PowerShell.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace Sheas_Unlocker
{
internal class PowerShell : SheasCore.Proc
{
private readonly MainForm MAIN_FORM;
private bool IS_SUCCESSFUL = true;

internal PowerShell(MainForm mainForm) : base("powershell")
{
Control.CheckForIllegalCrossThreadCalls = false;
MAIN_FORM = mainForm;
}

public override void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
OutputError(e);
}

public override void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
OutputError(e);
}

public override void Process_Exited(object sender, EventArgs e)
{
if (IS_SUCCESSFUL)
MAIN_FORM.Text = "解锁成功";
}

private void OutputError(DataReceivedEventArgs e)
{
if (!string.IsNullOrEmpty(e.Data) && !string.IsNullOrWhiteSpace(e.Data))
{
IS_SUCCESSFUL = false;
MAIN_FORM.Text = "解锁失败";

if (!MAIN_FORM.IgnoreCheckBox.Checked)
MessageBox.Show("Error: " + e.Data);
}
}
}
}
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ private static void Main()
Application.Run(new MainForm());
}
}
}
}
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
</br>

## 自我介绍:
**Sheas Unlocker**: 一只基于**Winform(.Net5)** 的Windows外来文件解锁定工具
**Sheas Unlocker**: 一只基于**Winform (.Net5)** 的 Windows 外来文件解锁定工具

适用平台: **Windows**

## 注意事项:
1. Sheas Unlocker仍处于开发阶段,但每个正式版发布前会尽量确保其稳定可用
2. Github Release中会保留目前能够使用的所有版本,但强烈推荐使用最新版
1. 为避免不必要的麻烦,食用前请先阅读注意事项和用户协议
2. Sheas Unlocker 仍处于开发阶段,但每个正式版发布前会尽量确保其稳定可用
3. Github Release 中会保留目前能够使用的所有版本,但强烈推荐使用最新版

## 用户协议:
暂无
1. [隐私政策](https://thoughts.teambition.com/share/62215b3f8ecda0004135fa83#title=Sheas_Unlocker_隐私政策)
2. [使用协议](https://thoughts.teambition.com/share/62215bb80afc380041785103#title=Sheas_Unlocker_使用协议)

## 下载地址:
暂无
Github: [https://github.com/SpaceTimee/Sheas-Unlocker/releases](https://github.com/SpaceTimee/Sheas-Unlocker/releases)

## 安装方式:
暂无
下载 Sheas Unlocker Setup.exe 并双击运行 -> 按照提示设置即可安装

## 开发者:
**Space Time**
Expand Down
25 changes: 22 additions & 3 deletions Sheas-Unlocker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,49 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows10.0.22000.0</TargetFramework>
<RootNamespace>Sheas_Unlocker</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Authors>Space Time</Authors>
<Product>Sheas Unlocker</Product>
<Description></Description>
<Copyright></Copyright>
<Description>Just Unlocker</Description>
<Copyright>Copyright © 2077</Copyright>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<ApplicationIcon>Sheas Unlocker Logo.ico</ApplicationIcon>
<Version>0</Version>
<Company />
<PackageId>SpaceTime.Sheas.Unlocker</PackageId>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
<PackageReleaseNotes>Just Unlocker</PackageReleaseNotes>
<PackageTags>tool;unlocker;sheas</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/SpaceTimee/Sheas-Unlocker</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/SpaceTimee/Sheas-Unlocker</PackageProjectUrl>
<PackageIcon>Sheas Unlocker Logo 384x384.png</PackageIcon>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>

<ItemGroup>
<None Remove=".gitattributes" />
<None Remove=".gitignore" />
<None Remove="README.md" />
<None Remove="Sheas Unlocker Logo.ico" />
</ItemGroup>

<ItemGroup>
<Reference Include="Sheas Core">
<HintPath>C:\Users\Space Time\Desktop\Sheas Core\bin\Release\Sheas Core.dll</HintPath>
Expand Down

0 comments on commit e3e346f

Please sign in to comment.