|
|
@@ -4,6 +4,7 @@ using System.Security.Principal;
|
|
|
using System.Text;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Xml;
|
|
|
+using UAS_MES.Entity;
|
|
|
using UAS_MES.PublicMethod;
|
|
|
|
|
|
namespace UAS_MES
|
|
|
@@ -35,22 +36,21 @@ namespace UAS_MES
|
|
|
Application.AddMessageFilter(g);
|
|
|
//启用异常记录日志的操作
|
|
|
string sysdisc = Environment.GetEnvironmentVariable("windir").Substring(0, 1);
|
|
|
- string lblpath = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo";
|
|
|
//创建标签缓存的文件夹
|
|
|
if (!Directory.Exists(ftpOperater.DownLoadTo))
|
|
|
Directory.CreateDirectory(ftpOperater.DownLoadTo);
|
|
|
- if (!Directory.Exists(sysdisc + @":\Log"))
|
|
|
- Directory.CreateDirectory(sysdisc + @":\Log");
|
|
|
- FileStream fs = new FileStream(sysdisc + @":\Log\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
+ if (!Directory.Exists(SystemInf.LogFolder))
|
|
|
+ Directory.CreateDirectory(SystemInf.LogFolder);
|
|
|
+ FileStream fs = new FileStream(SystemInf.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
fs.Close();
|
|
|
//创建存储登录信息的文件
|
|
|
- if (!Directory.Exists(sysdisc + @":\Log\cacheInfo"))
|
|
|
- Directory.CreateDirectory(sysdisc + @":\Log\cacheInfo");
|
|
|
- FileStream fcaches = new FileStream(sysdisc + @":\Log\cacheInfo\cacheInfo.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
+ if (!Directory.Exists(SystemInf.CacheFolder))
|
|
|
+ Directory.CreateDirectory(SystemInf.CacheFolder);
|
|
|
+ FileStream fcaches = new FileStream(SystemInf.CacheFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
fcaches.Close();
|
|
|
//判断是否xml文件大小为0
|
|
|
- FileInfo info = new FileInfo(sysdisc + @":\Log\cacheInfo\cacheInfo.xml");
|
|
|
- if (info.Length==0)
|
|
|
+ FileInfo info = new FileInfo(SystemInf.CacheFilePath);
|
|
|
+ if (info.Length == 0)
|
|
|
{
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
//创建类型声明节点
|
|
|
@@ -59,10 +59,10 @@ namespace UAS_MES
|
|
|
//创建根节点
|
|
|
XmlElement xeRoot = doc.CreateElement("cacheInfo");
|
|
|
doc.AppendChild(xeRoot);
|
|
|
- doc.Save(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml");
|
|
|
+ doc.Save(SystemInf.CacheFilePath);
|
|
|
}
|
|
|
//创建记录打印进程的文件
|
|
|
- FileStream fas = new FileStream(lblpath + @"\" + "lblprocess" + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
+ FileStream fas = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
fas.Close();
|
|
|
if (principal.IsInRole(WindowsBuiltInRole.Administrator))
|
|
|
Application.Run(new Login());
|