1. 환경설정에 window 파일 저장 주기 추가(단위:분)
2. window1(2).grp 파일 생성시 임시(.temp) 파일에 생성 후 원본을 덮어쓰기 함 (window 파일 손상시 프로그램에 치명적이므로 임시파일로 처리)
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using vmsnet;
|
||||
using System.Xml;
|
||||
|
||||
namespace vmsnet
|
||||
{
|
||||
@@ -84,6 +85,7 @@ namespace vmsnet
|
||||
public static FMain mainWindow;
|
||||
public static DocumentElement DS = new DocumentElement();
|
||||
public static bool runerror = false; ////실행오류
|
||||
public static DateTime LastWindowCellinfoSaved = DateTime.Now;
|
||||
|
||||
|
||||
public static string lastStatueMessage = "";
|
||||
@@ -122,7 +124,7 @@ namespace vmsnet
|
||||
}
|
||||
|
||||
public static void RaiseRemoteCommandEvent(rCommand cmd, object data = null)
|
||||
{
|
||||
{
|
||||
RemoteCommandEvent?.Invoke(null, new RemoteCommand(cmd, data));
|
||||
}
|
||||
|
||||
@@ -596,15 +598,22 @@ namespace vmsnet
|
||||
|
||||
public static void SaveGroupClass(HMI.CGROUP[] grous, System.IO.FileInfo fi)
|
||||
{
|
||||
|
||||
LastWindowCellinfoSaved = DateTime.Now;
|
||||
|
||||
////그룹정보를 파일로 직렬화저장
|
||||
try
|
||||
{
|
||||
if (fi.Directory.Exists == false) fi.Directory.Create();
|
||||
System.IO.FileStream fs2 = new System.IO.FileStream(fi.FullName, System.IO.FileMode.Create);
|
||||
|
||||
var tempfile = fi.FullName + ".temp";
|
||||
System.IO.FileStream fs2 = new System.IO.FileStream(tempfile, System.IO.FileMode.Create);
|
||||
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf2 = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
|
||||
bf2.Serialize(fs2, grous);
|
||||
fs2.Close();
|
||||
PUB.log.Add(AR.Log.ETYPE.NORMAL, "그룹정보파일 저장완료");
|
||||
System.IO.File.Copy(tempfile, fi.FullName, true);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user