public void OnClickBattleScene(Vector2 _screenPos) { OperateMode operateMode = OperateMode.DefaultMode; Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null) { operateMode = hostPlayer.GetOperateMode(); } if (operateMode == OperateMode.DefaultMode) { return; } uint num = 0u; Ray ray = Camera.main.ScreenPointToRay(_screenPos); Player hostPlayer2 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); float distance; if (this.curPlane.Raycast(ray, out distance)) { Vector3 point = ray.GetPoint(distance); if (hostPlayer2 != null) { num = Singleton <AttackModeTargetSearcher> .GetInstance().SearchNearestTarget(ref hostPlayer2.Captain, (VInt3)point, 3000); } if (num != 0u) { Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(num); } } }
public override void OnUse() { base.OnUse(); if (this.m_heroProficiency != null) { this.m_heroProficiency.UnInit(); } this.m_heroProficiency = null; this.multiKillNum = 0; this.contiKillNum = 0; this.contiDeadNum = 0; this.bGodMode = false; this.autoRevived = false; byte b = 0; while ((int)b < this.m_talentArr.Length) { this.m_talentArr[(int)b] = 0u; b += 1; } this.m_skinCfgId = 0u; this.m_skinId = 0u; this.bDeadLevelUp = false; this.skillEffectPath = string.Empty; this.CurOpMode = OperateMode.DefaultMode; }
public FormHomemadeRejectlist(OperateMode operateMode, string vProvider, string billNo) { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); m_operateMode = operateMode; m_strProvider = vProvider; m_strBillID = billNo; if (m_operateMode == OperateMode.查看) { toolStrip1.Visible = false; } m_queryGoodsInfo = m_goodsServer.GetBillView(m_strBillID); RefreshDataGridView(m_queryGoodsInfo); // 添加数据定位控件 m_dataLocalizer = new UserControlDataLocalizer( dataGridView1, this.Name, UniversalFunction.SelectHideFields( this.Name, dataGridView1.Name, BasicInfo.LoginID)); txtProvider.Text = m_strProvider; panelTop.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; m_strStorage = m_serverStorageInfo.GetStorageID(billNo, "S_HomemadeRejectBill", "Bill_ID"); }
public void OnHandleClickSelectTargetBtn(AttackTargetType _targetType) { OperateMode operateMode = OperateMode.DefaultMode; Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); if (hostPlayer != null) { operateMode = hostPlayer.GetOperateMode(); } if (operateMode == OperateMode.DefaultMode) { return; } if (_targetType != this.m_TargetType) { this.m_CurSelectedActor.Release(); } SelectEnemyType selectType = SelectEnemyType.SelectLowHp; if (hostPlayer != null) { selectType = hostPlayer.AttackTargetMode; } uint selectTargetByTag = this.GetSelectTargetByTag(_targetType, selectType); Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(selectTargetByTag); this.m_TargetType = _targetType; }
public void OnClickBattleScene(Vector2 _screenPos) { OperateMode defaultMode = OperateMode.DefaultMode; Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null) { defaultMode = hostPlayer.GetOperateMode(); } if (defaultMode != OperateMode.DefaultMode) { float num; uint num2 = 0; Ray ray = Camera.main.ScreenPointToRay((Vector3)_screenPos); Player player2 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (this.curPlane.Raycast(ray, out num)) { Vector3 point = ray.GetPoint(num); if (player2 != null) { num2 = Singleton <AttackModeTargetSearcher> .GetInstance().SearchNearestTarget(ref player2.Captain, (VInt3)point, 0xbb8); } if (num2 != 0) { Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(num2); } } } }
public DiaboxPiece(int id, GameObject diabox, bool isopen, float time) : base(id) { this.diabox = diabox; this.isopen = isopen; this.time = time; this.operate = OperateMode.Show; }
public void SetOperateMode(OperateMode _mode) { if (_mode == OperateMode.DefaultMode) { if (this.Captain && this.Captain.get_handle().LockTargetAttackModeControl != null) { this.Captain.get_handle().LockTargetAttackModeControl.ClearTargetID(); } } else if (this.Captain && this.Captain.get_handle().DefaultAttackModeControl != null) { this.Captain.get_handle().DefaultAttackModeControl.ClearCommonAttackTarget(); } this.useOperateMode = _mode; List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors; for (int i = 0; i < heroActors.get_Count(); i++) { PoolObjHandle <ActorRoot> poolObjHandle = heroActors.get_Item(i); if (poolObjHandle && poolObjHandle.get_handle().TheActorMeta.PlayerId == this.PlayerId) { HeroWrapper heroWrapper = poolObjHandle.get_handle().ActorControl as HeroWrapper; if (heroWrapper != null) { heroWrapper.CurOpMode = this.useOperateMode; } } } if (ActorHelper.IsHostCtrlActor(ref this.Captain)) { Singleton <EventRouter> .GetInstance().BroadCastEvent <CommonAttactType>(EventID.GAME_SETTING_COMMONATTACK_TYPE_CHANGE, (CommonAttactType)_mode); } }
public NewImageEffect() { time = 0; depth = 0; end = false; loop = false; target = ImageType.Back; operate = OperateMode.SetSprite; }
public void ChangeOperation(Int32 val) { OperateMode modeVal = (OperateMode)val; m_CurOpaMode = modeVal; if (Global.instance.m_Hero_01 != null) { Global.instance.m_Hero_01.UpdateOpaMode(m_CurOpaMode); } }
private void SetCanAutoFindEnemies(OperateMode val) { if (m_OpaMode == val) { return; } m_OpaMode = val; this.UpdateFirstAtkWaiteTime(); }
public override void OnUse() { base.OnUse(); this.m_skinCfgId = 0u; this.m_skinId = 0u; this.skillEffectPath = string.Empty; this.CurOpMode = OperateMode.DefaultMode; this.m_iLifeTime = 0; this.m_bIsTrueType = false; this.hostActor.Release(); this.imposterActor.Release(); }
public void OnClickBattleUI(uint _targetID) { OperateMode defaultMode = OperateMode.DefaultMode; Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null) { defaultMode = hostPlayer.GetOperateMode(); } if ((defaultMode != OperateMode.DefaultMode) && (_targetID != 0)) { Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(_targetID); } }
/// <summary> /// 构造函数(带要显示信息) /// </summary> /// <param name="operateMode">操作模式</param> /// <param name="row">要显示的信息</param> public FormMeeting(OperateMode operateMode, DataRow row) { InitializeComponent(); if (operateMode == OperateMode.Update) { AuthorityControl(); } else { toolStrip.Visible = false; } InitForm(row); }
protected uint ExecuteSearchTarget(int srchR, ref bool bSearched) { PoolObjHandle <ActorRoot> poolObjHandle = this.actorPtr; MonsterWrapper monsterWrapper = poolObjHandle.handle.ActorControl as MonsterWrapper; if (monsterWrapper != null && monsterWrapper.isCalledMonster) { poolObjHandle = monsterWrapper.hostActor; } Player ownerPlayer = ActorHelper.GetOwnerPlayer(ref poolObjHandle); if (ownerPlayer == null) { return(0u); } SelectEnemyType attackTargetMode = ownerPlayer.AttackTargetMode; LastHitMode useLastHitMode = ownerPlayer.useLastHitMode; AttackOrganMode curAttackOrganMode = ownerPlayer.curAttackOrganMode; OperateMode operateMode = ownerPlayer.GetOperateMode(); uint result; if (operateMode == OperateMode.LockMode) { result = this.NormalModeCommonAttackSearchTarget(srchR, attackTargetMode, ref bSearched); } else if (this.commonAttackButtonType == CommonAttackButtonType.CommonAttackButton) { if (useLastHitMode == LastHitMode.None && curAttackOrganMode == AttackOrganMode.None) { result = this.NormalModeCommonAttackSearchTarget(srchR, attackTargetMode, ref bSearched); } else { result = this.AdvancedModeCommonAttackSearchTarget(srchR, attackTargetMode, ref bSearched); } } else if (this.commonAttackButtonType == CommonAttackButtonType.LastHitButton) { result = this.LastHitModeSearchTarget(srchR, attackTargetMode, ref bSearched); } else { result = this.AttackOrganModeSearchTarget(srchR, attackTargetMode, ref bSearched); } return(result); }
public void ReadyUseSkill() { Skill readySkillObj = (this.NextSkillObj == null) ? this.SkillObj : this.NextSkillObj; if (((readySkillObj != null) && (readySkillObj.cfgData != null)) && (readySkillObj.cfgData.bWheelType != 1)) { OperateMode playerOperateMode = ActorHelper.GetPlayerOperateMode(ref this.Actor); if (!Singleton <GameInput> .GetInstance().IsSmartUse() && (playerOperateMode == OperateMode.DefaultMode)) { this.ReadyUseSkillDefaultAttackMode(readySkillObj); } else if (playerOperateMode == OperateMode.LockMode) { this.ReadyUseSkillLockAttackMode(readySkillObj); } } }
public void ReadyUseSkill(bool bForceSkillUseInDefaultPosition = false) { Skill skill = (this.NextSkillObj != null) ? this.NextSkillObj : this.SkillObj; if (skill == null || skill.cfgData == null || skill.cfgData.bWheelType == 1) { return; } OperateMode playerOperateMode = ActorHelper.GetPlayerOperateMode(ref this.Actor); if (!Singleton <GameInput> .GetInstance().IsSmartUse() && playerOperateMode == OperateMode.DefaultMode) { this.ReadyUseSkillDefaultAttackMode(skill, bForceSkillUseInDefaultPosition); } else if (playerOperateMode == OperateMode.LockMode) { this.ReadyUseSkillLockAttackMode(skill, bForceSkillUseInDefaultPosition); } }
private void rbMode_CheckedChanged(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; if (!rb.Checked) { return; } if (rb.Name == rbPreview.Name) { operateMode = OperateMode.Preview; } else if (rb.Name == rbEditRegion.Name) { operateMode = OperateMode.EditRegion; } else if (rb.Name == rbSetRegionProps.Name) { operateMode = OperateMode.SetRegionProps; } else if (rb.Name == rbEditInfluence.Name) { operateMode = OperateMode.EditInfluence; } else if (rb.Name == rbSetInfluenceProps.Name) { operateMode = OperateMode.SetInfluenceProps; } else if (rb.Name == rbEditGameArea.Name) { operateMode = OperateMode.EditGameArea; } Refresh(); }
private static void AppendOperateLog(string category, string typeName, OperateMode mode, string key) { if (!IsOpenWriteLog) { return; } lock (rootSync) { //{Time:xxx type [operateMode] entityName keys:} _operateLog.AppendFormat("Time:{0} {1} [{2}] {3} key:{4}", MathUtils.UnixEpochTimeSpan.TotalSeconds, category, (string.Join("|", new[] { (mode.HasFlag(OperateMode.Add) ? OperateMode.Add.ToString() : ""), (mode.HasFlag(OperateMode.Modify) ? OperateMode.Modify.ToString() : ""), (mode.HasFlag(OperateMode.Remove) ? OperateMode.Remove.ToString() : "") }.Where(t => !string.IsNullOrEmpty(t))) ), typeName, key ); _operateLog.AppendLine(); } }
private static void AppendOperateLog(string category, string typeName, OperateMode mode, string key) { if (!IsOpenWriteLog) return; lock (rootSync) { //{Time:xxx type [operateMode] entityName keys:} _operateLog.AppendFormat("Time:{0} {1} [{2}] {3} key:{4}", MathUtils.UnixEpochTimeSpan.TotalSeconds, category, (string.Join("|", new[]{(mode.HasFlag(OperateMode.Add) ? OperateMode.Add.ToString() : ""), (mode.HasFlag(OperateMode.Modify) ? OperateMode.Modify.ToString() : ""), (mode.HasFlag(OperateMode.Remove) ? OperateMode.Remove.ToString() : "")}.Where(t => !string.IsNullOrEmpty(t))) ), typeName, key ); _operateLog.AppendLine(); } }
/// <summary> /// /// </summary> /// <param name="typeName"></param> /// <param name="keys"></param> /// <param name="mode"></param> public static void ProcessEntityOfMessageQueueTimes(string typeName, IEnumerable<string> keys, OperateMode mode) { if (!IsEnable) return; var obj = _entityObjectCollection.GetOrAdd(typeName, t => new EntityProfileCollection()); foreach (var key in keys) { AppendOperateLog(MessageQueueTableName + "#Process", typeName, mode, key); obj.ProcessTimes.Countor(); obj.ProcessKeyCountor(key); } }
/// <summary> /// /// </summary> /// <param name="typeName"></param> /// <param name="key">entity key</param> /// <param name="mode"></param> public static void PostEntityOfMessageQueueTimes(string typeName, string key, OperateMode mode) { if (!IsEnable) return; var obj = _entityObjectCollection.GetOrAdd(typeName, t => new EntityProfileCollection()); AppendOperateLog(MessageQueueTableName + "#Post", typeName, mode, key); obj.PostTimes.Countor(); obj.PostKeyCountor(key); }
public void SetLineFeed() { operate = OperateMode.LineFeed; }
public TextPiece(int id, GameObject diabox) : base(id) { this.diabox = diabox; this.operate = OperateMode.ClearPage; }
public void UpdateOpaMode(OperateMode opaMode) { this.SetCanAutoFindEnemies(opaMode); }
public DiaboxPiece(int id, GameObject diabox) : base(id) { this.diabox = diabox; this.operate = OperateMode.Set; }
void Update() { var device = SteamVR_Controller.Input((int)trackedObj.index); attachball = GetComponentInChildren <AttachmentPoint>().gameObject; //Vector4 controllerPosition = new Vector4(attachpoint.transform.position.x, attachpoint.transform.position.y, attachpoint.transform.position.z, 1); Vector4 controllerPosition = new Vector4(attachball.transform.position.x, attachball.transform.position.y, attachball.transform.position.z, 1); if (mode == GameMode.Create) { if (currentArrow == null && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { Debug.LogWarning("MakinVectors::Update() - Creating vector"); currentArrow = scene.createVector(controllerPosition); } else if (currentArrow != null && device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) { currentArrow.finalize(); currentArrow = null; } else if (currentArrow != null) { currentArrow.setPoints(currentArrow.getStart(), controllerPosition); } if (device.GetTouchDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { //mode = GameMode.Operate; mode = GameMode.Edit; } } else if (mode == GameMode.Edit) { if (device.GetTouchDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { mode = GameMode.Operate; } if (currentArrow == null && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { foreach (Arrow v in scene.ourVectors) { if ((v.getInfo() - controllerPosition).magnitude < 1) { currentArrow = v; } } } else if (currentArrow != null && device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) { currentArrow.FinishEditing(); currentArrow = null; } else if (currentArrow != null) { currentArrow.setPoints(currentArrow.getStart(), controllerPosition); } } else if (mode == GameMode.Operate) { if (scene.selected.Count < 2 && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { foreach (Arrow vector in scene.ourVectors) { if ((vector.getInfo() - controllerPosition).magnitude < 1) { scene.selectVector(vector); break; } } } else if (scene.selected.Count == 2 && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { if (operation == OperateMode.addition) { scene.addSelected(); } if (operation == OperateMode.crossProduct) { scene.crossSelected(); } //if (operation == OperateMode.dotProduct) // scene.dotSelected(); } else if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Axis0)) { if (operation == OperateMode.addition) { operation = OperateMode.crossProduct; } else if (operation == OperateMode.crossProduct) { operation = OperateMode.addition; } //else if (operation == OperateMode.dotProduct) // operation = OperateMode.addition; } if (device.GetTouchDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { mode = GameMode.Create; } } /*if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Grip)) * { * scene.getAGrip(); * } * else if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Grip)) * { * scene.loseAGrip(); * }*/ //gamemodetext.text = mode.ToString(); //if (mode == GameMode.Operate) // operationtext.text = operation.ToString(); //else // operationtext.text = ""; //CGHW //Change Menu System if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { toggle++; toggle = toggle % 3; /* * if (toggle == Cartesian) * { * // Display "Cartesian" * coordtext.text = "Cartesian"; * GRID.SetActive(true); * SPHERICAL.SetActive(false); * CYLINDRICAL.SetActive(false); * } * //else * // coordtext.text = ""; * * if (toggle == Spherical) * { * // Display "Spherical" * coordtext.text = "Spherical"; * GRID.SetActive(false); * SPHERICAL.SetActive(true); * CYLINDRICAL.SetActive(false); * } * //else * // coordtext.text = ""; * * if (toggle == Cylindrical) * { * // Display "Cylindrical" * coordtext.text = "Cylindrical"; * GRID.SetActive(false); * SPHERICAL.SetActive(false); * CYLINDRICAL.SetActive(true); * } * //else * // coordtext.text = ""; */ } }
public void SetOpMode(OperateMode mode) { opMode = mode; }
public void SetPageLine() { operate = OperateMode.PageLine; }
/// <summary> /// /// </summary> /// <param name="typeName"></param> /// <param name="keys"></param> /// <param name="mode"></param> public static void ProcessEntityOfMessageQueueTimes(string typeName, IEnumerable <string> keys, OperateMode mode) { if (!IsEnable) { return; } var obj = _entityObjectCollection.GetOrAdd(typeName, t => new EntityProfileCollection()); foreach (var key in keys) { AppendOperateLog(MessageQueueTableName + "#Process", typeName, mode, key); obj.ProcessTimes.Countor(); obj.ProcessKeyCountor(key); } }
/// <summary> /// Gets all Command Line Arguments /// </summary> private static void GetCommandArgs() { // Now get any commandline args string[] CmdArgs = Environment.GetCommandLineArgs(); // Check for proper switches if (!ValidArgs(CmdArgs)) { // If ValidArgs returns false, then the supplied arguments are invalid // therefore, we message the user on proper usage and then UsageMessage terminates the application UsageMessage(); } // Loop through all commandline args for (int LoopCtl = 0; LoopCtl < CmdArgs.Length; LoopCtl++) { // Daily Stats = No Switch / -DddMonYYYY // Weekly Status Update = -W or -WddMonYYYY // Monthly Stats = -M# // Quarterly Stats = -Q#YYYY // Annual Stats = -AYYYY string CommandLinePart = CmdArgs[LoopCtl]; switch (CommandLinePart.Substring(0, 2).ToUpper()) { case "/H": // Message the user what the usage is UsageMessage(); break; case "-Q": // Format should be -Q<number><Year> OperatingMode = OperateMode.Quarterly; if (CommandLinePart.Length > 2) { ReportQuarter = Convert.ToInt32(CommandLinePart.Substring(2, 1)); ReportYear = Convert.ToInt32(CommandLinePart.Substring(3, 4)); } else { string QuarterDay = QuarterReportDay(); ReportQuarter = Convert.ToInt32(QuarterDay.Substring(0, 1)); ReportYear = Convert.ToInt32(QuarterDay.Substring(1, 4)); } break; case "-A": // Format should be -A<Year> OperatingMode = OperateMode.Annual; ReportYear = Convert.ToInt32(CommandLinePart.Substring(2, 4)); break; case "-M": // Format should be -M<Number> OperatingMode = OperateMode.Monthly; if (CommandLinePart.Length > 2) { ReportMonth = Convert.ToInt32(CommandLinePart.Substring(2, 1)); ReportingDay = new DateTime(DateTime.Today.Year, ReportMonth, DateTime.Today.Day); ReportDayNum = ReportingDay.Day; ReportYear = ReportingDay.Year; } else { ReportMonth = DateTime.Today.Month; ReportingDay = new DateTime(DateTime.Today.Year, ReportMonth, DateTime.Today.Day); ReportDayNum = ReportingDay.Day; ReportYear = ReportingDay.Year; } break; case "-W": // Format should be -W or -WddMonYYYY OperatingMode = OperateMode.Weekly; if (CommandLinePart.Length > 2) { ReportingDay = WeeklyReportDay(new DateTime(Convert.ToInt32(CommandLinePart.Substring(7, 4)), MonthNumber(CommandLinePart.Substring(4, 3)), Convert.ToInt32(CommandLinePart.Substring(2, 2)))); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; ReportWeekNum = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(ReportingDay, CalendarWeekRule.FirstDay, DayOfWeek.Sunday); } else { ReportingDay = PrevWeeklyReportDay(); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; ReportWeekNum = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(ReportingDay, CalendarWeekRule.FirstDay, DayOfWeek.Sunday); } break; case "-D": // Format should be -DddMonYYYY or -D OperatingMode = OperateMode.Daily; if (CommandLinePart.Length > 2) { ReportDayNum = Convert.ToInt32(CommandLinePart.Substring(2, 2)); ReportMonth = MonthNumber(CommandLinePart.Substring(4, 3)); ReportYear = Convert.ToInt32(CommandLinePart.Substring(7, 4)); ReportingDay = new DateTime(ReportYear, ReportMonth, ReportDayNum); } else { ReportingDay = DateTime.Today.AddDays(-1); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; } break; default: // If the last part of the commandline contains "EXE" then it is the full path to the executable and we don't care if (CommandLinePart.Contains(".exe")) { break; } // Format should be -DddMonYYYY OperatingMode = OperateMode.Daily; ReportingDay = DateTime.Today.AddDays(-1); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; break; } } }
static void Main(string[] args) { #region StartUp Section // Initialize all variables ConfigRallyUID = ""; ConfigRallyPWD = ""; ConfigLogPath = ""; ConfigStatusEOL = ""; ConfigReportPath = ""; ReportFile = ""; LogFile = ""; ConfigDBServer = ""; ConfigDBName = ""; ConfigDBUID = ""; ConfigDBPWD = ""; ReportDayNum = 0; ReportWeekNum = 0; ReportMonth = 0; ReportQuarter = 0; ReportYear = 0; // Get the configuration information from config file if (!GetConfigSettings()) { // If we can't get the configuration settings, we can't even log anything, so just terminate Environment.Exit(-1); } // Check for any commandline arguments. If there are not any, assume a "Daily" operating mode and set // the report date to yesterday (we don't want to report on today) if (args.Length != 0) { GetCommandArgs(); } else { OperatingMode = OperateMode.Daily; ReportingDay = DateTime.Today.AddDays(-1); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; } #endregion StartUp Section // Log the start of processing LogOutput("Started processing at " + DateTime.Now.ToLongTimeString() + " on " + DateTime.Now.ToLongDateString(), "Main", false); DateTime dtStartTime = DateTime.Now; // Log the operating mode switch (OperatingMode) { case OperateMode.Daily: LogOutput("Operating in Daily Mode...Processing for Day " + ReportingDay.ToString("dd-MMM-yyyy"), "Main", false); break; case OperateMode.Monthly: LogOutput("Operating in Monthly Mode...Processing for " + ReportingDay.ToString("MMM"), "Main", false); break; case OperateMode.Quarterly: LogOutput("Operating in Quarterly mode...Processing for Quarter Q" + ReportQuarter.ToString() + "Y" + ReportYear.ToString(), "Main", false); break; case OperateMode.Annual: LogOutput("Operating in Annual mode...Processing for year " + ReportYear.ToString(), "Main", false); break; case OperateMode.Weekly: LogOutput("Operating in Weekly mode...Processing for Day " + ReportingDay.ToString("dd-MMM-yyyy"), "Main", false); break; default: LogOutput("Unknown Operating mode...assuming Daily...", "Main", false); break; } #region Gather from Rally // Create the Rally API object LogOutput("Creating reference to RallyAPI...", "Main", true); RallyAPI = new RallyRestApi(); // Login to Rally LogOutput("Starting connection to Rally...", "Main", true); try { RallyAPI.Authenticate(ConfigRallyUID, ConfigRallyPWD, ConfigRallyURL); LogOutput("Response from RallyAPI.Authenticate: " + RallyAPI.AuthenticationState.ToString(), "Main", true); if (RallyAPI.AuthenticationState.ToString() != "Authenticated") { // We did not actually connect LogOutput("Unable to connect to Rally and establish session. Application will terminate.", "Main", false); Environment.Exit(-1); } else { if (RallyAPI.ConnectionInfo.UserName == null) { LogOutput("RallyAPI.ConnectionInfo: " + RallyAPI.ConnectionInfo.ToString(), "Main", false); LogOutput("Unable to authenticate with Rally. Application will terminate.", "Main", false); Environment.Exit(-1); } else { LogOutput("Connected to Rally as user " + RallyAPI.ConnectionInfo.UserName, "Main", true); } } } catch (Exception ex) { LogOutput("Error Connecting to Rally: " + ex.Message, "Main", false); LogOutput("Rally Authentication State: " + RallyAPI.AuthenticationState.ToString() + "Rally Connection Info: " + RallyAPI.ConnectionInfo.ToString(), "Main", false); } // Grab the active Initiatives we want to report on LogOutput("Getting all Initiatives...", "Main", false); List<Initiative> InitiativeList = new List<Initiative>(); LogOutput("Calling 'GetInitiativeList'...", "Main", true); InitiativeList = GetInitiativeList(); LogOutput("Done with 'GetInitiativeList'", "Main", true); if (InitiativeList.Count == 0) { // Could not get the Initiatives...or nothing to report on, so stop LogOutput("Unable to open Initiative list or no Initiatives to report on. Application will terminate.", "Main", false); InitiativeList.Clear(); RallyAPI.Logout(); // Disconnect from Rally Environment.Exit(-1); // End Program } LogOutput("Retrieved " + InitiativeList.Count + " Initiatives to report on", "Main", false); // Now iterate through the initiatives and get all the Features or "Projects" LogOutput("Getting all Projects for the Initiatives...", "Main", false); BasicProjectList = new List<Project>(); LogOutput("Looping for each Initiative...", "Main", true); foreach (Initiative init in InitiativeList) { // Get the project list for the current initiative ONLY List<Project> ProjectList = new List<Project>(); LogOutput("Calling 'GetProjectsForInitiative' with " + init.Name.Trim() + "...", "Main", true); ProjectList = GetProjectsForInitiative(init.Name.Trim()); LogOutput("Done with 'GetProjectsForInitiative' for " + init.Name.Trim(), "Main", true); // Append this list to the FULL list LogOutput("Appending " + ProjectList.Count + " projects to object 'BasicProjectList'", "Main", true); BasicProjectList.AddRange(ProjectList); } LogOutput("Retrieved " + BasicProjectList.Count + " Projects total", "Main", false); // We need to loop through the project list now and for each project // we need to get all the epics. Then with each epic, we recursively // get all user stories LogOutput("Getting all User Stories for all projects...", "Main", false); // Initialize a new list of projects. This will become the full list including stories // and defects CompleteProjectList = new List<Project>(); LogOutput("Looping for each Project...", "Main", true); foreach (Project proj in BasicProjectList) { // Get all the epics for this project LogOutput("~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+", "Main", true); LogOutput("Calling 'GetEpicsForProject' with " + proj.Name.Trim() + "...", "Main", true); List<Epic> EpicList = new List<Epic>(); EpicList = GetEpicsForProject(proj.FormattedID.Trim()); LogOutput("Done with 'GetEpicsForProject' for " + proj.Name.Trim(), "Main", true); // Now go through each of the Epics for the current project // and recurse through to get all final-level user stories LogOutput("Getting all User Stories for " + proj.Name + "...", "Main", true); List<Epic> FullEpicList = new List<Epic>(); BasicStoryList = new List<UserStory>(); LogOutput("Looping for each Epic...", "Main", true); foreach (Epic epic in EpicList) { Epic newepic = new Epic(); List<UserStory> StoryList = new List<UserStory>(); LogOutput("Calling 'GetUserStoriesPerParent' with " + epic.FormattedID.Trim() + " as Root Parent...", "Main", true); StoryList = GetUserStoriesPerParent(epic.FormattedID.Trim(), epic.Name.Trim(), true); LogOutput("Done with 'GetUserStoriesPerParent' for " + epic.FormattedID.Trim(), "Main", true); // save the info as a new epic newepic.ActualEndDate = epic.ActualEndDate; newepic.DefectActual = epic.DefectActual; newepic.DefectEstimate = epic.DefectEstimate; newepic.DefectToDo = epic.DefectToDo; newepic.Description = epic.Description; newepic.FormattedID = epic.FormattedID; newepic.Name = epic.Name; newepic.Owner = epic.Owner; newepic.ParentProject = epic.ParentProject; newepic.PlannedEndDate = epic.PlannedEndDate; newepic.PlannedStartDate = epic.PlannedStartDate; newepic.Release = epic.Release; newepic.State = epic.State; newepic.StateChangedDate = epic.StateChangedDate; newepic.StoryActual = epic.StoryActual; newepic.StoryEstimate = epic.StoryEstimate; newepic.StoryToDo = epic.StoryToDo; newepic.UserStories = StoryList; // Add the stories to the full list FullEpicList.Add(newepic); BasicStoryList.AddRange(StoryList); } LogOutput("Retrieved " + BasicStoryList.Count + " User Stories for " + proj.Name, "Main", false); // Get any defects there may be for the User Stories LogOutput("Getting all Defects for " + proj.Name + "...", "Main", false); BasicDefectList = new List<Defect>(); LogOutput("Looping for each Story...", "Main", true); foreach (UserStory story in BasicStoryList) { List<Defect> DefectList = new List<Defect>(); // Defects will always be attached to a User Story LogOutput("Calling 'GetDefectsForStory' with " + story.Name + "...", "Main", true); DefectList = GetDefectsForStory(story); LogOutput("Done with 'GetDefectsForStory' for " + story.Name, "Main", true); // If there are any defects, add them to the list if (DefectList.Count > 0) { LogOutput("Appending " + DefectList.Count + " defects to object 'BasicDefectList'", "Main", true); BasicDefectList.AddRange(DefectList); } } // At this point we have the FULL list of User Stories/Defects for the current // project. We now create a "new" project with the same properties, but this time // we are able to store the Epics, User Stories, and Defects. LogOutput("Creating new project object and populating with full information...", "Main", true); Project newproject = new Project(); newproject.ActualEndDate = proj.ActualEndDate; newproject.Description = proj.Description; newproject.Expedite = proj.Expedite; newproject.FormattedID = proj.FormattedID; newproject.Initiative = proj.Initiative; newproject.LastUpdateDate = proj.LastUpdateDate; newproject.Name = proj.Name; newproject.OpportunityAmount = proj.OpportunityAmount; newproject.Owner = proj.Owner; newproject.UpdateOwner = proj.UpdateOwner; newproject.StakeHolder = proj.StakeHolder; newproject.PlannedEndDate = proj.PlannedEndDate; newproject.PlannedStartDate = proj.PlannedStartDate; newproject.RevokedReason = proj.RevokedReason; newproject.State = proj.State; newproject.StateChangedDate = proj.StateChangedDate; newproject.StatusUpdate = proj.StatusUpdate; newproject.UserStories = BasicStoryList; newproject.Defects = BasicDefectList; newproject.Epics = FullEpicList; LogOutput("Appending new project object to object 'CompleteProjectList'", "Main", true); CompleteProjectList.Add(newproject); } LogOutput("Done looping through all projects", "Main", false); LogOutput("Appending new project object to object 'CompleteProjectList'", "Main", true); #endregion Gather from Rally #region Calculation Section // We now have a full list of all projects with all complete information so // at this point we can calculate the Actuals for each project based on the reporting mode we are operating in switch (OperatingMode) { case OperateMode.Daily: // This mode runs every day and simply keeps running total of time with daily inserts for each project AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateDailyTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateDailyTotals(CompleteProjectList, ReportingDay); LogOutput("Done with 'CalculateDailyTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateDailyReport'...", "Main", true); CreateDailyReport(AllProjectInfo, ReportingDay); LogOutput("Done with 'CreateDailyReport'...", "Main", true); break; case OperateMode.Monthly: // This mode runs each month and creates very high-level summary info AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateMonthlyReport' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateMonthlyReport(CompleteProjectList, ReportMonth); LogOutput("Done with 'CalculateMonthlyReport'", "Main", true); // Now create the final report LogOutput("Calling 'CreateMonthlyReport'...", "Main", true); CreateMonthlyReport(AllProjectInfo, ReportMonth); LogOutput("Done with 'CreateMonthlyReport'...", "Main", true); break; case OperateMode.Quarterly: AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateQuarterTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateQuarterTotals(CompleteProjectList, ReportQuarter, ReportYear); LogOutput("Done with 'CalculateQuarterTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateQuarterReport'...", "Main", true); CreateQuarterReport(AllProjectInfo, ReportYear.ToString() + 'Q' + ReportQuarter.ToString()); LogOutput("Done with 'CreateQuarterReport'...", "Main", true); break; case OperateMode.Annual: AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateAnnualTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateAnnualTotals(CompleteProjectList, ReportYear); LogOutput("Done with 'CalculateAnnualTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateAnnualReport'...", "Main", true); CreateAnnualReport(AllProjectInfo, ReportYear); LogOutput("Done with 'CreateAnnualReport'...", "Main", true); break; case OperateMode.Weekly: // This mode is intended to run on Sunday in order to run stats for up-to-and-including current week for projects. The "Project Update" // is also included so the single table can be queried AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateWeeklyTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateWeeklyTotals(CompleteProjectList, ReportingDay); LogOutput("Done with 'CalculateWeeklyTotals'", "Main", true); // Now create the weekly report LogOutput("Calling 'CreateWeeklyReport'...", "Main", true); CreateWeeklyReport(AllProjectInfo, ReportingDay); LogOutput("Done with 'CreateWeeklyReport'...", "Main", true); break; } #endregion DateTime dtEndTime = DateTime.Now; string strTotSeconds = dtEndTime.Subtract(dtStartTime).TotalSeconds.ToString(); LogOutput("Completed processing at " + DateTime.Now.ToLongTimeString() + " on " + DateTime.Now.ToLongDateString() + " - Total Processing Time: " + strTotSeconds + " seconds", "Main", false); Environment.Exit(0); }
/// <summary> /// /// </summary> /// <param name="typeName"></param> /// <param name="key">entity key</param> /// <param name="mode"></param> public static void PostEntityOfMessageQueueTimes(string typeName, string key, OperateMode mode) { if (!IsEnable) { return; } var obj = _entityObjectCollection.GetOrAdd(typeName, t => new EntityProfileCollection()); AppendOperateLog(MessageQueueTableName + "#Post", typeName, mode, key); obj.PostTimes.Countor(); obj.PostKeyCountor(key); }