_Cfg.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. namespace IControls_FireManager
  7. {
  8. public static class _Cfg
  9. {
  10. // 파일 생성
  11. // Path는 "C:\\Documents and Settings\\gadget81\\My Documents\\Visual Studio 2010\\Projects\\INI\\test.cfg"
  12. public static bool Create_Cfg(string txt, string path)
  13. {
  14. try
  15. {
  16. // 파일이 존재하면 삭제
  17. if (File.Exists(path))
  18. {
  19. File.Delete(path);
  20. }
  21. // 파일 생성
  22. File.WriteAllText(path, txt);
  23. // 성공
  24. return true;
  25. }
  26. catch (Exception e)
  27. {
  28. // LOG
  29. _Event.DebugView_SendMessage_Write(e.ToString());
  30. // 실패
  31. return false;
  32. }
  33. }
  34. // 파일 삭제
  35. // Path는 "C:\\Documents and Settings\\gadget81\\My Documents\\Visual Studio 2010\\Projects\\INI\\test.cfg"
  36. public static void Write_Ini(string path)
  37. {
  38. try
  39. {
  40. // 파일이 존재하면 삭제
  41. if (File.Exists(path))
  42. {
  43. File.Delete(path);
  44. }
  45. }
  46. catch
  47. {
  48. }
  49. }
  50. }
  51. }