Skip to content

Commit 881dd82

Browse files
committed
bug fixed
1 parent d164118 commit 881dd82

5 files changed

+15
-19
lines changed

Config.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace SshTool
1+
namespace SshTool
82
{
93
class Config
104
{

MainWindow.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<Label Content="ssh端口" HorizontalAlignment="Left" Margin="148,270,0,0" VerticalAlignment="Top" Height="40" Width="200" FontSize="20" RenderTransformOrigin="0.531,0.333" FontWeight="Bold" Grid.Column="1"/>
3232
<TextBox x:Name="ssh_user" HorizontalAlignment="Left" Height="40" Margin="348,210,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="700" RenderTransformOrigin="0.45,0.778" FontSize="18" FontWeight="Bold" ToolTip="如:root" Grid.Column="1"/>
3333
<Label Content="ssh用户名" HorizontalAlignment="Left" Margin="148,210,0,0" VerticalAlignment="Top" Height="40" Width="200" FontSize="20" RenderTransformOrigin="0.531,0.333" FontWeight="Bold" Grid.Column="1"/>
34-
<TextBox x:Name="info" HorizontalAlignment="Left" Height="250" Margin="298,510,0,0" TextWrapping="Wrap" Text="版本:V1.0.2。&#xA;关注作者,持续更新。&#xA;&#xA;输出信息:" VerticalAlignment="Top" Width="750" RenderTransformOrigin="0.45,0.778" FontSize="16" Background="#FFA9E8FF" FontWeight="Bold" AcceptsReturn="True" ToolTip="显示输出信息,也可以作为记事本,可随意更改" Grid.Column="1"/>
34+
<TextBox x:Name="info" HorizontalAlignment="Left" Height="250" Margin="298,510,0,0" TextWrapping="Wrap" Text="版本:V1.0.2。关注作者,持续更新。&#xD;&#xA;注:鼠标悬停在控件上方可显示更多信息。&#xA;输出信息:" VerticalAlignment="Top" Width="750" RenderTransformOrigin="0.45,0.778" FontSize="16" Background="#FFA9E8FF" FontWeight="Bold" AcceptsReturn="True" ToolTip="显示输出信息,也可以作为记事本,可随意更改" Grid.Column="1"/>
3535
<Label Content="输出信息" HorizontalAlignment="Left" Margin="148,510,0,0" VerticalAlignment="Top" Height="40" Width="144" RenderTransformOrigin="0.446,2.115" FontSize="20" FontWeight="Bold" Grid.Column="1"/>
3636
<Button x:Name="disconnect" Content="断开" HorizontalAlignment="Left" Margin="498,765,0,35" VerticalAlignment="Center" Width="200" Height="70" Click="Disconnect_Click" FontSize="18" Background="#FFEC967D" FontWeight="Bold" RenderTransformOrigin="0.364,1.209" IsEnabled="False" Grid.Column="1"/>
3737
<Button x:Name="exit" Content="退出" HorizontalAlignment="Left" Margin="848,766,0,34" VerticalAlignment="Center" Width="200" Height="70" Click="Exit_Click" FontSize="18" Background="#FFC3AEAE" ClipToBounds="True" FontWeight="Bold" Grid.Column="1"/>

MainWindow.xaml.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ public void ReadConfig()
2828
{
2929
byte[] bytes = File.ReadAllBytes("config");
3030
string[] info = System.Text.Encoding.Default.GetString(bytes).Split('\n');
31-
Console.WriteLine(info.Length);
31+
// Console.WriteLine(info.Length);
3232
if (info.Length > 1)
3333
{
3434
// MsgAppend("已读取配置");
35+
Console.WriteLine(info[0]);
3536
last_selected = int.Parse(info[0]);
3637
configs = new Config[info.Length - 1];
3738
for(int i = 1; i < info.Length; i++)
3839
{
3940
// Console.WriteLine("ID: " + i + " MSG:" + info[i]);
4041
string[] items = info[i].Split('\t');
41-
Console.WriteLine(info[i]);
42+
// Console.WriteLine(info[i]);
4243
if (items.Length == 7)
4344
{
4445
configs[i-1] = new Config(i-1, items[0], items[1], items[2], items[3], items[4], items[5], items[6]);
@@ -270,18 +271,14 @@ private void Create_Click(object sender, RoutedEventArgs e)
270271

271272
void NewConfigFromInput()
272273
{
273-
if (null == config_label.Text || config_label.Text.Equals(""))
274-
{
275-
config_label.Text = "undefined";
276-
}
277274
var host = ssh_host.Text.Trim();
278275
var label = config_label.Text.Trim();
279276
var ssh_u = ssh_user.Text.Trim();
280277
var ssh_p = ssh_port.Text.Trim();
281278
var pwd = ssh_password.Text.Trim();
282279
var app_p = app_port.Text.Trim();
283280
var local_p = local_port.Text.Trim();
284-
if (IsEmpty(host) || IsEmpty(label) || IsEmpty(ssh_p) || IsEmpty(pwd) || IsEmpty(app_p) || IsEmpty(local_p))
281+
if (IsEmpty(host) || IsEmpty(label) || IsEmpty(label) || IsEmpty(ssh_u) || IsEmpty(pwd) || IsEmpty(app_p) || IsEmpty(local_p))
285282
{
286283
MessageBox.Show("所有参数均为必填项");
287284
return;

SshTool.csproj

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<OutputType>WinExe</OutputType>
99
<RootNamespace>SshTool</RootNamespace>
1010
<AssemblyName>SshTool</AssemblyName>
11-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1414
<WarningLevel>4</WarningLevel>
@@ -31,10 +31,12 @@
3131
<DebugType>pdbonly</DebugType>
3232
<Optimize>true</Optimize>
3333
<OutputPath>bin\Release\</OutputPath>
34-
<DefineConstants>TRACE</DefineConstants>
34+
<DefineConstants>DEBUG;TRACE</DefineConstants>
3535
<ErrorReport>prompt</ErrorReport>
36-
<WarningLevel>4</WarningLevel>
36+
<WarningLevel>3</WarningLevel>
3737
<Prefer32Bit>false</Prefer32Bit>
38+
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
39+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3840
</PropertyGroup>
3941
<PropertyGroup>
4042
<ApplicationIcon>ic.ico</ApplicationIcon>
@@ -45,6 +47,9 @@
4547
<PropertyGroup>
4648
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
4749
</PropertyGroup>
50+
<PropertyGroup>
51+
<NoWin32Manifest>true</NoWin32Manifest>
52+
</PropertyGroup>
4853
<ItemGroup>
4954
<Reference Include="PresentationFramework.Aero2" />
5055
<Reference Include="Renci.SshNet, Version=2020.0.2.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">

app.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
3+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>

0 commit comments

Comments
 (0)