/// <summary> 增加重启时间 </summary> public static DATES AddSchDates(this SCHEDULE schDate, DateTime startTime, DateTime pTime) { BaseKey findKey = null; DateTime nowTime = startTime; if (nowTime > pTime) { throw new ArgumentException("插入的时间不能小于案例的起始时间!"); } schDate.Foreach( l => { if (l is DATES) { DATES date = l as DATES; nowTime = date.DateTime; // 记录比当前时间小的 if (nowTime < pTime) { findKey = l; } } //else if (l is TSTEP) //{ // TSTEP step = l as TSTEP; // int dayCount = step.DataCount; // nowTime.AddDays(dayCount); // // 记录比当前时间小的 // if (nowTime <= pTime) // { // findKey = l; // } //} } ); DATES insertDate = new DATES("DATES"); insertDate.SetDateTime(pTime); // 没有找到 = 插入END前面 if (findKey == null) { END endKey = schDate.Find <END>(); schDate.InsertBefore(endKey, insertDate); } // 找到了 = 插入指定关键字前面 else { schDate.InsertAfter(findKey, insertDate); } return(insertDate); }
public Form1() { InitializeComponent(); assing(); Star.Visible = false; END.Start(); santa.Visible = false; SetStyle(ControlStyles.SupportsTransparentBackColor, true); santa.BackColor = Color.Transparent; }
static void Main(string[] args) { Lista START, END, ff; START = END = null; int n, escolha, resultado; do { Console.Clear(); Console.WriteLine("--Menu Principal--"); Console.WriteLine("(1) - Insere um elemento na Lista"); Console.WriteLine("(2) - Remove um elemento da Lista"); Console.WriteLine("(3) - Consulta um elemento da Lista"); Console.WriteLine("(4) - Imprime os elementos da Lista"); Console.WriteLine("(5) - Imprime os elementos da Lista ao contrario"); Console.WriteLine("(6) - Para SAIR"); escolha = int.Parse(Console.ReadLine()); Console.Clear(); switch (escolha) { case 1: // Insere um elemento na Lista ff = new Lista(); Console.Write("Entre com um numero : "); n = int.Parse(Console.ReadLine()); ff.Insere(n, ref START, ref END); break; case 2: // Remove o primeiro elemento na lista START.Remove(ref START, ref END); break; case 3: //Consulta um elemento na lista Console.Write("Insira numero a consultar: "); resultado = int.Parse(Console.ReadLine()); START.Consulta(resultado, START); break; case 4: //Imprime todos os elementos da lista START.Imprimir(); break; case 5: //Imprime todos os elementos da lista ao contrario END.ImprimirInverso(); break; } } while (escolha != 6); }
public bool CheckWin() { if (stkChessUsed.Count == chessBoard.NumOfColumns * chessBoard.NumOfLines) { _end = END.Draw; return(true); } foreach (ChessPiece cp in stkChessUsed) { if (CheckVertical(cp.Row, cp.Column, cp.Owner) || CheckHorizontal(cp.Row, cp.Column, cp.Owner) || CheckCross(cp.Row, cp.Column, cp.Owner) || CheckCrossBackwards(cp.Row, cp.Column, cp.Owner)) { _end = cp.Owner == 1 ? END.Player1 : END.Player2; return(true); } } return(false); }
public bool KiemtraWin() { if (stkcacnuocdadi.Count() == _BanCo.Socot * _BanCo.Sodong) { _end = END.HoaCo; return(true); } foreach (Ô_cờ oco in stkcacnuocdadi) { if (DuyetDoc(oco.Dong, oco.Cot, oco.SoHuu) || DuyetNgang(oco.Dong, oco.Cot, oco.SoHuu) || CheoXuoi(oco.Dong, oco.Cot, oco.SoHuu) || CheoNguoc(oco.Dong, oco.Cot, oco.SoHuu)) { _end = oco.SoHuu == 1 ? END.P1 : END.P2; return(true); } } return(false); }
public bool onWin() { if (m_StoneList.Count == (m_BoardSize + 1) * (m_BoardSize + 1)) { _end = END.TIE; return(true); } for (int i = 0; i < 12; i++) { if (checkVertical(i, Stone.Black) || checkHorizontal(i, Stone.Black) || checkCrossRight(i, Stone.Black) || checkCrossLeft(i, Stone.Black)) { _end = END.BLACK; return(true); } if (checkVertical(i, Stone.Red) || checkHorizontal(i, Stone.Red) || checkCrossRight(i, Stone.Red) || checkCrossLeft(i, Stone.Red)) { _end = END.RED; return(true); } } return(false); }
/// <summary> 格式化文件 </summary> public void Format() { RUNSPEC runspec = this.Key.CreateSingle <RUNSPEC>("RUNSPEC"); REGIONS region = this.Key.CreateSingle <REGIONS>("REGIONS"); if (region != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_REG.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; region.Add(include); } GRID grid = this.Key.CreateSingle <GRID>("GRID"); var includesOld = grid.FindAll <INCLUDE>(); if (grid != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOPP.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GGO.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); #region - ggo - var echo = this.Key.FindAll <ECHO>(); if (echo != null) { grid.DeleteAll <ECHO>(); include.AddRange(echo); } var mapaxes = this.Key.FindAll <MAPAXES>(); if (mapaxes != null) { grid.DeleteAll <MAPAXES>(); include.AddRange(mapaxes); } var gridunit = this.Key.FindAll <GRIDUNIT>(); if (gridunit != null) { grid.DeleteAll <GRIDUNIT>(); include.AddRange(gridunit); } var coordsys = this.Key.FindAll <COORDSYS>(); if (coordsys != null) { grid.DeleteAll <COORDSYS>(); include.AddRange(coordsys); } var mapunits = this.Key.FindAll <MAPUNITS>(); if (mapunits != null) { grid.DeleteAll <MAPUNITS>(); include.AddRange(mapunits); } var noecho = this.Key.FindAll <NOECHO>(); if (noecho != null) { grid.DeleteAll <NOECHO>(); include.AddRange(noecho); } var coord = this.Key.FindAll <COORD>(); if (coord != null) { grid.DeleteAll <COORD>(); include.AddRange(coord); } var zcorn = this.Key.FindAll <ZCORN>(); if (zcorn != null) { grid.DeleteAll <ZCORN>(); include.AddRange(zcorn); } // 清空原有INCLUDE foreach (var v in includesOld) { grid.Delete(v); } #endregion include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GPRO.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOTH.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); ECHO echo1 = grid.Find <ECHO>(); if (echo1 != null) { grid.DeleteAll <ECHO>(); include.Add(echo1); } List <FAULTS> faults = grid.FindAll <FAULTS>(); if (faults != null) { grid.DeleteAll <FAULTS>(); foreach (var v in faults) { include.Add(v); } } MULTFLT multflt = grid.Find <MULTFLT>(); if (multflt != null) { grid.DeleteAll <MULTFLT>(); include.Add(multflt); } } END end = this.Key.CreateSingle <END>("END"); }
/// <summary> 清理父节点 </summary> public void InitParentKey() { RUNSPEC runspec = this.Key.CreateSingle <RUNSPEC>("RUNSPEC"); GRID grid = this.Key.CreateSingle <GRID>("GRID"); if (grid != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_grid.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); INCLUDE include1 = new INCLUDE("INCLUDE"); include1.FileName = this.FileName.GetFileNameWithoutExtension() + "_faults.inc"; include1.FilePath = this.FilePath.GetDirectoryName() + "\\" + include1.FileName; grid.Add(include1); INCLUDE include2 = new INCLUDE("INCLUDE"); include2.FileName = this.FileName.GetFileNameWithoutExtension() + "_aquifer.inc"; include2.FilePath = this.FilePath.GetDirectoryName() + "\\" + include1.FileName; grid.Add(include2); } EDIT edit = this.Key.Find <EDIT>(); if (edit != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_edit.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; edit.Add(include); } PROPS props = this.Key.CreateSingle <PROPS>("PROPS"); if (props != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_pvt.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; props.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_rp.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; props.Add(include); } SOLUTION solution = this.Key.CreateSingle <SOLUTION>("SOLUTION"); if (solution != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_init.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; solution.Add(include); } REGIONS region = this.Key.CreateSingle <REGIONS>("REGIONS"); if (region != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_regs.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; region.Add(include); } SUMMARY summary = this.Key.CreateSingle <SUMMARY>("SUMMARY"); if (summary != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sum.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; summary.Add(include); //if (include.Keys.Count == 0) //{ // ALL all = new ALL("ALL"); // include.Add(all); //} } SCHEDULE schedule = this.Key.CreateSingle <SCHEDULE>("SCHEDULE"); if (schedule != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sch.inc"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; schedule.Add(include); } END end = this.Key.CreateSingle <END>("END"); }
public bool onWin() { if (m_StoneList.Count == (m_BoardSize + 1) * (m_BoardSize + 1)) { _end = END.TIE; return true; } for (int i = 0; i < 12; i++) { if (checkVertical(i, Stone.Black) || checkHorizontal(i, Stone.Black) || checkCrossRight(i, Stone.Black) || checkCrossLeft(i, Stone.Black)) { _end = END.BLACK; return true; } if (checkVertical(i, Stone.Red) || checkHorizontal(i, Stone.Red) || checkCrossRight(i, Stone.Red) || checkCrossLeft(i, Stone.Red)) { _end = END.RED; return true; } } return false; }
// Use this for initialization void Start() { cName.text = character._characterName; race.text = character._characterRace.ToString(); HP.text = "" + character.GetCurrentHealth() + " / " + character.GetMaxHealth(); STR = character.GetAbilityScore(AbilityID.Strength); DEX = character.GetAbilityScore(AbilityID.Dexterity); CON = character.GetAbilityScore(AbilityID.Constitution); INT = character.GetAbilityScore(AbilityID.Intelligence); WIS = character.GetAbilityScore(AbilityID.Wisdom); CHA = character.GetAbilityScore(AbilityID.Charisma); ATH = character.GetSkill(SkillID.Athletics); ACR = character.GetSkill(SkillID.Acrobatics); STE = character.GetSkill(SkillID.Stealth); THI = character.GetSkill(SkillID.Thievery); END = character.GetSkill(SkillID.Endurance); ARC = character.GetSkill(SkillID.Arcana); HIS = character.GetSkill(SkillID.History); REL = character.GetSkill(SkillID.Religion); DUN = character.GetSkill(SkillID.Dungeoneering); HEA = character.GetSkill(SkillID.Heal); INS = character.GetSkill(SkillID.Insight); NAT = character.GetSkill(SkillID.Nature); PER = character.GetSkill(SkillID.Perception); BLU = character.GetSkill(SkillID.Bluff); DIP = character.GetSkill(SkillID.Diplomacy); INTI = character.GetSkill(SkillID.Intimidate); STRE = character.GetSkill(SkillID.Streetwise); tSTR.text = STR + " +" + character.GetModifier(AbilityID.Strength); tDEX.text = DEX + " +" + character.GetModifier(AbilityID.Dexterity); tCON.text = CON + " +" + character.GetModifier(AbilityID.Constitution); tINT.text = INT + " +" + character.GetModifier(AbilityID.Intelligence); tWIS.text = WIS + " +" + character.GetModifier(AbilityID.Wisdom); tCHA.text = CHA + " +" + character.GetModifier(AbilityID.Charisma); tAC.text = character.GetDefence(DefenceID.ArmorClass).ToString(); tFO.text = character.GetDefence(DefenceID.Fortitude).ToString(); tRE.text = character.GetDefence(DefenceID.Reflex).ToString(); tWI.text = character.GetDefence(DefenceID.Will).ToString(); tATH.text = ATH.ToString(); tACR.text = ACR.ToString(); tSTE.text = STE.ToString(); tTHI.text = THI.ToString(); tEND.text = END.ToString(); tARC.text = ARC.ToString(); tHIS.text = HIS.ToString(); tREL.text = REL.ToString(); tDUN.text = DUN.ToString(); tHEA.text = HEA.ToString(); tINS.text = INS.ToString(); tNAT.text = NAT.ToString(); tPER.text = PER.ToString(); tBLU.text = BLU.ToString(); tDIP.text = DIP.ToString(); tINTI.text = INTI.ToString(); tSTRE.text = STRE.ToString(); }