msgList, string str, int index, string flag, Color color, Color back)
77 | {
78 | Message msg = null;
79 | if (index > 0)
80 | {
81 | string str1 = str.Substring(0, index);
82 | msg = new Message();
83 | msg.Text = str1;
84 | msgList.Add(msg);
85 | }
86 |
87 | string str2 = str.Substring(index + flag.Length);
88 | msg = new Message();
89 | msg.Text = str2;
90 | msg.Color = color;
91 | if (back != Color.Empty)
92 | {
93 | msg.BackColor = back;
94 | }
95 | msgList.Add(msg);
96 | }
97 | }
98 |
99 | public class Message {
100 | public string Text { get; set; }
101 |
102 | private Color _color = Color.CadetBlue;
103 | public Color Color {
104 | get
105 | {
106 | return _color;
107 | }
108 | set
109 | {
110 | _color = value;
111 | }
112 | }
113 |
114 | private Color _backColor = Color.FromArgb(255, 20, 20, 20);
115 | public Color BackColor
116 | {
117 | get
118 | {
119 | return _backColor;
120 | }
121 | set
122 | {
123 | _backColor = value;
124 | }
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/AppMonitor/obj/Debug/AppMonitor.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\Tamir.SharpSSH.dll
2 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\DiffieHellman.dll
3 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\Org.Mentalis.Security.dll
4 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\Tamir.SharpSSH.pdb
5 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.csprojResolveAssemblyReference.cache
6 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Form1.resources
7 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Properties.Resources.resources
8 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.csproj.GenerateResource.Cache
9 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.MainForm.resources
10 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\TabStrip.dll
11 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.SshSettingForm.resources
12 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\YSTools.dll
13 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\Newtonsoft.Json.dll
14 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.MonitorForm.resources
15 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\log4net.dll
16 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\CSkin.dll
17 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.FullScreenMonitorForm.resources
18 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.MonitorItemForm.resources
19 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.CustomScriptForm.resources
20 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.QuickCommandManageForm.resources
21 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.SpringBootMonitorForm.resources
22 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.MonitorBaseForm.resources
23 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.NginxMonitorForm.resources
24 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.TomcatMonitorForm.resources
25 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.SessionManageForm.resources
26 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\FastColoredTextBox.dll
27 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.TextEditorForm.resources
28 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.CustomShellForm.resources
29 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.TimedTaskForm.resources
30 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.ShellHelpForm.resources
31 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.InputSshPwdForm.resources
32 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.NginxMappingItemForm.resources
33 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.ConditionTaskForm.resources
34 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.LockForm.resources
35 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.SettingForm.resources
36 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.SftpForm.resources
37 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.sftpWinForm.resources
38 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.SftpLinuxForm.resources
39 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.InputForm.resources
40 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.FileAttrForm.resources
41 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\AppMonitor.exe.config
42 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\AppMonitor.exe
43 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\AppMonitor.pdb
44 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.exe
45 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.pdb
46 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.TextFindForm.resources
47 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.IceMonitorForm.resources
48 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\System.Runtime.InteropServices.APIs.dll
49 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\bin\Debug\System.Windows.Forms.TreeListView.dll
50 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Froms.AboutForm.resources
51 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.CentralServerConfigForm.resources
52 | G:\SoftResource\CSharp\SharpSSH-1.1.1.13.src\AppMonitor\obj\Debug\AppMonitor.Plugin.YmlNodeForm.resources
53 |
--------------------------------------------------------------------------------
/AppMonitor/Program.cs:
--------------------------------------------------------------------------------
1 | using AppMonitor.Bex;
2 | using AppMonitor.Froms;
3 | using AppMonitor.Nodel;
4 | using AppMonitor.Plugin;
5 | using log4net;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Diagnostics;
9 | using System.Runtime.InteropServices;
10 | using System.Text;
11 | using System.Windows.Forms;
12 | using Tamir.SharpSsh.java.lang;
13 |
14 | [assembly: log4net.Config.XmlConfigurator(Watch = true)]
15 | namespace AppMonitor
16 | {
17 | public static class Program
18 | {
19 | static ILog logger = LogManager.GetLogger("LogFileAppender");
20 | public static MainForm MAIN = null;
21 | public static SshUser initUser = null;
22 |
23 | /*
24 | [DllImport("Kernel32.dll")]
25 | private static extern bool AllocConsole();
26 | [DllImport("kernel32.dll", EntryPoint = "FreeConsole")]
27 | private static extern bool FreeConsole();
28 | [DllImport("user32.dll", EntryPoint = "FindWindow")]
29 | extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
30 | [DllImport("user32.dll", EntryPoint = "GetSystemMenu")]
31 | extern static IntPtr GetSystemMenu(IntPtr hWnd, IntPtr bRevert);
32 | [DllImport("user32.dll", EntryPoint = "RemoveMenu")]
33 | extern static IntPtr RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags);
34 | [DllImport("Kernel32.dll")]
35 | public static extern bool SetConsoleTitle(string strMessage);
36 |
37 | public static IntPtr windowHandle;
38 | */
39 | ///
40 | /// 应用程序的主入口点。
41 | ///
42 | [STAThread]
43 | static void Main(string[] args)
44 | {
45 | if (null != args && args.Length > 3)
46 | {
47 | initUser = new SshUser();
48 | initUser.Host = args[0];
49 | initUser.UserName = args[1];
50 | initUser.Password = args[2];
51 | initUser.Port = Convert.ToInt32(args[3]);
52 | }
53 | /*AllocConsole();
54 | windowHandle = FindWindow(null, Process.GetCurrentProcess().MainModule.FileName);
55 |
56 | IntPtr closeMenu = GetSystemMenu(windowHandle, IntPtr.Zero);
57 | uint SC_CLOSE = 0xF060;
58 | RemoveMenu(closeMenu, SC_CLOSE, 0x0);
59 | SetConsoleTitle("调试信息");*/
60 |
61 | try
62 | {
63 | //处理未捕获的异常
64 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
65 | //处理UI线程异常
66 | Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
67 | //处理非UI线程异常
68 | AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
69 |
70 |
71 | Application.EnableVisualStyles();
72 | Application.SetCompatibleTextRenderingDefault(false);
73 |
74 | MAIN = new MainForm();
75 | Application.Run(MAIN);
76 |
77 | //Application.Run(new SftpForm(initUser));
78 | }
79 | catch (Exception ex)
80 | {
81 | string str = GetExceptionMsg(ex, string.Empty);
82 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
83 | }
84 |
85 | //FreeConsole();
86 | }
87 |
88 | static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
89 | {
90 | string str = GetExceptionMsg(e.Exception, e.ToString());
91 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
92 | logger.Error(str);
93 | }
94 |
95 | static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
96 | {
97 | string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
98 | MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
99 | logger.Error(str);
100 | }
101 |
102 | ///
103 | /// 生成自定义异常消息
104 | ///
105 | /// 异常对象
106 | /// 备用异常消息:当ex为null时有效
107 | /// 异常字符串文本
108 | static string GetExceptionMsg(Exception ex, string backStr)
109 | {
110 | StringBuilder sb = new StringBuilder();
111 | sb.AppendLine("****************************异常文本****************************");
112 | sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
113 | if (ex != null)
114 | {
115 | sb.AppendLine("【异常类型】:" + ex.GetType().Name);
116 | sb.AppendLine("【异常信息】:" + ex.Message);
117 | sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
118 | }
119 | else
120 | {
121 | sb.AppendLine("【未处理异常】:" + backStr);
122 | }
123 | sb.AppendLine("***************************************************************");
124 | return sb.ToString();
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/AppMonitor/bin/Release/help/ssh.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Linux
6 |
7 |
21 |
22 |
23 | 显示当前目录路径
24 | [root@localhost ~]$ pwd
25 |
26 |
27 | 更改服务器目录到“路径”:
28 | [root@localhost ~]$ cd [path]
29 |
30 |
31 | 在服务器路径下创建“目录”:
32 | [root@localhost ~]$ mkdir [path]
33 |
34 |
35 | 删除服务器文件或目录:
36 | [root@localhost ~]$ rm [path]
37 | [root@localhost ~]$ rm -rf [path]
38 | [root@localhost ~]$ rm --help
39 |
40 |
41 | 重命名或移动文件/目录:
42 | [root@localhost ~]$ mv [path] [new path]
43 | [root@localhost ~]$ mv [name] [new name]
44 |
45 |
46 | 端口占用查询:
47 | [root@localhost ~]$ netstat –apn | grep [port]
48 | [root@localhost ~]$ lsof -i:[port]
49 |
50 |
51 | 新增用户:
52 | [root@localhost ~]$ useradd [acc]
53 | [root@localhost ~]$ passwd [acc]
54 |
55 |
56 | 安装zip 、unzip 命令组件
57 | [root@localhost ~]$ yum install -y unzip zip
58 |
59 |
60 | 把文件授权给当前用户
61 | [root@localhost ~]$ chmod +x [file]
62 |
63 |
64 | 文件权限转移
65 | [root@localhost ~]$ chown [username]:[username] [file]
66 | [root@localhost ~]$ chown -R [username]:[username] [file]
67 |
68 |
69 | 关闭Conter Os系统防火墙
70 | [root@localhost ~]$ systemctl stop firewalld.service
71 |
72 |
73 | 快速开放端口(重启后失效):
74 | [root@localhost ~]$ iptables -I INPUT -p tcp --dport [port] -j ACCEPT
75 |
76 |
77 |
78 | 解压:
79 | //解压 tar包
80 | [root@localhost ~]$ tar –xvf [*.tar]
81 | //解压tar.gz
82 | [root@localhost ~]$ tar -xzvf [*.tar.gz]
83 | //解压 tar.bz2
84 | [root@localhost ~]$ tar -xjvf [*.tar.bz2]
85 | //解压tar.Z
86 | [root@localhost ~]$ tar –xZvf [*.tar.Z]
87 | //解压rar
88 | [root@localhost ~]$ unrar e [*.rar]
89 | //解压zip
90 | [root@localhost ~]$ unzip [*.zip]
91 |
92 |
93 | 1、*.tar 用tar –xvf 解压
94 | 2、*.gz 用gzip -d或者gunzip 解压
95 | 3、*.tar.gz和*.tgz 用tar –xzf 解压
96 | 4、*.bz2 用bzip2 -d或者用bunzip2 解压
97 | 5、*.tar.bz2 用tar –xjf 解压
98 | 6、*.Z 用uncompress 解压
99 | 7、*.tar.Z 用tar –xZf 解压
100 | 8、*.rar 用unrar e 解压
101 | 9、*.zip 用unzip 解压
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/AppMonitor/Froms/SshSettingForm.cs:
--------------------------------------------------------------------------------
1 | using AppMonitor.Bex;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using YSTools;
10 |
11 | namespace AppMonitor.Froms
12 | {
13 | public partial class SshSettingForm : CCWin.Skin_Metro
14 | {
15 | private static SessionConfig config = null;
16 |
17 | public SshSettingForm(SessionConfig _config = null)
18 | {
19 | config = _config;
20 | InitializeComponent();
21 | }
22 |
23 | private void SshSettingForm_Load(object sender, EventArgs e)
24 | {
25 | SkinUtil.SetFormSkin(this);
26 |
27 | cb_protocol.SelectedIndex = 0;
28 | cb_method.SelectedIndex = 0;
29 | cb_scheme.SelectedIndex = 0;
30 | cb_fontName.SelectedIndex = 0;
31 | cb_fontSize.SelectedIndex = 2;
32 |
33 | if (null != config)
34 | {
35 | InitUI();
36 | }
37 |
38 | treeView1.ExpandAll();
39 | }
40 |
41 | public SessionConfig getSessionConfig()
42 | {
43 | return config;
44 | }
45 |
46 | public void InitUI()
47 | {
48 | tb_host.Text = config.Host;
49 | tb_name.Text = config.Name;
50 | tb_password.Text = YSEncrypt.DecryptB(config.Password, KeysUtil.PassKey);
51 | tb_userName.Text = config.UserName;
52 |
53 | cb_protocol.SelectedItem = config.Protocol;
54 | cb_method.SelectedItem = config.Method;
55 | cb_scheme.SelectedItem = config.Theme.ColorScheme;
56 | cb_fontName.SelectedItem = config.Theme.FontName;
57 | cb_fontSize.SelectedItem = config.Theme.FontSize;
58 | cb_remenber_pwd.Checked = config.RemenberPwd;
59 |
60 | }
61 |
62 | private void btn_Cancel_Click(object sender, EventArgs e)
63 | {
64 | this.Close();
65 | }
66 |
67 | private void btn_Ok_Click(object sender, EventArgs e)
68 | {
69 | // 保存
70 | if (config == null)
71 | {
72 | config = new SessionConfig();
73 | config.Index = AppConfig.Instance.SessionConfigDict.Count + 1;
74 | config.SessionId = "S" + YSTools.YSDateTime.ConvertDateTimeToLong();
75 | config.Name = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
76 | config.Host = tb_host.Text;
77 | config.Port = (int) nud_port.Value;
78 | config.Protocol = cb_protocol.SelectedItem.ToString();
79 | config.Method = cb_method.SelectedItem.ToString();
80 | config.RemenberPwd = cb_remenber_pwd.Checked;
81 | config.UserName = tb_userName.Text;
82 | config.Password = YSEncrypt.EncryptA(tb_password.Text, KeysUtil.PassKey);
83 |
84 | ColorTheme theme = new ColorTheme();
85 | theme.ColorScheme = cb_scheme.SelectedItem.ToString();
86 | theme.FontName = cb_fontName.SelectedItem.ToString();
87 | theme.FontSize = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());
88 |
89 | config.Theme = theme;
90 |
91 | AppConfig.Instance.SessionConfigDict.Add(config.Index + config.Name, config);
92 | }
93 | else
94 | {
95 | config.Name = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
96 | config.Host = tb_host.Text;
97 | config.Port = (int)nud_port.Value;
98 | config.Protocol = cb_protocol.SelectedItem.ToString();
99 | config.Method = cb_method.SelectedItem.ToString();
100 | config.RemenberPwd = cb_remenber_pwd.Checked;
101 | config.UserName = tb_userName.Text;
102 | config.Password = YSEncrypt.EncryptA(tb_password.Text, KeysUtil.PassKey);
103 |
104 | config.Theme.ColorScheme = cb_scheme.SelectedItem.ToString();
105 | config.Theme.FontName = cb_fontName.SelectedItem.ToString();
106 | config.Theme.FontSize = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());
107 |
108 | if (AppConfig.Instance.SessionConfigDict.ContainsKey(config.SessionId))
109 | {
110 | AppConfig.Instance.SessionConfigDict.Remove(config.SessionId);
111 | }
112 | AppConfig.Instance.SessionConfigDict.Add(config.SessionId, config);
113 | }
114 | // 保存
115 | AppConfig.Instance.SaveConfig();
116 |
117 | this.Close();
118 | }
119 |
120 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
121 | {
122 | string name = treeView1.SelectedNode.Name;
123 | if (name == "Connection")
124 | {
125 | tabControl1.SelectedIndex = 0;
126 | }
127 | else if (name == "Authentication")
128 | {
129 | tabControl1.SelectedIndex = 1;
130 | }
131 | else if (name == "Setting")
132 | {
133 | tabControl1.SelectedIndex = 2;
134 | }
135 | else if (name == "Appearance")
136 | {
137 | tabControl1.SelectedIndex = 3;
138 | }
139 | }
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/AppMonitor/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/AppMonitor/Froms/MonitorBaseForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/AppMonitor/Bex/Utils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace AppMonitor.Bex
8 | {
9 | public class Utils
10 | {
11 |
12 | public static MonitorItemConfig getMonitorItemConfig(List monitorConfigList, string uuid)
13 | {
14 | MonitorItemConfig itemConfig = null;
15 | foreach (var item in monitorConfigList)
16 | {
17 | if (null != item.spring && item.spring.Uuid == uuid)
18 | {
19 | itemConfig = item;
20 | break;
21 | }
22 | else if (null != item.tomcat && item.tomcat.Uuid == uuid)
23 | {
24 | itemConfig = item;
25 | break;
26 | }
27 | else if (null != item.nginx && item.nginx.Uuid == uuid)
28 | {
29 | itemConfig = item;
30 | break;
31 | }
32 | else if (null != item.ice && item.ice.Uuid == uuid)
33 | {
34 | itemConfig = item;
35 | break;
36 | }
37 | }
38 | return itemConfig;
39 | }
40 |
41 | public static int getMonitorItemIndex(MonitorItemConfig itemConfig)
42 | {
43 | int index = -1;
44 | if (itemConfig.nginx != null)
45 | {
46 | index = itemConfig.nginx.Index;
47 | }
48 | else if (itemConfig.spring != null)
49 | {
50 | index = itemConfig.spring.Index;
51 | }
52 | else if (itemConfig.tomcat != null)
53 | {
54 | index = itemConfig.tomcat.Index;
55 | }
56 | else if (itemConfig.ice != null)
57 | {
58 | index = itemConfig.ice.Index;
59 | }
60 | return index;
61 | }
62 |
63 | public static string getFileSize(long size)
64 | {
65 | if (size < 1024)
66 | {
67 | return size + "Bytes";
68 | }
69 | else if (size < 1024 * 1024)
70 | {
71 | return (size / 1024) + "KB";
72 | }
73 | else if (size < 1024 * 1024 * 1024)
74 | {
75 | return (size / (1024 * 1024)) + "MB";
76 | }
77 | else if ((size / 1024) < 1024 * 1024 * 1024)
78 | {
79 | return (size / (1024 * 1024 * 1024)) + "GB";
80 | }
81 | else if ((size / (1024 * 1024)) < 1024 * 1024 * 1024)
82 | {
83 | return ((size / (1024 * 1024) / 1024)) + "TB";
84 | }
85 | else
86 | {
87 | return "";
88 | }
89 | }
90 |
91 | public static string CalculaSpeed(long startByte, long endByte, long max, int start, int end)
92 | {
93 | float time = (end - start)/1000.0f;
94 | return getFileSize((long)((endByte - startByte) / time)) + "/S";
95 | }
96 |
97 | public static string CalculaTimeLeft(long startByte, long endByte, long max, int start, int end)
98 | {
99 | int time = (end - start);
100 | long millis = ((time * (max - endByte)) / (endByte - startByte)) / 1000;
101 | long s = millis % 60;
102 | long m = millis / 60;
103 | long h = m / 60;
104 | m = m % 60;
105 | string timeLeft = (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
106 | return timeLeft;
107 | }
108 |
109 | public static string getLinuxName(string name)
110 | {
111 | if(name.Contains(" ")){
112 | return "\"" + name + "\"";
113 | }
114 | return name;
115 | }
116 |
117 | public static bool isLinuxRootPath(string pathname)
118 | {
119 | return (pathname == "." || pathname == "..");
120 | }
121 |
122 | public static string getLinuxPathDir(string remotePath)
123 | {
124 | string dir = "/";
125 | int index = remotePath.LastIndexOf("/");
126 | if (index > 0)
127 | {
128 | dir = remotePath.Substring(0, index);
129 | }
130 | return dir;
131 | }
132 |
133 | ///
134 | /// 判断目标是文件夹还是目录(目录包括磁盘)
135 | ///
136 | /// 文件名
137 | ///
138 | public static bool IsDir(string filepath)
139 | {
140 | FileInfo fi = new FileInfo(filepath);
141 | if ((fi.Attributes & FileAttributes.Directory) != 0)
142 | return true;
143 | else
144 | {
145 | return false;
146 | }
147 | }
148 |
149 | public static void CopyDir(string fromDir, string toDir)
150 | {
151 | if (!Directory.Exists(fromDir))
152 | return;
153 |
154 | if (!Directory.Exists(toDir))
155 | {
156 | Directory.CreateDirectory(toDir);
157 | }
158 |
159 | string[] files = Directory.GetFiles(fromDir);
160 | foreach (string formFileName in files)
161 | {
162 | string fileName = Path.GetFileName(formFileName);
163 | string toFileName = Path.Combine(toDir, fileName);
164 | File.Copy(formFileName, toFileName);
165 | }
166 | string[] fromDirs = Directory.GetDirectories(fromDir);
167 | foreach (string fromDirName in fromDirs)
168 | {
169 | string dirName = Path.GetFileName(fromDirName);
170 | string toDirName = Path.Combine(toDir, dirName);
171 | CopyDir(fromDirName, toDirName);
172 | }
173 | }
174 |
175 | public static void createParentDir(DirectoryInfo dire)
176 | {
177 | if(!dire.Exists){
178 | if(dire.Parent.Exists){
179 | dire.Create();
180 | }
181 | else
182 | {
183 | createParentDir(dire.Parent);
184 | }
185 | }
186 | }
187 |
188 | public static string PathEndAddSlash(string path)
189 | {
190 | if(!path.EndsWith("/")){
191 | path += "/";
192 | }
193 | return path;
194 | }
195 |
196 | public static string PathWinToLinux(string path)
197 | {
198 | return path.Replace("\\", "/");
199 | }
200 |
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/AppMonitor/Froms/InputForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace AppMonitor.Froms
2 | {
3 | partial class InputForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputForm));
32 | this.input = new CCWin.SkinControl.SkinTextBox();
33 | this.btn_sure = new System.Windows.Forms.Button();
34 | this.btn_cancel = new System.Windows.Forms.Button();
35 | this.info = new System.Windows.Forms.Label();
36 | this.SuspendLayout();
37 | //
38 | // input
39 | //
40 | this.input.BackColor = System.Drawing.Color.Transparent;
41 | this.input.DownBack = null;
42 | this.input.Icon = null;
43 | this.input.IconIsButton = false;
44 | this.input.IconMouseState = CCWin.SkinClass.ControlState.Normal;
45 | this.input.IsPasswordChat = '\0';
46 | this.input.IsSystemPasswordChar = false;
47 | this.input.Lines = new string[0];
48 | this.input.Location = new System.Drawing.Point(18, 97);
49 | this.input.Margin = new System.Windows.Forms.Padding(0);
50 | this.input.MaxLength = 32767;
51 | this.input.MinimumSize = new System.Drawing.Size(28, 28);
52 | this.input.MouseBack = null;
53 | this.input.MouseState = CCWin.SkinClass.ControlState.Normal;
54 | this.input.Multiline = false;
55 | this.input.Name = "input";
56 | this.input.NormlBack = null;
57 | this.input.Padding = new System.Windows.Forms.Padding(5);
58 | this.input.ReadOnly = false;
59 | this.input.ScrollBars = System.Windows.Forms.ScrollBars.None;
60 | this.input.Size = new System.Drawing.Size(415, 28);
61 | //
62 | //
63 | //
64 | this.input.SkinTxt.BorderStyle = System.Windows.Forms.BorderStyle.None;
65 | this.input.SkinTxt.Dock = System.Windows.Forms.DockStyle.Fill;
66 | this.input.SkinTxt.Font = new System.Drawing.Font("微软雅黑", 9.75F);
67 | this.input.SkinTxt.Location = new System.Drawing.Point(5, 5);
68 | this.input.SkinTxt.Name = "BaseText";
69 | this.input.SkinTxt.Size = new System.Drawing.Size(405, 18);
70 | this.input.SkinTxt.TabIndex = 0;
71 | this.input.SkinTxt.WaterColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127)))));
72 | this.input.SkinTxt.WaterText = "";
73 | this.input.TabIndex = 0;
74 | this.input.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
75 | this.input.WaterColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127)))));
76 | this.input.WaterText = "";
77 | this.input.WordWrap = true;
78 | //
79 | // btn_sure
80 | //
81 | this.btn_sure.Location = new System.Drawing.Point(373, 33);
82 | this.btn_sure.Name = "btn_sure";
83 | this.btn_sure.Size = new System.Drawing.Size(60, 25);
84 | this.btn_sure.TabIndex = 1;
85 | this.btn_sure.Text = "确定";
86 | this.btn_sure.UseVisualStyleBackColor = true;
87 | this.btn_sure.Click += new System.EventHandler(this.btn_sure_Click);
88 | //
89 | // btn_cancel
90 | //
91 | this.btn_cancel.Location = new System.Drawing.Point(373, 62);
92 | this.btn_cancel.Name = "btn_cancel";
93 | this.btn_cancel.Size = new System.Drawing.Size(60, 25);
94 | this.btn_cancel.TabIndex = 2;
95 | this.btn_cancel.Text = "取消";
96 | this.btn_cancel.UseVisualStyleBackColor = true;
97 | this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
98 | //
99 | // info
100 | //
101 | this.info.Location = new System.Drawing.Point(21, 37);
102 | this.info.Name = "info";
103 | this.info.Size = new System.Drawing.Size(328, 50);
104 | this.info.TabIndex = 3;
105 | //
106 | // InputForm
107 | //
108 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
109 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
110 | this.BackColor = System.Drawing.SystemColors.Control;
111 | this.BackgroundImage = global::AppMonitor.Properties.Resources.skin_12;
112 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
113 | this.CaptionFont = new System.Drawing.Font("微软雅黑", 9F);
114 | this.ClientSize = new System.Drawing.Size(451, 142);
115 | this.Controls.Add(this.info);
116 | this.Controls.Add(this.btn_cancel);
117 | this.Controls.Add(this.btn_sure);
118 | this.Controls.Add(this.input);
119 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
120 | this.MaximizeBox = false;
121 | this.MaximumSize = new System.Drawing.Size(451, 142);
122 | this.MinimizeBox = false;
123 | this.MinimumSize = new System.Drawing.Size(451, 142);
124 | this.Name = "InputForm";
125 | this.Text = "请输入";
126 | this.TitleCenter = false;
127 | this.TitleColor = System.Drawing.Color.White;
128 | this.Load += new System.EventHandler(this.InputForm_Load);
129 | this.ResumeLayout(false);
130 |
131 | }
132 |
133 | #endregion
134 |
135 | private CCWin.SkinControl.SkinTextBox input;
136 | private System.Windows.Forms.Button btn_sure;
137 | private System.Windows.Forms.Button btn_cancel;
138 | private System.Windows.Forms.Label info;
139 | }
140 | }
--------------------------------------------------------------------------------
/AppMonitor/Froms/TextFindForm.cs:
--------------------------------------------------------------------------------
1 | using AppMonitor.Bex;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Text.RegularExpressions;
10 | using System.Windows.Forms;
11 |
12 | namespace AppMonitor.Froms
13 | {
14 | public partial class TextFindForm : CCWin.Skin_Metro
15 | {
16 | public delegate string GetContentMethod();
17 | public delegate void FindCallback(string str, int index);
18 | public delegate void ReplaceCallback(string str, string res, bool isAll);
19 | private bool openReplace = false;
20 | private GetContentMethod getContent;
21 | private FindCallback findCall;
22 | private ReplaceCallback replaceCall;
23 | private string tempCont = null, tempStr = null;
24 | private Regex reg1 = null, reg2 = null;
25 | private Match match1 = null, match2 = null;
26 | private List findHisList = new List();
27 |
28 | public TextFindForm(GetContentMethod method, FindCallback findCall, bool openReplace = false)
29 | {
30 | InitializeComponent();
31 | SkinUtil.SetFormSkin(this);
32 | this.openReplace = openReplace;
33 | this.getContent = method;
34 | this.findCall = findCall;
35 | }
36 |
37 | public TextFindForm(GetContentMethod method, FindCallback findCall, ReplaceCallback replaceCall)
38 | : this(method, findCall, true)
39 | {
40 | this.replaceCall = replaceCall;
41 | }
42 |
43 | private void regex_CheckedChanged(object sender, EventArgs e)
44 | {
45 | if (cb_regex.Checked)
46 | {
47 | cb_case.Enabled = false;
48 | cb_case.Checked = false;
49 | cb_whole.Enabled = false;
50 | cb_whole.Checked = false;
51 | }
52 | else
53 | {
54 | cb_case.Enabled = true;
55 | cb_whole.Enabled = true;
56 | }
57 | }
58 |
59 | private void find_Click(object sender, EventArgs e)
60 | {
61 | FindStr();
62 | }
63 |
64 | private void btn_replace_find_Click(object sender, EventArgs e)
65 | {
66 | ReplaceStr();
67 |
68 | bool result = FindStr();
69 | }
70 |
71 | private void btn_replace_Click(object sender, EventArgs e)
72 | {
73 | ReplaceStr();
74 | }
75 |
76 | private void btn_replace_all_Click(object sender, EventArgs e)
77 | {
78 | string res = text_res.Text;
79 | if(res.Length > 0){
80 | ReplaceStr(res, true);
81 | }
82 | }
83 |
84 | private void btn_close_Click(object sender, EventArgs e)
85 | {
86 | this.Close();
87 | }
88 |
89 | private void TextFindForm_Load(object sender, EventArgs e)
90 | {
91 | if (!this.openReplace)
92 | {
93 | text_target.Enabled = false;
94 | btn_replace.Enabled = false;
95 | btn_replace_all.Enabled = false;
96 | btn_replace_find.Enabled = false;
97 | }
98 | }
99 |
100 | private void addFindHisItem(string str) {
101 | if (null != str && str.Length > 0 && !findHisList.Contains(str))
102 | {
103 | findHisList.Add(str);
104 |
105 | text_res.Items.Add(str);
106 | }
107 | }
108 |
109 | private void text_res_KeyUp(object sender, KeyEventArgs e)
110 | {
111 | if (e.KeyCode == Keys.Enter || cb_immed.Checked)
112 | {
113 | FindStr();
114 | }
115 | }
116 |
117 | public bool FindStr()
118 | {
119 | bool finds = false;
120 | string text = text_res.Text;
121 | info.Text = "";
122 | if (text != "")
123 | {
124 | string content = getContent();
125 | bool caseDx = cb_case.Checked;
126 | bool whole = cb_whole.Checked;
127 | bool regex = cb_regex.Checked;
128 |
129 | if (tempCont != content || text != tempStr)
130 | {
131 | string fmt = null;
132 | if (whole)
133 | {
134 | fmt = "[^\u4e00-\u9fa50-9a-zA-Z]+{0}[^\u4e00-\u9fa50-9a-zA-Z]+";
135 | }
136 |
137 | reg1 = new Regex(fmt == null ? text : string.Format(fmt, text));
138 | reg2 = null;
139 | if (caseDx)
140 | {
141 | if (text.ToUpper() != text.ToLower())
142 | {
143 | reg1 = new Regex(fmt == null ? text.ToUpper() : string.Format(fmt, text.ToUpper()));
144 | reg2 = new Regex(fmt == null ? text.ToLower() : string.Format(fmt, text.ToLower()));
145 | }
146 | }
147 |
148 | match1 = reg1.Match(content);
149 | match2 = null;
150 | if (reg2 != null)
151 | {
152 | match2 = reg2.Match(content);
153 | }
154 | }
155 | else
156 | {
157 | match1 = reg1.Match(content, match1.Index + match1.Length);
158 | if (reg2 != null)
159 | {
160 | match2 = reg2.Match(content, match2.Index + match2.Length);
161 | }
162 | }
163 |
164 |
165 | if (null != match1 && match1.Success) //当查找成功时候
166 | {
167 | tempCont = content;
168 | tempStr = text;
169 | addFindHisItem(text);
170 | finds = true;
171 |
172 | findCall(text, match1.Index);
173 | }
174 | else if (null != match2 && match2.Success) //当查找成功时候
175 | {
176 | tempCont = content;
177 | tempStr = text;
178 | addFindHisItem(text);
179 | finds = true;
180 |
181 | findCall(text, match2.Index);
182 | }
183 | else
184 | {
185 | info.Text = "没有找到结果";
186 | }
187 | }
188 | return finds;
189 | }
190 |
191 | public void ReplaceStr(string res = null, bool isAll = false)
192 | {
193 | string target = text_target.Text;
194 | replaceCall(target, res, isAll);
195 | }
196 |
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/AppMonitor/Plugin/sftpWinForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | 380, 17
125 |
126 |
127 | 253, 17
128 |
129 |
130 | 127, 17
131 |
132 |
--------------------------------------------------------------------------------
/AppMonitor/Froms/SpringBootMonitorForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | 107, 17
125 |
126 |
127 | 230, 19
128 |
129 |
130 | 353, 19
131 |
132 |
133 | 56
134 |
135 |
--------------------------------------------------------------------------------
/AppMonitor/Froms/TomcatMonitorForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 18, 12
122 |
123 |
124 | 108, 12
125 |
126 |
127 | 273, 12
128 |
129 |
130 | 409, 13
131 |
132 |
133 | 42
134 |
135 |
--------------------------------------------------------------------------------