Ejemplo n.º 1
0
        public bool Delete(string classMemberObj, string fileName, mType mtype)
        {
            bool bl = false;

            try {
                bl = serv.Delete(classMemberObj, fileName, mtype);
            } catch (Exception ex) {
                ++retry;
                if (retry < 3)
                {
                    this.Delete(classMemberObj, fileName, mtype);
                }
                EchoHelper.EchoException(ex);
            }
            return(bl);
        }
Ejemplo n.º 2
0
        public ModelShopOne[] GetAllPutModules()
        {
            ModelShopOne[] slist = new ModelShopOne[] { };
            try {
                slist = serv.GetAllPutModules();
            } catch (Exception ex) {
                ++retry;

                if (retry < 3)
                {
                    this.GetAllPutModules();
                }
                EchoHelper.EchoException(ex);
            }
            return(slist);
        }
Ejemplo n.º 3
0
        public bool UploadClassStr(string fileName, string fileClassStr, mType mtype)
        {
            bool bl = false;

            try {
                bl = serv.UploadClassStr(fileName, fileClassStr, mtype);
            } catch (Exception ex) {
                ++retry;

                if (retry < 3)
                {
                    this.UploadClassStr(fileName, fileClassStr, mtype);
                }
                EchoHelper.EchoException(ex);
            }
            return(bl);
        }
Ejemplo n.º 4
0
        public string GetClassStr(string filename, mType ty)
        {
            string str = "";

            try {
                str = serv.GetClassStr(filename, ty);
            } catch (Exception ex) {
                ++retry;

                if (retry < 3)
                {
                    this.GetClassStr(filename, ty);
                }
                EchoHelper.EchoException(ex);
            }
            return(str);
        }
Ejemplo n.º 5
0
 public byte[] Decryption(byte[] data, string key)
 {
     byte[] by = new byte[0];
     if (data.Length > 0)
     {
         try {
             DESCryptoServiceProvider descsp = new DESCryptoServiceProvider();   //实例化加解密类对象
             byte[]       KEY     = Encoding.Unicode.GetBytes(key);              //定义字节数组,用来存储密钥
             MemoryStream MStream = new MemoryStream();                          //实例化内存流对象
             //使用内存流实例化加密流对象
             CryptoStream CStream = new CryptoStream(MStream, descsp.CreateDecryptor(KEY, KEY), CryptoStreamMode.Write);
             CStream.Write(data, 0, data.Length);                              //向加密流中写入数据
             CStream.FlushFinalBlock();                                        //释放加密流
             by = MStream.ToArray();                                           //返回加密后的数组
         } catch (Exception ex) {
             EchoHelper.EchoException(ex);
         }
     }
     return(by);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 下载更新文件到临时目录
        /// </summary>
        /// <returns></returns>
        protected void DownAutoUpdateFile(string downpath)
        {
            if (!System.IO.Directory.Exists(downpath))
            {
                System.IO.Directory.CreateDirectory(downpath);
            }
            string serverXmlFile = downpath + @"UpdateList.xml";

            try {
                WebRequest  req = WebRequest.Create(this.UpdaterUrl);
                WebResponse res = req.GetResponse();
                if (res.ContentLength > 0)
                {
                    try {
                        WebClient wClient = new WebClient();
                        wClient.DownloadFile(this.UpdaterUrl, serverXmlFile);
                    } catch (Exception ex) {
                        EchoHelper.EchoException(ex);
                    }
                }
            } catch {
                return;
            }
        }