markus / MarkupToPDF_Old / Controls / Parsing / MarkupCopy.cs @ 5538eb5a
이력 | 보기 | 이력해설 | 다운로드 (28.4 KB)
1 |
using System; |
---|---|
2 |
using System.Net; |
3 |
using System.Windows; |
4 |
using System.Windows.Controls; |
5 |
using System.Windows.Documents; |
6 |
using System.Windows.Ink; |
7 |
using System.Windows.Input; |
8 |
using System.Windows.Media; |
9 |
using System.Windows.Media.Animation; |
10 |
using System.Windows.Shapes; |
11 |
using MarkupToPDF.Controls; |
12 |
using MarkupToPDF.Controls.Line; |
13 |
using MarkupToPDF.Controls.Shape; |
14 |
using MarkupToPDF.Controls.Polygon; |
15 |
using MarkupToPDF.Controls.Text; |
16 |
using MarkupToPDF.Controls.Etc; |
17 |
using MarkupToPDF.Controls.Common.ValueConverter; |
18 |
using MarkupToPDF.Serialize.S_Control; |
19 |
using MarkupToPDF.Serialize.Core; |
20 |
using System.Collections.Generic; |
21 |
using System.Collections.ObjectModel; |
22 |
using System.Text; |
23 |
using MarkupToPDF.Controls.Common; |
24 |
|
25 |
namespace MarkupToPDF.Controls.Parsing |
26 |
{ |
27 |
public partial class LayerControl : Control |
28 |
{ |
29 |
public string MarkupToString(ObservableCollection<Control> baseLayer) |
30 |
{ |
31 |
String ConvertData = ""; |
32 |
|
33 |
#region ######### 마크업 파싱########## |
34 |
foreach (UIElement item in baseLayer) |
35 |
{ |
36 |
switch (item.GetType().Name.ToString()) |
37 |
{ |
38 |
#region Arrow |
39 |
case "ArrowControl": |
40 |
using (S_ArrowControl STemp = new S_ArrowControl()) |
41 |
{ |
42 |
var instance = item as LineControl; |
43 |
STemp.TransformPoint = "0|0"; |
44 |
STemp.PointSet = instance.PointSet; |
45 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
46 |
STemp.ArStyle = instance.LineStyle; |
47 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
48 |
STemp.StartPoint = instance.StartPoint; |
49 |
STemp.EndPoint = instance.EndPoint; |
50 |
STemp.UserID = instance.UserID; |
51 |
STemp.DashSize = instance.DashSize; |
52 |
STemp.Opac = instance.Opacity; |
53 |
STemp.DimSize = instance.DimSize; |
54 |
STemp.Name = instance.GetType().Name.ToString(); |
55 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
56 |
}; |
57 |
break; |
58 |
#endregion |
59 |
#region Arrow_Multi |
60 |
case "ArrowControl_Multi": |
61 |
using (S_ArrowControl_Multi STemp = new S_ArrowControl_Multi()) |
62 |
{ |
63 |
var instance = item as ArrowControl_Multi; |
64 |
STemp.TransformPoint = "0|0"; |
65 |
STemp.PointSet = instance.PointSet; |
66 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
67 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
68 |
STemp.StartPoint = instance.StartPoint; |
69 |
STemp.EndPoint = instance.EndPoint; |
70 |
STemp.UserID = instance.UserID; |
71 |
STemp.Opac = instance.Opacity; |
72 |
STemp.DashSize = instance.DashSize; |
73 |
STemp.MidPoint = instance.MiddlePoint; |
74 |
STemp.Name = instance.GetType().Name.ToString(); |
75 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
76 |
}; |
77 |
break; |
78 |
#endregion |
79 |
#region ArrowText |
80 |
case "ArrowTextControl": |
81 |
using (S_ArrowTextControl STemp = new S_ArrowTextControl()) |
82 |
{ |
83 |
var instance = item as ArrowTextControl; |
84 |
STemp.TransformPoint = "0|0"; |
85 |
STemp.PointSet = instance.PointSet; |
86 |
//STemp.SizeSet = String.Format("{0}", instance.LineSize); |
87 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
88 |
STemp.StartPoint = instance.StartPoint; |
89 |
STemp.ArrowStyle = instance.ArrowTextStyle; |
90 |
STemp.UserID = instance.UserID; |
91 |
STemp.ArrowText = instance.Base_TextBox.Text; |
92 |
STemp.BorderSize = instance.BorderSize; |
93 |
STemp.isHighLight = instance.isHighLight; |
94 |
STemp.BoxHeight = instance.BoxHeight; |
95 |
STemp.BoxWidth = instance.BoxWidth; |
96 |
STemp.Opac = instance.Opacity; |
97 |
STemp.EndPoint = instance.EndPoint; |
98 |
STemp.isFixed = instance.isFixed; |
99 |
//STemp.DashSize = instance.DashSize; |
100 |
STemp.Name = instance.GetType().Name.ToString(); |
101 |
STemp.isTrans = instance.isTrans; |
102 |
STemp.MidPoint = instance.MidPoint; |
103 |
//STemp.Angle = instance.Angle; |
104 |
STemp.fontConfig = new List<string>() |
105 |
{ |
106 |
instance.TextFamily.ToString(), |
107 |
instance.TextStyle.ToString(), |
108 |
instance.TextWeight.ToString(), |
109 |
instance.TextSize.ToString(), |
110 |
}; |
111 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
112 |
}; |
113 |
break; |
114 |
#endregion |
115 |
#region Line |
116 |
case "LineControl": |
117 |
using (S_LineControl STemp = new S_LineControl()) |
118 |
{ |
119 |
var instance = item as LineControl; |
120 |
STemp.TransformPoint = "0|0"; |
121 |
STemp.PointSet = instance.PointSet; |
122 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
123 |
STemp.LineStyleSet = instance.ControlType; |
124 |
STemp.StokeColor = instance.StrokeColor.Color.ToString(); |
125 |
STemp.StartPoint = instance.StartPoint; |
126 |
STemp.EndPoint = instance.EndPoint; |
127 |
STemp.UserID = instance.UserID; |
128 |
STemp.Opac = instance.Opacity; |
129 |
STemp.DashSize = instance.DashSize; |
130 |
STemp.Interval = instance.Interval; |
131 |
STemp.Name = instance.GetType().Name.ToString(); |
132 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
133 |
}; |
134 |
break; |
135 |
#endregion |
136 |
#region Arc |
137 |
case "ArcControl": |
138 |
using (S_ArcControl STemp = new S_ArcControl()) |
139 |
{ |
140 |
var instance = item as ArcControl; |
141 |
STemp.TransformPoint = "0|0"; |
142 |
STemp.PointSet = instance.PointSet; |
143 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
144 |
STemp.StokeColor = instance.StrokeColor.Color.ToString(); |
145 |
STemp.StartPoint = instance.StartPoint; |
146 |
STemp.UserID = instance.UserID; |
147 |
STemp.Opac = instance.Opacity; |
148 |
STemp.MidPoint = instance.MidPoint; |
149 |
STemp.EndPoint = instance.EndPoint; |
150 |
STemp.IsTransOn = instance.isTransOn; |
151 |
STemp.DashSize = instance.DashSize; |
152 |
STemp.Clock = instance.Clock; |
153 |
//STemp.ArcStyleSet = instance.ControlType; |
154 |
STemp.Name = instance.GetType().Name.ToString(); |
155 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
156 |
}; |
157 |
break; |
158 |
#endregion |
159 |
#region RectCloud |
160 |
case "RectCloudControl": |
161 |
{ |
162 |
using (S_RectCloudControl STemp = new S_RectCloudControl()) |
163 |
{ |
164 |
var instance = item as RectCloudControl; |
165 |
STemp.TransformPoint = "0|0"; |
166 |
STemp.PointSet = instance.PointSet; |
167 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
168 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
169 |
STemp.StartPoint = instance.StartPoint; |
170 |
STemp.UserID = instance.UserID; |
171 |
STemp.Opac = instance.Opacity; |
172 |
STemp.TR = instance.TopRightPoint; |
173 |
STemp.LB = instance.LeftBottomPoint; |
174 |
STemp.EndPoint = instance.EndPoint; |
175 |
STemp.PaintState = instance.Paint; |
176 |
STemp.DashSize = instance.DashSize; |
177 |
STemp.Name = instance.GetType().Name.ToString(); |
178 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
179 |
} |
180 |
} |
181 |
break; |
182 |
#endregion |
183 |
#region Circle |
184 |
case "CircleControl": |
185 |
using (S_CircleControl STemp = new S_CircleControl()) |
186 |
{ |
187 |
var instance = item as CircleControl; |
188 |
STemp.TransformPoint = "0|0"; |
189 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
190 |
STemp.PaintState = instance.Paint; |
191 |
STemp.StokeColor = instance.StrokeColor.Color.ToString(); |
192 |
if (instance.FillColor != null) |
193 |
{ |
194 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
195 |
} |
196 |
STemp.StartPoint = instance.StartPoint; |
197 |
STemp.UserID = instance.UserID; |
198 |
STemp.EndPoint = instance.EndPoint; |
199 |
STemp.TRP = instance.TopRightPoint; |
200 |
STemp.LBP = instance.LeftBottomPoint; |
201 |
STemp.Opac = instance.Opacity; |
202 |
STemp.Angle = instance.Angle; |
203 |
STemp.PointSet = instance.PointSet; |
204 |
STemp.DashSize = instance.DashSize; |
205 |
STemp.Name = instance.GetType().Name.ToString(); |
206 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
207 |
}; |
208 |
break; |
209 |
#endregion |
210 |
#region Rectangle |
211 |
case "RectangleControl": |
212 |
using (S_RectControl STemp = new S_RectControl()) |
213 |
{ |
214 |
var instance = item as RectangleControl; |
215 |
STemp.TransformPoint = "0|0"; |
216 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
217 |
//STemp.PaintState = instance.Paint; |
218 |
//STemp.PointSet = instance.PointSet; |
219 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
220 |
if (instance.FillColor != null) |
221 |
{ |
222 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
223 |
} |
224 |
STemp.StartPoint = instance.StartPoint; |
225 |
STemp.UserID = instance.Uid; |
226 |
//STemp.Angle = instance.a; |
227 |
STemp.EndPoint = instance.EndPoint; |
228 |
STemp.LB = instance.LeftBottomPoint; |
229 |
STemp.TR = instance.TopRightPoint; |
230 |
//STemp.DashSize = instance.DashSize; |
231 |
STemp.Opac = instance.Opacity; |
232 |
STemp.Name = instance.GetType().Name.ToString(); |
233 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
234 |
}; |
235 |
break; |
236 |
#endregion |
237 |
#region Triangle |
238 |
case "TriControl": |
239 |
using (S_TriControl STemp = new S_TriControl()) |
240 |
{ |
241 |
var instance = item as TriControl; |
242 |
STemp.TransformPoint = "0|0"; |
243 |
STemp.Paint = instance.Paint; |
244 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
245 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
246 |
if (instance.FillColor != null) |
247 |
{ |
248 |
STemp.FillColor = instance.FillColor.Color.ToString(); |
249 |
} |
250 |
STemp.StartPoint = instance.StartPoint; |
251 |
STemp.EndPoint = instance.EndPoint; |
252 |
STemp.MidPoint = instance.MidPoint; |
253 |
STemp.Opac = instance.Opacity; |
254 |
STemp.UserID = instance.UserID; |
255 |
STemp.PointSet = instance.PointSet; |
256 |
STemp.Angle = instance.Angle; |
257 |
STemp.DashSize = instance.DashSize; |
258 |
STemp.Name = instance.GetType().Name.ToString(); |
259 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
260 |
} |
261 |
break; |
262 |
#endregion |
263 |
#region Poly |
264 |
case "PolygonControl": |
265 |
using (S_PolyControl STemp = new S_PolyControl()) |
266 |
{ |
267 |
var instance = item as PolygonControl; |
268 |
|
269 |
STemp.TransformPoint = "0|0"; |
270 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
271 |
//STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
272 |
STemp.Name = instance.GetType().Name.ToString(); |
273 |
//STemp.Toler = instance.Toler; |
274 |
//STemp.PaintState = instance.Paint; |
275 |
STemp.Opac = instance.Opacity; |
276 |
STemp.UserID = instance.UserID; |
277 |
//STemp.IsTrans = instance.isTransOn; |
278 |
//STemp.IsChain = instance.isChain; |
279 |
STemp.PointSet = new List<Point>(); |
280 |
//STemp.DashSize = instance.DashSize; |
281 |
STemp.IsCompleted = instance.IsCompleted; |
282 |
foreach (var point in instance.PointSet) |
283 |
{ |
284 |
STemp.PointSet.Add(point); |
285 |
} |
286 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
287 |
}; |
288 |
break; |
289 |
#endregion |
290 |
#region Cloud |
291 |
case "CloudControl": |
292 |
using (S_CloudControl STemp = new S_CloudControl()) |
293 |
{ |
294 |
var instance = item as CloudControl; |
295 |
|
296 |
STemp.TransformPoint = "0|0"; |
297 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
298 |
STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
299 |
STemp.Name = instance.GetType().Name.ToString(); |
300 |
STemp.Toler = instance.Toler; |
301 |
STemp.PaintState = instance.Paint; |
302 |
STemp.Opac = instance.Opacity; |
303 |
STemp.UserID = instance.UserID; |
304 |
STemp.IsTrans = instance.isTransOn; |
305 |
STemp.IsChain = instance.isChain; |
306 |
STemp.PointSet = new List<Point>(); |
307 |
STemp.DashSize = instance.DashSize; |
308 |
foreach (var point in instance.PointSet) |
309 |
{ |
310 |
STemp.PointSet.Add(point); |
311 |
} |
312 |
|
313 |
//STemp.CloudFill = instance.Fill; |
314 |
STemp.ArcLength = instance.ArcLength; |
315 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
316 |
} |
317 |
break; |
318 |
#endregion |
319 |
#region Sign |
320 |
case "SignControl": |
321 |
{ |
322 |
using (S_SignControl STemp = new S_SignControl()) |
323 |
{ |
324 |
//SignControl instance = item as SignControl; |
325 |
//STemp.Angle = instance.Angle; |
326 |
//STemp.EndPoint = instance.EndPoint; |
327 |
//STemp.UserID = instance.UserID; |
328 |
//STemp.LB = instance.LeftBottomPoint; |
329 |
//STemp.Name = instance.GetType().Name; |
330 |
//STemp.PointSet = instance.PointSet; |
331 |
//STemp.StartPoint = instance.StartPoint; |
332 |
//STemp.Opac = instance.Opacity; |
333 |
//STemp.TR = instance.TopRightPoint; |
334 |
//STemp.UserNumber = instance.UserNumber; |
335 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
336 |
} |
337 |
} |
338 |
break; |
339 |
#endregion |
340 |
#region Ink |
341 |
case "InkPresenter": |
342 |
{ |
343 |
var instance = item as InkPresenter; |
344 |
if (instance.Strokes.Count >= 1) |
345 |
{ |
346 |
using (S_PensilControl STemp = new S_PensilControl()) |
347 |
{ |
348 |
bool isRealData = true; |
349 |
foreach (var strokeData in instance.Strokes) |
350 |
{ |
351 |
if (strokeData.StylusPoints.Count == 0) |
352 |
{ |
353 |
isRealData = false; |
354 |
} |
355 |
} |
356 |
if (isRealData) |
357 |
{ |
358 |
if (instance.Tag != null) |
359 |
{ |
360 |
STemp.UserID = instance.Tag.ToString(); |
361 |
} |
362 |
STemp.SCC = instance.Strokes; |
363 |
STemp.Name = instance.GetType().Name; |
364 |
STemp.Opac = instance.Opacity; |
365 |
STemp.TransformPoint = "0|0"; |
366 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
367 |
} |
368 |
} |
369 |
} |
370 |
} |
371 |
break; |
372 |
#endregion |
373 |
#region Text |
374 |
case "TextControl": |
375 |
using (S_TextControl STemp = new S_TextControl()) |
376 |
{ |
377 |
|
378 |
var instance = item as TextControl; |
379 |
STemp.TransformPoint = "0|0"; |
380 |
STemp.SizeSet = String.Format("{0}|{1}", instance.LineSize.Left.ToString(), instance.TextSize.ToString()); |
381 |
STemp.Text = instance.Text; |
382 |
STemp.UserID = instance.UserID; |
383 |
STemp.FontColor = instance.FontColor.Color.ToString(); |
384 |
//STemp.EndPoint = instance.EndPoint; |
385 |
STemp.StartPoint = new Point(instance.CanvasX, instance.CanvasY); |
386 |
STemp.Opac = instance.Opacity; |
387 |
//STemp.StartPoint = instance.StartPoint; |
388 |
STemp.PointSet = instance.PointSet; |
389 |
STemp.Angle = instance.Angle; |
390 |
STemp.paintMethod = instance.ControlType_No; |
391 |
STemp.BoxW = instance.BoxWidth; |
392 |
STemp.BoxH = instance.BoxHeight; |
393 |
STemp.isHighLight = instance.IsHighLight; |
394 |
STemp.Name = instance.GetType().Name.ToString(); |
395 |
STemp.fontConfig = new List<string>() |
396 |
{ |
397 |
instance.TextFamily.ToString(), |
398 |
instance.TextStyle.ToString(), |
399 |
instance.TextWeight.ToString(), |
400 |
}; |
401 |
|
402 |
|
403 |
|
404 |
if (instance.UnderLine != null) |
405 |
{ |
406 |
STemp.fontConfig.Add("true"); |
407 |
} |
408 |
|
409 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
410 |
} |
411 |
break; |
412 |
#endregion |
413 |
#region Date |
414 |
case "DateControl": |
415 |
{ |
416 |
using (S_DateControl STemp = new S_DateControl()) |
417 |
{ |
418 |
DateControl instance = item as DateControl; |
419 |
STemp.Angle = instance.Angle; |
420 |
STemp.EndPoint = instance.EndPoint; |
421 |
STemp.UserID = instance.UserID; |
422 |
STemp.LB = instance.LeftBottomPoint; |
423 |
STemp.Name = instance.GetType().Name; |
424 |
STemp.PointSet = instance.PointSet; |
425 |
STemp.StartPoint = instance.StartPoint; |
426 |
STemp.Opac = instance.Opacity; |
427 |
STemp.TR = instance.TopRightPoint; |
428 |
STemp.TransformPoint = "0|0"; |
429 |
STemp.FontColor = instance.FontColor.Color.ToString(); |
430 |
STemp.SizeSet = String.Format("{0}", instance.LineSize); |
431 |
STemp.Text = instance.Text; |
432 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
433 |
} |
434 |
} |
435 |
break; |
436 |
#endregion |
437 |
#region Symbol |
438 |
case "SymControl": |
439 |
using (S_SymControl STemp = new S_SymControl()) |
440 |
{ |
441 |
//var instance = item as SymControl; |
442 |
//STemp.TransformPoint = "0|0"; |
443 |
//STemp.PointSet = instance.PointSet; |
444 |
//STemp.UserID = instance.UserID; |
445 |
//STemp.SizeSet = String.Format("{0}", instance.LineSize.ToString()); |
446 |
//STemp.PaintState = instance.Paint; |
447 |
//STemp.PathInfo = instance.PathData.ToString(); |
448 |
//STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
449 |
//STemp.StartPoint = instance.StartPoint; |
450 |
//STemp.Angle = instance.Angle; |
451 |
//STemp.EndPoint = instance.EndPoint; |
452 |
//STemp.LB = instance.LeftBottomPoint; |
453 |
//STemp.TR = instance.TopRightPoint; |
454 |
//STemp.Opac = instance.Opacity; |
455 |
//STemp.Name = instance.GetType().Name.ToString(); |
456 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
457 |
} |
458 |
break; |
459 |
#endregion |
460 |
#region SymbolN |
461 |
case "SymControlN": |
462 |
using (S_SymControlN STemp = new S_SymControlN()) |
463 |
{ |
464 |
//var instance = item as SymControlN; |
465 |
//STemp.TransformPoint = "0|0"; |
466 |
//STemp.PointSet = instance.PointSet; |
467 |
////STemp.XamlData = instance.PathXathData; |
468 |
//STemp.UserID = instance.UserID; |
469 |
//STemp.DBData = JsonSerializerHelper.CompressString(instance.PathXathData); |
470 |
////STemp.StrokeColor = instance.StrokeColor.Color.ToString(); |
471 |
//STemp.StartPoint = instance.StartPoint; |
472 |
//STemp.Angle = instance.Angle; |
473 |
//STemp.EndPoint = instance.EndPoint; |
474 |
//STemp.LB = instance.LeftBottomPoint; |
475 |
//STemp.TR = instance.TopRightPoint; |
476 |
//STemp.Opac = instance.Opacity; |
477 |
//STemp.Name = instance.GetType().Name.ToString(); |
478 |
//ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
479 |
} |
480 |
break; |
481 |
#endregion |
482 |
#region Image |
483 |
case "ImgControl": |
484 |
using (S_ImgControl STemp = new S_ImgControl()) |
485 |
{ |
486 |
ImgControl instance = item as ImgControl; |
487 |
STemp.Angle = instance.Angle; |
488 |
STemp.EndPoint = instance.EndPoint; |
489 |
STemp.LB = instance.LeftBottomPoint; |
490 |
STemp.Name = instance.GetType().Name; |
491 |
STemp.PointSet = instance.PointSet; |
492 |
STemp.StartPoint = instance.StartPoint; |
493 |
STemp.UserID = instance.UserID; |
494 |
STemp.Opac = instance.Opacity; |
495 |
STemp.TR = instance.TopRightPoint; |
496 |
STemp.ImagePath = instance.FilePath; |
497 |
ConvertData += "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
498 |
} |
499 |
break; |
500 |
#endregion |
501 |
default: |
502 |
break; |
503 |
} |
504 |
} |
505 |
#endregion |
506 |
|
507 |
return ConvertData; |
508 |
} |
509 |
|
510 |
//GUID생성 |
511 |
public Guid GetUniqueGuid() |
512 |
{ |
513 |
char[] chars = "ABCDEF1234567890".ToCharArray(); |
514 |
byte[] data = new byte[1]; |
515 |
System.Security.Cryptography.RNGCryptoServiceProvider crypto = new System.Security.Cryptography.RNGCryptoServiceProvider(); |
516 |
crypto.GetNonZeroBytes(data); |
517 |
data = new byte[32]; |
518 |
crypto.GetNonZeroBytes(data); |
519 |
StringBuilder result = new StringBuilder(32); |
520 |
|
521 |
foreach (byte b in data) |
522 |
{ |
523 |
result.Append(chars[b % (chars.Length - 1)]); |
524 |
} |
525 |
|
526 |
return Guid.ParseExact(result.ToString(0, 8) + "-" + result.ToString(8, 4) + "-" + result.ToString(11, 4) + "-" |
527 |
+ result.ToString(16, 4) + "-" + result.ToString(20, 12), "D"); |
528 |
} |
529 |
} |
530 |
} |