public PlayerState(Player player) { this.player = player; foreach (Card c in player.GetHandZone().GetCards()) { hand.Add(new CardPoint() { card = c, point = 0, zone = CardZoneType.Hand }); } foreach (Card c in player.GetUnitZone().GetCards()) { Unit.Add(new CardPoint() { card = c, point = 0, zone = CardZoneType.Unit }); } foreach (Card c in player.GetSupportZone().GetCards()) { Support.Add(new CardPoint() { card = c, point = 0, zone = CardZoneType.Support }); } atk = player.AttackPower; skill = player.SkillDamage; atkMod = player.AttackPower - (player.GetUnitZone().GetAtack() + player.GetSupportZone().GetAtack()); skillMod = player.SkillDamage - (player.GetUnitZone().GetSkill() + player.GetSupportZone().GetSkill()); cost = player.cost; }
public override TimeBaseValue Calculate(int forIndex) { if (forIndex < Length) { return new SRValue() { Time = GetTime(forIndex), Value = double.NaN, Source = GetValueBySource(forIndex), Index = Result.Count } } ; double[] close = GetClose(forIndex, Range); double[] low = close, high = close; int center = forIndex - 1 - Range; DateTime tm = GetTime(center); SRValue value = new SRValue() { Time = tm, Index = Result.Count, Power = 1 }; if (IsMin(low[Range], low)) // support { value.Type = SupResType.Support; value.Value = low[Range]; if (UpdateSupport(value)) { Support.Add(value); } } else if (IsMax(high[Range], high)) // resistance { value.Type = SupResType.Resistance; value.Value = high[Range]; if (UpdateResistance(value)) { Resistance.Add(value); } } SRValue lastRes = GetLastResistance(); if (lastRes != null && lastRes != value) { lastRes.Length++; } SRValue lastSup = GetLastSupport(); if (lastSup != null && lastSup != value) { lastSup.Length++; } return(value); }
public void Update() { if (LastGet >= DateTime.Now.AddHours(1)) { return; } LastGet = DateTime.Now; string url = "https://www.gaitameonline.com/rateaj/getrate"; string json = (new System.Net.WebClient()).DownloadString(url); ExchangeRateInfo eri = JsonConvert.DeserializeObject <ExchangeRateInfo>(json); Infos.Clear(); Support.Clear(); foreach (ExchangeRateInfo.Quote ei in eri.quotes) { string Frm = ei.currencyPairCode.Substring(0, 3); string Dst = ei.currencyPairCode.Substring(3, 3); float Rate = float.Parse(ei.bid); Infos.Add(new Info() { From = Frm, To = Dst, Rate = Rate, Div = false }); Infos.Add(new Info() { From = Dst, To = Frm, Rate = Rate, Div = true }); Support.Add($"{Frm}/{Dst}"); Support.Add($"{Dst}/{Frm}"); } }
public bool Read(string FilePath) { ClearVars(); //To Do: read from file FileStream kFs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite); StreamReader sr = new StreamReader(kFs); string str = ""; while (sr.EndOfStream == false) { str = sr.ReadLine(); if (BasicInfo.UsersTitle == "") { if (str.Contains("ASTRA")) { if (str.Length > 12) { str = str.Remove(0, 12); BasicInfo.UsersTitle = str; continue; } } } //if (ProjectTitle == "") //{ // ProjectTitle = str; // continue; //} if (str.Contains("UNIT") && this.LUnit == "" && this.MUnit == "") { string[] ss = CAstraUnits.GetBasicLengthMassUnits(str); this.MUnit = ss[0]; this.LUnit = ss[1]; switch (this.MUnit.ToUpper()) { case "MTON": this.wfct_flag = 1; break; case "KN": this.wfct_flag = 2; break; case "KG": this.wfct_flag = 3; break; case "NEW": this.wfct_flag = 4; break; case "N": this.wfct_flag = 4; break; case "GM": this.wfct_flag = 5; break; case "GMS": this.wfct_flag = 5; break; case "KIP": this.wfct_flag = 6; break; case "LBS": this.wfct_flag = 7; break; } switch (this.LUnit.ToUpper()) { case "MM": this.lfct_flag = 1; break; case "CM": this.lfct_flag = 2; break; case "M": this.lfct_flag = 3; break; case "ME": this.lfct_flag = 3; break; case "METRES": this.lfct_flag = 3; break; case "YDS": this.lfct_flag = 4; break; case "FT": this.lfct_flag = 5; break; case "INCH": this.lfct_flag = 6; break; case "IN": this.lfct_flag = 6; break; } } if (str.ToUpper().Contains("STRUCTURE")) { str = str.Replace('\t', ' '); string[] values = str.Split(new char[] { ' ' }); while (str.IndexOf(" ") != -1) { str = str.Replace(" ", " "); } if (values.Length == 3) { int.Parse(values[1]); BasicInfo.Type = (StructureType)int.Parse(values[1]); BasicInfo.RunningOption = short.Parse(values[2]); } //str = str.Remove(0, 10); //str = str.Trim(); //string[] values = str.Split(new char[] { ' ' }); //while (str.IndexOf(" ") != -1) //{ // str = str.Replace(" ", " "); //} //str = str.Replace('\t', ' '); //values = str.Split(new char[] { ' ' }); //str = values[0]; //StructureType = ((str == "1") ? StructureType.SPACE : (str == "2") ? StructureType.FLOOR : StructureType.PLANE); //try { this.Modex = short.Parse(values[1]); } //catch (Exception ex) { this.Modex = -1; } } string find = getNodeName(str); if (find == "N000") { str = str.Replace('\t', ' '); string[] values = str.Split(new char[] { ' ' }); while (str.IndexOf(" ") != -1) { str = str.Replace(" ", " "); } if (values.Length == 3) { BasicInfo.MassUnit = CAstraUnits.GetMassUnit(values[1]); BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(values[2]); } } if (find == "N001") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); NodeData.MassFactor = d[0]; NodeData.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); NodeData.MassUnit = CAstraUnits.GetMassUnit(unt[2]); NodeData.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { NodeData.Add(CNodeData.Parse(str)); } catch (Exception ex) { } } else if (find == "N002") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); BeamConnectivity.MassFactor = d[0]; BeamConnectivity.LengthFactor = d[1]; } try { BeamConnectivity.Add(CMemberConnectivity.Parse(str)); } catch (Exception ex) { } } else if (find == "N003") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); SectionProperty.MassFactor = d[0]; SectionProperty.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); SectionProperty.MassUnit = CAstraUnits.GetMassUnit(unt[2]); SectionProperty.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { SectionProperty.Add(CSectionProperty.Parse(str)); } catch (Exception ex) { } } else if (find == "N004") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MaterialProperty.MassFactor = d[0]; MaterialProperty.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MaterialProperty.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MaterialProperty.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MaterialProperty.Add(CMaterialProperty.Parse(str)); } catch (Exception ex) { } } else if (find == "N005") { try { Support.Add(CSupport.Parse(str)); } catch (Exception ex) { } } else if (find == "N008") { try { MemberTruss.Add(CMemberTruss.Parse(str)); } catch (Exception ex) { } } else if (find == "N010") { try { SelfWeight = (CSelfWeight.Parse(str)); } catch (Exception ex) { } } else if (find == "N007") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MemberBeamLoad.MassFactor = d[0]; MemberBeamLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MemberBeamLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MemberBeamLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MemberBeamLoad.Add(CMemberBeamLoading.Parse(str)); } catch (Exception ex) { } } else if (find == "N009") { try { BeamConnectivityRelease.Add(CBeamConnectivityRelease.Parse(str)); } catch (Exception ex) { } } else if (find == "N006") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); JointNodalLoad.MassFactor = d[0]; JointNodalLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); JointNodalLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); JointNodalLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { //CJointNodalLoad jntLoad = new CJointNodalLoad(); //jntLoad = CJointNodalLoad.Parse(str); JointNodalLoad.Add(CJointNodalLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N099") { try { Analysis = CAnalysis.Parse(str); } catch (Exception ex) { } } else if (find == "N011") { if (str.Contains("FILE")) { int j = str.IndexOf("FILE"); str = str.Remove(0, j + 5); str = str.ToUpper().Trim(); MovingLoad.FileName = str; } try { MovingLoad.Add(CMovingLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N012") { string[] values = str.Split(new char[] { ' ' }); if (values.Length == 4) { try { LoadGeneration.repeatTime = int.Parse(values[3]); } catch (Exception ex) { } } try { LoadGeneration.Add(CLoadGeneration.Parse(str)); } catch (Exception ex) { } } else if (find == "N013") { try { LoadCombination.Add(CLoadCombination.Parse(str)); } catch (Exception ex) { } } else if (find == "N014") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); AreaLoad.MassFactor = d[0]; AreaLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); AreaLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); AreaLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { AreaLoad.Add(CAreaLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N019") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MatPropertyInfo.MassFactor = d[0]; MatPropertyInfo.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MatPropertyInfo.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MatPropertyInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MatPropertyInfo.Add(CMaterialPropertyInformation.Parse(str)); } catch (Exception ex) { } } else if (find == "N016") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); ElementData.MassFactor = d[0]; ElementData.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); ElementData.MassUnit = CAstraUnits.GetMassUnit(unt[2]); ElementData.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { //ElementData.Add(CElementData.Parse(str)); } catch (Exception ex) { } } else if (find == "N020") { try { ElementMultiplier.Add(CElementMultiplier.Parse(str)); } catch (Exception ex) { } } else if (find == "N018") { try { ElementData.Add(CElementData.Parse(str)); } catch (Exception ex) { } } if (Analysis.NDYN == 2) { if (find == "N101") { try { TimeHistory.THist_1 = CTimeHistory1.Parse(str); } catch (Exception exx) { } } else if (find == "N102") { try { TimeHistory.THist_2 = CTimeHistory2.Parse(str); } catch (Exception exx) { } } else if (find == "N103") { try { TimeHistory.THist_3 = CTimeHistory3.Parse(str); } catch (Exception exx) { } } else if (find == "N104") { try { TimeHistory.THist_4 = CTimeHistory4.Parse(str); } catch (Exception exx) { } } else if (find == "N105") { try { if (TimeHistory.THist_5.Count > 0) { TimeHistory.THist_5.NodalConstraint = true; } TimeHistory.THist_5.Add(CTimeHistory5.Parse(str)); } catch (Exception exx) { } } else if (find == "N106") { try { TimeHistory.THist_6.Add(CTimeHistory6.Parse(str)); } catch (Exception exx) { } } } else if (Analysis.NDYN == 3) { Response.ReadFromStream(sr); } } kFs.Close(); sr.Close(); return(true); }
public override Task DivideLine(string line) { if (line.Contains(" CITC ")) { CitC.Add(line); } else if (line.Contains(" LOGIN: "******" LOGIN MISC: ")) { LoginMisc.Add(line); } else if (line.Contains(" QUIT MISC: ")) { QuitMisc.Add(line); } else if (line.Contains(" (AA)(BAN) ")) { Bans.Add(line); } else if (line.Contains(" (AA)(MUTE) ")) { Mutes.Add(line); } else if (line.Contains(" (AA)(JAIL) ")) { Jails.Add(line); } else if (line.Contains(" (AA)(CONTACTADMIN) ")) { Cad.Add(line); } else if (line.Contains(" (AA)(SUPPORT) ")) { Support.Add(line); } else if (line.Contains(" opened '") && line.Contains(" ms")) { LogsFetched.Add(line); } else if (line.Contains(" [CM] ") && line.Contains(" set ")) { Reports.Add(line); } else if (line.Contains("[Complaint ID") && line.Contains(" replied with ")) { Reports.Add(line); } else if (line.Contains(" warped to ") || line.Contains(" WL: ")) { if (line.Contains("WL: 0") || line.Contains("with 0 stars Dim: 0")) { PossibleAbuse.Add(line); } else { RegisteredAbuse.Add(line); } } /*else if (line.Contains(" warped to ") && !line.Contains(" WL: 0") && !line.Contains(" (EM) ")) * RegisteredAbuse.Add(line); * else if (line.Contains(" warped to ") && line.Contains(" WL: 0") && !line.Contains(" (EM) ")) * PossibleAbuse.Add(line); * else if (line.Contains(" ST ") && (!line.Contains("from 0") && line.Contains("wanted points."))) * RegisteredAbuse.Add(line);*/ else if (line.Contains(" ST ") && line.Contains("from 0 wanted points.")) { PossibleAbuse.Add(line); } else if (line.Contains("abuse") || line.Contains("recommendation") || line.Contains("leak") || line.Contains("bias") || line.Contains("accept") || line.Contains("jcm") || line.Contains("rcm") || line.Contains("scm") ) { PossibleAbuse.Add(line); } else if (line.Contains("object. ID:")) { DutyRelated.Add(line); } else if (line.Contains("changed account:")) { DutyRelated.Add(line); } else if (line.Contains("changed the password of account")) { DutyRelated.Add(line); } else if (line.Contains("checked the PIN code of account")) { DutyRelated.Add(line); } else if (line.Contains("zone 0 p")) { DutyRelated.Add(line); } else if (line.Contains(" (PP) ")) { PendingPunishments.Add(line); } else { Other.Add(line); } return(Task.CompletedTask); }
public override Task DivideLine(string line) { Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} started job."); if (line.Length < 5) { Console.WriteLine($"{DateTime.Now} Line too small, skipped."); } else if (line.Contains(" TC: ")) { Team.Add(line); } else if (line.Contains(" MC LS:")) { Main.Add(line); } else if (line.Contains(" MC LV:")) { Main.Add(line); } else if (line.Contains(" MC SF:")) { Main.Add(line); } else if (line.Contains(" (ADVERT) ")) { Advert.Add(line); } else if (line.Contains(" (MYC ")) { Country.Add(line); } else if (line.Contains(" (sup) ")) { Support.Add(line); } else if (line.Contains(" (cad) ")) { Cad.Add(line); } else if (line.Contains(" KILL: ")) { KillDeaths.Add(line); } else if (line.Contains(" DEATH: ")) { KillDeaths.Add(line); } else if (line.Contains(" killed themselves via command")) { KillDeaths.Add(line); } else if (line.Contains(" GrC (")) { Group.Add(line); } else if (line.Contains(" SC (")) { Squad.Add(line); } else if (line.Contains(" UC (")) { Unit.Add(line); } else if (line.Contains(" (alliance) ")) { Group.Add(line); } else if (line.Contains(" SMS from ")) { Sms.Add(line); } else if (line.Contains(" SMS to ")) { Sms.Add(line); } else if (line.Contains(" T$ ")) { TTransactions.Add(line); if (line.Contains("(CITphoneTran")) { PlayerTransactions.Add(line); } else if (line.Contains("CIThit")) { Hit.Add(line); } } else if (line.Contains(" G$ ")) { GTransactions.Add(line); if (line.Contains("(CITphoneTran")) { PlayerTransactions.Add(line); } else if (line.Contains("CIThit")) { Hit.Add(line); } } else if (line.Contains(" BT: ")) { PlayerTransactions.Add(line); } else if (line.Contains(" (FMSG) ")) { Fmsg.Add(line); } else if (line.Contains(" (LOCF)[")) { Fmsg.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" LC ")) { Emergency.Add(line); } else if (line.Contains(" GroupPromotion: ")) { Group.Add(line); } else if (line.Contains(" modify ")) { Inventory.Add(line); } else if (line.Contains(" Crafting ")) { Inventory.Add(line); } else if (line.Contains(") sold ")) { Trading.Add(line); } else if (line.Contains(" (Bought ")) { Trading.Add(line); } else if (line.Contains(" NC ")) { JoinQuit.Add(line); } else if (line.Contains(" LOGIN MISC: ")) { JoinQuit.Add(line); } else if (line.Contains(" LOGIN: "******" LOGIN WEPS: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT MISC: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT WEPS: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT WEPS: ")) { JoinQuit.Add(line); } else { Other.Add(line); } Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} ended job."); return(Task.CompletedTask); }