markus / KCOM / Common / TempFile.cs @ 2b19f5f2
이력 | 보기 | 이력해설 | 다운로드 (44.7 KB)
1 | ccf944bb | ljiyeon | using IKCOM; |
---|---|---|---|
2 | using KCOM.Common; |
||
3 | using KCOMDataModel.DataModel; |
||
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; |
||
9 | using System; |
||
10 | using System.Collections.Generic; |
||
11 | using System.IO; |
||
12 | using System.Linq; |
||
13 | using System.Text; |
||
14 | using System.Xml; |
||
15 | using System.Net; |
||
16 | using System.Windows; |
||
17 | using System.Windows.Controls; |
||
18 | using System.Windows.Documents; |
||
19 | using System.Windows.Ink; |
||
20 | using System.Windows.Input; |
||
21 | 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 | |||
32 | |||
33 | namespace KCOM |
||
34 | { |
||
35 | public class TempFile |
||
36 | { |
||
37 | // public Undo_data UndoData { get; set; } |
||
38 | public class MarkupReturn |
||
39 | { |
||
40 | public string ConvertData { get; set; } |
||
41 | public int DATA_TYPE { get; set; } |
||
42 | public string CommentID { get; set; } |
||
43 | } |
||
44 | |||
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 | MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
773 | |||
774 | public void AddTemp(CommentUserInfo currentControl, int PageNumber) |
||
775 | { |
||
776 | try |
||
777 | { |
||
778 | XmlDocument xmlDoc; |
||
779 | XmlElement xmlEle1, xmlEle2, xmlEle3, xmlEle4; |
||
780 | XmlNode newNode; |
||
781 | XmlElement xmlEle; |
||
782 | xmlDoc = new XmlDocument(); |
||
783 | |||
784 | if(!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml")) |
||
785 | { |
||
786 | XmlWriterSettings settings = new XmlWriterSettings(); |
||
787 | settings.Indent = true; |
||
788 | settings.NewLineOnAttributes = true; |
||
789 | |||
790 | XmlWriter xmlWriter = XmlWriter.Create(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); |
||
791 | xmlWriter.WriteStartDocument(); |
||
792 | xmlWriter.WriteStartElement("Root"); |
||
793 | |||
794 | xmlWriter.WriteEndDocument(); |
||
795 | |||
796 | xmlWriter.Flush(); |
||
797 | xmlWriter.Close(); |
||
798 | } |
||
799 | |||
800 | xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 로딩 |
||
801 | var root = layerControl.MarkupToString(currentControl, App.ViewInfo.UserID); |
||
802 | |||
803 | newNode = xmlDoc.SelectSingleNode("Root"); // 추가할 부모 Node 찾기 |
||
804 | xmlEle = xmlDoc.CreateElement("CommentID"); |
||
805 | xmlEle.SetAttribute("Value", root.CommentID); |
||
806 | newNode.AppendChild(xmlEle); |
||
807 | |||
808 | |||
809 | xmlEle1 = xmlDoc.CreateElement("MarkupInfoID"); // 추가할 Node 생성 |
||
810 | xmlEle1.InnerText = currentControl.MarkupInfoID; |
||
811 | xmlEle.AppendChild(xmlEle1); |
||
812 | |||
813 | |||
814 | xmlEle2 = xmlDoc.CreateElement("ConvertData"); // 추가할 Node 생성 |
||
815 | xmlEle2.InnerText = root.ConvertData; |
||
816 | xmlEle.AppendChild(xmlEle2); |
||
817 | |||
818 | xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); // 추가할 Node 생성 |
||
819 | xmlEle3.InnerText = root.DATA_TYPE.ToString(); |
||
820 | xmlEle.AppendChild(xmlEle3); |
||
821 | |||
822 | xmlEle4 = xmlDoc.CreateElement("PageNumber"); // 추가할 Node 생성 |
||
823 | xmlEle4.InnerText = PageNumber.ToString(); |
||
824 | xmlEle.AppendChild(xmlEle4); |
||
825 | |||
826 | |||
827 | xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장.. |
||
828 | xmlDoc = null; |
||
829 | |||
830 | } |
||
831 | catch(Exception ex) |
||
832 | { |
||
833 | |||
834 | } |
||
835 | } |
||
836 | |||
837 | public void Remove() //저장 완료시 파일 삭제 |
||
838 | { |
||
839 | FileInfo fileDel = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); |
||
840 | if (fileDel.Exists) //삭제할 파일이 있는지 |
||
841 | { |
||
842 | fileDel.Delete(); //없어도 에러안남 |
||
843 | } |
||
844 | } |
||
845 | |||
846 | public const int DELETE = 0; |
||
847 | public const int MOVE = 1; |
||
848 | |||
849 | public void DataDel(string CommentID) //Control 삭제시 |
||
850 | { |
||
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문서 로딩 |
||
857 | |||
858 | var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
||
859 | XmlElement root = xmlDoc.DocumentElement; |
||
860 | |||
861 | foreach (XmlNode node in nodes) |
||
862 | { |
||
863 | string sCommentID = node.Attributes["Value"].Value; |
||
864 | |||
865 | if (sCommentID == CommentID) |
||
866 | { |
||
867 | root.RemoveChild(xmlDoc.SelectNodes("//CommentID[@Value='" + CommentID + "']")[0]); |
||
868 | } |
||
869 | } |
||
870 | |||
871 | xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장 |
||
872 | xmlDoc = null; |
||
873 | |||
874 | } |
||
875 | else |
||
876 | { |
||
877 | MessageBox.Show("TEST : 임시파일이없음!!에러!!"); |
||
878 | } |
||
879 | } |
||
880 | |||
881 | |||
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(); |
||
891 | |||
892 | if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml")) |
||
893 | { |
||
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"); |
||
901 | |||
902 | xmlWriter.WriteEndDocument(); |
||
903 | |||
904 | xmlWriter.Flush(); |
||
905 | xmlWriter.Close(); |
||
906 | } |
||
907 | |||
908 | xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 로딩 |
||
909 | |||
910 | var nodes = xmlDoc.SelectNodes("/Root/CommentID"); |
||
911 | XmlElement root = xmlDoc.DocumentElement; |
||
912 | |||
913 | foreach (XmlNode node in nodes) |
||
914 | { |
||
915 | string sCommentID = node.Attributes["Value"].Value; |
||
916 | |||
917 | if (sCommentID == currentControl.CommentID) |
||
918 | { |
||
919 | root.RemoveChild(xmlDoc.SelectNodes("//CommentID[@Value='" + currentControl.CommentID + "']")[0]); |
||
920 | } |
||
921 | } |
||
922 | |||
923 | |||
924 | var root1 = layerControl.MarkupToString(currentControl, App.ViewInfo.UserID); |
||
925 | |||
926 | newNode = xmlDoc.SelectSingleNode("Root"); // 추가할 부모 Node 찾기 |
||
927 | xmlEle = xmlDoc.CreateElement("CommentID"); |
||
928 | xmlEle.SetAttribute("Value", root1.CommentID); |
||
929 | newNode.AppendChild(xmlEle); |
||
930 | |||
931 | xmlEle1 = xmlDoc.CreateElement("MarkupInfoID"); // 추가할 Node 생성 |
||
932 | xmlEle1.InnerText = currentControl.MarkupInfoID; |
||
933 | xmlEle.AppendChild(xmlEle1); |
||
934 | |||
935 | |||
936 | xmlEle2 = xmlDoc.CreateElement("ConvertData"); // 추가할 Node 생성 |
||
937 | xmlEle2.InnerText = root1.ConvertData; |
||
938 | xmlEle.AppendChild(xmlEle2); |
||
939 | |||
940 | xmlEle3 = xmlDoc.CreateElement("DATA_TYPE"); // 추가할 Node 생성 |
||
941 | xmlEle3.InnerText = root1.DATA_TYPE.ToString(); |
||
942 | xmlEle.AppendChild(xmlEle3); |
||
943 | |||
944 | xmlEle4 = xmlDoc.CreateElement("PageNumber"); // 추가할 Node 생성 |
||
945 | xmlEle4.InnerText = PageNumber.ToString(); |
||
946 | xmlEle.AppendChild(xmlEle4); |
||
947 | |||
948 | xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML문서 저장.. |
||
949 | xmlDoc = null; |
||
950 | |||
951 | } |
||
952 | catch (Exception ex) |
||
953 | { |
||
954 | |||
955 | } |
||
956 | } |
||
957 | } |
||
958 | } |