public byte[] AR_GetReportData(byte[] loginTicket, string DocNoFrom, string DocNoTo, DateTime DateFrom, DateTime DateTo) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataSet data = new dalAR(loginer).GetReportData(DocNoFrom, DocNoTo, DateFrom, DateTo); return(ZipTools.CompressionDataSet(data)); }
/// <summary> /// 检查用户登录凭证,验证通过才允许访问后台数据. /// </summary> /// <param name="loginer">用户登录凭证</param> /// <returns></returns> public static Loginer ValidateLoginer(byte[] loginer) { //用户登录信息的长度小于伪码长度,数据包无效! if (loginer.Length < PREFIX_LEN + SUFFIX_LEN) { return(null); } try { //用户登录信息的长度 byte[] objectArrar = new byte[loginer.Length - (PREFIX_LEN + SUFFIX_LEN)]; //复制用户登录信息的数据包(去掉前后伪码) Array.Copy(loginer, PREFIX_LEN, objectArrar, 0, objectArrar.Length); //转换为用户对象 Loginer user = (Loginer)ZipTools.DecompressionObject(objectArrar); if (user.Account.Length >= 1) //系统限制用户帐号的长度必须大于或等于1位 { return(user); //转换成功,返回用户对象. } else { throw new Exception("用户帐号不正确!"); } } catch { throw new Exception("验证用户资料失败!"); } }
/// <summary> /// 获取字典 /// </summary> /// <returns></returns> public async Task <byte[]> GetDictionarys() { var dicList = await new DictionaryTypeManager().GetDictionaryTypes(); byte[] bytes = ZipTools.CompressionObject(dicList); return(bytes); }
public async Task <byte[]> GetModelsByUser(byte[] search) { var UserSearch = ZipTools.DecompressionObject(search) as tb_User; var UserList = await new UserManager().GetModels(UserSearch); return(ZipTools.CompressionObject(UserList)); }
public async Task <byte[]> UpdateEntityByUser(byte[] entity) { var User = ZipTools.DecompressionObject(entity) as tb_User; var result = await new UserManager().UpdateEntity(User); return(ZipTools.CompressionObject(result)); }
/// <summary> /// 获取指定组用户 /// </summary> /// <param name="groupID"></param> /// <returns></returns> public async Task <byte[]> GetGroupUsers(string groupID) { var userViewList = await new GroupManager().GetGroupUsers(groupID); byte[] bytes = ZipTools.CompressionObject(userViewList); return(bytes); }
public byte[] G_GetUserGroupByCode(byte[] loginTicket, string groupCode) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataSet ds = new dalUserGroup(loginer).GetUserGroup(groupCode); return(ZipTools.CompressionDataSet(ds)); }
public bool SaveFieldDef(byte[] loginTicket, byte[] data) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataSet ds = ZipTools.DecompressionDataSet(data); return(new dalEditLogHistory(loginer).SaveFieldDef(ds.Tables[0])); }
public byte[] GetBackupHistory(byte[] loginTicket, int topList) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataTable data = new dalCommon(null).GetBackupHistory(topList); return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(data))); }
/// <summary> /// 获取表OR视图 /// </summary> /// <returns></returns> public async Task <byte[]> GetUvs() { var result = await new GeneratorManager().GetUvs(); byte[] bytes = ZipTools.CompressionObject(result); return(bytes); }
/// <summary> /// 获取表结构 /// </summary> /// <param name="tableName">表名</param> /// <returns></returns> public async Task <byte[]> GetTableStatus(string tableName, string nameSpace, string desc) { var result = await new GeneratorManager().GetTableStructs(tableName, nameSpace, desc); byte[] bytes = ZipTools.CompressionObject(result); return(bytes); }
public bool Go(string backupName) { try { ZipTools.CreateZipFile(backupName, TempPath, null); if (File.Exists(Path.Combine(TempPath, backupName))) { File.Delete(Path.Combine(TempPath, backupName)); } var zipName = backupName.Replace(".sql", ".zip"); NewFileName = zipName; if (File.Exists(Path.Combine(TempPath, zipName))) { File.Move(Path.Combine(TempPath, zipName), Path.Combine(BackupPath, zipName)); } return(true); } catch (Exception ex) { //TODO - ILogger return(false); } }
public byte[] G_GetFormTagCustomName(byte[] loginTicket) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataTable data = new dalUserGroup(loginer).GetFormTagCustomName(); return(ZipTools.CompressionObject(DataConverter.TableToDataSet(data))); }
public byte[] G_GetAuthorityItem(byte[] loginTicket, string sFunID) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataTable data = new dalUserGroup(loginer).GetAuthorityItem(sFunID); return(ZipTools.CompressionObject(DataConverter.TableToDataSet(data))); }
/// <summary> /// 检查组是否存在 /// </summary> /// <param name="search"></param> /// <returns></returns> public async Task <byte[]> ExistEntityByGroup(byte[] search) { var Group = ZipTools.DecompressionObject(search) as tb_Group; var result = await new GroupManager().ExistEntity(Group); return(ZipTools.CompressionObject(result)); }
public byte[] SearchOutstanding(byte[] loginTicket, string invoiceNo, string customer, DateTime dateFrom, DateTime dateTo, DateTime dateEnd, string outstandingType) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataTable data = new dalCommon(loginer).SearchOutstanding(invoiceNo, customer, dateFrom, dateTo, dateEnd, outstandingType); return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(data))); }
/// <summary> /// 获取用户组集合 /// </summary> /// <param name="search"></param> /// <returns></returns> public async Task <byte[]> GetGroups(string search) { var GroupList = await new GroupManager().GetGroups(search); byte[] bytes = ZipTools.CompressionObject(GroupList); return(bytes); }
public string GetDataPathOrDefault(string key, string defaultValue) { if (key != null && _contentDataPaths.ContainsKey(key.ToLower())) { if (_contentDataPaths[key.ToLower()].AbsolutePath != null) { return(_contentDataPaths[key.ToLower()].AbsolutePath); } if (_contentDataPaths[key.ToLower()].ZipFilePath != null) { var tempContentFile = TempfileUtil.NewFilename(Path.GetExtension(defaultValue)); try { ZipTools.ExtractZipFileToFile(_contentDataPaths[key.ToLower()].ZipFilePath, null, _contentDataPaths[key.ToLower()].ReferencePath, tempContentFile); return(tempContentFile); } catch (Exception ex) { // ignore errors, keep on trucking just like SE. // write event log warning of any files not loaded. DiagnosticsLogging.LogWarning(string.Format(Res.ExceptionState_CorruptModFile, _contentDataPaths[key.ToLower()].ZipFilePath), ex); return(defaultValue); } } } return(defaultValue); }
/// <summary> /// 获取指定组所含权限 /// </summary> /// <param name="groupCode"></param> /// <returns></returns> public async Task <byte[]> GetGroupFuncs(string groupCode) { var gpFuncList = await new GroupManager().GetGroupFuncs(groupCode); byte[] bytes = ZipTools.CompressionObject(gpFuncList); return(bytes); }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // public static byte[] Decode(byte[] data) { MaskGZData(data); byte[] ret = ZipTools.Decompress(data); //MaskGZData(data); // 復元 return(ret); }
public byte[] G_GetFormTagCustomName(byte[] loginTicket) { Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket); DataTable dt = new dalUserGroup(loginer).GetFormTagCustomName(); return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(dt))); }
public void SaveCheckPoint(bool backupFile) { var checkpointFilename = Path.Combine(Savepath, SpaceEngineersConsts.SandBoxCheckpointFilename); if (backupFile) { var checkpointBackupFilename = checkpointFilename + ".bak"; if (File.Exists(checkpointBackupFilename)) { FileSystem.DeleteFile(checkpointBackupFilename, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); } File.Move(checkpointFilename, checkpointBackupFilename); } if (_compressedCheckpointFormat) { var tempFilename = TempfileUtil.NewFilename(); SpaceEngineersApi.WriteSpaceEngineersFile(Checkpoint, tempFilename); ZipTools.GZipCompress(tempFilename, checkpointFilename); } else { SpaceEngineersApi.WriteSpaceEngineersFile(Checkpoint, checkpointFilename); } }
public async Task <byte[]> GetPagingModelsByUser(int pageIndex, int pageSize, byte[] search, bool Asc = false) { var UserSearch = ZipTools.DecompressionObject(search) as tb_User; var UserList = await new UserManager().GetPagingModels(pageIndex, pageSize, UserSearch, Asc); return(ZipTools.CompressionObject(UserList)); }
public XmlDocument LoadSectorXml() { var filename = Path.Combine(Savepath, SpaceEngineersConsts.SandBoxCheckpointFilename); var xDoc = new XmlDocument(); try { if (ZipTools.IsGzipedFile(filename)) { // New file format is compressed. // These steps could probably be combined, but would have to use a MemoryStream, which has memory limits before it causes performance issues when chunking memory. // Using a temporary file in this situation has less performance issues as it's moved straight to disk. var tempFilename = TempfileUtil.NewFilename(); ZipTools.GZipUncompress(filename, tempFilename); xDoc.Load(tempFilename); _compressedCheckpointFormat = true; } else { // Old file format is raw XML. xDoc.Load(filename); _compressedCheckpointFormat = false; } } catch { return(null); } return(xDoc); }
public async Task <byte[]> AddEntityByUser(byte[] entity) { var User = ZipTools.DecompressionObject(entity) as tb_User; var NewUser = await new UserManager().AddEntity(User); return(ZipTools.CompressionObject(NewUser)); }
public void SaveSectorXml(bool backupFile, XmlDocument xDoc) { var sectorFilename = Path.Combine(Savepath, SpaceEngineersConsts.SandBoxSectorFilename); if (backupFile) { var sectorBackupFilename = sectorFilename + ".bak"; if (File.Exists(sectorBackupFilename)) { FileSystem.DeleteFile(sectorBackupFilename, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); } File.Move(sectorFilename, sectorBackupFilename); } if (_compressedSectorFormat) { var tempFilename = TempfileUtil.NewFilename(); xDoc.Save(tempFilename); ZipTools.GZipCompress(tempFilename, sectorFilename); } else { xDoc.Save(sectorFilename); } }
public async Task <ObjectResult <object> > DownloadPackage(int packageId, string token) { Uri url = new Uri(ApiUrl + $"download?token={token}&package_id={packageId}"); OnDownloadProgressChanged?.Invoke(0); WebClient webClient = new WebClient(); webClient.DownloadProgressChanged += (sender, e) => { OnDownloadProgressChanged?.Invoke(e.ProgressPercentage); }; string tempFname = Path.GetTempFileName(); await webClient.DownloadFileTaskAsync(url, tempFname); if (ZipTools.IsCompressedData(tempFname)) { return(new ObjectResult <object>(1, "Package succesfully downloaded!", tempFname)); } else { ObjectResult <object> obj = JsonConvert.DeserializeObject <ObjectResult <object> >(File.ReadAllText(tempFname)); obj.code = 0; obj.content = tempFname; return(obj); } }
/// <summary> /// 更新组 /// </summary> /// <param name="entity"></param> /// <returns></returns> public async Task <byte[]> UpdateEntityByGroup(byte[] entity) { var Group = ZipTools.DecompressionObject(entity) as tb_Group; var result = await new GroupManager().UpdateEntity(Group); return(ZipTools.CompressionObject(result)); }
/// <summary> /// 更新字典 /// </summary> /// <param name="entity"></param> /// <returns></returns> public async Task <byte[]> UpdateEntityByDic(byte[] entity) { var dic = ZipTools.DecompressionObject(entity) as tb_Dictionary; var result = await new DictionaryManager().UpdateEntity(dic); return(ZipTools.CompressionObject(result)); }
/// <summary> /// 更新菜单 /// </summary> /// <param name="entity"></param> /// <returns></returns> public async Task <byte[]> UpdateEntityByMenu(byte[] entity) { var Menu = ZipTools.DecompressionObject(entity) as tb_Menu; var result = await new MenuManager().UpdateEntity(Menu); return(ZipTools.CompressionObject(result)); }