123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PacsView3D
- {
- public class RegistFileHelper
- {
- public static string ComputerInfofile = "Localinfo.key";
- public static string RegistInfofile = "RegistInfo.key";
- public static void WriteRegistFile(string info)
- {
- WriteFile(info, RegistInfofile);
- }
- public static void WriteComputerInfoFile(string info)
- {
- WriteFile(info, ComputerInfofile);
- }
- public static string ReadRegistFile()
- {
- return ReadFile(RegistInfofile);
- }
- public static string ReadComputerInfoFile()
- {
- return ReadFile(ComputerInfofile);
- }
- public static bool ExistComputerInfofile()
- {
- return File.Exists(ComputerInfofile);
- }
- public static bool ExistRegistInfofile()
- {
- return File.Exists(RegistInfofile);
- }
- private static void WriteFile(string info, string fileName)
- {
- try
- {
- using (StreamWriter sw = new StreamWriter(fileName, false))
- {
- sw.Write(info);
- sw.Close();
- }
- }
- catch (Exception ex)
- {
- }
- }
- private static string ReadFile(string fileName)
- {
- string info = string.Empty;
- try
- {
- using (StreamReader sr = new StreamReader(fileName))
- {
- info = sr.ReadToEnd();
- sr.Close();
- }
- }
- catch (Exception ex)
- {
- }
- return info;
- }
- }
- }
|