예제 #1
0
        public byte[] DataRequest_By_SimpDEs_GZip(string methodRequests)
        {
            var jsonSimpEtys = DataRequest_By_SimpDEs(methodRequests);
            var bts          = System.Text.Encoding.UTF8.GetBytes(jsonSimpEtys);

            return(GZipStreamHelper.GZipCompress(bts));
        }
예제 #2
0
        /// <summary>
        /// 客户端下升级文件用
        /// </summary>
        /// <param name="Infs"></param>
        /// <returns></returns>
        public List <FileEntery> LoadUpdataByte(string Infs)
        {
#if SUDID_KEY_REGE
            if (!MachineCode.CurrentMachineCode.Hash.Equals(SUDID_KEY_REGE))
            {
                return(null);
            }
#endif
            List <FileEntery>           _dllFileEntys      = new List <FileEntery>();
            Dictionary <string, string> _client_File_INFOs = GetClientDllVersionInfos(Infs);//将文件名全转成大写
            string[] _server_Files = Directory.GetFiles(UPAPPDLL_PATH);
            for (int _i = 0, _iCnt = _server_Files.Length; _i < _iCnt; _i++)
            {
                string _severFileName = _server_Files[_i].Substring(_server_Files[_i].LastIndexOf('\\') + 1);
                string _upperName     = _severFileName.ToUpper();
                if (_client_File_INFOs.ContainsKey(_upperName))//如果客户端存在就对比版本
                {
                    FileVersionInfo _fileVer = FileVersionInfo.GetVersionInfo(_server_Files[_i]);
                    if (_fileVer.FileVersion.Trim().ToUpper().Equals(
                            _client_File_INFOs[_upperName].Trim().ToUpper()
                            ))
                    {
                        continue;
                    }
                }
                byte[] _bts = File.ReadAllBytes(_server_Files[_i]);
                _dllFileEntys.Add(new FileEntery()
                {
                    Buff = GZipStreamHelper.GZipCompress(_bts), Length = _bts.Length, Name = _severFileName
                });
            }

            return(_dllFileEntys);
        }
예제 #3
0
        //BaseTablesGetter
        public byte[] BaseDataRequest(byte[] methodBytes)
        {
            byte[]          _metBts    = GZipStreamHelper.GZipDecompress(methodBytes);
            MethodRequest[] _metodReqs = __JsonSerial.Deserialize <MethodRequest[]>(System.Text.Encoding.UTF8.GetString(_metBts));
            if (_metodReqs == null)
            {
                return(null);
            }
            ShareSqlManager _sh = new ShareSqlManager();
            List <List <SimpDataEntery> > _simpEtys = new List <List <SimpDataEntery> >();

            for (int _i = 0, _iCnt = _metodReqs.Length; _i < _iCnt; _i++)
            {
                List <SimpDataEntery> _lis = BaseTablesGetter.GetBaseTablesGetterInstances(_metodReqs[_i].ProceDb).GetBaseTable(
                    MethodRequestHelper.GetParam(_metodReqs[_i], "tableName"),
                    MethodRequestHelper.GetParam(_metodReqs[_i], "ChangTime"),
                    MethodRequestHelper.GetParam(_metodReqs[_i], "schemaMD5"),
                    MethodRequestHelper.GetParam(_metodReqs[_i], "contentsMD5"));

                _simpEtys.Add(_lis);
            }
            string _jsonSimpEtys = __JsonSerial.Serialize(_simpEtys);

            byte[] _bts = System.Text.Encoding.UTF8.GetBytes(_jsonSimpEtys);
            return(GZipStreamHelper.GZipCompress(_bts));
        }
예제 #4
0
        public byte[] DataRequest_By_SimpDEs_All_GZip(byte[] methodBts)
        {
            if (methodBts == null)
            {
                return(null);
            }
            var metBts       = GZipStreamHelper.GZipDecompress(methodBts);
            var jsonSimpEtys = DataRequest_By_SimpDEs(Encoding.UTF8.GetString(metBts));
            var bts          = Encoding.UTF8.GetBytes(jsonSimpEtys);

            return(GZipStreamHelper.GZipCompress(bts));
        }
예제 #5
0
        public byte[] DataRequest_By_SimpDEs_All_GZip(byte[] methodBts)
        {
#if SUDID_KEY_REGE
            if (!MachineCode.CurrentMachineCode.Hash.Equals(SUDID_KEY_REGE))
            {
                return(null);
            }
#endif
            byte[] _metBts       = GZipStreamHelper.GZipDecompress(methodBts);
            string _jsonSimpEtys = DataRequest_By_SimpDEs(System.Text.Encoding.UTF8.GetString(_metBts));
            byte[] _bts          = System.Text.Encoding.UTF8.GetBytes(_jsonSimpEtys);
            return(GZipStreamHelper.GZipCompress(_bts));
        }
예제 #6
0
        public byte[] DataRequest_By_SimpDEs_GZip(string methodRequests)
        {
#if SUDID_KEY_REGE
            if (!MachineCode.CurrentMachineCode.Hash.Equals(SUDID_KEY_REGE))
            {
                return(null);
            }
#endif
            string _jsonSimpEtys = DataRequest_By_SimpDEs(methodRequests);
            byte[] _bts          = System.Text.Encoding.UTF8.GetBytes(_jsonSimpEtys);
            //byte[] _newBts = GZipStreamHelper.GZipCompress(_bts);
            //System.IO.StreamReader _wt = new System.IO.StreamReader(new System.IO.MemoryStream(_newBts));
            //string _st=_wt.ReadLine();
            //if (_st.Length>0)
            //{
            //}
            //;
            return(GZipStreamHelper.GZipCompress(_bts));//WCF消息传至客户端的时候会自动用Base64编码
        }
예제 #7
0
        /// <summary>
        /// 下截文件用
        /// </summary>
        /// <param name="_methodRequests"></param>
        /// <returns></returns>
        public byte[] FileDownLoad(string _methodRequests)
        {
#if SUDID_KEY_REGE
            if (!MachineCode.CurrentMachineCode.Hash.Equals(SUDID_KEY_REGE))
            {
                return(null);
            }
#endif
            MethodRequest _metodReq     = __JsonSerial.Deserialize <MethodRequest>(_methodRequests);
            byte[]        _bts          = null;
            string        _filefullpath = string.Empty;
            switch (_metodReq.ProceName)
            {
            /// <summary>
            /// 下截款式图片
            /// </summary>
            case "DownLoad_MODELPIC_File":
                _filefullpath = string.Format("{0}\\{1}", MODELPIC_PATH, _metodReq.ParamVals[0]);
                if (File.Exists(_filefullpath))
                {
                    _bts = File.ReadAllBytes(_filefullpath);
                }
                break;

            /// <summary>
            /// 下截订单图片
            /// </summary>
            case "DownLoad_RequsetPIC_File":
                _filefullpath = string.Format("{0}\\{1}", REQUESTPIC_PATH, _metodReq.ParamVals[0]);
                if (File.Exists(_filefullpath))
                {
                    _bts = File.ReadAllBytes(_filefullpath);
                }
                break;

            /// <summary>
            /// 下截单件产品图片
            /// </summary>
            case "DownLoad_ProductPIC_File":
                _filefullpath = string.Format("{0}\\{1}", PRODUCTPIC_PATH, _metodReq.ParamVals[0]);
                if (File.Exists(_filefullpath))
                {
                    _bts = File.ReadAllBytes(_filefullpath);
                }
                break;

            /// <summary>
            /// 下截报表
            /// </summary>
            case "DownLoad_Report_File":
                _filefullpath = string.Format("{0}\\{1}", ReportFile_PATH, _metodReq.ParamVals[0]);
                if (File.Exists(_filefullpath))
                {
                    _bts = File.ReadAllBytes(_filefullpath);
                }
                _bts = GZipStreamHelper.GZipCompress(_bts);
                break;

            /// <summary>
            /// 下截SYS DLL
            /// </summary>
            case "DownLoad_SYSDLL_File":
                _filefullpath = string.Format("{0}\\{1}", UPAPPDLL_PATH, _metodReq.ParamVals[0]);
                if (File.Exists(_filefullpath))
                {
                    _bts = File.ReadAllBytes(_filefullpath);
                }
                _bts = GZipStreamHelper.GZipCompress(_bts);
                break;

            default:
                string _setPath = ConfigurationManager.AppSettings[_metodReq.ProceName];
                if (!string.IsNullOrWhiteSpace(_setPath))
                {
                    string _savePath = System.AppDomain.CurrentDomain.BaseDirectory + _setPath;
                    _filefullpath = string.Format("{0}\\{1}", _savePath, _metodReq.ParamVals[0]);
                    if (File.Exists(_filefullpath))
                    {
                        _bts = File.ReadAllBytes(_filefullpath);
                    }
                    //_bts = GZipStreamHelper.GZipCompress(_bts);
                }
                break;
            }
            return(_bts);
        }
예제 #8
0
        public void CheckRullDllINFO(string dllpath)
        {
            string[]  _server_Files = Directory.GetFiles(dllpath);
            DataTable _dt           = ClientDLL_INFO.Clone();

            for (int _i = 0, _iCnt = _server_Files.Length; _i < _iCnt; _i++)
            {
                string _severFileName = _server_Files[_i].Substring(_server_Files[_i].LastIndexOf('\\') + 1);
                string _fileName      = _severFileName.ToUpper();
                string _fileVer       = FileVersionInfo.GetVersionInfo(_server_Files[_i]).FileVersion.Trim().ToUpper();
                if (ClientDLL_INFO.Select(string.Format("File_Name={0} AND File_Ver={1}", _fileName, _fileVer)).Length == 0)
                {
                    byte[] _bts = File.ReadAllBytes(_server_Files[_i]);
                    File.WriteAllBytes(string.Format("{0}/{1}/{2}", System.AppDomain.CurrentDomain.BaseDirectory, FILE_INFO_NAME, _fileName), GZipStreamHelper.GZipCompress(_bts));
                    _dt.LoadDataRow(new object[] { _fileName, _fileVer, _bts.Length }, false);
                }
            }
            _dt.AcceptChanges();
            BaseDataCache.BaseDataTables.getInstance().Merge(FILE_INFO_NAME, _dt);
        }