Реорганизация

This commit is contained in:
kislovdm
2026-04-27 00:15:02 +03:00
parent 2fb673661f
commit ec933abf36
23 changed files with 77 additions and 88 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.2
1.0.3
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32929.386
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonsterMonitor", "src\MonsterMonitor.csproj", "{7D6104C6-6AEF-4D31-8463-FCEABDF1577A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonsterMonitor", "MonsterMonitor\MonsterMonitor.csproj", "{7D6104C6-6AEF-4D31-8463-FCEABDF1577A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -4,7 +4,7 @@ using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace SshTunnelMonitor.Models
namespace MonsterMonitor.Models
{
public sealed class AppSettings
{
@@ -58,7 +58,7 @@ namespace SshTunnelMonitor.Models
{
if (string.IsNullOrWhiteSpace(SystemPasswordProtected))
{
return "STerra";
return "";
}
if (!SystemPasswordProtected.StartsWith(ProtectedPrefix, StringComparison.Ordinal))
@@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>7.3</LangVersion>
<RootNamespace>SshTunnelMonitor</RootNamespace>
<RootNamespace>MonsterMonitor</RootNamespace>
<AssemblyName>MonsterMonitor</AssemblyName>
<AssemblyVersion>1.0.3</AssemblyVersion>
<Version>1.0.3</Version>
<FileVersion>1.0.3</FileVersion>
<InformationalVersion>1.0.3</InformationalVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="6.0.0">
@@ -1,8 +1,8 @@
using System;
using System.Windows.Forms;
using SshTunnelMonitor.UI;
using MonsterMonitor.UI;
namespace SshTunnelMonitor
namespace MonsterMonitor
{
internal static class Program
{
@@ -1,7 +1,7 @@
using System;
using SshTunnelMonitor.Models;
using MonsterMonitor.Models;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public sealed class AppController : IDisposable
{
@@ -4,9 +4,9 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SshTunnelMonitor.Models;
using MonsterMonitor.Models;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public class AuthMonitor: IAuthMonitor
{
@@ -57,10 +57,14 @@ namespace SshTunnelMonitor.Services
var activeWindowTitle = GetActiveWindowTitle();
if (activeWindowTitle?.Contains("XAuth request") == true)
{
SendKeys.SendWait(_settings.GetSystemPassword());
var password = _settings.GetSystemPassword();
if (!string.IsNullOrEmpty(password))
{
SendKeys.SendWait(password);
SendKeys.SendWait("{ENTER}");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
@@ -1,6 +1,6 @@
using System;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public enum LogLevel
{
@@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public sealed class PowerManagementService
{
@@ -2,7 +2,7 @@ using System;
using System.Diagnostics;
using System.Threading;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public sealed class ProcessMonitorService : IDisposable
{
@@ -1,9 +1,9 @@
using System;
using System.IO;
using System.Security.Cryptography;
using SshTunnelMonitor.Models;
using MonsterMonitor.Models;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public sealed class SsConfigService
{
@@ -2,11 +2,11 @@ using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MonsterMonitor.Models;
using Renci.SshNet;
using Renci.SshNet.Common;
using SshTunnelMonitor.Models;
namespace SshTunnelMonitor.Services
namespace MonsterMonitor.Services
{
public sealed class SshTunnelService : IDisposable
{
@@ -1,10 +1,10 @@
using SshTunnelMonitor.Models;
using SshTunnelMonitor.Services;
using System;
using System.Drawing;
using System.Windows.Forms;
using MonsterMonitor.Models;
using MonsterMonitor.Services;
namespace SshTunnelMonitor.UI
namespace MonsterMonitor.UI
{
public sealed class MainForm : Form
{
@@ -21,7 +21,7 @@ namespace SshTunnelMonitor.UI
public MainForm()
{
Text = "Monster Monitor";
Text = string.Format("Monster Monitor v{0}", Application.ProductVersion);
Width = 980;
Height = 620;
StartPosition = FormStartPosition.CenterScreen;
@@ -1,10 +1,9 @@
using System;
using System.Drawing;
using System.Security.Cryptography;
using System.Windows.Forms;
using SshTunnelMonitor.Models;
using MonsterMonitor.Models;
namespace SshTunnelMonitor.UI
namespace MonsterMonitor.UI
{
public sealed class SettingsForm : Form
{

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

-31
View File
@@ -1,31 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MonsterMonitor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MonsterMonitor")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0fb13d01-79ef-4d33-82ee-20f411e173fa")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyInformationalVersion("1.0.2")]
+41 -28
View File
@@ -9,39 +9,52 @@ set informationalversion=%1
if [%2] NEQ [] SET fileversion=%2
if [%3] NEQ [] SET informationalversion=%3
echo Setting assembly version information
echo Setting version in *.csproj files
set "script=%TEMP%\setversion-csproj.ps1"
(
echo param^(
echo [string]$Version,
echo [string]$FileVersion,
echo [string]$InformationalVersion
echo ^)
echo $ErrorActionPreference = "Stop"
echo $projects = Get-ChildItem -Path ^(Get-Location^) -Filter *.csproj -Recurse
echo foreach ^($project in $projects^) ^{
echo Write-Host "^> $($project.FullName)"
echo [xml]$xml = Get-Content -Path $project.FullName
echo $propertyGroup = $xml.Project.PropertyGroup ^| Select-Object -First 1
echo if ^(-not $propertyGroup^) ^{
echo $propertyGroup = $xml.CreateElement^("PropertyGroup"^)
echo [void]$xml.Project.AppendChild^($propertyGroup^)
echo ^}
echo function Set-Or-CreateTag ^([xml]$doc, [System.Xml.XmlElement]$group, [string]$tagName, [string]$value^) ^{
echo $node = $group.SelectSingleNode^($tagName^)
echo if ^($node^) ^{
echo $node.InnerText = $value
echo ^} else ^{
echo $newNode = $doc.CreateElement^($tagName^)
echo $newNode.InnerText = $value
echo [void]$group.AppendChild^($newNode^)
echo ^}
echo ^}
echo Set-Or-CreateTag $xml $propertyGroup "Version" $Version
echo Set-Or-CreateTag $xml $propertyGroup "AssemblyVersion" $Version
echo Set-Or-CreateTag $xml $propertyGroup "FileVersion" $FileVersion
echo Set-Or-CreateTag $xml $propertyGroup "InformationalVersion" $InformationalVersion
echo $xml.Save^($project.FullName^)
echo ^}
) > "%script%"
for /F "delims=" %%f in ('dir /s /b Assemblyinfo.cs') do (
echo ^> %%f
pushd %%~dpf
for /F "usebackq delims=" %%g in ("AssemblyInfo.cs") do (
set ln=%%g
set skip=0
if "!ln:AssemblyVersion=!" NEQ "!ln!" set skip=1
if "!ln:AssemblyFileVersion=!" NEQ "!ln!" set skip=1
if "!ln:AssemblyInformationalVersion=!" NEQ "!ln!" set skip=1
if !skip!==0 echo !ln! >> AssemblyInfo.cs.versioned
)
echo [assembly: AssemblyVersion^("%version%"^)] >> AssemblyInfo.cs.versioned
echo [assembly: AssemblyFileVersion^("%fileversion%"^)] >> AssemblyInfo.cs.versioned
echo [assembly: AssemblyInformationalVersion^("%informationalversion%"^)] >> AssemblyInfo.cs.versioned
copy /y AssemblyInfo.cs AssemblyInfo.cs.orig
move /y AssemblyInfo.cs.versioned AssemblyInfo.cs
popd
)
echo Done^^!
powershell -NoProfile -ExecutionPolicy Bypass -File "%script%" "%version%" "%fileversion%" "%informationalversion%"
set exit_code=%ERRORLEVEL%
del /q "%script%" >nul 2>&1
if not %exit_code%==0 exit /b %exit_code%
echo Done!
GOTO:EOF
:USAGE
echo Usage:
echo.
echo SetVersion.bat Version [FileVersion] [InformationalVersion]
echo SetVersion.cmd Version [FileVersion] [InformationalVersion]
echo.