개정판 68daae12
issue #000: TempFile Path 수정
Change-Id: I82d52691ab197b5fce410e3d4273904c9f62454a
KCOM/Common/TempFile.cs | ||
---|---|---|
29 | 29 |
{ |
30 | 30 |
public class TempFile |
31 | 31 |
{ |
32 |
//public static string PathString = AppDomain.CurrentDomain.BaseDirectory + "Temp"; |
|
33 |
public static string PathString = Path.GetTempPath() + "\\MARKUS"; |
|
34 |
public static string FilePath = PathString + "\\" + App.ViewInfo.DocumentItemID + ".tmp"; |
|
32 |
//public static string TempFolder = AppDomain.CurrentDomain.BaseDirectory + "Temp"; |
|
33 |
//public static string TempFolder = Path.GetTempPath() + "\\MARKUS"; |
|
34 |
//public static string TempFilePath = TempFolder + "\\" + App.ViewInfo.DocumentItemID + ".tmp"; |
|
35 |
|
|
36 |
public static string TempFolder |
|
37 |
{ |
|
38 |
get |
|
39 |
{ |
|
40 |
return Path.Combine(Path.GetTempPath(), "MARKUS"); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
public static string TempFilePath |
|
45 |
{ |
|
46 |
get |
|
47 |
{ |
|
48 |
return Path.Combine(Path.GetTempPath(), "MARKUS\\" + App.ViewInfo.DocumentItemID + ".tmp"); |
|
49 |
} |
|
50 |
} |
|
35 | 51 |
|
36 | 52 |
internal static void WriteTemp(List<TempDt> tempDtList) |
37 | 53 |
{ |
... | ... | |
42 | 58 |
XmlNode newNode; |
43 | 59 |
xmlDoc = new XmlDocument(); |
44 | 60 |
|
45 |
if ((System.IO.File.Exists(FilePath)) == false) |
|
61 |
if ((System.IO.File.Exists(TempFilePath)) == false)
|
|
46 | 62 |
{ |
47 |
if (!File.Exists(PathString))
|
|
63 |
if (!File.Exists(TempFolder))
|
|
48 | 64 |
{ |
49 |
Directory.CreateDirectory(PathString);
|
|
65 |
Directory.CreateDirectory(TempFolder);
|
|
50 | 66 |
} |
51 | 67 |
|
52 | 68 |
XmlWriterSettings settings = new XmlWriterSettings(); |
53 | 69 |
settings.Indent = true; |
54 | 70 |
settings.NewLineOnAttributes = true; |
55 | 71 |
|
56 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath); |
|
72 |
XmlWriter xmlWriter = XmlWriter.Create(TempFilePath);
|
|
57 | 73 |
xmlWriter.WriteStartDocument(); |
58 | 74 |
xmlWriter.WriteStartElement("Root"); |
59 | 75 |
|
... | ... | |
63 | 79 |
xmlWriter.Close(); |
64 | 80 |
} |
65 | 81 |
|
66 |
xmlDoc.Load(FilePath); // XML문서 로딩 |
|
82 |
xmlDoc.Load(TempFilePath); // XML문서 로딩
|
|
67 | 83 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
68 | 84 |
for (int i = 0; i < tempDtList.Count; i++) |
69 | 85 |
{ |
... | ... | |
80 | 96 |
e.SelectSingleNode("PageNumber").InnerText = tempDtList[i].PageNumber.ToString(); |
81 | 97 |
e.SelectSingleNode("IsUpdate").InnerText = tempDtList[i].IsUpdate.ToString(); |
82 | 98 |
|
83 |
xmlDoc.Save(FilePath); // XML문서 저장 |
|
99 |
xmlDoc.Save(TempFilePath); // XML문서 저장
|
|
84 | 100 |
|
85 | 101 |
check = false; |
86 | 102 |
break; |
... | ... | |
114 | 130 |
xmlEle6.InnerText = tempDtList[i].IsUpdate.ToString(); |
115 | 131 |
xmlEle1.AppendChild(xmlEle6); |
116 | 132 |
|
117 |
xmlDoc.Save(FilePath); // XML문서 저장.. |
|
133 |
xmlDoc.Save(TempFilePath); // XML문서 저장..
|
|
118 | 134 |
} |
119 | 135 |
} |
120 | 136 |
xmlDoc = null; |
... | ... | |
128 | 144 |
XmlNode newNode; |
129 | 145 |
xmlDoc = new XmlDocument(); |
130 | 146 |
|
131 |
if ((System.IO.File.Exists(FilePath)) == false) |
|
147 |
if ((System.IO.File.Exists(TempFilePath)) == false)
|
|
132 | 148 |
{ |
133 |
if (!File.Exists(PathString))
|
|
149 |
if (!File.Exists(TempFolder))
|
|
134 | 150 |
{ |
135 |
Directory.CreateDirectory(PathString);
|
|
151 |
Directory.CreateDirectory(TempFolder);
|
|
136 | 152 |
} |
137 | 153 |
|
138 | 154 |
XmlWriterSettings settings = new XmlWriterSettings(); |
139 | 155 |
settings.Indent = true; |
140 | 156 |
settings.NewLineOnAttributes = true; |
141 | 157 |
|
142 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath); |
|
158 |
XmlWriter xmlWriter = XmlWriter.Create(TempFilePath);
|
|
143 | 159 |
xmlWriter.WriteStartDocument(); |
144 | 160 |
xmlWriter.WriteStartElement("Root"); |
145 | 161 |
|
... | ... | |
149 | 165 |
xmlWriter.Close(); |
150 | 166 |
} |
151 | 167 |
|
152 |
xmlDoc.Load(FilePath); // XML문서 로딩 |
|
168 |
xmlDoc.Load(TempFilePath); // XML문서 로딩
|
|
153 | 169 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
154 | 170 |
for (int i = 0; i < undoDataList.Markup_List.Count; i++) |
155 | 171 |
{ |
... | ... | |
167 | 183 |
e.SelectSingleNode("PageNumber").InnerText = PageNumber.ToString(); |
168 | 184 |
e.SelectSingleNode("IsUpdate").InnerText = 1.ToString(); |
169 | 185 |
|
170 |
xmlDoc.Save(FilePath); // XML문서 저장 |
|
186 |
xmlDoc.Save(TempFilePath); // XML문서 저장
|
|
171 | 187 |
|
172 | 188 |
check = false; |
173 | 189 |
break; |
... | ... | |
201 | 217 |
xmlEle6.InnerText = 1.ToString(); |
202 | 218 |
xmlEle1.AppendChild(xmlEle6); |
203 | 219 |
|
204 |
xmlDoc.Save(FilePath); |
|
220 |
xmlDoc.Save(TempFilePath);
|
|
205 | 221 |
} |
206 | 222 |
} |
207 | 223 |
xmlDoc = null; |
... | ... | |
209 | 225 |
|
210 | 226 |
public static void Remove() |
211 | 227 |
{ |
212 |
FileInfo fileDel = new FileInfo(FilePath); |
|
228 |
FileInfo fileDel = new FileInfo(TempFilePath);
|
|
213 | 229 |
if (fileDel.Exists) |
214 | 230 |
{ |
215 | 231 |
fileDel.Delete(); |
... | ... | |
218 | 234 |
|
219 | 235 |
internal static void DelTemp(string CommentID, string PageNumber) //Control 삭제시 |
220 | 236 |
{ |
221 |
if ((System.IO.File.Exists(FilePath)) == false) |
|
237 |
if ((System.IO.File.Exists(TempFilePath)) == false)
|
|
222 | 238 |
{ |
223 |
if (!File.Exists(PathString))
|
|
239 |
if (!File.Exists(TempFolder))
|
|
224 | 240 |
{ |
225 |
Directory.CreateDirectory(PathString);
|
|
241 |
Directory.CreateDirectory(TempFolder);
|
|
226 | 242 |
} |
227 | 243 |
|
228 | 244 |
XmlWriterSettings settings = new XmlWriterSettings(); |
229 | 245 |
settings.Indent = true; |
230 | 246 |
settings.NewLineOnAttributes = true; |
231 | 247 |
|
232 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath); |
|
248 |
XmlWriter xmlWriter = XmlWriter.Create(TempFilePath);
|
|
233 | 249 |
xmlWriter.WriteStartDocument(); |
234 | 250 |
xmlWriter.WriteStartElement("Root"); |
235 | 251 |
|
... | ... | |
241 | 257 |
|
242 | 258 |
XmlDocument xmlDoc; |
243 | 259 |
xmlDoc = new XmlDocument(); |
244 |
xmlDoc.Load(FilePath); |
|
260 |
xmlDoc.Load(TempFilePath);
|
|
245 | 261 |
|
246 | 262 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
247 | 263 |
XmlElement root = xmlDoc.DocumentElement; |
... | ... | |
290 | 306 |
xmlEle1.AppendChild(xmlEle6); |
291 | 307 |
} |
292 | 308 |
|
293 |
xmlDoc.Save(FilePath); |
|
309 |
xmlDoc.Save(TempFilePath);
|
|
294 | 310 |
xmlDoc = null; |
295 | 311 |
} |
296 | 312 |
|
... | ... | |
323 | 339 |
|
324 | 340 |
public static void TempLoad() |
325 | 341 |
{ |
326 |
if ((System.IO.File.Exists(FilePath)) == true) |
|
342 |
if ((System.IO.File.Exists(TempFilePath)) == true)
|
|
327 | 343 |
{ |
328 | 344 |
XmlDocument xdoc = new XmlDocument(); |
329 |
xdoc.Load(FilePath); |
|
345 |
xdoc.Load(TempFilePath);
|
|
330 | 346 |
XmlNodeList nodes = xdoc.SelectNodes("/Root/CommentID"); |
331 | 347 |
int PageNumber = 0; |
332 | 348 |
if (nodes.Count > 0) |
... | ... | |
534 | 550 |
|
535 | 551 |
} |
536 | 552 |
|
537 |
//public static string PathString = System.IO.Path.GetTempPath() + "\\MARKUS\\" + App.ViewInfo.DocumentItemID + ".tmp";
|
|
553 |
//public static string TempFolder = System.IO.Path.GetTempPath() + "\\MARKUS\\" + App.ViewInfo.DocumentItemID + ".tmp";
|
|
538 | 554 |
|
539 | 555 |
} |
540 | 556 |
} |
내보내기 Unified diff