개정판 6707a5c7
issue #680 temp file save add
KCOM/Common/TempFile.cs | ||
---|---|---|
1 |
using IKCOM;
|
|
2 |
using KCOM.Common;
|
|
3 |
using KCOMDataModel.DataModel;
|
|
1 |
using KCOM.Common;
|
|
2 |
using KCOM.Controls;
|
|
3 |
using KCOM.Views;
|
|
4 | 4 |
using MarkupToPDF.Common; |
5 |
using MarkupToPDF.Controls.Etc;
|
|
6 |
using MarkupToPDF.Controls.Text;
|
|
7 |
using MarkupToPDF.Serialize.Core;
|
|
8 |
using MarkupToPDF.Serialize.S_Control;
|
|
5 |
using Newtonsoft.Json;
|
|
6 |
using Newtonsoft.Json.Converters;
|
|
7 |
using Newtonsoft.Json.Linq;
|
|
8 |
using Newtonsoft.Json.Serialization;
|
|
9 | 9 |
using System; |
10 |
using System.Collections; |
|
10 | 11 |
using System.Collections.Generic; |
12 |
using System.ComponentModel; |
|
13 |
using System.Data; |
|
11 | 14 |
using System.IO; |
12 | 15 |
using System.Linq; |
16 |
using System.Reflection; |
|
17 |
using System.Runtime.Serialization.Formatters; |
|
18 |
using System.Runtime.Serialization.Formatters.Binary; |
|
19 |
using System.Runtime.Serialization.Json; |
|
13 | 20 |
using System.Text; |
14 |
using System.Xml; |
|
15 |
using System.Net; |
|
16 | 21 |
using System.Windows; |
17 |
using System.Windows.Controls; |
|
18 |
using System.Windows.Documents; |
|
19 |
using System.Windows.Ink; |
|
20 |
using System.Windows.Input; |
|
21 | 22 |
using System.Windows.Media; |
22 |
using System.Windows.Media.Animation; |
|
23 |
using System.Windows.Shapes; |
|
24 |
using MarkupToPDF.Controls; |
|
25 |
using MarkupToPDF.Controls.Line; |
|
26 |
using MarkupToPDF.Controls.Shape; |
|
27 |
using MarkupToPDF.Controls.Polygon; |
|
28 |
using MarkupToPDF.Controls.Common.ValueConverter; |
|
29 |
using System.Collections.ObjectModel; |
|
30 |
using MarkupToPDF.Controls.Common; |
|
31 |
|
|
23 |
using System.Xml; |
|
24 |
using System.Xml.Serialization; |
|
32 | 25 |
|
33 | 26 |
namespace KCOM |
34 |
{
|
|
27 |
{ |
|
35 | 28 |
public class TempFile |
36 | 29 |
{ |
37 |
// public Undo_data UndoData { get; set; } |
|
38 | 30 |
public class MarkupReturn |
39 | 31 |
{ |
40 | 32 |
public string ConvertData { get; set; } |
... | ... | |
42 | 34 |
public string CommentID { get; set; } |
43 | 35 |
} |
44 | 36 |
|
45 |
public string shortGuid() |
|
46 |
{ |
|
47 |
byte[] bytes = new byte[16]; |
|
48 |
using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
|
49 |
{ |
|
50 |
provider.GetBytes(bytes); |
|
51 |
} |
|
52 |
|
|
53 |
var guid = new Guid(bytes); |
|
54 |
|
|
55 |
return Convert.ToBase64String(guid.ToByteArray()) |
|
56 |
.Substring(0, 10) |
|
57 |
.Replace("/", "") |
|
58 |
.Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x"); |
|
59 |
} |
|
60 |
//MarkupReturn Data = new MarkupReturn(); |
|
61 |
public MarkupReturn MarkupToString(CommentUserInfo Control, string UserId) |
|
62 |
{ |
|
63 |
MarkupReturn Data = new MarkupReturn(); |
|
64 |
Data.ConvertData = ""; |
|
65 |
Data.DATA_TYPE = 0; |
|
66 |
Data.CommentID = Control.CommentID; |
|
67 |
|
|
68 |
if (Data.CommentID == null) |
|
69 |
{ |
|
70 |
Data.CommentID = shortGuid(); |
|
71 |
} |
|
72 |
|
|
73 |
String ConvertData = ""; |
|
74 |
//int DATA_TYPE = 0; |
|
75 |
|
|
76 |
#region ######### 마크업 파싱########## |
|
77 |
|
|
78 |
switch (Control.GetType().Name.ToString()) |
|
79 |
{ |
|
80 |
#region Line |
|
81 |
#region Arrow_Multi |
|
82 |
case "ArrowControl_Multi": |
|
83 |
using (S_ArrowControl_Multi STemp = new S_ArrowControl_Multi()) |
|
84 |
{ |
|
85 |
var instance = Control as ArrowControl_Multi; |
|
86 |
STemp.TransformPoint = "0|0"; |
|
87 |
STemp.PointSet = instance.PointSet; |
|
88 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
89 |
//STemp.StrokeColor = "#FF00FF00"; |
|
90 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
91 |
STemp.StartPoint = instance.StartPoint; |
|
92 |
STemp.EndPoint = instance.EndPoint; |
|
93 |
STemp.UserID = UserId; |
|
94 |
STemp.Opac = instance.Opacity; |
|
95 |
STemp.DashSize = instance.DashSize; |
|
96 |
STemp.MidPoint = instance.MiddlePoint; |
|
97 |
STemp.Name = instance.GetType().Name.ToString(); |
|
98 |
|
|
99 |
///강인구 추가(2017.11.02) |
|
100 |
///Memo 추가 |
|
101 |
STemp.Memo = instance.Memo; |
|
102 |
|
|
103 |
///강인구 추가(2017.11.02) |
|
104 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
105 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
106 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
107 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
108 |
}; |
|
109 |
break; |
|
110 |
#endregion |
|
111 |
#region Line |
|
112 |
case "LineControl": |
|
113 |
using (S_LineControl STemp = new S_LineControl()) |
|
114 |
{ |
|
115 |
var instance = Control as LineControl; |
|
116 |
|
|
117 |
STemp.TransformPoint = "0|0"; |
|
118 |
STemp.PointSet = instance.PointSet; |
|
119 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
120 |
STemp.LineStyleSet = instance.LineStyleSet; |
|
121 |
//STemp.StrokeColor = "#FF00FF00"; |
|
122 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
123 |
STemp.StartPoint = instance.StartPoint; |
|
124 |
STemp.EndPoint = instance.EndPoint; |
|
125 |
STemp.UserID = UserId; |
|
126 |
STemp.Opac = instance.Opacity; |
|
127 |
// STemp.DashSize = instance.DashSize; |
|
128 |
STemp.Interval = instance.Interval; |
|
129 |
STemp.DimSize = instance.DimSize; |
|
130 |
STemp.Name = instance.GetType().Name.ToString(); |
|
131 |
|
|
132 |
///강인구 추가(2017.11.02) |
|
133 |
///Memo 추가 |
|
134 |
STemp.Memo = instance.Memo; |
|
135 |
|
|
136 |
///강인구 추가(2017.11.02) |
|
137 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
138 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
139 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
140 |
|
|
141 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
142 |
|
|
143 |
//var item = JsonSerializerHelper.UnCompressString(Data.ConvertData); //언패킹작업 |
|
144 |
//using (S_LineControl s = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item)) |
|
145 |
//{ |
|
146 |
// LineControl ins = new LineControl() |
|
147 |
// { |
|
148 |
// Memo = s.Memo |
|
149 |
// }; |
|
150 |
//} |
|
151 |
|
|
152 |
}; |
|
153 |
break; |
|
154 |
#endregion |
|
155 |
#region Arc |
|
156 |
case "ArcControl": |
|
157 |
using (S_ArcControl STemp = new S_ArcControl()) |
|
158 |
{ |
|
159 |
var instance = Control as ArcControl; |
|
160 |
STemp.TransformPoint = "0|0"; |
|
161 |
STemp.PointSet = instance.PointSet; |
|
162 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
163 |
//STemp.StrokeColor = "#FF000FFF"; |
|
164 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
165 |
STemp.StartPoint = instance.StartPoint; |
|
166 |
STemp.UserID = UserId; |
|
167 |
STemp.Opac = instance.Opacity; |
|
168 |
STemp.MidPoint = instance.MidPoint; |
|
169 |
STemp.EndPoint = instance.EndPoint; |
|
170 |
STemp.IsTransOn = instance.isTransOn; |
|
171 |
STemp.DashSize = instance.DashSize; |
|
172 |
STemp.Clock = instance.Clock; |
|
173 |
//STemp.ArcStyleSet = instance.ControlType; |
|
174 |
STemp.Name = instance.GetType().Name.ToString(); |
|
175 |
|
|
176 |
///강인구 추가(2017.11.02) |
|
177 |
///Memo 추가 |
|
178 |
STemp.Memo = instance.Memo; |
|
179 |
|
|
180 |
///강인구 추가(2017.11.02) |
|
181 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
182 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
183 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
184 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
185 |
|
|
186 |
}; |
|
187 |
break; |
|
188 |
#endregion |
|
189 |
#endregion |
|
190 |
|
|
191 |
#region Shape |
|
192 |
#region RectCloud |
|
193 |
case "RectCloudControl": |
|
194 |
{ |
|
195 |
using (S_RectCloudControl STemp = new S_RectCloudControl()) |
|
196 |
{ |
|
197 |
var instance = Control as RectCloudControl; |
|
198 |
STemp.TransformPoint = "0|0"; |
|
199 |
STemp.PointSet = instance.PointSet; |
|
200 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
201 |
//STemp.StrokeColor = "#FF00FF00"; |
|
202 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
203 |
STemp.StartPoint = instance.StartPoint; |
|
204 |
STemp.UserID = UserId; |
|
205 |
STemp.Opac = instance.Opacity; |
|
206 |
STemp.TR = instance.TopRightPoint; |
|
207 |
STemp.LB = instance.LeftBottomPoint; |
|
208 |
STemp.EndPoint = instance.EndPoint; |
|
209 |
STemp.PaintState = instance.Paint; |
|
210 |
STemp.DashSize = instance.DashSize; |
|
211 |
STemp.ArcLength = instance.ArcLength; |
|
212 |
STemp.Name = instance.GetType().Name.ToString(); |
|
213 |
///강인구 추가(2017.11.02) |
|
214 |
///Memo 추가 |
|
215 |
STemp.Memo = instance.Memo; |
|
216 |
|
|
217 |
///강인구 추가(2017.11.02) |
|
218 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
219 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
220 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
221 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
222 |
} |
|
223 |
} |
|
224 |
break; |
|
225 |
#endregion |
|
226 |
#region Circle |
|
227 |
case "CircleControl": |
|
228 |
using (S_CircleControl STemp = new S_CircleControl()) |
|
229 |
{ |
|
230 |
var instance = Control as CircleControl; |
|
231 |
STemp.TransformPoint = "0|0"; |
|
232 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
233 |
STemp.PaintState = instance.Paint; |
|
234 |
//STemp.StrokeColor = "#FF00FF00"; |
|
235 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
236 |
if (instance.FillColor != null) |
|
237 |
{ |
|
238 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
|
239 |
} |
|
240 |
STemp.StartPoint = instance.StartPoint; |
|
241 |
STemp.UserID = UserId; |
|
242 |
STemp.EndPoint = instance.EndPoint; |
|
243 |
STemp.TRP = instance.TopRightPoint; |
|
244 |
STemp.LBP = instance.LeftBottomPoint; |
|
245 |
STemp.Opac = instance.Opacity; |
|
246 |
STemp.Angle = instance.Angle; |
|
247 |
STemp.PointSet = instance.PointSet; |
|
248 |
STemp.DashSize = instance.DashSize; |
|
249 |
STemp.Name = instance.GetType().Name.ToString(); |
|
250 |
///강인구 추가(2017.11.02) |
|
251 |
///Memo 추가 |
|
252 |
STemp.Memo = instance.Memo; |
|
253 |
|
|
254 |
///강인구 추가(2017.11.02) |
|
255 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
256 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
257 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
258 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
259 |
}; |
|
260 |
break; |
|
261 |
#endregion |
|
262 |
#region Rectangle |
|
263 |
case "RectangleControl": |
|
264 |
using (S_RectControl STemp = new S_RectControl()) |
|
265 |
{ |
|
266 |
var instance = Control as RectangleControl; |
|
267 |
STemp.TransformPoint = "0|0"; |
|
268 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
269 |
STemp.PaintState = instance.Paint; |
|
270 |
STemp.PointSet = instance.PointSet; |
|
271 |
//STemp.StrokeColor = "#FF00FF00"; |
|
272 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
273 |
if (instance.FillColor != null) |
|
274 |
{ |
|
275 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
|
276 |
} |
|
277 |
STemp.StartPoint = instance.StartPoint; |
|
278 |
STemp.UserID = UserId; |
|
279 |
//STemp.Angle = instance.a; |
|
280 |
STemp.EndPoint = instance.EndPoint; |
|
281 |
STemp.LB = instance.LeftBottomPoint; |
|
282 |
STemp.TR = instance.TopRightPoint; |
|
283 |
STemp.DashSize = instance.DashSize; |
|
284 |
STemp.Opac = instance.Opacity; |
|
285 |
STemp.Name = instance.GetType().Name.ToString(); |
|
286 |
///강인구 추가(2017.11.02) |
|
287 |
///Memo 추가 |
|
288 |
STemp.Memo = instance.Memo; |
|
289 |
|
|
290 |
///강인구 추가(2017.11.02) |
|
291 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
292 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
293 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
294 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
295 |
}; |
|
296 |
break; |
|
297 |
#endregion |
|
298 |
#region Triangle |
|
299 |
case "TriControl": |
|
300 |
using (S_TriControl STemp = new S_TriControl()) |
|
301 |
{ |
|
302 |
var instance = Control as TriControl; |
|
303 |
STemp.TransformPoint = "0|0"; |
|
304 |
STemp.Paint = instance.Paint; |
|
305 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
306 |
//STemp.StrokeColor = "#FF00FF00"; |
|
307 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
308 |
if (instance.FillColor != null) |
|
309 |
{ |
|
310 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
|
311 |
} |
|
312 |
STemp.StartPoint = instance.StartPoint; |
|
313 |
STemp.EndPoint = instance.EndPoint; |
|
314 |
STemp.MidPoint = instance.MidPoint; |
|
315 |
STemp.Opac = instance.Opacity; |
|
316 |
STemp.UserID = UserId; |
|
317 |
STemp.PointSet = instance.PointSet; |
|
318 |
STemp.Angle = instance.Angle; |
|
319 |
STemp.DashSize = instance.DashSize; |
|
320 |
STemp.Name = instance.GetType().Name.ToString(); |
|
321 |
///강인구 추가(2017.11.02) |
|
322 |
///Memo 추가 |
|
323 |
STemp.Memo = instance.Memo; |
|
324 |
|
|
325 |
///강인구 추가(2017.11.02) |
|
326 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
327 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
328 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
329 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
330 |
} |
|
331 |
break; |
|
332 |
#endregion |
|
333 |
#endregion |
|
334 |
|
|
335 |
#region Polygon |
|
336 |
#region Poly |
|
337 |
case "PolygonControl": |
|
338 |
using (S_PolyControl STemp = new S_PolyControl()) |
|
339 |
{ |
|
340 |
var instance = Control as PolygonControl; |
|
341 |
|
|
342 |
STemp.TransformPoint = "0|0"; |
|
343 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
344 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
345 |
//STemp.StrokeColor = "#FF000FFF"; |
|
346 |
STemp.Name = instance.GetType().Name.ToString(); |
|
347 |
//STemp.Toler = instance.Toler; |
|
348 |
STemp.PaintState = instance.Paint; |
|
349 |
STemp.Opac = instance.Opacity; |
|
350 |
STemp.UserID = UserId; |
|
351 |
STemp.PaintState = instance.Paint; |
|
352 |
//강인구 추가(Chain인지 Polygon인지 구분) |
|
353 |
STemp.Type = instance.ControlType; |
|
354 |
//STemp.IsTrans = instance.isTransOn; |
|
355 |
//STemp.IsChain = instance.isChain; |
|
356 |
STemp.PointSet = new List<Point>(); |
|
357 |
STemp.DashSize = instance.DashSize; |
|
358 |
STemp.StartPoint = instance.StartPoint; |
|
359 |
STemp.EndPoint = instance.EndPoint; |
|
360 |
STemp.IsCompleted = instance.IsCompleted; |
|
361 |
foreach (var point in instance.PointSet) |
|
362 |
{ |
|
363 |
STemp.PointSet.Add(point); |
|
364 |
} |
|
365 |
///강인구 추가(2017.11.02) |
|
366 |
///Memo 추가 |
|
367 |
STemp.Memo = instance.Memo; |
|
368 |
|
|
369 |
///강인구 추가(2017.11.02) |
|
370 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
371 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
372 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
373 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
374 |
}; |
|
375 |
break; |
|
376 |
#endregion |
|
377 |
|
|
378 |
#region InkControl |
|
379 |
case "InkControl": |
|
380 |
using (S_PolyControl STemp = new S_PolyControl()) |
|
381 |
{ |
|
382 |
var instance = Control as InkControl; |
|
383 |
|
|
384 |
STemp.TransformPoint = "0|0"; |
|
385 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
386 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
387 |
//STemp.StrokeColor = "#FF000FFF"; |
|
388 |
STemp.Name = instance.GetType().Name.ToString(); |
|
389 |
//STemp.Toler = instance.Toler; |
|
390 |
STemp.PaintState = instance.Paint; |
|
391 |
STemp.Opac = instance.Opacity; |
|
392 |
STemp.UserID = UserId; |
|
393 |
STemp.PaintState = instance.Paint; |
|
394 |
//강인구 추가(Chain인지 Polygon인지 구분) |
|
395 |
STemp.Type = instance.ControlType; |
|
396 |
//STemp.IsTrans = instance.isTransOn; |
|
397 |
//STemp.IsChain = instance.isChain; |
|
398 |
STemp.PointSet = new List<Point>(); |
|
399 |
STemp.DashSize = instance.DashSize; |
|
400 |
STemp.IsCompleted = instance.IsCompleted; |
|
401 |
STemp.StartPoint = instance.StartPoint; |
|
402 |
STemp.EndPoint = instance.EndPoint; |
|
403 |
foreach (var point in instance.PointSet) |
|
404 |
{ |
|
405 |
STemp.PointSet.Add(point); |
|
406 |
} |
|
407 |
///강인구 추가(2017.11.02) |
|
408 |
///Memo 추가 |
|
409 |
STemp.Memo = instance.Memo; |
|
410 |
|
|
411 |
///강인구 추가(2017.11.02) |
|
412 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
413 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
414 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
415 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
416 |
}; |
|
417 |
break; |
|
418 |
#endregion |
|
419 |
|
|
420 |
#region Cloud |
|
421 |
case "CloudControl": |
|
422 |
using (S_CloudControl STemp = new S_CloudControl()) |
|
423 |
{ |
|
424 |
var instance = Control as CloudControl; |
|
425 |
|
|
426 |
STemp.TransformPoint = "0|0"; |
|
427 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
428 |
//STemp.StrokeColor = "#FF000FFF"; |
|
429 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
430 |
STemp.Name = instance.GetType().Name.ToString(); |
|
431 |
STemp.Toler = instance.Toler; |
|
432 |
STemp.PaintState = instance.Paint; |
|
433 |
STemp.Opac = instance.Opacity; |
|
434 |
STemp.UserID = UserId; |
|
435 |
STemp.IsTrans = instance.isTransOn; |
|
436 |
STemp.IsChain = instance.isChain; |
|
437 |
STemp.PointSet = new List<Point>(); |
|
438 |
STemp.DashSize = instance.DashSize; |
|
439 |
STemp.StartPoint = instance.StartPoint; |
|
440 |
STemp.EndPoint = instance.EndPoint; |
|
441 |
STemp.ArcLength = instance.ArcLength; |
|
442 |
foreach (var point in instance.PointSet) |
|
443 |
{ |
|
444 |
STemp.PointSet.Add(point); |
|
445 |
} |
|
446 |
|
|
447 |
//STemp.CloudFill = instance.Fill; |
|
448 |
STemp.ArcLength = instance.ArcLength; |
|
449 |
///강인구 추가(2017.11.02) |
|
450 |
///Memo 추가 |
|
451 |
STemp.Memo = instance.Memo; |
|
452 |
|
|
453 |
///강인구 추가(2017.11.02) |
|
454 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
455 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
456 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
457 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
458 |
} |
|
459 |
break; |
|
460 |
#endregion |
|
461 |
#endregion |
|
462 |
|
|
463 |
#region Text |
|
464 |
#region Text |
|
465 |
case "TextControl": |
|
466 |
using (S_TextControl STemp = new S_TextControl()) |
|
467 |
{ |
|
468 |
|
|
469 |
var instance = Control as TextControl; |
|
470 |
STemp.TransformPoint = "0|0"; |
|
471 |
STemp.SizeSet = String.Format("{0}|{1}", instance.LineSize.Left.ToString(), instance.TextSize.ToString()); |
|
472 |
STemp.Text = instance.Text; |
|
473 |
STemp.UserID = UserId; |
|
474 |
STemp.FontColor = instance.FontColor.Color.ToString(); |
|
475 |
//STemp.FontColor = "#FFFFFF00"; |
|
476 |
|
|
477 |
if (instance.StartPoint == new Point()) |
|
478 |
STemp.StartPoint = new Point(instance.CanvasX, instance.CanvasY); |
|
479 |
else |
|
480 |
STemp.StartPoint = instance.StartPoint; |
|
481 |
|
|
482 |
STemp.EndPoint = instance.EndPoint; |
|
483 |
STemp.Opac = instance.Opacity; |
|
484 |
STemp.PointSet = instance.PointSet; |
|
485 |
STemp.Angle = instance.Angle; |
|
486 |
STemp.paintMethod = instance.ControlType_No; |
|
487 |
STemp.BoxW = instance.BoxWidth; |
|
488 |
STemp.BoxH = instance.BoxHeight; |
|
489 |
STemp.isHighLight = instance.IsHighLight; |
|
490 |
STemp.Name = instance.GetType().Name.ToString(); |
|
491 |
STemp.fontConfig = new List<string>() |
|
492 |
{ |
|
493 |
instance.TextFamily.ToString(), |
|
494 |
instance.TextStyle.ToString(), |
|
495 |
instance.TextWeight.ToString(), |
|
496 |
}; |
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
if (instance.UnderLine != null) |
|
501 |
{ |
|
502 |
STemp.fontConfig.Add("true"); |
|
503 |
} |
|
504 |
|
|
505 |
///강인구 추가(2017.11.02) |
|
506 |
///Memo 추가 |
|
507 |
STemp.Memo = instance.Memo; |
|
508 |
|
|
509 |
///강인구 추가(2017.11.02) |
|
510 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
511 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
512 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
513 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
514 |
} |
|
515 |
break; |
|
516 |
#endregion |
|
517 |
#region ArrowText |
|
518 |
case "ArrowTextControl": |
|
519 |
using (S_ArrowTextControl STemp = new S_ArrowTextControl()) |
|
520 |
{ |
|
521 |
var instance = Control as ArrowTextControl; |
|
522 |
|
|
523 |
STemp.TransformPoint = "0|0"; |
|
524 |
STemp.PointSet = instance.PointSet; |
|
525 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
526 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
527 |
STemp.StartPoint = instance.StartPoint; |
|
528 |
STemp.ArrowStyle = instance.ArrowTextStyle; |
|
529 |
//STemp.StrokeColor = "#FF00FF00"; |
|
530 |
STemp.UserID = UserId; |
|
531 |
STemp.ArrowText = instance.Base_TextBox.Text; |
|
532 |
STemp.BorderSize = instance.BorderSize; |
|
533 |
STemp.isHighLight = instance.isHighLight; |
|
534 |
STemp.BoxHeight = instance.BoxHeight; |
|
535 |
STemp.BoxWidth = instance.BoxWidth; |
|
536 |
STemp.Opac = instance.Opacity; |
|
537 |
STemp.EndPoint = instance.EndPoint; |
|
538 |
STemp.isFixed = instance.isFixed; |
|
539 |
//STemp.DashSize = instance.DashSize; |
|
540 |
STemp.Name = instance.GetType().Name.ToString(); |
|
541 |
STemp.isTrans = instance.isTrans; |
|
542 |
STemp.MidPoint = instance.MidPoint; |
|
543 |
STemp.Angle = instance.Angle; |
|
544 |
STemp.fontConfig = new List<string>() |
|
545 |
{ |
|
546 |
instance.TextFamily.ToString(), |
|
547 |
instance.TextStyle.ToString(), |
|
548 |
instance.TextWeight.ToString(), |
|
549 |
instance.TextSize.ToString(), |
|
550 |
}; |
|
551 |
|
|
552 |
if (instance.UnderLine != null) |
|
553 |
{ |
|
554 |
STemp.fontConfig.Add("true"); |
|
555 |
} |
|
556 |
|
|
557 |
///강인구 추가(2017.11.02) |
|
558 |
///Memo 추가 |
|
559 |
STemp.Memo = instance.Memo; |
|
560 |
|
|
561 |
///강인구 추가(2017.11.02) |
|
562 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
563 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
564 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
565 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
566 |
}; |
|
567 |
break; |
|
568 |
#endregion |
|
569 |
#endregion |
|
570 |
|
|
571 |
#region ETC |
|
572 |
#region Sign |
|
573 |
case "SignControl": |
|
574 |
{ |
|
575 |
//강인구 추가 |
|
576 |
using (S_SignControl STemp = new S_SignControl()) |
|
577 |
{ |
|
578 |
SignControl instance = Control as SignControl; |
|
579 |
STemp.Angle = instance.Angle; |
|
580 |
STemp.EndPoint = instance.EndPoint; |
|
581 |
STemp.UserID = UserId; |
|
582 |
STemp.LB = instance.LeftBottomPoint; |
|
583 |
STemp.Name = instance.GetType().Name; |
|
584 |
STemp.PointSet = instance.PointSet; |
|
585 |
STemp.StartPoint = instance.StartPoint; |
|
586 |
STemp.Opac = instance.Opacity; |
|
587 |
STemp.TR = instance.TopRightPoint; |
|
588 |
STemp.UserNumber = instance.UserNumber == null ? UserId : instance.UserNumber; |
|
589 |
|
|
590 |
///강인구 추가(2017.11.02) |
|
591 |
///Memo 추가 |
|
592 |
STemp.Memo = instance.Memo; |
|
593 |
|
|
594 |
///강인구 추가(2017.11.02) |
|
595 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
596 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
597 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
598 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
599 |
} |
|
600 |
} |
|
601 |
break; |
|
602 |
#endregion |
|
603 |
|
|
604 |
|
|
605 |
//변경 필요 |
|
606 |
#region Ink |
|
607 |
case "InkPresenter": |
|
608 |
{ |
|
609 |
//var instance = item as InkPresenter; |
|
610 |
//if (instance.Strokes.Count >= 1) |
|
611 |
//{ |
|
612 |
// using (S_PensilControl STemp = new S_PensilControl()) |
|
613 |
// { |
|
614 |
// bool isRealData = true; |
|
615 |
// foreach (var strokeData in instance.Strokes) |
|
616 |
// { |
|
617 |
// if (strokeData.StylusPoints.Count == 0) |
|
618 |
// { |
|
619 |
// isRealData = false; |
|
620 |
// } |
|
621 |
// } |
|
622 |
// if (isRealData) |
|
623 |
// { |
|
624 |
// if (instance.Tag != null) |
|
625 |
// { |
|
626 |
// STemp.UserID = instance.Tag.ToString(); |
|
627 |
// } |
|
628 |
// STemp.SCC = instance.Strokes; |
|
629 |
// STemp.Name = instance.GetType().Name; |
|
630 |
// STemp.Opac = instance.Opacity; |
|
631 |
// STemp.TransformPoint = "0|0"; |
|
632 |
// ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
633 |
// } |
|
634 |
// } |
|
635 |
//} |
|
636 |
} |
|
637 |
break; |
|
638 |
#endregion |
|
639 |
#region Date |
|
640 |
case "DateControl": |
|
641 |
{ |
|
642 |
using (S_DateControl STemp = new S_DateControl()) |
|
643 |
{ |
|
644 |
DateControl instance = Control as DateControl; |
|
645 |
STemp.Angle = instance.Angle; |
|
646 |
STemp.EndPoint = instance.EndPoint; |
|
647 |
STemp.UserID = UserId; |
|
648 |
STemp.LB = instance.LeftBottomPoint; |
|
649 |
STemp.Name = instance.GetType().Name; |
|
650 |
STemp.PointSet = instance.PointSet; |
|
651 |
STemp.StartPoint = instance.StartPoint; |
|
652 |
STemp.Opac = instance.Opacity; |
|
653 |
STemp.TR = instance.TopRightPoint; |
|
654 |
STemp.TransformPoint = "0|0"; |
|
655 |
STemp.FontColor = instance.FontColor.Color.ToString(); |
|
656 |
//STemp.FontColor = "#FFFFFF00"; |
|
657 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
|
658 |
STemp.Text = instance.Text; |
|
659 |
///강인구 추가(2017.11.02) |
|
660 |
///Memo 추가 |
|
661 |
STemp.Memo = instance.Memo; |
|
662 |
|
|
663 |
///강인구 추가(2017.11.02) |
|
664 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
665 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
666 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
667 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
668 |
} |
|
669 |
} |
|
670 |
break; |
|
671 |
#endregion |
|
672 |
#region Symbol |
|
673 |
case "SymControl": |
|
674 |
using (S_SymControl STemp = new S_SymControl()) |
|
675 |
{ |
|
676 |
var instance = Control as SymControl; |
|
677 |
STemp.TransformPoint = "0|0"; |
|
678 |
STemp.PointSet = instance.PointSet; |
|
679 |
STemp.UserID = UserId; |
|
680 |
STemp.SizeSet = String.Format("{0}", instance.LineSize.ToString()); |
|
681 |
STemp.PaintState = instance.Paint; |
|
682 |
STemp.PathInfo = instance.PathData.ToString(); |
|
683 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
684 |
STemp.StartPoint = instance.StartPoint; |
|
685 |
STemp.Angle = instance.Angle; |
|
686 |
STemp.EndPoint = instance.EndPoint; |
|
687 |
STemp.LB = instance.LeftBottomPoint; |
|
688 |
STemp.TR = instance.TopRightPoint; |
|
689 |
STemp.Opac = instance.Opacity; |
|
690 |
STemp.Name = instance.GetType().Name.ToString(); |
|
691 |
|
|
692 |
///강인구 추가(2017.11.02) |
|
693 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
694 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
695 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
696 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
697 |
} |
|
698 |
break; |
|
699 |
#endregion |
|
700 |
#region SymbolN |
|
701 |
case "SymControlN": |
|
702 |
using (S_SymControlN STemp = new S_SymControlN()) |
|
703 |
{ |
|
704 |
var instance = Control as SymControlN; |
|
705 |
STemp.TransformPoint = "0|0"; |
|
706 |
STemp.PointSet = instance.PointSet; |
|
707 |
//STemp.XamlData = instance.PathXathData; |
|
708 |
STemp.UserID = UserId; |
|
709 |
STemp.DBData = instance.PathXathData; |
|
710 |
//STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
|
711 |
STemp.StartPoint = instance.StartPoint; |
|
712 |
STemp.Angle = instance.Angle; |
|
713 |
STemp.EndPoint = instance.EndPoint; |
|
714 |
STemp.LB = instance.LeftBottomPoint; |
|
715 |
STemp.TR = instance.TopRightPoint; |
|
716 |
STemp.Opac = instance.Opacity; |
|
717 |
STemp.Name = instance.GetType().Name.ToString(); |
|
718 |
|
|
719 |
///강인구 추가(2017.11.02) |
|
720 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
721 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
722 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
723 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
724 |
} |
|
725 |
break; |
|
726 |
#endregion |
|
727 |
#region Image |
|
728 |
case "ImgControl": |
|
729 |
using (S_ImgControl STemp = new S_ImgControl()) |
|
730 |
{ |
|
731 |
ImgControl instance = Control as ImgControl; |
|
732 |
STemp.Angle = instance.Angle; |
|
733 |
STemp.EndPoint = instance.EndPoint; |
|
734 |
STemp.LB = instance.LeftBottomPoint; |
|
735 |
STemp.Name = instance.GetType().Name; |
|
736 |
STemp.PointSet = instance.PointSet; |
|
737 |
STemp.StartPoint = instance.StartPoint; |
|
738 |
STemp.UserID = UserId; |
|
739 |
STemp.Opac = instance.Opacity; |
|
740 |
STemp.TR = instance.TopRightPoint; |
|
741 |
STemp.ImagePath = instance.FilePath; |
|
742 |
///강인구 추가(2017.11.02) |
|
743 |
///Memo 추가 |
|
744 |
STemp.Memo = instance.Memo; |
|
745 |
|
|
746 |
///강인구 추가(2017.11.02) |
|
747 |
///DATA_TYPE추가로 인한 클래스 변수 대입 |
|
748 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
749 |
Data.DATA_TYPE = (int)(instance.ControlType); |
|
750 |
Data.ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
|
751 |
} |
|
752 |
break; |
|
753 |
#endregion |
|
754 |
#endregion |
|
755 |
default: |
|
756 |
break; |
|
757 |
} |
|
758 |
|
|
759 |
#endregion |
|
760 |
|
|
761 |
//return ConvertData; |
|
762 |
return Data; |
|
763 |
} |
|
764 |
|
|
765 |
public CommentUserInfo GetControlList() //추가 코드..! |
|
766 |
{ |
|
767 |
CommentUserInfo aa = new CommentUserInfo(); |
|
768 |
|
|
769 |
return aa; |
|
770 |
} |
|
771 |
|
|
772 | 37 |
MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
773 | 38 |
|
774 |
public void AddTemp(CommentUserInfo currentControl, int PageNumber) |
|
39 |
public static string PathString = AppDomain.CurrentDomain.BaseDirectory + "Temp"; |
|
40 |
public static string FilePath = PathString + "\\" + App.ViewInfo.DocumentItemID + ".tmp"; |
|
41 |
|
|
42 |
internal void WriteTemp(List<MainMenu.TempDt> tempDtList) |
|
775 | 43 |
{ |
776 |
try
|
|
44 |
if (tempDtList.Count > 0)
|
|
777 | 45 |
{ |
778 | 46 |
XmlDocument xmlDoc; |
779 |
XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4; |
|
47 |
XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4, xmlEle5, xmlEle6;
|
|
780 | 48 |
XmlNode newNode; |
781 |
XmlElement xmlEle; |
|
782 | 49 |
xmlDoc = new XmlDocument(); |
783 | 50 |
|
784 |
if(!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"))
|
|
51 |
if ((System.IO.File.Exists(FilePath)) == false)
|
|
785 | 52 |
{ |
53 |
if (!File.Exists(PathString)) |
|
54 |
{ |
|
55 |
Directory.CreateDirectory(PathString); |
|
56 |
} |
|
57 |
|
|
786 | 58 |
XmlWriterSettings settings = new XmlWriterSettings(); |
787 | 59 |
settings.Indent = true; |
788 | 60 |
settings.NewLineOnAttributes = true; |
789 | 61 |
|
790 |
XmlWriter xmlWriter = XmlWriter.Create(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml");
|
|
62 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath);
|
|
791 | 63 |
xmlWriter.WriteStartDocument(); |
792 | 64 |
xmlWriter.WriteStartElement("Root"); |
793 |
|
|
65 |
|
|
794 | 66 |
xmlWriter.WriteEndDocument(); |
795 | 67 |
|
796 | 68 |
xmlWriter.Flush(); |
797 | 69 |
xmlWriter.Close(); |
798 | 70 |
} |
799 | 71 |
|
800 |
xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 로딩 |
|
801 |
var root = layerControl.MarkupToString(currentControl, App.ViewInfo.UserID); |
|
72 |
xmlDoc.Load(FilePath); // XML문서 로딩 |
|
73 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
|
74 |
for (int i = 0; i < tempDtList.Count; i++) |
|
75 |
{ |
|
76 |
bool check = true; |
|
802 | 77 |
|
803 |
newNode = xmlDoc.SelectSingleNode("Root"); // 추가할 부모 Node 찾기 |
|
804 |
xmlEle = xmlDoc.CreateElement("CommentID"); |
|
805 |
xmlEle.SetAttribute("Value", root.CommentID); |
|
806 |
newNode.AppendChild(xmlEle); |
|
78 |
foreach (XmlNode e in xmlDoc.GetElementsByTagName("CommentID")) |
|
79 |
{ |
|
80 |
if (e.Attributes["Value"].Value.Equals(tempDtList[i].CommentID)) //CommentID가 같은경우 |
|
81 |
{ |
|
82 |
//데이터 수정 |
|
83 |
e.SelectSingleNode("ConvertData").InnerText = tempDtList[i].ConvertData; |
|
84 |
e.SelectSingleNode("DATA_TYPE").InnerText = tempDtList[i].DATA_TYPE.ToString(); |
|
85 |
e.SelectSingleNode("MarkupInfoID").InnerText = tempDtList[i].MarkupInfoID; |
|
86 |
e.SelectSingleNode("PageNumber").InnerText = tempDtList[i].PageNumber.ToString(); |
|
87 |
e.SelectSingleNode("IsUpdate").InnerText = tempDtList[i].IsUpdate.ToString(); |
|
807 | 88 |
|
808 |
|
|
809 |
xmlEle1 = xmlDoc.CreateElement("MarkupInfoID"); // 추가할 Node 생성 |
|
810 |
xmlEle1.InnerText = currentControl.MarkupInfoID; |
|
811 |
xmlEle.AppendChild(xmlEle1); |
|
812 |
|
|
89 |
xmlDoc.Save(FilePath); // XML문서 저장 |
|
813 | 90 |
|
814 |
xmlEle2 = xmlDoc.CreateElement("ConvertData"); // 추가할 Node 생성 |
|
815 |
xmlEle2.InnerText = root.ConvertData; |
|
816 |
xmlEle.AppendChild(xmlEle2); |
|
91 |
check = false; |
|
92 |
break; |
|
93 |
} |
|
94 |
} |
|
817 | 95 |
|
818 |
xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); // 추가할 Node 생성 |
|
819 |
xmlEle3.InnerText = root.DATA_TYPE.ToString(); |
|
820 |
xmlEle.AppendChild(xmlEle3); |
|
96 |
if (check == true) |
|
97 |
{ |
|
98 |
newNode = xmlDoc.SelectSingleNode("Root"); // 추가할 부모 Node 찾기 |
|
99 |
xmlEle1 = xmlDoc.CreateElement("CommentID"); |
|
100 |
xmlEle1.SetAttribute("Value", tempDtList[i].CommentID); |
|
101 |
newNode.AppendChild(xmlEle1); |
|
821 | 102 |
|
822 |
xmlEle4 = xmlDoc.CreateElement("PageNumber"); // 추가할 Node 생성
|
|
823 |
xmlEle4.InnerText = PageNumber.ToString();
|
|
824 |
xmlEle.AppendChild(xmlEle4);
|
|
103 |
xmlEle2 = xmlDoc.CreateElement("ConvertData"); // 추가할 Node 생성
|
|
104 |
xmlEle2.InnerText = tempDtList[i].ConvertData;
|
|
105 |
xmlEle1.AppendChild(xmlEle2);
|
|
825 | 106 |
|
107 |
xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); // 추가할 Node 생성 |
|
108 |
xmlEle3.InnerText = tempDtList[i].DATA_TYPE.ToString(); |
|
109 |
xmlEle1.AppendChild(xmlEle3); |
|
826 | 110 |
|
827 |
xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장.. |
|
828 |
xmlDoc = null; |
|
111 |
xmlEle4 = xmlDoc.CreateElement("MarkupInfoID"); // 추가할 Node 생성 |
|
112 |
xmlEle4.InnerText = tempDtList[i].MarkupInfoID; |
|
113 |
xmlEle1.AppendChild(xmlEle4); |
|
829 | 114 |
|
830 |
}
|
|
831 |
catch(Exception ex)
|
|
832 |
{
|
|
115 |
xmlEle5 = xmlDoc.CreateElement("PageNumber"); // 추가할 Node 생성
|
|
116 |
xmlEle5.InnerText = tempDtList[i].PageNumber.ToString();
|
|
117 |
xmlEle1.AppendChild(xmlEle5);
|
|
833 | 118 |
|
834 |
} |
|
835 |
} |
|
119 |
xmlEle6 = xmlDoc.CreateElement("IsUpdate"); |
|
120 |
xmlEle6.InnerText = tempDtList[i].IsUpdate.ToString(); |
|
121 |
xmlEle1.AppendChild(xmlEle6); |
|
836 | 122 |
|
837 |
public void Remove() //저장 완료시 파일 삭제 |
|
838 |
{ |
|
839 |
FileInfo fileDel = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); |
|
840 |
if (fileDel.Exists) //삭제할 파일이 있는지 |
|
841 |
{ |
|
842 |
fileDel.Delete(); //없어도 에러안남 |
|
123 |
xmlDoc.Save(FilePath); // XML문서 저장.. |
|
124 |
} |
|
125 |
} |
|
126 |
xmlDoc = null; |
|
843 | 127 |
} |
844 | 128 |
} |
845 |
|
|
846 |
public const int DELETE = 0; |
|
847 |
public const int MOVE = 1; |
|
848 |
|
|
849 |
public void DataDel(string CommentID) //Control 삭제시 |
|
129 |
|
|
130 |
public void AddTemp(MarkupToPDF.Common.Undo_data undoDataList, int PageNumber, double x, double y) |
|
850 | 131 |
{ |
851 |
FileInfo fileEdit = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); |
|
852 |
if (fileEdit.Exists) //수정할 파일이 있는지 |
|
853 |
{ |
|
854 |
XmlDocument xmlDoc; |
|
855 |
xmlDoc = new XmlDocument(); |
|
856 |
xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 로딩 |
|
132 |
XmlDocument xmlDoc; |
|
133 |
XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4, xmlEle5, xmlEle6; |
|
134 |
XmlNode newNode; |
|
135 |
xmlDoc = new XmlDocument(); |
|
857 | 136 |
|
858 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
|
859 |
XmlElement root = xmlDoc.DocumentElement; |
|
860 |
|
|
861 |
foreach (XmlNode node in nodes) |
|
137 |
if ((System.IO.File.Exists(FilePath)) == false) |
|
138 |
{ |
|
139 |
if (!File.Exists(PathString)) |
|
862 | 140 |
{ |
863 |
string sCommentID = node.Attributes["Value"].Value; |
|
141 |
Directory.CreateDirectory(PathString); |
|
142 |
} |
|
864 | 143 |
|
865 |
if (sCommentID == CommentID) |
|
866 |
{ |
|
867 |
root.RemoveChild(xmlDoc.SelectNodes("//CommentID[@Value='" + CommentID + "']")[0]); |
|
868 |
} |
|
869 |
} |
|
144 |
XmlWriterSettings settings = new XmlWriterSettings(); |
|
145 |
settings.Indent = true; |
|
146 |
settings.NewLineOnAttributes = true; |
|
870 | 147 |
|
871 |
xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장 |
|
872 |
xmlDoc = null; |
|
148 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath); |
|
149 |
xmlWriter.WriteStartDocument(); |
|
150 |
xmlWriter.WriteStartElement("Root"); |
|
151 |
|
|
152 |
xmlWriter.WriteEndDocument(); |
|
873 | 153 |
|
154 |
xmlWriter.Flush(); |
|
155 |
xmlWriter.Close(); |
|
874 | 156 |
} |
875 |
else |
|
157 |
|
|
158 |
xmlDoc.Load(FilePath); // XML문서 로딩 |
|
159 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
|
160 |
for (int i = 0; i < undoDataList.Markup_List.Count; i++) |
|
876 | 161 |
{ |
877 |
MessageBox.Show("TEST : 임시파일이없음!!에러!!"); |
|
878 |
} |
|
879 |
} |
|
162 |
var root = layerControl.MarkupToString(undoDataList.Markup_List[i].Markup, App.ViewInfo.UserID); |
|
163 |
bool check = true; |
|
164 |
|
|
165 |
foreach (XmlNode e in xmlDoc.GetElementsByTagName("CommentID")) |
|
166 |
{ |
|
167 |
if (e.Attributes["Value"].Value.Equals(root.CommentID)) //CommentID가 같은경우 |
|
168 |
{ |
|
169 |
//데이터 수정 |
|
170 |
e.SelectSingleNode("ConvertData").InnerText = root.ConvertData; |
|
171 |
e.SelectSingleNode("DATA_TYPE").InnerText = root.DATA_TYPE.ToString(); |
|
172 |
e.SelectSingleNode("MarkupInfoID").InnerText = undoDataList.Markup_List[i].Markup.MarkupInfoID; |
|
173 |
e.SelectSingleNode("PageNumber").InnerText = PageNumber.ToString(); |
|
174 |
e.SelectSingleNode("IsUpdate").InnerText = 1.ToString(); |
|
880 | 175 |
|
176 |
xmlDoc.Save(FilePath); // XML문서 저장 |
|
881 | 177 |
|
882 |
public void DELADDTemp(CommentUserInfo currentControl, int PageNumber) |
|
883 |
{ |
|
884 |
try |
|
885 |
{ |
|
886 |
XmlDocument xmlDoc; |
|
887 |
XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4; |
|
888 |
XmlNode newNode; |
|
889 |
XmlElement xmlEle; |
|
890 |
xmlDoc = new XmlDocument(); |
|
178 |
check = false; |
|
179 |
break; |
|
180 |
} |
|
181 |
} |
|
891 | 182 |
|
892 |
if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"))
|
|
183 |
if (check == true)
|
|
893 | 184 |
{ |
894 |
XmlWriterSettings settings = new XmlWriterSettings(); |
|
895 |
settings.Indent = true; |
|
896 |
settings.NewLineOnAttributes = true; |
|
897 |
|
|
898 |
XmlWriter xmlWriter = XmlWriter.Create(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); |
|
899 |
xmlWriter.WriteStartDocument(); |
|
900 |
xmlWriter.WriteStartElement("Root"); |
|
185 |
newNode = xmlDoc.SelectSingleNode("Root"); |
|
186 |
xmlEle1 = xmlDoc.CreateElement("CommentID"); |
|
187 |
xmlEle1.SetAttribute("Value", root.CommentID); |
|
188 |
newNode.AppendChild(xmlEle1); |
|
901 | 189 |
|
902 |
xmlWriter.WriteEndDocument(); |
|
190 |
xmlEle2 = xmlDoc.CreateElement("ConvertData"); |
|
191 |
xmlEle2.InnerText = root.ConvertData; |
|
192 |
xmlEle1.AppendChild(xmlEle2); |
|
903 | 193 |
|
904 |
xmlWriter.Flush();
|
|
905 |
xmlWriter.Close();
|
|
906 |
}
|
|
194 |
xmlEle3 = xmlDoc.CreateElement("DATA_TYPE");
|
|
195 |
xmlEle3.InnerText = root.DATA_TYPE.ToString();
|
|
196 |
xmlEle1.AppendChild(xmlEle3);
|
|
907 | 197 |
|
908 |
xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 로딩 |
|
198 |
xmlEle4 = xmlDoc.CreateElement("MarkupInfoID"); |
|
199 |
xmlEle4.InnerText = undoDataList.Markup_List[i].Markup.MarkupInfoID; |
|
200 |
xmlEle1.AppendChild(xmlEle4); |
|
909 | 201 |
|
910 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
|
911 |
XmlElement root = xmlDoc.DocumentElement; |
|
202 |
xmlEle5 = xmlDoc.CreateElement("PageNumber"); |
|
203 |
xmlEle5.InnerText = PageNumber.ToString(); |
|
204 |
xmlEle1.AppendChild(xmlEle5); |
|
912 | 205 |
|
913 |
foreach (XmlNode node in nodes)
|
|
914 |
{
|
|
915 |
string sCommentID = node.Attributes["Value"].Value;
|
|
206 |
xmlEle6 = xmlDoc.CreateElement("IsUpdate");
|
|
207 |
xmlEle6.InnerText = 1.ToString();
|
|
208 |
xmlEle1.AppendChild(xmlEle6);
|
|
916 | 209 |
|
917 |
if (sCommentID == currentControl.CommentID) |
|
918 |
{ |
|
919 |
root.RemoveChild(xmlDoc.SelectNodes("//CommentID[@Value='" + currentControl.CommentID + "']")[0]); |
|
920 |
} |
|
210 |
xmlDoc.Save(FilePath); |
|
921 | 211 |
} |
212 |
} |
|
213 |
xmlDoc = null; |
|
214 |
} |
|
922 | 215 |
|
216 |
public void Remove() |
|
217 |
{ |
|
218 |
FileInfo fileDel = new FileInfo(FilePath); |
|
219 |
if (fileDel.Exists) |
|
220 |
{ |
|
221 |
fileDel.Delete(); |
|
222 |
} |
|
223 |
} |
|
923 | 224 |
|
924 |
var root1 = layerControl.MarkupToString(currentControl, App.ViewInfo.UserID); |
|
225 |
internal void DelTemp(string CommentID, string PageNumber) //Control 삭제시 |
|
226 |
{ |
|
227 |
if ((System.IO.File.Exists(FilePath)) == false) |
|
228 |
{ |
|
229 |
if (!File.Exists(PathString)) |
|
230 |
{ |
|
231 |
Directory.CreateDirectory(PathString); |
|
232 |
} |
|
925 | 233 |
|
926 |
newNode = xmlDoc.SelectSingleNode("Root"); // 추가할 부모 Node 찾기 |
|
927 |
xmlEle = xmlDoc.CreateElement("CommentID"); |
|
928 |
xmlEle.SetAttribute("Value", root1.CommentID); |
|
929 |
newNode.AppendChild(xmlEle); |
|
234 |
XmlWriterSettings settings = new XmlWriterSettings(); |
|
235 |
settings.Indent = true; |
|
236 |
settings.NewLineOnAttributes = true; |
|
930 | 237 |
|
931 |
xmlEle1 = xmlDoc.CreateElement("MarkupInfoID"); // 추가할 Node 생성
|
|
932 |
xmlEle1.InnerText = currentControl.MarkupInfoID;
|
|
933 |
xmlEle.AppendChild(xmlEle1);
|
|
238 |
XmlWriter xmlWriter = XmlWriter.Create(FilePath);
|
|
239 |
xmlWriter.WriteStartDocument();
|
|
240 |
xmlWriter.WriteStartElement("Root");
|
|
934 | 241 |
|
242 |
xmlWriter.WriteEndDocument(); |
|
935 | 243 |
|
936 |
xmlEle2 = xmlDoc.CreateElement("ConvertData"); // 추가할 Node 생성
|
|
937 |
xmlEle2.InnerText = root1.ConvertData;
|
|
938 |
xmlEle.AppendChild(xmlEle2);
|
|
244 |
xmlWriter.Flush();
|
|
245 |
xmlWriter.Close();
|
|
246 |
}
|
|
939 | 247 |
|
940 |
xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); // 추가할 Node 생성
|
|
941 |
xmlEle3.InnerText = root1.DATA_TYPE.ToString();
|
|
942 |
xmlEle.AppendChild(xmlEle3);
|
|
248 |
XmlDocument xmlDoc;
|
|
249 |
xmlDoc = new XmlDocument();
|
|
250 |
xmlDoc.Load(FilePath);
|
|
943 | 251 |
|
944 |
xmlEle4 = xmlDoc.CreateElement("PageNumber"); // 추가할 Node 생성 |
|
945 |
xmlEle4.InnerText = PageNumber.ToString(); |
|
946 |
xmlEle.AppendChild(xmlEle4); |
|
252 |
var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
|
253 |
XmlElement root = xmlDoc.DocumentElement; |
|
947 | 254 |
|
948 |
xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장.. |
|
949 |
xmlDoc = null; |
|
255 |
bool check = true; |
|
950 | 256 |
|
951 |
}
|
|
952 |
catch (Exception ex)
|
|
257 |
/*
|
|
258 |
foreach (XmlNode node in nodes)
|
|
953 | 259 |
{ |
260 |
string sCommentID = node.Attributes["Value"].Value; |
|
261 |
|
|
262 |
if (sCommentID == CommentID) |
|
263 |
{ |
|
264 |
root.RemoveChild(xmlDoc.SelectNodes("//CommentID[@Value='" + CommentID + "']")[0]); |
|
265 |
check = false; |
|
266 |
} |
|
267 |
}*/ |
|
954 | 268 |
|
269 |
if (check == true) |
|
270 |
{ |
|
271 |
XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4, xmlEle5, xmlEle6; |
|
272 |
XmlNode newNode; |
|
273 |
newNode = xmlDoc.SelectSingleNode("Root"); |
|
274 |
xmlEle1 = xmlDoc.CreateElement("CommentID"); |
|
275 |
xmlEle1.SetAttribute("Value", CommentID); |
|
276 |
newNode.AppendChild(xmlEle1); |
|
277 |
|
|
278 |
xmlEle2 = xmlDoc.CreateElement("ConvertData"); |
|
279 |
xmlEle2.InnerText = ""; |
|
280 |
xmlEle1.AppendChild(xmlEle2); |
|
281 |
|
|
282 |
xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); |
|
283 |
xmlEle3.InnerText = ""; |
|
284 |
xmlEle1.AppendChild(xmlEle3); |
|
285 |
|
|
286 |
xmlEle4 = xmlDoc.CreateElement("MarkupInfoID"); |
|
287 |
xmlEle4.InnerText = ""; |
|
288 |
xmlEle1.AppendChild(xmlEle4); |
|
289 |
|
|
290 |
xmlEle5 = xmlDoc.CreateElement("PageNumber"); |
|
291 |
xmlEle5.InnerText = PageNumber; |
|
292 |
xmlEle1.AppendChild(xmlEle5); |
|
293 |
|
|
294 |
xmlEle6 = xmlDoc.CreateElement("IsUpdate"); |
|
295 |
xmlEle6.InnerText = 2.ToString(); |
|
296 |
xmlEle1.AppendChild(xmlEle6); |
|
955 | 297 |
} |
956 |
} |
|
298 |
|
|
299 |
xmlDoc.Save(FilePath); |
|
300 |
xmlDoc = null; |
|
301 |
} |
|
957 | 302 |
} |
958 | 303 |
} |
959 | 304 |
|
내보내기 Unified diff