프로젝트

일반

사용자정보

개정판 c73426a9

IDc73426a9cfe121831292ed3f8739ca17860d790e
상위 f286e80b
하위 e1fb3d16, 37262028

이지연이(가) 5년 이상 전에 추가함

issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)

Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b

차이점 보기:

KCOM/Views/MainMenu.xaml.cs
4647 4647
                                    }
4648 4648
                                    else
4649 4649
                                    {
4650
                                        
4650 4651
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
4651 4652
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
4652 4653
                                        {
......
6193 6194
                        string guid = Save.shortGuid();
6194 6195

  
6195 6196
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
6197
                        //Check_Uri.UriCheck();
6196 6198
                        fileUploader.RunCompleted += (ex, arg) =>
6197 6199
                        {
6198 6200
                            filename = arg.Result;
......
6212 6214
                                }                                
6213 6215
                            }
6214 6216

  
6215

  
6216

  
6217 6217
                            if (symbolsvg == true)
6218 6218
                            {
6219
                                //Common.Converter.SvgConverter svgConverter = new Common.Converter.SvgConverter();
6220
                                var defaultBitmapImage = new BitmapImage();
6221
                                defaultBitmapImage.BeginInit();
6222
                                defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
6223
                                defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
6224
                                defaultBitmapImage.UriSource = new Uri(filename);
6225
                                defaultBitmapImage.EndInit();
6226

  
6227
                                System.Drawing.Bitmap image;
6228

  
6229
                                if (defaultBitmapImage.IsDownloading)
6219
                                try
6230 6220
                                {
6231
                                    defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
6232
                                    {
6233
                                        defaultBitmapImage.Freeze();
6234
                                        //GC.Collect();
6221
                                    var defaultBitmapImage = new BitmapImage();
6222
                                    defaultBitmapImage.BeginInit();
6223
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
6224
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
6225
                                    Check_Uri.UriCheck(filename);
6226
                                    defaultBitmapImage.UriSource = new Uri(filename);
6227
                                    defaultBitmapImage.EndInit();
6235 6228

  
6236
                                        image = GetBitmap(defaultBitmapImage);
6229
                                    System.Drawing.Bitmap image;
6237 6230

  
6238
                                        image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
6239

  
6240
                                        Process potrace = new Process
6231
                                    if (defaultBitmapImage.IsDownloading)
6232
                                    {
6233
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
6241 6234
                                        {
6242
                                            StartInfo = new ProcessStartInfo
6235
                                            defaultBitmapImage.Freeze();
6236
                                            image = GetBitmap(defaultBitmapImage);
6237
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
6238
                                            Process potrace = new Process
6243 6239
                                            {
6244
                                                //FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe",
6245
                                                FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
6246
                                                //Arguments = "-s -u 1", //SVG
6247
                                                //Arguments = "- -o- --svg",
6248
                                                //Arguments = filename2 + "  --backend svg",
6249
                                                //Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + "  --backend svg -i",
6250
                                                //Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6251
                                                Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6252
                                                RedirectStandardInput = true,
6253
                                                RedirectStandardOutput = true,
6254
                                                //RedirectStandardError = Program.IsDebug,
6255
                                                RedirectStandardError = true,
6256
                                                UseShellExecute = false,
6257
                                                CreateNoWindow = true,
6258
                                                WindowStyle = ProcessWindowStyle.Hidden
6259
                                            },
6260
                                            //EnableRaisingEvents = false
6261
                                        };
6262

  
6263
                                        StringBuilder svgBuilder = new StringBuilder();
6264
                                        potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => {
6265
                                            svgBuilder.AppendLine(e2.Data);
6266
                                        };
6267

  
6268

  
6269
                                        //potrace.WaitForExit();
6240
                                                StartInfo = new ProcessStartInfo
6241
                                                {
6242
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
6243
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6244
                                                    RedirectStandardInput = true,
6245
                                                    RedirectStandardOutput = true,
6246
                                                    RedirectStandardError = true,
6247
                                                    UseShellExecute = false,
6248
                                                    CreateNoWindow = true,
6249
                                                    WindowStyle = ProcessWindowStyle.Hidden
6250
                                                },
6251
                                            };
6270 6252

  
6271
                                        potrace.EnableRaisingEvents = true;
6272
                                        potrace.Start();
6273
                                        potrace.Exited += (sender, e) => {
6274
                                            byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
6275
                                            //kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6276
                                            svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
6277
                                            if (symbolselectindex == 0)
6253
                                            StringBuilder svgBuilder = new StringBuilder();
6254
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
6278 6255
                                            {
6279
                                                SymbolSave(symbolname, svgfilename, data);
6280
                                            }
6281
                                            else
6256
                                                svgBuilder.AppendLine(e2.Data);
6257
                                            };
6258

  
6259
                                            potrace.EnableRaisingEvents = true;
6260
                                            potrace.Start();
6261
                                            potrace.Exited += (sender, e) =>
6282 6262
                                            {
6283
                                                SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6284
                                            }
6263
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
6264
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
6265
                                                Check_Uri.UriCheck(svgfilename);
6266
                                                if (symbolselectindex == 0)
6267
                                                {
6268
                                                    SymbolSave(symbolname, svgfilename, data);
6269
                                                }
6270
                                                else
6271
                                                {
6272
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6273
                                                }
6285 6274

  
6286
                                            DataBind();
6275
                                                DataBind();
6276
                                            };
6277
                                            potrace.WaitForExit();
6287 6278
                                        };
6288
                                        potrace.WaitForExit();
6289
                                        //potrace.WaitForExit();
6290
                                    };
6279
                                    }
6280
                                    else
6281
                                    {
6282
                                        //GC.Collect();
6283
                                    }
6291 6284
                                }
6292
                                else
6285
                                catch(Exception ee)
6293 6286
                                {
6294

  
6295
                                    //GC.Collect();
6287
                                    DialogMessage_Alert("" + ee, "Alert");
6296 6288
                                }
6297 6289
                            }
6298 6290
                        };                                             
......
6414 6406
        }
6415 6407
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
6416 6408
        {
6417
            Save save = new Save();
6418
            if (args.PromptResult != null)
6409
            try
6419 6410
            {
6420
                if (args.DialogResult.Value)
6411
                Save save = new Save();
6412
                if (args.PromptResult != null)
6421 6413
                {
6422
                    PngBitmapEncoder _Encoder = symImage(data);
6423

  
6424
                    System.IO.MemoryStream fs = new System.IO.MemoryStream();
6425
                    _Encoder.Save(fs);
6426
                    System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
6414
                    if (args.DialogResult.Value)
6415
                    {
6416
                        PngBitmapEncoder _Encoder = symImage(data);
6427 6417

  
6428
                    byte[] Img_byte = fs.ToArray();
6418
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
6419
                        _Encoder.Save(fs);
6420
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
6429 6421

  
6430
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6431
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
6422
                        byte[] Img_byte = fs.ToArray();
6432 6423

  
6433
                    if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
6434
                    {
6435
                        save.SymbolSave(args.PromptResult, filename, data);
6436
                    }
6437
                    else
6438
                    {
6439
                        save.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6424
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6425
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
6426
                        Check_Uri.UriCheck(filename);
6427
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
6428
                        {
6429
                            save.SymbolSave(args.PromptResult, filename, data);
6430
                        }
6431
                        else
6432
                        {
6433
                            save.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6434
                        }
6435
                        DataBind();
6440 6436
                    }
6441
                    DataBind();
6442 6437
                }
6443 6438
            }
6439
            catch(Exception ex)
6440
            {
6441
                DialogMessage_Alert("" + ex, "Alert");
6442
            }
6444 6443
        }
6445 6444

  
6446 6445
        public PngBitmapEncoder symImage(string data)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)