public async Task <FtpResponse> SendCommandAsync(string command, CancellationToken token = default(CancellationToken)) { #if NET40 await Task.Factory.StartNew(() => semaphore.Wait(token)); #else await semaphore.WaitAsync(token); #endif try { if (SocketDataAvailable()) { var staleDataResult = await GetResponseAsync(token); LoggerHelper.Warn($"Stale data on socket {staleDataResult.ResponseMessage}"); } string commandToPrint = command.StartsWith(FtpCommand.PASS.ToString()) ? "PASS *****" : command; LoggerHelper.Debug($"[FtpClient] Sending command: {commandToPrint}"); await WriteLineAsync(command); var response = await GetResponseAsync(token); return(response); } finally { semaphore.Release(); } }
public void AddDragonItem(int level, string type, int gridId, string imgName = "", int color = 0) { RemoveDragonItem(gridId); LoggerHelper.Debug("Add " + gridId); AssetCacheMgr.GetUIInstance("DragonUIGridInfotest.prefab", (prefab, id, go) => { GameObject obj = (GameObject)go; obj.SetActive(true); obj.name = gridId.ToString(); obj.transform.parent = GetTransform("DragonUIPackageList");// m_myTransform.FindChild(m_widgetToFullName["DragonUIPackageList"]); obj.transform.localPosition = m_arrDragonPackageItem[gridId].parent.localPosition; obj.transform.localScale = new Vector3(1, 1, 1); TweenPosition tp = obj.GetComponentsInChildren <TweenPosition>(true)[0]; tp.enabled = false; obj.transform.FindChild("DragonUIGridLevel").GetComponentsInChildren <UILabel>(true)[0].text = "Lv" + level; obj.transform.FindChild("DragonUIGridName").GetComponentsInChildren <UILabel>(true)[0].text = type; UISprite s = obj.transform.FindChild("DragonUIGridBG").GetComponentsInChildren <UISprite>(true)[0]; s.spriteName = imgName; MogoUtils.SetImageColor(s, color); m_listDragonItem.Add(obj); }); }
private void ParseEntitiesXmlFile(String fileName, String etyName, ushort entityID, bool needMD5 = false) { string strContent; if (m_isUseOutterConfig) { strContent = Util.Utils.LoadFile(fileName.Replace('\\', '/')); } else { strContent = XMLParser.LoadText(fileName); } if (needMD5) { LoggerHelper.Debug("AddMD5Content: " + fileName); EventDispatcher.TriggerEvent(VersionEvent.AddMD5Content, strContent); } SecurityElement xmlDoc = XMLParser.LoadXML(strContent); if (xmlDoc == null) { return; } //String etyName = Path.GetFileNameWithoutExtension(fileName); ParseEntitiesXml(xmlDoc, etyName, entityID); }
/// <summary> /// Updates the specified entity. /// Obtaines the page and entity info from the request. /// </summary> /// <param name="request">The request</param> /// <returns>a JSON response</returns> public virtual string UpdatePageEntity(HttpRequest request) { LoggerHelper.Info("Start"); Entity entity = null; try { Page page = GetPage(request); entity = CreateEntity(request, page); Entity whereEntity = null; string json = request.Params[PageInfo.WhereEntityParam]; LoggerHelper.Debug("whereEntity = " + json); if (!string.IsNullOrEmpty(json)) { whereEntity = EntityUtils.CreateEntity(page, false); Dictionary <string, string> props = new JavaScriptSerializer().Deserialize <Dictionary <string, string> >(json); whereEntity.SetProperties(props); } GetCatalogDAO(page).UpdateEntity(entity, whereEntity); } catch (Exception e) { LoggerHelper.Error(e); return(ErrorResponse(e)); } finally { LoggerHelper.Info("End"); } return(SuccessResponse(entity)); }
/// <summary> /// Deletes the specified page configuration. /// Obtaines the page info from the request. /// </summary> /// <param name="request">The request</param> /// <returns>a JSON response</returns> public virtual string DeletePage(HttpRequest request) { LoggerHelper.Info("Start"); try { if (!CheckPermissions()) { return(ErrorResponse("User don't have permissions to use this functionality.")); } string json = request.Params[EntityParam]; LoggerHelper.Debug("entity = " + json); Page page = (Page) new JavaScriptSerializer().Deserialize(json, typeof(Page)); page.UpdatedBy = GetCurrentUserName(); GetPageInfoDAO().DeletePage(page); } catch (Exception e) { LoggerHelper.Error(e); return(ErrorResponse(e)); } finally { LoggerHelper.Info("End"); } return(SuccessResponse()); }
void preparePath() { //if (Application.isEditor && m_SimulateAssetBundleInEditor) //{ // pkgResBase = "file://" + System.Environment.CurrentDirectory.Replace("\\", "/"); // Use the build output folder directly. // localResBase = pkgResBase; // localFileBase = System.Environment.CurrentDirectory.Replace("\\", "/"); // Use the build output folder directly. //} //else// if (Application.isMobilePlatform || Application.isConsolePlatform) { pkgResBase = Application.streamingAssetsPath; if (!pkgResBase.Contains("file://")) { pkgResBase = "file://" + pkgResBase; } localResBase = "file://" + Application.persistentDataPath + "/res"; localFileBase = Application.persistentDataPath + "/res"; } string platformFolderForAssetBundles = #if UNITY_EDITOR GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget); #else GetPlatformFolderForAssetBundles(Application.platform); #endif pkgResBase = pkgResBase + kAssetBundlesPath + platformFolderForAssetBundles + "/" + SubName + "/"; localResBase = localResBase + kAssetBundlesPath + platformFolderForAssetBundles + "/" + SubName + "/"; localFileBase = localFileBase + kAssetBundlesPath + platformFolderForAssetBundles + "/" + SubName + "/"; LoggerHelper.Debug("pkgResBase:" + pkgResBase + ",localResBase:" + localResBase + ",localFileBase:" + localFileBase); }
public static void LoadAudioClip(int soundID, AudioSource source, bool isLoop, Action <AudioSource, UnityEngine.Object, bool> action = null) { if (audioClipBuffer.ContainsKey(soundID)) { if (action != null) { action(source, audioClipBuffer[soundID], isLoop); } } if (!SoundData.dataMap.ContainsKey(soundID)) { LoggerHelper.Debug("Sound ID " + soundID + " not exist"); return; } AssetCacheMgr.GetResourceAutoRelease(SoundData.dataMap[soundID].path, (obj) => { UnityEngine.Object.DontDestroyOnLoad(obj); if (action != null) { action(source, obj, isLoop); } //var clip = (obj as GameObject).GetComponent<AudioSource>().clip; //if (clip != null) // audioClipBuffer.Add(soundID, clip); }); }
/// <summary> /// Returns the list of columns of the specified table. /// </summary> /// <param name="tableName">The table name</param> /// <returns>The list of columns</returns> public virtual IList <Entity> GetTableColumns(string tableName) { LoggerHelper.Info("Start"); IList <Entity> list = null; try { string[] tableInfo = tableName.Split('.'); LoggerHelper.Debug("tableInfo,length = " + tableInfo.Length.ToString()); StringBuilder query = new StringBuilder(); IList <DBParam> queryParams = new List <DBParam>(); query.Append("SELECT COLUMN_NAME AS [Name], IS_NULLABLE AS [Required], DATA_TYPE AS [Type], "); query.Append("CHARACTER_MAXIMUM_LENGTH AS [MaxLength], ORDINAL_POSITION AS [Order] "); query.Append("FROM INFORMATION_SCHEMA.COLUMNS "); query.Append("WHERE TABLE_NAME = @p0 "); if (tableInfo.Length == 1) { queryParams.Add(new DBParam(queryParams, tableInfo[0], DbType.String)); } else if (tableInfo.Length == 2) { query.Append("AND TABLE_SCHEMA = @p1 "); queryParams.Add(new DBParam(queryParams, tableInfo[1], DbType.String)); queryParams.Add(new DBParam(queryParams, tableInfo[0], DbType.String)); } else { queryParams.Add(new DBParam(queryParams, tableName, DbType.String)); } query.Append("ORDER BY TABLE_NAME,ORDINAL_POSITION "); LoggerHelper.Debug(query.ToString()); //TODO : Create an entity object Entity entity = new Entity("Columns"); entity.SetField(new Field("Name")); entity.SetField(new Field("Required")); entity.SetField(new Field("Type")); entity.SetField(new Field("MaxLength")); entity.SetField(new Field("Order")); StatementWrapper wrapper = new StatementWrapper(query, queryParams); ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity); list = GetQueryRunner().Query(GetConnection(), wrapper, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get table columns.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// Returns a list of pages for the specified AppName /// </summary> /// <param name="appName">The application name </param> /// <returns>the page list</returns> public virtual IList <Page> GetPageList(string appName) { LoggerHelper.Info("Start"); IList <Page> list = null; IList <DBParam> queryParams = new List <DBParam>(); try { StringBuilder query = new StringBuilder(); query.Append("SELECT * FROM Page P "); query.Append("INNER JOIN PageApp A ON P.PageAppId = A.PageAppId "); query.Append("WHERE A.AppName = @p0 "); query.Append("ORDER BY Name "); queryParams.Add(new DBParam(queryParams, appName, DbType.String)); LoggerHelper.Debug(query.ToString()); StatementWrapper wrapper = new StatementWrapper(query, queryParams); ResultSetHandler <IList <Page> > h = new BeanListHandler <Page>(typeof(Page)); list = GetQueryRunner().Query(GetConnection(), wrapper, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get page list.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// Returns the Page Configuration from the data base for the specified application name and pageId or pageName /// </summary> /// <param name="appName">The application name</param> /// <param name="pageId">The id of the page</param> /// <param name="pageName">The name of the page</param> /// <returns>The Page</returns> public virtual Page GetPageConfig(string appName, string pageId, string pageName) { if (string.IsNullOrEmpty(appName)) { LoggerHelper.Warning("Page Application Name is not specified."); throw new ArgumentNullException("Page Application Name is not specified."); } LoggerHelper.Info("Start"); Page _page = null; try { StringBuilder query = new StringBuilder(); IList <DBParam> queryParams = new List <DBParam>(); query.Append("SELECT A.PageAppId, A.AppName, P.PageId, P.Name, P.Title, P.TableName, P.ConnName, T.TabId, T.TabName, T.TabOrder, T.Cols, F.FieldId, F.FieldName, "); query.Append("F.Label, F.Type, F.Required, F.DropDownInfo, F.Exportable, F.IsId, F.FieldOrder, F.ControlType, F.JoinInfo, "); query.Append("F.DBFieldName, F.Insertable, F.Updatable, F.ControlProps, "); query.Append("G.ColumnId, G.Visible, G.Searchable, G.Width, G.ColumnName, G.ColumnLabel, G.ColumnOrder "); query.Append("FROM Page P "); query.Append("INNER JOIN PageApp A ON A.PageAppId = P.PageAppId "); query.Append("LEFT OUTER JOIN PageTab T ON P.PageId = T.PageId "); query.Append("LEFT OUTER JOIN PageField F ON T.TabId = F.TabId "); query.Append("LEFT OUTER JOIN PageGridColumn G ON P.PageId = G.PageId AND F.FieldId = G.FieldId "); query.Append("WHERE A.AppName = @p0 "); queryParams.Add(new DBParam(queryParams, appName, DbType.String)); if (!String.IsNullOrEmpty(pageId)) { query.Append("AND P.PageId = @p1 "); queryParams.Add(new DBParam(queryParams, pageId, DbType.Int32)); } else { query.Append("AND P.Name = @p1 "); queryParams.Add(new DBParam(queryParams, pageName, DbType.String)); } query.Append("ORDER BY T.TabOrder, F.FieldOrder, F.Label"); LoggerHelper.Debug(query.ToString()); StatementWrapper wrapper = new StatementWrapper(query, queryParams); ResultSetHandler <Page> h = new PageInfoHandler <Page>(typeof(Page)); _page = GetQueryRunner().Query(GetConnection(), wrapper, h); _page.Filter = GetPageFilter(_page.PageId); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get page config.", e); } finally { LoggerHelper.Info("End"); } return(_page); }
/// <summary> /// Returns the list of tables in the database /// </summary> /// <returns>The list of tables</returns> public virtual IList <Entity> GetTables() { LoggerHelper.Info("Start"); IList <Entity> list = null; try { StringBuilder query = new StringBuilder(); query.Append("SELECT CASE WHEN SCHEMA_NAME(schema_id) = 'dbo' THEN name ELSE SCHEMA_NAME(schema_id) + '.' + name END AS [Name] "); query.Append("FROM sys.tables WHERE name <> 'sysdiagrams' "); query.Append("UNION "); query.Append("SELECT CASE WHEN SCHEMA_NAME(schema_id) = 'dbo' THEN name ELSE SCHEMA_NAME(schema_id) + '.' + name END AS [Name] "); query.Append("FROM sys.views "); query.Append("ORDER BY 1"); LoggerHelper.Debug(query.ToString()); Entity entity = new Entity("Tables"); entity.SetField(new Field("Name")); ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity); list = GetQueryRunner().Query(GetConnection(), query, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get tables/views.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// Returns a list a all page configurations defined in the database. /// </summary> /// <returns>The list of page configurations</returns> public virtual IList <Page> GetPageList() { LoggerHelper.Info("Start"); IList <Page> list = null; try { StringBuilder query = new StringBuilder(); query.Append("SELECT * FROM Page ORDER BY Name "); LoggerHelper.Debug(query.ToString()); ResultSetHandler <IList <Page> > h = new BeanListHandler <Page>(typeof(Page)); list = GetQueryRunner().Query(GetConnection(), query, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get page list.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// Saves the specified page configuration of the specified application name into the database. /// </summary> /// <param name="appName">the application name</param> /// <param name="page">The page to be saved</param> public virtual void SavePage(string appName, Page page) { LoggerHelper.Info("Start"); try { if (string.IsNullOrEmpty(page.PageAppId)) { StringBuilder query = new StringBuilder("SELECT PageAppId FROM PageApp WHERE AppName = @p0"); IList <DBParam> queryParams = new List <DBParam>(); queryParams.Add(new DBParam(queryParams, appName, DbType.String)); LoggerHelper.Debug(query.ToString()); StatementWrapper wrapper = new StatementWrapper(query, queryParams); int pageAppId = GetQueryRunner().ExecuteScalar(GetConnection(), wrapper); page.PageAppId = pageAppId.ToString(); } SavePage(page, false); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to save application page.", e); } finally { LoggerHelper.Info("End"); } }
protected async Task <Stream> AcceptStreamAsync(System.Net.Sockets.TcpListener listener) { try { LoggerHelper.Debug($"Accept stream on {listener.LocalEndpoint.ToString()}"); Socket = await listener.AcceptSocketAsync(); BaseStream = new NetworkStream(Socket); LastActivity = DateTime.Now; if (IsDataConnection) { if (Configuration.ShouldEncrypt && Configuration.EncryptionType == FtpEncryption.Explicit) { await ActivateEncryptionServerAsync(); } } else { if (Configuration.ShouldEncrypt && Configuration.EncryptionType == FtpEncryption.Implicit) { await ActivateEncryptionServerAsync(); } } return(this); } catch (Exception exception) { LoggerHelper.Error($"Could accept connect {listener.LocalEndpoint.ToString()} :{exception.ToString()}"); throw; } }
/// <summary> /// Updates the specified entity and then deletes the entity from the Oracle database as a single transacion. /// The purpose of this method is to be used when you have a delete trigger in the Oracle database and you need to update /// first who is doing the delete. /// </summary> /// <param name="entity"></param> public virtual void UpdateDeleteEntity(Entity entity) { LoggerHelper.Info("Start"); try { if (entity.GetFieldId() == null) { LoggerHelper.Error("Entity does not have an Id field defined."); return; } IList <string> queries = new List <string>(); StringBuilder query = GetQueryBuilder().BuildUpdateEntityQuery(entity); LoggerHelper.Debug(query.ToString()); queries.Add(query.ToString()); query = GetQueryBuilder().BuildDeleteQuery(entity); LoggerHelper.Debug(query.ToString()); queries.Add(query.ToString()); GetQueryRunner().ExecuteTransaction(GetConnection(), queries); } catch (Exception e) { throw new Exception("Unable to update " + entity.GetTableName() + ".", e); } finally { LoggerHelper.Info("End"); } }
/// <summary> /// Returns the total number of records of the specified entity filtered by the specified filter. /// </summary> /// <param name="entity">An Entity</param> /// <param name="filter">The filter information</param> /// <exception cref="System.ArgumentNullException">Thrown when entity is null, entity TableName is not specified.</exception> /// <exception cref="System.Exception">Thrown when a problem occur during the execution of the statement.</exception> /// <returns>The total number of filtered records</returns> public virtual int GetFilteredTotalRecords(Entity entity, FilterInfo filter) { if (entity == null || string.IsNullOrEmpty(entity.GetTableName())) { LoggerHelper.Warning("Entity is null or entity TableName is not specified."); throw new ArgumentNullException("Entity is null or entity TableName is not specified."); } LoggerHelper.Info("Start"); int total = 0; try { StatementWrapper stmtWrapper = this.GetQueryBuilder().BuildFilteredTotalRecordsStatement(entity, filter); LoggerHelper.Debug(stmtWrapper.Query.ToString()); total = GetQueryRunner().ExecuteScalar(GetConnection(), stmtWrapper); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to get " + entity.GetTableName() + " filtered total records.", e); } finally { LoggerHelper.Info("End"); } return(total); }
/// <summary> /// Return the filtered list of entities related to the specified entity type and applying the /// specified filter from an Oracle database. /// </summary> /// <param name="entity">The entity type</param> /// <param name="filter">The Filter</param> /// <returns>The filtered list of entities</returns> public virtual IList <Entity> GetEntities(Entity entity, FilterInfo filter) { LoggerHelper.Info("Start"); IList <Entity> list = new List <Entity>(); try { filter.Total = GetTotalRecords(entity); filter.FilteredRecords = GetFilteredTotalRecords(entity, filter); StringBuilder query = GetQueryBuilder().BuildQuery(entity, filter); LoggerHelper.Debug(query.ToString()); ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity); list = GetQueryRunner().Query(GetConnection(), query, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to fetch " + entity.GetTableName() + " list.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// 检查版本。 /// </summary> public void CheckVersion(Action <bool> fileDecompress, Action <int, int, string> taskProgress, Action <int, long, long> progress, Action finished, Action <Exception> error) { BeforeCheck((result) => { LoggerHelper.Debug(result); if (result == UpdateType.NormalRes) { ModalCheckNetwork(() => CheckAndDownload(fileDecompress, taskProgress, progress, finished, error)); } else if (result == UpdateType.FirstRes) { CheckAndDownloadFirstPkg(fileDecompress, taskProgress, progress, () => { //大小包资源下载完后,使用FullResourceVersion作为完整包标记 LocalVersion.FullResourceVersionInfo = ServerVersion.FullResourceVersionInfo; SaveVersion(LocalVersion); //继续检查资源版本更新 CheckVersion(fileDecompress, taskProgress, progress, finished, error); }, error); } else { LoggerHelper.Debug("不需要更新apk和pkg"); if (finished != null) { finished(); } } }, () => { error(new Exception("download version file time out.")); }); }
public static void LoadAudioClip(int soundID, Action <UnityEngine.Object> action = null) { if (audioClipBuffer.ContainsKey(soundID)) { if (action != null) { action(audioClipBuffer[soundID]); } return; } if (!SoundData.dataMap.ContainsKey(soundID)) { LoggerHelper.Debug("Sound ID " + soundID + " not exist"); return; } AssetCacheMgr.GetResourceAutoRelease(SoundData.dataMap[soundID].path, (obj) => { UnityEngine.Object.DontDestroyOnLoad(obj); if (action != null) { action(obj); } if (obj is AudioClip && !audioClipBuffer.ContainsKey(soundID)) { audioClipBuffer.Add(soundID, obj as AudioClip); } }); }
public void AsynDownloadUpdatePackage(Action <bool> fileDecompress, VersionCodeInfo serverVersion, VersionCodeInfo localVersion, Dictionary <String, String> packageMD5Dic, String packageUrl, string packageMd5List, Action <int, int, string> taskProgress, Action <int, long, long> progress, Action finished, Action <Exception> error, bool isFirstRes = false, bool forFullPkg = false) { LoggerHelper.Debug("下载包列表"); DownloadPackageInfoList(packageMd5List, (packageInfoList) => { var downloadList = (from packageInfo in packageInfoList where packageInfo.LowVersion.Compare(localVersion) >= 0 && packageInfo.HighVersion.Compare(serverVersion) <= 0 select new KeyValuePair <string, string>(packageInfo.HighVersion.ToString(), packageInfo.Name)).ToList(); if (downloadList.Count != 0) { LoggerHelper.Debug("开始下载包列表"); DownDownloadPackageList(fileDecompress, packageUrl, downloadList, packageMD5Dic, taskProgress, progress, finished, error, isFirstRes, forFullPkg); } else { LoggerHelper.Debug("更新包数目为0"); if (finished != null) { finished(); } } }, () => { error(new Exception("DownloadPackageInfoList error.")); }, isFirstRes); }
public static void PlayBackgroundMusic(int missionID, PlayMusicMode mode = PlayMusicMode.Repeat) { LoggerHelper.Debug("PlayBackgroundMusic Check"); if (!MapData.dataMap.ContainsKey(missionID)) { return; } if (MapData.dataMap[missionID].backgroundMusic == null) { return; } if (MapData.dataMap[missionID].backgroundMusic.Count == 0) { return; } LoggerHelper.Debug("PlayBackgroundMusic"); backgroundMusicOrder = MapData.dataMap[missionID].backgroundMusic; orderIndex = RandomHelper.GetRandomInt(0, MapData.dataMap[missionID].backgroundMusic.Count - 1); PlayMusic(backgroundMusicOrder[orderIndex], mode); }
/// <summary> /// Updates the specified entity and then deletes the entity from the SQL database as a single transacion. /// The purpose of this method is to be used when you have a delete trigger in the SQL database and you need to update /// first who is doing the delete. /// </summary> /// <param name="entity"></param> public virtual void UpdateDeleteEntity(Entity entity) { LoggerHelper.Info("Start"); try { if (entity.GetFieldId() == null) { LoggerHelper.Error("Entity does not have an Id field defined."); return; } IList <StatementWrapper> statements = new List <StatementWrapper>(); StatementWrapper stmtWrapper = GetQueryBuilder().BuildUpdateEntityStatement(entity); LoggerHelper.Debug(stmtWrapper.Query.ToString()); statements.Add(stmtWrapper); stmtWrapper = GetQueryBuilder().BuildDeleteStatement(entity); LoggerHelper.Debug(stmtWrapper.Query.ToString()); statements.Add(stmtWrapper); GetQueryRunner().ExecuteTransaction(GetConnection(), statements); } catch (Exception e) { throw new Exception("Unable to delete " + entity.GetTableName() + ".", e); } finally { LoggerHelper.Info("End"); } }
/// <summary> /// Executes an aggregated operation in the datasource and returns the list of entities as a JSON response. /// </summary> /// <param name="request">The request</param> /// <returns>a JSON response</returns> public virtual string GetAggreateEntities(HttpRequest request) { LoggerHelper.Info("Start"); IList <Entity> list = new List <Entity>(); try { if (string.IsNullOrEmpty(request.Params[AggregateParam])) { throw new Exception("aggregate info can not be null."); } Page page = GetPage(request); //Creating entity Entity entity = CreateEntity(request, page); string json = request.Params[AggregateParam]; LoggerHelper.Debug("AggregateInfo = " + json); AggregateInfo aggregateInfo = (AggregateInfo) new JavaScriptSerializer().Deserialize(json, typeof(AggregateInfo)); list = GetCatalogDAO(page).GetAggregateEntities(entity, aggregateInfo, GetSearchType(request), CreateFilter(request)); } catch (Exception e) { LoggerHelper.Error(e); return(ErrorResponse(e)); } finally { LoggerHelper.Info("End"); } return(CreateEntityListResponse(list)); }
/// <summary> /// Returns the result of the specified aggregated function(s) executed in a SQL Database. /// </summary> /// <param name="entity">The entity type</param> /// <param name="aggregateInfo">The aggregateInfo data</param> /// <param name="searchType">The search type</param> /// <param name="filter">The filter info</param> /// <returns>The agregated list of entities</returns> public IList <Entity> GetAggregateEntities(Entity entity, AggregateInfo aggregateInfo, FilterInfo.SearchType searchType, FilterInfo filter) { LoggerHelper.Info("Start"); IList <Entity> list = new List <Entity>(); try { Entity aggregateEntity = new Entity(); StatementWrapper stmtWrapper = GetQueryBuilder().BuildAggregateStatement(entity, aggregateInfo, aggregateEntity, searchType, filter); LoggerHelper.Debug(stmtWrapper.Query.ToString()); ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(aggregateEntity); list = GetQueryRunner().Query(GetConnection(), stmtWrapper, h); } catch (Exception e) { LoggerHelper.Error(e); throw new Exception("Unable to fetch " + entity.GetTableName() + " list.", e); } finally { LoggerHelper.Info("End"); } return(list); }
/// <summary> /// encapsulate Log.debug /// </summary> /// <param name="DebugText"></param> private void Debug(string DebugText) { if (SystemConfiguration.Debug) { LoggerHelper.Debug(DebugText); } }
public override void HandleData() { UInt32 entityID = (UInt32)Arguments[0]; LoggerHelper.Debug("aoi del " + entityID); EventDispatcher.TriggerEvent <uint>(Events.FrameWorkEvent.AOIDelEvtity, entityID); }
void Update() { if (BeginCountDown) { m_fCurrentTime += Time.deltaTime; m_fElapseTime += Time.deltaTime; if (m_fCurrentTime >= m_fCDTime) { LoggerHelper.Debug("CountDown End"); //BeginCountDown = false; //m_fCurrentTime = 0f; //m_fElapseTime = 0f; EventDispatcher.TriggerEvent(OccupyTowerUIDict.OccupyTowerUEvent.OnJoinCountDownEnd); } else { if (m_fElapseTime >= 1.0f) { LoggerHelper.Debug("CountDown ING"); int downCount = (int)m_fCDTime - (int)m_fCurrentTime; SetCountDownTime(downCount); m_fElapseTime = 0f; } } } }
/// <summary> /// Deletes the specified entity from an Oracle database. /// </summary> /// <param name="entity">The entity to be deleted</param> public virtual void DeleteEntity(Entity entity) { LoggerHelper.Info("Start"); try { if (entity.GetFieldId() == null) { LoggerHelper.Error("Entity does not have an Id field defined."); return; } StringBuilder query = GetQueryBuilder().BuildDeleteQuery(entity); LoggerHelper.Debug(query.ToString()); GetQueryRunner().ExecuteNonQuery(GetConnection(), query); } catch (Exception e) { if (e.Message.Contains("FK") || e.Message.Contains("REFERENCE")) { throw new Exception(entity.GetTableName() + " cannot be deleted, because is being used."); } else { throw new Exception("Unable to delete " + entity.GetTableName() + " record.", e); } } finally { LoggerHelper.Info("End"); } }
private void DownloadFinishWithMd5(DownloadTask task) { string str = Utils.BuildFileMd5(task.FileName); if (str.Trim() != task.MD5.Trim()) { if (System.IO.File.Exists(task.FileName)) { System.IO.File.Delete(task.FileName); } LoggerHelper.Error("断点MD5验证失败,从新下载:" + task.FileName + "--" + str + " vs " + task.MD5, true); task.bDownloadAgain = true; task.bFineshed = false; this.CheckDownLoadList(); } else { LoggerHelper.Debug("断点下载验证全部通过,下载完成:" + task.FileName, true, 0); if (this.FileDecompress != null) { this.FileDecompress(true); } task.bDownloadAgain = false; task.bFineshed = true; task.Finished(); if (this.FileDecompress != null) { this.FileDecompress(false); } LoggerHelper.Debug("断点下载完成后,再次核对下载列表", true, 0); this.CheckDownLoadList(); } }
protected void ShowButton() { // 设置左侧登录奖励和领取按钮 if (!MogoWorld.thePlayer.IsLoginRewardHasGot) { LoggerHelper.Debug("ShowLoginGrid IsLoginRewardHasGot True"); LoginRewardUIViewManager.Instance.ShowLoginGotButtom(loginCircleDay, true); LoginRewardUIViewManager.Instance.ShowLeftGetSign(loginCircleDay, false); LoginRewardUIViewManager.Instance.ShowRightTitle(loginCircleDay); } else { LoggerHelper.Debug("ShowLoginGrid IsLoginRewardHasGot False"); LoginRewardUIViewManager.Instance.ShowLoginGotButtom(loginCircleDay, false); LoginRewardUIViewManager.Instance.ShowLeftGetSign(loginCircleDay, true); LoginRewardUIViewManager.Instance.ShowRightTitle(loginCircleDay); } // 设置右侧限时购买和购买按钮 if ((MogoTime.Instance.GetCurrentDateTime().Year == MogoTime.Instance.GetDateTimeBySecond((int)MogoWorld.thePlayer.buyHotSalesLastTime).Year&& MogoTime.Instance.GetCurrentDateTime().DayOfYear != MogoTime.Instance.GetDateTimeBySecond((int)MogoWorld.thePlayer.buyHotSalesLastTime).DayOfYear) || (MogoTime.Instance.GetCurrentDateTime().Year != MogoTime.Instance.GetDateTimeBySecond((int)MogoWorld.thePlayer.buyHotSalesLastTime).Year)) { LoginRewardUIViewManager.Instance.ShowLoginBuyButtom(loginCircleDay, true); LoginRewardUIViewManager.Instance.ShowRightBuySign(loginCircleDay, false); } else { LoginRewardUIViewManager.Instance.ShowLoginBuyButtom(loginCircleDay, false); LoginRewardUIViewManager.Instance.ShowRightBuySign(loginCircleDay, true); } }