]> insang Git - newton-cn_pos.git/commitdiff
테스트
authornewton-cn <insang@kakao.com>
Sat, 3 May 2025 08:08:25 +0000 (17:08 +0900)
committernewton-cn <insang@kakao.com>
Sat, 3 May 2025 08:08:25 +0000 (17:08 +0900)
.vs/newton-cn/v16/.suo
newton-cn/USBControl.cs
newton-cn/bin/Debug/newton-cn.exe
newton-cn/bin/Debug/newton-cn.pdb
newton-cn/bin/Release/newton-cn.exe
newton-cn/bin/Release/newton-cn.pdb
newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache
newton-cn/obj/Debug/newton-cn.exe
newton-cn/obj/Debug/newton-cn.pdb
newton-cn/obj/Release/newton-cn.exe
newton-cn/obj/Release/newton-cn.pdb

index 6f7f6d9fe60b48927828c938513eac42daa6a94b..ecf25787bda41df840d72ac727047622bc8c8ba4 100644 (file)
Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ
index e8207a6507378802b5802954a59d925611fca834..8486e3f72abcdc546f7fe42d503e0cc0f2e41fc4 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.IO;
 using System.Management;
 
 // ##### 유기중.... 언젠가 해야지
@@ -23,13 +24,12 @@ class USBControl
         }
         return result;
     }
-    public static void test()
-    { 
-    }
 
     // 장치 비활성화
     public static void DisableDevice(string where)
     {
+        string textFile = @"c:\temp\newton-cn_log.txt";
+
         string deviceId = getDeviceId(where);
         try
         {
@@ -38,11 +38,42 @@ class USBControl
             foreach (ManagementObject device in searcher.Get())
             {
                 ManagementBaseObject outParams = device.InvokeMethod("Disable", null, null);
+                if (!System.IO.File.Exists(textFile))
+                {
+                    using (StreamWriter sw = File.CreateText(textFile))
+                    {
+                        sw.WriteLine($"장치 {deviceId}가 비활성화되었습니다.");
+                    }
+                }
+                else
+                {
+                    using (StreamWriter sw= File.AppendText(textFile))
+                    {
+                        sw.WriteLine($"장치 {deviceId}가 비활성화되었습니다.");
+                    }
+                }
                 Console.WriteLine($"장치 {deviceId}가 비활성화되었습니다.");
             }
         }
         catch (Exception ex)
         {
+            if (!System.IO.File.Exists(textFile))
+            {
+                if (!System.IO.File.Exists(textFile))
+                {
+                    using (StreamWriter sw = File.CreateText(textFile))
+                    {
+                        sw.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
+                    }
+                }
+                else
+                {
+                    using (StreamWriter sw = File.AppendText(textFile))
+                    {
+                        sw.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
+                    }
+                }
+            }
             Console.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
         }
     }
@@ -50,6 +81,7 @@ class USBControl
     // 장치 활성화
     public static void EnableDevice(string where)
     {
+        string textFile = @"c:\temp\newton-cn_log.txt";
         string deviceId = getDeviceId(where);
         try
         {
@@ -58,11 +90,39 @@ class USBControl
             foreach (ManagementObject device in searcher.Get())
             {
                 ManagementBaseObject outParams = device.InvokeMethod("Enable", null, null);
+                if (!System.IO.File.Exists(textFile))
+                {
+                    using (StreamWriter sw = File.CreateText(textFile))
+                    {
+                        sw.WriteLine($"장치 {deviceId}가 활성화되었습니다.");
+                    }
+                }
+                else
+                {
+                    using (StreamWriter sw = File.AppendText(textFile))
+                    {
+                        sw.WriteLine($"장치 {deviceId}가 활성화되었습니다.");
+                    }
+                }
                 Console.WriteLine($"장치 {deviceId}가 활성화되었습니다.");
             }
         }
         catch (Exception ex)
         {
+            if (!System.IO.File.Exists(textFile))
+            {
+                using (StreamWriter sw = File.CreateText(textFile))
+                {
+                    sw.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
+                }
+            }
+            else
+            {
+                using (StreamWriter sw = File.AppendText(textFile))
+                {
+                    sw.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
+                }
+            }
             Console.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}");
         }
 
index 4af8ac49c3896b3ae49a47ccc9e1b0b66dc21936..03dcd18f661674a477231ecc80d8d6defe3a311f 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ
index 33d684c9c99d70d74bc0225703acf3fd257446ce..170a19f4b560ba1c53f7f0d6fa014981ad29126a 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ
index f18b07f5c6cb6c4b606cf59a9c612e1953e871ad..6233d1a50aa77a6df2a038df6216f7b0f1e7f1c7 100644 (file)
Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ
index f9322bfb917f7c2e618da643df1b87026f078c4e..a61b6ba30a061d80f137d4b1cdda5cc563504a29 100644 (file)
Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ
index 266099493a80bc275b485ac3b10012bf81a7b34c..bf06e0131044045e0e5bdbb4b18d3260c77c1b1c 100644 (file)
Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ
index 4af8ac49c3896b3ae49a47ccc9e1b0b66dc21936..03dcd18f661674a477231ecc80d8d6defe3a311f 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ
index 33d684c9c99d70d74bc0225703acf3fd257446ce..170a19f4b560ba1c53f7f0d6fa014981ad29126a 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ
index f18b07f5c6cb6c4b606cf59a9c612e1953e871ad..6233d1a50aa77a6df2a038df6216f7b0f1e7f1c7 100644 (file)
Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ
index f9322bfb917f7c2e618da643df1b87026f078c4e..a61b6ba30a061d80f137d4b1cdda5cc563504a29 100644 (file)
Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ