Esempio n. 1
0
        public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, SmartBox.Console.Service.ApplicationCenterWS.WebService ws)
        {
            string smartbox_console_path = System.Configuration.ConfigurationManager.AppSettings["smartbox_console_path"];
            IList<SMC_PackageExt> data = bo.GetNeedSyncPackageList();

            foreach (SMC_PackageExt ext in data)
            {
                SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageExt entity = CopyPackageExt(ext);

                //同步安装包到外网应用中心
                ws.PackageExtSync(entity);

                SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ faqEntity = new SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ();

                //同步问题反馈到外网应用中心
                //IList<SMC_PackageFAQ> faqs = bo.GetPackageFAQs(entity.pe_id);
                //foreach (SMC_PackageFAQ _faq in faqs)
                //{
                //    OutsideWS.SMC_PackageFAQ faq = CopyPackageFAQ(_faq);
                //    ws.PackageFAQSync(faq);
                //}

                //同步应用手册到外网应用中心
                IList<SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id);
                foreach (SMC_PackageManual _manual in manuals)
                {
                    SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageManual manual = CopyPackageManual(_manual);
                    ws.PackageManualSync(manual);
                }

                //同步截图表到外网应用中心
                IList<SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id);
                foreach (SMC_PackagePicture _pic in pics)
                {
                    SmartBox.Console.Service.ApplicationCenterWS.SMC_PackagePicture pic = CopyPackagePicture(_pic);
                    ws.PackagePictuerSync(pic);
                }

                //同步附件到外网应用中心
                string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id;
                if (Directory.Exists(entityFolder))
                {
                    string[] files = System.IO.Directory.GetFiles(entityFolder);

                    List<SmartBox.Console.Service.ApplicationCenterWS.FileEntity> fs = new List<SmartBox.Console.Service.ApplicationCenterWS.FileEntity>();
                    foreach (string filePath in files)
                    {
                        if (File.Exists(filePath))
                        {
                            FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                            SmartBox.Console.Service.ApplicationCenterWS.FileEntity fEntity = new SmartBox.Console.Service.ApplicationCenterWS.FileEntity();
                            fEntity.Content = new byte[s.Length];
                            s.Read(fEntity.Content, 0, (int)s.Length);
                            fEntity.FileName = Path.GetFileName(filePath);
                            fs.Add(fEntity);
                        }
                    }

                    try
                    {
                        ws.PackageFilesSync(fs.ToArray(), ext.pe_id);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Esempio n. 2
0
        public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, SmartBox.Console.Service.ApplicationCenterWS.WebService ws)
        {
            string smartbox_console_path = System.Configuration.ConfigurationManager.AppSettings["smartbox_console_path"];
            IList <SMC_PackageExt> data  = bo.GetNeedSyncPackageList();

            foreach (SMC_PackageExt ext in data)
            {
                SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageExt entity = CopyPackageExt(ext);

                //同步安装包到外网应用中心
                ws.PackageExtSync(entity);

                SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ faqEntity = new SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ();

                //同步问题反馈到外网应用中心
                //IList<SMC_PackageFAQ> faqs = bo.GetPackageFAQs(entity.pe_id);
                //foreach (SMC_PackageFAQ _faq in faqs)
                //{
                //    OutsideWS.SMC_PackageFAQ faq = CopyPackageFAQ(_faq);
                //    ws.PackageFAQSync(faq);
                //}

                //同步应用手册到外网应用中心
                IList <SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id);
                foreach (SMC_PackageManual _manual in manuals)
                {
                    SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageManual manual = CopyPackageManual(_manual);
                    ws.PackageManualSync(manual);
                }

                //同步截图表到外网应用中心
                IList <SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id);
                foreach (SMC_PackagePicture _pic in pics)
                {
                    SmartBox.Console.Service.ApplicationCenterWS.SMC_PackagePicture pic = CopyPackagePicture(_pic);
                    ws.PackagePictuerSync(pic);
                }

                //同步附件到外网应用中心
                string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id;
                if (Directory.Exists(entityFolder))
                {
                    string[] files = System.IO.Directory.GetFiles(entityFolder);

                    List <SmartBox.Console.Service.ApplicationCenterWS.FileEntity> fs = new List <SmartBox.Console.Service.ApplicationCenterWS.FileEntity>();
                    foreach (string filePath in files)
                    {
                        if (File.Exists(filePath))
                        {
                            FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                            SmartBox.Console.Service.ApplicationCenterWS.FileEntity fEntity = new SmartBox.Console.Service.ApplicationCenterWS.FileEntity();
                            fEntity.Content = new byte[s.Length];
                            s.Read(fEntity.Content, 0, (int)s.Length);
                            fEntity.FileName = Path.GetFileName(filePath);
                            fs.Add(fEntity);
                        }
                    }

                    try
                    {
                        ws.PackageFilesSync(fs.ToArray(), ext.pe_id);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }