Initial commit

v1.0
This commit is contained in:
2023-03-14 17:30:09 +09:00
parent fa3fe72e21
commit 59dac350d8
25 changed files with 2072 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
namespace HSUCO_Server_Monitoring
{
[Serializable]
public struct Config
{
public List<Information> NVR { get; set; }
public List<Information> CCTV { get; set; }
public int NVR_DelayTime { get; set; }
public int CCTV_DelayTime { get; set; }
public struct Information
{
public string Name { get; set; }
public string IpAddress { get; set; }
}
}
public enum MessageSender
{
NVR,
CCTV
}
public enum StatusResult
{
Success,
Fail,
Inspection
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E1F4C9BF-FE6C-4F46-843C-93B4C575703C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>HSUCO_CCTV_Monitoring</RootNamespace>
<AssemblyName>HSUCO_CCTV_Monitoring</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>HSUCO_Server_Monitoring.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Speech" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataModel.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Log.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="StatusChecker.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NVRStatus.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="NVRStatus.Designer.cs">
<DependentUpon>NVRStatus.cs</DependentUpon>
</Compile>
<Compile Include="Worker.cs" />
<Compile Include="XmlSystem.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="NVRStatus.resx">
<DependentUpon>NVRStatus.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NVR_Fail.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NVR_Inspection.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NVR_Success.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,174 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace HSUCO_Server_Monitoring
{
public static class Log
{
//로그파일 이름 규칙 어셈블리명-날짜.log
public static LogLevel logLevel { get; set; }
private static string logDateTime;
static Log()
{
SetLogFile(DateTime.Now.ToString("yyyy-MM-dd")); // Log파일 이름 세팅을 위한 함수 호출
}
/// <summary>
/// 로그 파일 리스너 세팅
/// </summary>
/// <param name="dateTimeString">로그파일 이름에 들어갈 DateTime String</param>
private static void SetLogFile(string dateTimeString)
{
logDateTime = dateTimeString;
if (!System.IO.Directory.Exists("logs"))
{
System.IO.Directory.CreateDirectory("logs");
}
var logFileName = $"logs/{logDateTime}.log";
Trace.Listeners.Clear();
Trace.Listeners.Add(new TextWriterTraceListener(new FileStream(logFileName, FileMode.Append, FileAccess.Write, FileShare.Read)));
Trace.Write("====================================================================================================// ");
Trace.Write(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Trace.WriteLine(" //====================================================================================================");
Trace.Flush();
}
//FATAL > ERROR > WARN > INFO > DEBUG > TRACE
public static void FATAL(string message)
{
if (LogLevel.FATAL >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.FATAL, location + "\t" + message);
}
}
public static void ERROR(string message)
{
if (LogLevel.Error >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Error, location + "\t" + message);
}
}
public static void WARN(string message)
{
if (LogLevel.Warn >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Warn, location + "\t" + message);
}
}
public static void INFO(string message)
{
if (LogLevel.Info >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Info, location + "\t" + message);
}
}
public static void DEBUG(string message)
{
if (LogLevel.Debug >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Debug, location + "\t" + message);
}
}
public static void TRACE(string message)
{
if (LogLevel.Trace >= logLevel)
{
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Debug, location + "\t" + message);
WriteLog(LogLevel.Trace, message);
}
}
/// <summary>
///
/// </summary>
/// <param name="logLevel">enum LogLevel</param>
/// <param name="message">로그 메세지</param>
public static void WriteLog(LogLevel logLevel, string message)
{
string nowDateTime = DateTime.Now.ToString("yyyy-MM-dd");
if (nowDateTime != logDateTime)
{
SetLogFile(nowDateTime);
}
// Log String
var stringBuilder = new StringBuilder();
stringBuilder.Append("[");
stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
stringBuilder.Append("]");
stringBuilder.Append("\t");
stringBuilder.Append(logLevel);
stringBuilder.Append("\t");
stringBuilder.Append(message.Trim());
Trace.WriteLine(stringBuilder.ToString());
Trace.Flush();
}
}
public enum LogLevel
{
Trace,
Debug,
Info,
Warn,
Error,
FATAL
}
}

163
HSUCO_CCTV_Monitoring/MainForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,163 @@
namespace HSUCO_Server_Monitoring
{
partial class MainForm
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanelMaster = new System.Windows.Forms.TableLayoutPanel();
this.label2 = new System.Windows.Forms.Label();
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.tableLayoutPanelMaster.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanelMaster
//
this.tableLayoutPanelMaster.BackColor = System.Drawing.Color.White;
this.tableLayoutPanelMaster.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
this.tableLayoutPanelMaster.ColumnCount = 2;
this.tableLayoutPanelMaster.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 500F));
this.tableLayoutPanelMaster.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelMaster.Controls.Add(this.label2, 1, 2);
this.tableLayoutPanelMaster.Controls.Add(this.flowLayoutPanel, 0, 0);
this.tableLayoutPanelMaster.Controls.Add(this.label1, 1, 0);
this.tableLayoutPanelMaster.Controls.Add(this.listBox1, 1, 1);
this.tableLayoutPanelMaster.Controls.Add(this.listBox2, 1, 3);
this.tableLayoutPanelMaster.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanelMaster.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanelMaster.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanelMaster.Name = "tableLayoutPanelMaster";
this.tableLayoutPanelMaster.RowCount = 2;
this.tableLayoutPanelMaster.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanelMaster.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanelMaster.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanelMaster.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanelMaster.Size = new System.Drawing.Size(804, 361);
this.tableLayoutPanelMaster.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Font = new System.Drawing.Font("마비옛체", 20F, System.Drawing.FontStyle.Bold);
this.label2.ForeColor = System.Drawing.Color.Red;
this.label2.Location = new System.Drawing.Point(502, 181);
this.label2.Margin = new System.Windows.Forms.Padding(0);
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.label2.Size = new System.Drawing.Size(1274, 30);
this.label2.TabIndex = 6;
this.label2.Text = "CCTV (연결끊김)";
//
// flowLayoutPanel
//
this.flowLayoutPanel.BackColor = System.Drawing.Color.Black;
this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel.Location = new System.Drawing.Point(1, 1);
this.flowLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel.Name = "flowLayoutPanel";
this.tableLayoutPanelMaster.SetRowSpan(this.flowLayoutPanel, 4);
this.flowLayoutPanel.Size = new System.Drawing.Size(500, 359);
this.flowLayoutPanel.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("마비옛체", 20F, System.Drawing.FontStyle.Bold);
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(502, 1);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.label1.Size = new System.Drawing.Size(1274, 30);
this.label1.TabIndex = 5;
this.label1.Text = "CCTV (점검필요)";
//
// listBox1
//
this.listBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBox1.Font = new System.Drawing.Font("마비옛체", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 18;
this.listBox1.Location = new System.Drawing.Point(502, 32);
this.listBox1.Margin = new System.Windows.Forms.Padding(0);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(1274, 148);
this.listBox1.TabIndex = 7;
//
// listBox2
//
this.listBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.listBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.listBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBox2.Font = new System.Drawing.Font("마비옛체", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.listBox2.FormattingEnabled = true;
this.listBox2.ItemHeight = 18;
this.listBox2.Location = new System.Drawing.Point(502, 212);
this.listBox2.Margin = new System.Windows.Forms.Padding(0);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(1274, 148);
this.listBox2.TabIndex = 8;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(804, 361);
this.Controls.Add(this.tableLayoutPanelMaster);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.Text = "서부권 통합관제센터 CCTV NVR 모니터링";
this.Load += new System.EventHandler(this.MainForm_Load);
this.tableLayoutPanelMaster.ResumeLayout(false);
this.tableLayoutPanelMaster.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelMaster;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ListBox listBox2;
}
}

View File

@@ -0,0 +1,126 @@
using HSUCO_CCTV_Monitoring;
using HSUCO_CCTV_Monitoring.Properties;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HSUCO_Server_Monitoring
{
public partial class MainForm : Form
{
private string configPath = "config.xml";
private Config config;
private List<NVRStatus> nvrStatuses = new List<NVRStatus>();
private readonly object locker = new object();
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
if (!System.IO.File.Exists(configPath))
{
MessageBox.Show("config 파일을 찾을수 없습니다");
Application.Exit();
return;
}
config = XmlSystem.LoadFromPath<Config>("config.xml");
InitializeNVR();
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
Size = Screen.PrimaryScreen.WorkingArea.Size;
tableLayoutPanelMaster.ColumnStyles[0].SizeType = SizeType.Absolute;
tableLayoutPanelMaster.ColumnStyles[0].Width = 1490;
tableLayoutPanelMaster.ColumnStyles[1].SizeType = SizeType.AutoSize;
Task.Run(() => NVR_Runner());
Task.Run(() => CCTV_Runner());
}
public void InitializeNVR()
{
for (int i = 0; i < config.NVR.Count; i++)
{
NVRStatus nvrStatus = new NVRStatus(config.NVR[i].Name, Resources.NVR_Success, Resources.NVR_Fail, Resources.NVR_Inspection);
nvrStatuses.Add(nvrStatus);
flowLayoutPanel.Controls.Add(nvrStatus);
}
}
private void NVR_Runner()
{
Worker worker = new Worker(config);
worker.UpdateMessage += UpdateMessage;
worker.Start_NVR();
}
private void CCTV_Runner()
{
Worker worker = new Worker(config);
worker.UpdateMessage += UpdateMessage;
worker.Start_CCTV();
}
private void UpdateMessage(MessageSender sender, int from, StatusResult result)
{
Invoke((Action)(() =>
{
switch (sender)
{
case MessageSender.NVR:
nvrStatuses[from].StatusUpdate(result, DateTime.Now);
if (result != StatusResult.Success)
{
Log.WriteLog(LogLevel.Trace, "NVR " + (result == StatusResult.Fail ? "Fail" : "Inspection") + " : " + config.NVR[from].Name + " / " + config.NVR[from].IpAddress);
}
break;
case MessageSender.CCTV:
if (result == StatusResult.Success)
{
listBox1.Items.Remove(config.CCTV[from].Name);
listBox2.Items.Remove(config.CCTV[from].Name);
}
else if (result == StatusResult.Inspection)
{
if (!listBox1.Items.Contains((config.CCTV[from].Name)))
{
listBox1.Items.Add(config.CCTV[from].Name);
}
listBox2.Items.Remove(config.CCTV[from].Name);
Log.WriteLog(LogLevel.Trace, "CCTV Inspection : " + config.CCTV[from].Name + " / " + config.CCTV[from].IpAddress);
}
else
{
listBox1.Items.Remove(config.CCTV[from].Name);
if (!listBox2.Items.Contains(config.CCTV[from].Name))
{
listBox2.Items.Add(config.CCTV[from].Name);
}
Log.WriteLog(LogLevel.Trace, "CCTV Fail : " + config.CCTV[from].Name + " / " + config.CCTV[from].IpAddress);
}
break;
default:
break;
}
}));
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,102 @@
namespace HSUCO_CCTV_Monitoring
{
partial class NVRStatus
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.label_ServerName = new System.Windows.Forms.Label();
this.label_LastUpdateTimeName = new System.Windows.Forms.Label();
this.label_LastUpdateTime = new System.Windows.Forms.Label();
this.pictureBox_Status = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_Status)).BeginInit();
this.SuspendLayout();
//
// label_ServerName
//
this.label_ServerName.AutoSize = true;
this.label_ServerName.Font = new System.Drawing.Font("마비옛체", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label_ServerName.Location = new System.Drawing.Point(90, 5);
this.label_ServerName.Name = "label_ServerName";
this.label_ServerName.Size = new System.Drawing.Size(107, 22);
this.label_ServerName.TabIndex = 1;
this.label_ServerName.Text = "주차장 이름";
//
// label_LastUpdateTimeName
//
this.label_LastUpdateTimeName.AutoSize = true;
this.label_LastUpdateTimeName.Font = new System.Drawing.Font("마비옛체", 13F);
this.label_LastUpdateTimeName.Location = new System.Drawing.Point(90, 35);
this.label_LastUpdateTimeName.Name = "label_LastUpdateTimeName";
this.label_LastUpdateTimeName.Size = new System.Drawing.Size(158, 20);
this.label_LastUpdateTimeName.TabIndex = 2;
this.label_LastUpdateTimeName.Text = "마지막 상태 변경 시간";
//
// label_LastUpdateTime
//
this.label_LastUpdateTime.AutoSize = true;
this.label_LastUpdateTime.Font = new System.Drawing.Font("DS-Digital", 13F);
this.label_LastUpdateTime.Location = new System.Drawing.Point(120, 55);
this.label_LastUpdateTime.Name = "label_LastUpdateTime";
this.label_LastUpdateTime.Size = new System.Drawing.Size(160, 18);
this.label_LastUpdateTime.TabIndex = 3;
this.label_LastUpdateTime.Text = "0000-00-00 00:00:00";
//
// pictureBox_Status
//
this.pictureBox_Status.Location = new System.Drawing.Point(0, 0);
this.pictureBox_Status.Name = "pictureBox_Status";
this.pictureBox_Status.Size = new System.Drawing.Size(80, 80);
this.pictureBox_Status.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox_Status.TabIndex = 0;
this.pictureBox_Status.TabStop = false;
//
// ServerStatus
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.Controls.Add(this.label_LastUpdateTime);
this.Controls.Add(this.label_LastUpdateTimeName);
this.Controls.Add(this.label_ServerName);
this.Controls.Add(this.pictureBox_Status);
this.Margin = new System.Windows.Forms.Padding(5);
this.Name = "ServerStatus";
this.Size = new System.Drawing.Size(288, 80);
((System.ComponentModel.ISupportInitialize)(this.pictureBox_Status)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox_Status;
private System.Windows.Forms.Label label_ServerName;
private System.Windows.Forms.Label label_LastUpdateTimeName;
private System.Windows.Forms.Label label_LastUpdateTime;
}
}

View File

@@ -0,0 +1,66 @@
using HSUCO_Server_Monitoring;
using System;
using System.Drawing;
using System.Runtime.Remoting.Channels;
using System.Windows.Forms;
namespace HSUCO_CCTV_Monitoring
{
public partial class NVRStatus : UserControl
{
private Image _success;
private Image _fail;
private Image _inspection;
private string _nvrName;
private StatusResult _statusResult;
private DateTime _lastUpdateTime;
public NVRStatus(string nvrName, Image success, Image fail, Image inspection)
{
_nvrName = nvrName;
_statusResult = StatusResult.Fail;
_lastUpdateTime = DateTime.Now;
_success = success;
_fail = fail;
_inspection = inspection;
InitializeComponent();
label_ServerName.Text = _nvrName;
DisplayChange();
}
public void StatusUpdate(StatusResult result, DateTime dateTime)
{
if (_statusResult != result)
{
_statusResult = result;
_lastUpdateTime = dateTime;
DisplayChange();
}
}
private void DisplayChange()
{
switch(_statusResult)
{
case StatusResult.Success:
pictureBox_Status.Image = _success;
break;
case StatusResult.Fail:
pictureBox_Status.Image = _fail;
break;
case StatusResult.Inspection:
pictureBox_Status.Image = _inspection;
break;
default:
break;
}
label_LastUpdateTime.Text = _lastUpdateTime.ToString("yyyy-MM-dd HH:mm:ss");
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HSUCO_Server_Monitoring
{
internal static class Program
{
/// <summary>
/// 해당 애플리케이션의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Log.logLevel = LogLevel.Trace;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("HSUCO_Server_Monitoring")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HSUCO_Server_Monitoring")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("e1f4c9bf-fe6c-4f46-843c-93b4c575703c")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace HSUCO_CCTV_Monitoring.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HSUCO_CCTV_Monitoring.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap NVR_Fail {
get {
object obj = ResourceManager.GetObject("NVR_Fail", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap NVR_Inspection {
get {
object obj = ResourceManager.GetObject("NVR_Inspection", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap NVR_Success {
get {
object obj = ResourceManager.GetObject("NVR_Success", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="NVR_Fail" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NVR_Fail.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NVR_Inspection" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NVR_Inspection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NVR_Success" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NVR_Success.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace HSUCO_CCTV_Monitoring.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,51 @@
using System;
using System.Diagnostics.Tracing;
using System.Net.NetworkInformation;
using System.Text;
namespace HSUCO_Server_Monitoring
{
public class StatusChecker
{
public StatusResult Check(string ip)
{
try
{
Ping ping = new Ping();
PingOptions options = new PingOptions();
options.DontFragment = true;
string data = "hsuco";
byte[] buffer = ASCIIEncoding.ASCII.GetBytes(data);
int timeout = 120;
const int repetCount = 5;
int successCount = 0;
for (int i = 0; i < repetCount; i++)
{
var reply = ping.Send(System.Net.IPAddress.Parse(ip), timeout, buffer, options);
if (reply.Status == IPStatus.Success)
{
successCount++;
}
}
int marginal = (int)(repetCount * 0.6);
if (successCount >= marginal)
{
return StatusResult.Success;
}
if (successCount == 0)
{
return StatusResult.Fail;
}
return StatusResult.Inspection;
}
catch(Exception ex)
{
Log.FATAL(ex.Message);
return StatusResult.Fail;
}
}
}
}

View File

@@ -0,0 +1,53 @@
using System.Threading;
namespace HSUCO_Server_Monitoring
{
public class Worker
{
public delegate void MessageHandler(MessageSender sender, int from, StatusResult result);
public event MessageHandler UpdateMessage;
private bool loop = true;
private Config _config;
public Worker(Config config)
{
_config = config;
}
public void Start_NVR()
{
StatusChecker statusChecker = new StatusChecker();
while (loop)
{
for (int i = 0; i < _config.NVR.Count; i++)
{
StatusResult result = statusChecker.Check(_config.NVR[i].IpAddress);
UpdateMessage(MessageSender.NVR, i,result);
}
Thread.Sleep(_config.NVR_DelayTime);
}
}
public void Start_CCTV()
{
int workerCount = _config.CCTV.Count / 50;
StatusChecker statusChecker = new StatusChecker();
while (loop)
{
for (int i = 0; i < _config.CCTV.Count; i++)
{
StatusResult result = statusChecker.Check(_config.CCTV[i].IpAddress);
UpdateMessage(MessageSender.CCTV, i, result);
}
Thread.Sleep(_config.CCTV_DelayTime);
}
}
public void End()
{
loop = false;
}
}
}

View File

@@ -0,0 +1,84 @@
using System;
using System.IO;
using System.Xml.Serialization;
namespace HSUCO_Server_Monitoring
{
public static class XmlSystem
{
public static bool Save<T>(string path, T data) where T : struct
{
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
string directory = Path.GetDirectoryName(System.IO.Path.GetFullPath(path));
if (!System.IO.Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
using (StreamWriter sw = new StreamWriter(path))
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
XmlSerializerNamespaces xmlSerializerNamespaces = new XmlSerializerNamespaces();
xmlSerializerNamespaces.Add("", "");
xmlSerializer.Serialize(sw, data, xmlSerializerNamespaces);
sw.Close();
}
return true;
}
public static T LoadFromPath<T>(string path) where T : struct
{
if (string.IsNullOrWhiteSpace(path))
{
return default;
}
string directory = Path.GetDirectoryName(System.IO.Path.GetFullPath(path));
if (!System.IO.Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
if (!File.Exists(path))
{
return default;
}
using (StreamReader sr = new StreamReader(path))
{
try
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
T data = (T)xmlSerializer.Deserialize(sr);
return data;
}
catch (Exception ex)
{
Log.FATAL(ex.Message);
return default;
}
}
}
public static T LoadFromData<T>(string data) where T : struct
{
if (string.IsNullOrWhiteSpace(data))
{
return default;
}
using (StringReader sr = new StringReader(data))
{
try
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
return (T)xmlSerializer.Deserialize(sr);
}
catch (Exception ex)
{
Log.FATAL(ex.Message);
return default;
}
}
}
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Collections" version="4.3.0" targetFramework="net472" />
</packages>