protected void btnSubmit_Click(object sender, EventArgs e) { HelperUtility.hasPurviewPage("Department_add"); string strContent = tbDepartmentName.InnerText; HelperFile.WriteTxt(strContent, strFileName); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HelperUtility.hasPurviewPage("Department_add"); tbDepartmentName.InnerText = HelperFile.ReadTxt(strFileName); } }
public static void bindRPT(Repeater rpt) { string strFileName = "/BackManager/department/department.txt"; string strDepartment = HelperFile.ReadTxt(strFileName); List <string> listDepartment = strDepartment.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); rpt.DataSource = listDepartment; rpt.DataBind(); }
/// <summary> /// loads a game data from file. /// </summary> /// <param name="fileName">file name</param> /// <param name="type">object type</param> /// <returns></returns> public static GameDataSpec Load(string fileName, Type type) { GameDataSpec spec = FindSpec(fileName); if (spec == null) { spec = (GameDataSpec)HelperFile.LoadData(fileName, type); spec.sourceFilePath = fileName; specList.Add(fileName, spec); } return(spec); }
/// <summary> /// load all of the data for stage level, player, enemies, items, weapons, etc. /// </summary> /// <returns></returns> public void LoadLevel(string levelFile) { this.levelInfo = (GameLevelInfo)HelperFile.LoadData(levelFile, levelInfo.GetType()); RobotGameGame.CurrentGameLevel = this; // Initialize level Initialize(); // Global fog if (levelInfo.FogEnable) { FrameworkCore.Viewer.BasicFog = new RenderFog(); FrameworkCore.Viewer.BasicFog.enabled = true; FrameworkCore.Viewer.BasicFog.start = levelInfo.FogStart; FrameworkCore.Viewer.BasicFog.end = levelInfo.FogEnd; FrameworkCore.Viewer.BasicFog.color = new Color( (byte)levelInfo.FogColor.X, (byte)levelInfo.FogColor.Y, (byte)levelInfo.FogColor.Z); } else { FrameworkCore.Viewer.BasicFog = new RenderFog(); FrameworkCore.Viewer.BasicFog.enabled = false; } // Global lighting if (levelInfo.LightingEnable) { FrameworkCore.Viewer.BasicLighting = new RenderLighting(); FrameworkCore.Viewer.BasicLighting.enabled = true; FrameworkCore.Viewer.BasicLighting.ambientColor = new Color( (byte)levelInfo.LightingAmbientColor.X, (byte)levelInfo.LightingAmbientColor.Y, (byte)levelInfo.LightingAmbientColor.Z); FrameworkCore.Viewer.BasicLighting.diffuseColor = new Color( (byte)levelInfo.LightingDiffuseColor.X, (byte)levelInfo.LightingDiffuseColor.Y, (byte)levelInfo.LightingDiffuseColor.Z); FrameworkCore.Viewer.BasicLighting.specularColor = new Color( (byte)levelInfo.LightingSpecularColor.X, (byte)levelInfo.LightingSpecularColor.Y, (byte)levelInfo.LightingSpecularColor.Z); FrameworkCore.Viewer.BasicLighting.direction = levelInfo.LightingDirection; } else { FrameworkCore.Viewer.BasicLighting = new RenderLighting(); FrameworkCore.Viewer.BasicLighting.enabled = false; } // Create world if (this.levelInfo.WorldInLevel != null) { CreateWorld(ref this.levelInfo.WorldInLevel); } // Create particles CreateParticle(this.levelInfo.ParticleListFile); // Create player if (this.levelInfo.PlayerInLevel != null) { GamePlayer player = CreatePlayer(ref this.levelInfo.PlayerInLevel, this.SceneMechRoot); RobotGameGame.SinglePlayer = player; FrameworkCore.GameEventManager.TargetScene = player; } // Create all enemies in the level if (levelInfo.EnemyInLevelList != null) { for (int i = 0; i < levelInfo.EnemyInLevelList.Count; i++) { EnemyInLevel enemy = levelInfo.EnemyInLevelList[i]; CreateSpawnEnemy(ref enemy, this.SceneMechRoot); } } // Create all items in the level if (levelInfo.ItemInLevelList != null) { for (int i = 0; i < levelInfo.ItemInLevelList.Count; i++) { ItemInLevel item = levelInfo.ItemInLevelList[i]; CreateItemBox(ref item, this.SceneWorldRoot); } } // Create all weapons in the level if (levelInfo.WeaponInLevelList != null) { for (int i = 0; i < levelInfo.WeaponInLevelList.Count; i++) { CreateWeapon(levelInfo.WeaponInLevelList[i], SceneWorldRoot); } } // Entry collision of the units to layer in the level switch (Info.GamePlayType) { case GamePlayTypeId.StageClear: { GamePlayer player = SinglePlayer; // Entry collision of the player to layer in the level CollisionLayerFriendlyMech.AddCollide(player.Collide); CollisionLayerAllMech.AddCollide(player.Collide); // Entry collsion of each enemy to layer in the level for (int i = 0; i < EnemyCountInLevel; i++) { GameEnemy enemy = GetEnemyInLevel(i); CollisionLayerEnemyMech.AddCollide(enemy.Collide); CollisionLayerAllMech.AddCollide(enemy.Collide); } } break; case GamePlayTypeId.Versus: { } break; } // Entry collsion of items to layer in the level for (int i = 0; i < ItemCountInLevel; i++) { GameItemBox item = GetItemInLevel(i); CollisionLayerItems.AddCollide(item.Collide); } // Entry collsion of weapons to layer in the level for (int i = 0; i < WeaponCountInLevel; i++) { GameWeapon weapon = GetWeaponInLevel(i); CollisionLayerItems.AddCollide(weapon.Collide); } }
protected void btnReset_Click(object sender, EventArgs e) { string strFileName = "/BackManager/department/department_bak.txt"; tbDepartmentName.InnerText = HelperFile.ReadTxt(strFileName); }
protected override void BeginWork() { try { base.BeginWork(); m_Parameters = GetImportBEO(BootParameters); m_Parameters.ShouldNotBe(null); m_LoadFileUri = new Uri(m_Parameters.Locations.First()); m_ColumnDelimiter = (char)m_Parameters.LoadFile.ColumnDelimiter; m_QuoteCharacter = (char)m_Parameters.LoadFile.QuoteCharacter; m_NewlineCharacter = (char)m_Parameters.LoadFile.NewlineDelimiter; m_RecordTokenizer = new RecordTokenizer(m_ColumnDelimiter, m_QuoteCharacter); m_EncodingType = Encoding.GetEncoding(m_Parameters.LoadFile.EncodingType); m_IsFirstLineHeader = m_Parameters.LoadFile.IsFirstLineHeader; var loadFilePath = HttpUtility.UrlDecode(m_LoadFileUri.OriginalString); ReportToDirector("LoadFileParser works on load file {0}", loadFilePath); m_StreamReader = new StreamReader(loadFilePath, m_EncodingType); #region Dataset Detaills m_Parameters.DatasetId.ShouldBeGreaterThan(0); m_Dataset = DataSetBO.GetDataSetDetailForDataSetId(m_Parameters.DatasetId); var matterDetails = MatterDAO.GetMatterDetails(m_Parameters.MatterId.ToString()); matterDetails.ShouldNotBe(null); m_Dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); searchServerDetails.ShouldNotBe(null); m_Dataset.Matter.SearchServer = searchServerDetails; m_DatasetPath = m_Dataset.CompressedFileExtractionLocation; #endregion if (m_Parameters != null && m_Parameters.IsImportImages && m_Parameters.LoadFile.ImageFile != null && m_Parameters.LoadFile.ImageFile.ImageExtractionOption == LoadFileImageExtractionOption.HelperFile) { var imageHelperFileName = m_Parameters.LoadFile.ImageFile.HelperFileName; ReportToDirector("LoadFileParser uses image helper file {0}", imageHelperFileName); _imageHelperFileParser = new HelperFileParser(this, imageHelperFileName); } if (m_Parameters != null && m_Parameters.LoadFile.ContentFile != null && m_Parameters.LoadFile.ContentFile.TextExtractionOption == LoadFileTextExtractionOption.HelperFile) { var contentHelperFileName = m_Parameters.LoadFile.ContentFile.HelperFileName; ReportToDirector("LoadFileParser uses content (text) helper file {0}", contentHelperFileName); TextHelperFile = new HelperFile(this, contentHelperFileName); } if (null != m_Parameters && null != m_Parameters.LoadFile && null != m_Parameters.LoadFile.ContentFile && null != m_Parameters.LoadFile.ContentFile.LoadFileContentField) { m_ContentFieldNumber = Convert.ToInt32(m_Parameters.LoadFile.ContentFile.LoadFileContentField); } _uniqueThreadString = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); SetMessageBatchSize(m_Parameters); } catch (Exception ex) { //Send log to Log Pipe LogMessage(false, Constants.ParserFailureMessageOnInitialize); ex.Trace(); ReportToDirector("Exception in LoadFileParser.BeginWork", ex.ToDebugString()); throw; } }
protected override void BeginWork() { try { base.BeginWork(); m_Parameters = GetImportBEO(BootParameters); m_Parameters.ShouldNotBe(null); m_LoadFileUri = new Uri(m_Parameters.Locations.First()); m_ColumnDelimiter = (char) m_Parameters.LoadFile.ColumnDelimiter; m_QuoteCharacter = (char) m_Parameters.LoadFile.QuoteCharacter; m_NewlineCharacter = (char) m_Parameters.LoadFile.NewlineDelimiter; m_RecordTokenizer = new RecordTokenizer(m_ColumnDelimiter, m_QuoteCharacter); m_EncodingType = Encoding.GetEncoding(m_Parameters.LoadFile.EncodingType); m_IsFirstLineHeader = m_Parameters.LoadFile.IsFirstLineHeader; var loadFilePath = HttpUtility.UrlDecode(m_LoadFileUri.OriginalString); ReportToDirector("LoadFileParser works on load file {0}", loadFilePath); m_StreamReader = new StreamReader(loadFilePath, m_EncodingType); #region Dataset Detaills m_Parameters.DatasetId.ShouldBeGreaterThan(0); m_Dataset = DataSetBO.GetDataSetDetailForDataSetId(m_Parameters.DatasetId); var matterDetails = MatterDAO.GetMatterDetails(m_Parameters.MatterId.ToString()); matterDetails.ShouldNotBe(null); m_Dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); searchServerDetails.ShouldNotBe(null); m_Dataset.Matter.SearchServer = searchServerDetails; m_DatasetPath = m_Dataset.CompressedFileExtractionLocation; #endregion if (m_Parameters != null && m_Parameters.IsImportImages && m_Parameters.LoadFile.ImageFile != null && m_Parameters.LoadFile.ImageFile.ImageExtractionOption == LoadFileImageExtractionOption.HelperFile) { var imageHelperFileName = m_Parameters.LoadFile.ImageFile.HelperFileName; ReportToDirector("LoadFileParser uses image helper file {0}", imageHelperFileName); _imageHelperFileParser =new HelperFileParser(this,imageHelperFileName); } if (m_Parameters != null && m_Parameters.LoadFile.ContentFile != null && m_Parameters.LoadFile.ContentFile.TextExtractionOption == LoadFileTextExtractionOption.HelperFile) { var contentHelperFileName = m_Parameters.LoadFile.ContentFile.HelperFileName; ReportToDirector("LoadFileParser uses content (text) helper file {0}", contentHelperFileName); TextHelperFile = new HelperFile(this, contentHelperFileName); } if (null != m_Parameters && null != m_Parameters.LoadFile && null != m_Parameters.LoadFile.ContentFile && null != m_Parameters.LoadFile.ContentFile.LoadFileContentField) { m_ContentFieldNumber = Convert.ToInt32(m_Parameters.LoadFile.ContentFile.LoadFileContentField); } _uniqueThreadString = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); SetMessageBatchSize(m_Parameters); } catch (Exception ex) { //Send log to Log Pipe LogMessage(false, Constants.ParserFailureMessageOnInitialize); ex.Trace(); ReportToDirector("Exception in LoadFileParser.BeginWork", ex.ToDebugString()); throw; } }