diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07be0d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,513 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,c,c++,csharp,powershell +# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,c,c++,csharp,powershell + +### C ### +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +### C++ ### +# Prerequisites + +# Compiled Object files +*.slo + +# Precompiled Headers + +# Compiled Dynamic libraries + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai + +# Executables + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.meta +*.iobj +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### Linux ### + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### PowerShell ### +# Exclude packaged modules +*.zip + +# Exclude .NET assemblies from source + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/windows,linux,c,c++,csharp,powershell \ No newline at end of file diff --git a/HSUCO_CCTV_GetData.sln b/HSUCO_CCTV_GetData.sln new file mode 100644 index 0000000..4971fe9 --- /dev/null +++ b/HSUCO_CCTV_GetData.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33424.131 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSUCO_CCTV_GetData", "HSUCO_CCTV_GetData\HSUCO_CCTV_GetData.csproj", "{5FF020D2-12C5-43F3-A4B0-B86B959012DA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5FF020D2-12C5-43F3-A4B0-B86B959012DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FF020D2-12C5-43F3-A4B0-B86B959012DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FF020D2-12C5-43F3-A4B0-B86B959012DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FF020D2-12C5-43F3-A4B0-B86B959012DA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E7384927-0E01-428C-B445-A9B5C8DF89A8} + EndGlobalSection +EndGlobal diff --git a/HSUCO_CCTV_GetData/App.config b/HSUCO_CCTV_GetData/App.config new file mode 100644 index 0000000..afe1db2 --- /dev/null +++ b/HSUCO_CCTV_GetData/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HSUCO_CCTV_GetData/DataModel.cs b/HSUCO_CCTV_GetData/DataModel.cs new file mode 100644 index 0000000..e7af797 --- /dev/null +++ b/HSUCO_CCTV_GetData/DataModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; + + + + [Serializable] + public struct Config + { + public List NVR { get; set; } + public List 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 struct DetailData +{ + public string ServerName { get; set; } + public string ServerIP { get; set; } + public string Name { get; set; } + public string IP { get; set; } + public string ID { get; set; } + public string Password { get; set; } +} diff --git a/HSUCO_CCTV_GetData/FodyWeavers.xml b/HSUCO_CCTV_GetData/FodyWeavers.xml new file mode 100644 index 0000000..5029e70 --- /dev/null +++ b/HSUCO_CCTV_GetData/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/HSUCO_CCTV_GetData/HSUCO_CCTV_GetData.csproj b/HSUCO_CCTV_GetData/HSUCO_CCTV_GetData.csproj new file mode 100644 index 0000000..bad182c --- /dev/null +++ b/HSUCO_CCTV_GetData/HSUCO_CCTV_GetData.csproj @@ -0,0 +1,221 @@ + + + + + + Debug + AnyCPU + {5FF020D2-12C5-43F3-A4B0-B86B959012DA} + Exe + HSUCO_CCTV_GetData + HSUCO_CCTV_GetData + v4.7.2 + 512 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll + + + ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll + True + True + + + ..\packages\MySqlConnector.2.2.5\lib\net471\MySqlConnector.dll + + + + ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll + True + True + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll + True + True + + + + ..\packages\System.Diagnostics.DiagnosticSource.6.0.0\lib\net461\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll + True + True + + + ..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll + True + True + + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll + True + True + + + + ..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll + True + True + + + ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll + True + True + + + ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + True + True + + + ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll + True + True + + + ..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll + True + True + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll + True + True + + + ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll + True + True + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll + True + True + + + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll + True + True + + + ..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll + True + True + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + True + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + + + ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll + True + True + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + + ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + True + True + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/HSUCO_CCTV_GetData/Program.cs b/HSUCO_CCTV_GetData/Program.cs new file mode 100644 index 0000000..a84d0b4 --- /dev/null +++ b/HSUCO_CCTV_GetData/Program.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using MySqlConnector; + +namespace HSUCO_CCTV_GetData +{ + internal class Program + { + static void Main(string[] args) + { + const string _commandErrorMessge = "input command [data, xml]"; + const string _filePath = "config.xml"; + if (args.Length == 0 ) + { + + Console.WriteLine( _commandErrorMessge ); + return; + } + + + if(!System.IO.File.Exists(_filePath)) + { + Console.WriteLine("not Found config.xml"); + return; + } + + Config config = XmlSystem.LoadFromPath(_filePath); + + + switch (args[0].ToUpper()) + { + case "DATA": + GetData(config); + break; + case "XML": + List cctvInformations = GetInformation(config); + if(cctvInformations != null) + { + config.CCTV = cctvInformations; + XmlSystem.Save("result.xml", config); + Console.Write("Save Complete"); + } + break; + default: + Console.WriteLine(_commandErrorMessge); + return; + + } + + + + } + static void GetData(Config config) + { + List detailDatas = new List(); + foreach (var nvr in config.NVR) + { + try + { + string connectionString = String.Format("server={0};port=3306;database={1};user={2};password={3}", nvr.IpAddress, "leopard", "root", "ehtlrhdtk1!"); + MySqlConnection mySqlConnection = new MySqlConnection(connectionString); + mySqlConnection.Open(); + MySqlCommand sqlCommand = new MySqlCommand("Select name, addr,id,password From tbl_camera where IsDeleted='0'", mySqlConnection); + using (MySqlDataReader sqlDataReader = sqlCommand.ExecuteReader()) + { + while (sqlDataReader.Read()) + { + DetailData detailData = new DetailData(); + detailData.ServerName = nvr.Name; + detailData.ServerIP = nvr.IpAddress; + detailData.Name = sqlDataReader["name"].ToString(); + detailData.IP = sqlDataReader["addr"].ToString(); + detailData.ID = sqlDataReader["id"].ToString(); + detailData.Password = sqlDataReader["password"].ToString(); + detailDatas.Add(detailData); + + } + } + mySqlConnection.Close(); + } + catch (Exception ex) + { + Console.WriteLine(nvr.Name + " : " + ex.Message + Environment.NewLine); + } + + } + + StringBuilder writeData = new StringBuilder(); + writeData.AppendLine("ServerName, ServerIP, Name, IP, ID, Password"); + foreach (var item in detailDatas) + { + writeData.AppendLine(item.ServerName + "," + item.ServerIP + "," + item.Name + "," + item.IP + "," + item.ID + "," + item.Password); + } + + System.IO.File.WriteAllText("reulst.csv", writeData.ToString()); + Console.WriteLine("write result.csv, count : " + detailDatas.Count); + } + static List GetInformation(Config config) + { + List informations = new List(); + foreach (var nvr in config.NVR) + { + try + { + string connectionString = String.Format("server={0};port=3306;database={1};user={2};password={3}", nvr.IpAddress, "leopard", "root", "ehtlrhdtk1!"); + MySqlConnection mySqlConnection = new MySqlConnection(connectionString); + mySqlConnection.Open(); + MySqlCommand sqlCommand = new MySqlCommand("Select name, addr,id,password From tbl_camera where IsDeleted='0'", mySqlConnection); + using (MySqlDataReader sqlDataReader = sqlCommand.ExecuteReader()) + { + while (sqlDataReader.Read()) + { + Config.Information information = new Config.Information(); + + information.Name = sqlDataReader["name"].ToString(); + information.IpAddress = sqlDataReader["addr"].ToString(); + + informations.Add(information); + ; + } + } + mySqlConnection.Close(); + } + + catch (Exception ex) + { + + Console.WriteLine(nvr.Name + " : " + ex.Message + Environment.NewLine); + } + + } + if(informations.Count < 1) + { + return null; + } + + return informations; + } + } +} diff --git a/HSUCO_CCTV_GetData/Properties/AssemblyInfo.cs b/HSUCO_CCTV_GetData/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c7f7cef --- /dev/null +++ b/HSUCO_CCTV_GetData/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("HSUCO_CCTV_GetData")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HSUCO_CCTV_GetData")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("5ff020d2-12c5-43f3-a4b0-b86b959012da")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 +// 기본값으로 할 수 있습니다. +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HSUCO_CCTV_GetData/XmlSystem.cs b/HSUCO_CCTV_GetData/XmlSystem.cs new file mode 100644 index 0000000..39429fd --- /dev/null +++ b/HSUCO_CCTV_GetData/XmlSystem.cs @@ -0,0 +1,81 @@ +using System; +using System.IO; +using System.Xml.Serialization; + + + public static class XmlSystem + { + public static bool Save(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(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) + { + return default; + } + } + } + + public static T LoadFromData(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) + { + return default; + } + } + } + +} diff --git a/HSUCO_CCTV_GetData/packages.config b/HSUCO_CCTV_GetData/packages.config new file mode 100644 index 0000000..881fd82 --- /dev/null +++ b/HSUCO_CCTV_GetData/packages.config @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file