public void Struct_Serialise_Protobuf_TestByte() { ES es; es = new ES(10); es.Save("test.l10__.f5___.bin"); es = new ES(100); es.Save("test.l100_.f50__.bin"); es = new ES(1000, 100); es.Save("test.l1000.f100_.bin"); es = new ES(1000, 500); es.Save("test.l1000.f500_.bin"); es = new ES(1000, 1000); es.Save("test.l1000.f1000.bin"); es = new ES(65536, 1); es.Save("test.l65536.f1____.bin"); es = new ES(65536, 10); es.Save("test.l65536.f10___.bin"); es = new ES(65536, 100); es.Save("test.l65536.f100__.bin"); es = new ES(65536, 1000); es.Save("test.l65536.f1000_.bin"); es = new ES(65536, 10000); es.Save("test.l65536.f10000.bin"); es = new ES(65536, 50000); es.Save("test.l65536.f50000.bin"); }
public void Add(Entity entity) { int cmpHash = entity.GetCmpHash(); if (!entities.TryGetValue(cmpHash, out var es)) { es = new ES(); foreach (var item in entity.components.Keys) { es.eTypes.Add(item); } entities.Add(cmpHash, es); } //Debug.Log($"e {entity},hash:{cmpHash} c::{ es.values.Count}"); //string a = ""; //foreach (var item in entity.components.Keys) //{ // a += item.ToString() + ","; //} //Debug.Log($"Add e {cmpHash} {entity.id} {a}"); if (es.values.ContainsKey(entity.id)) { return; } es.values.Add(entity.id, entity); //UnityEngine.Debug.Log(entity); }
public static List <ListaEspera> SelectM(string cpf_medico, string especializacao) { var c = new MySqlCommand(); c.CommandText = $"select * " + $"from {Name} as a " + $"left join {nameof(ListaEspera_Funcionario)} as b on a.{nameof(Senha)} = b.{nameof(ListaEspera_Funcionario.Senha)} " + $"left join {nameof(ListaEspera_Especializacao)} as c on a.{nameof(Senha)} = c.{nameof(ListaEspera_Especializacao.Senha)} " + $"where b.{nameof(ListaEspera_Funcionario.Funcionario)} = @cpf or c.{nameof(ListaEspera_Especializacao.Especializacao)} = @esp " + $"limit 500;"; c.Parameters.AddWithValue("@cpf", cpf_medico); c.Parameters.AddWithValue("@esp", especializacao); var lista = new List <ListaEspera>(); QueryRLoop("Erro ao obter lista de espera para o médico.", c, (r) => { lista.Add(new ListaEspera() { Senha = r.GetInt32(0), Paciente = r.GetString(1), _DateTime = r.GetMySqlDateTime(2).GetDateTime(), _Status = ES.GetPStatus(r.GetString(3)), Fila = ES.GetFila(r.GetString(4)), Prioridade = r.GetBoolean(5) }); }); return(lista); }
public EditControl(string windowName = default, ES editStyle = ES.LEFT, WS style = WS.OVERLAPPED, WS_EX extendedStyle = WS_EX.CLIENTEDGE | WS_EX.LEFT | WS_EX.LTRREADING, bool isMainWindow = false, Window parentWindow = default, IntPtr parameters = default, IntPtr menuHandle = default) : base(s_editClass, new Rectangle(0, 0, 100, 50), windowName, style |= (WS)editStyle, extendedStyle, isMainWindow, parentWindow, parameters, menuHandle) { }
public void TextBoxBaseUiaTextProvider_EditStyle_ReturnsLeft_WithoutHandle() { using TextBoxBase textBoxBase = new SubTextBoxBase(); TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); ES actual = provider.EditStyle; Assert.Equal(ES.LEFT, actual); Assert.False(textBoxBase.IsHandleCreated); }
IEnumerator SpawnFirstWaveTest() { yield return(new WaitForSeconds(0.5f)); ES.SpawnEnemies(SpawnMethod.InJail, EnemyType.Squid, BehaviourType.RandomMovement, numEnemies: 5); ES.SpawnEnemies(SpawnMethod.Random, EnemyType.Squid, BehaviourType.SeekDoors, numEnemies: Doors.Count); ES.SpawnEnemies(SpawnMethod.Random, EnemyType.Starfish, numEnemies: 1); EC.StartEnemyUpdateCycle(); UpdateScore(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (sender == clear) { CmdGenWindow.AddCommand("/title " + ES.GetEntity() + " clear"); } else { CmdGenWindow.AddCommand("/title " + ES.GetEntity() + " reset"); } }
public void SetupAndSynchronise(Action onSynchronisedAndReady) { if (!PhotonNetwork.inRoom) { throw new Exception("Not connected to photon, could not start synchronisation"); } if (PhotonNetwork.otherPlayers.Length == 0) { Debug.Log("PhotonNetwork.otherPlayers.Length == 0"); // Setup mod filter to intercept mods and distribute them before applying them to all instances at once EM.Filters.Add(DistributeBetweenPlayersAsyncFilter); IntervalTimer.StartTimer(DateTime.Now, TimeSpan.FromMilliseconds(DefaultIntervalMS)); StartCoroutine(PingCheck()); onSynchronisedAndReady.Invoke(); return; } Action PauseAll = null, RequestES = null, CheckHash = null, SetupLocally = null, UnpauseAll = null; // Pause game for all players PauseAll = () => PUNPauser.RequestPause(() => NetworkInteractionTracker.WaitUntilCleared(RequestES)); // Request ES data from one player RequestES = () => PUNESRequester.RequestESAndImport(CheckHash); // Do hashcode check on data for all players CheckHash = () => PUNHasher.RequestHashCheck(SetupLocally); SetupLocally = () => { // Setup mod filter to intercept mods and distribute them before applying them to all instances at once EM.Filters.Add(DistributeBetweenPlayersAsyncFilter); NetworkInteractionTracker.WaitUntilCleared(UnpauseAll); }; // Unpause game for all players UnpauseAll = () => PUNPauser.RequestUnpause(() => { IntervalTimer.StartTimer( ES.GetFirstEventOfType <IntervalStartedEvent>(), ES.GetLastEventOfType <IntervalStepEvent>(), ES.GetLastEventOfType <IntervalChangedEvent>() ); //IntervalTimer.StartTimer(DateTime.Now, TimeSpan.FromMilliseconds(DefaultIntervalMS)); StartCoroutine(PingCheck()); onSynchronisedAndReady(); }); // Start PauseAll.Invoke(); }
public override void Execute() { //step1. Processing DB.BulkInsert <T>(this.DataObjs); ES.BulkInsert <T>(this.DataObjs); //step2. this.DataConnection.RemoveAll(this.Key); this.DataConnection.SetHashTable_Plus(KeyName.ReceiverReply, this.NodeId.ToString(), -1); this.DataObjs.Clear(); }
public void TextBoxBaseUiaTextProvider_EditStyle_ReturnsCorrectValue() { using TextBoxBase textBoxBase = new SubTextBoxBase(); textBoxBase.CreateControl(); TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); ES actual = provider.EditStyle; Assert.True(actual.HasFlag(ES.LEFT)); Assert.True(actual.HasFlag(ES.AUTOVSCROLL)); Assert.True(actual.HasFlag(ES.AUTOHSCROLL)); Assert.True(textBoxBase.IsHandleCreated); }
public void UiaTextProvider_GetEditStyle_ContainsMultilineStyle_ForMultilineTextBox() { // EditControl Multiline is true when EditControl has ES_MULTILINE style using EditControl textBox = new EditControl( editStyle: ES.MULTILINE | ES.LEFT | ES.AUTOHSCROLL | ES.AUTOVSCROLL, style: WS.OVERLAPPED | WS.VISIBLE); Mock <UiaTextProvider> providerMock = new Mock <UiaTextProvider>(MockBehavior.Strict); ES actual = UiaTextProvider.GetEditStyle(textBox); Assert.True(actual.HasFlag(ES.MULTILINE)); }
public void UiaTextProvider_GetEditStyle_DoesntContainMultilineStyle_ForSinglelineTextBox() { // EditControl Multiline is false when EditControl doesn't have ES_MULTILINE style using EditControl textBox = new EditControl( editStyle: ES.LEFT | ES.AUTOHSCROLL | ES.AUTOVSCROLL, style: WS.OVERLAPPED | WS.VISIBLE); Mock <UiaTextProvider> providerMock = new Mock <UiaTextProvider>(MockBehavior.Strict); ES actual = providerMock.Object.GetEditStyle(textBox); Assert.False(actual.HasFlag(ES.MULTILINE)); }
private void BookBtn_Click(object sender, EventArgs e) { using (var db = new Session2Entities()) { Booking booking = new Booking(); booking.userIdFK = users.userId; if (dataGridView1.SelectedRows.Count == 1) { foreach (DataGridViewRow dr in dataGridView1.SelectedRows) { var ID = int.Parse(dr.Cells["ID"].Value.ToString()); booking.packageIdFK = ID; var quan = int.Parse(dr.Cells["Availabile Qty"].Value.ToString()); if (quan >= DQ.Value) { booking.quantityBooked = (int)DQ.Value; } else { MessageBox.Show("Invalid Amount!"); return; } booking.status = "Pending"; db.Bookings.Add(booking); try { db.SaveChanges(); //Will hendle this when the manager approves the booking //var q2 = db.Packages.Where(x => x.packageId == ID).FirstOrDefault(); //q2.packageQuantity -= (int)DQ.Value; db.SaveChanges(); MessageBox.Show("Success!"); var q = db.Packages.ToList(); dataGridView1.DataSource = CDT(q); dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.Columns["ID"].Visible = false; } catch (Exception ES) { MessageBox.Show(ES.ToString()); } } } else { MessageBox.Show("Pick Only 1!"); return; } } }
private void UpdateBtn_Click(object sender, EventArgs e) { using (var db = new Session1Entities()) { var query = db.Resources.Where(x => x.resId == IDs).FirstOrDefault(); query.remainingQuantity = (int)quantity.Value; if (skills.Visible == false) { try { db.SaveChanges(); MessageBox.Show("Successful!"); this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.Show(); } catch (Exception ES) { MessageBox.Show(ES.ToString()); } } else { var query2 = db.Resource_Allocation.Where(x => x.resIdFK == IDs).ToList(); foreach (var item in query2) { db.Resource_Allocation.Remove(item); } for (int i = 0; i < skills.CheckedItems.Count; i++) { Resource_Allocation resource_Allocation = new Resource_Allocation(); resource_Allocation.resIdFK = IDs; resource_Allocation.skillIdFK = i + 1; db.Resource_Allocation.Add(resource_Allocation); } try { db.SaveChanges(); MessageBox.Show("Successful!"); this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.Show(); } catch (Exception es) { MessageBox.Show(es.ToString()); } } } }
public void RandomEnumTest() { Randomizer rand = new Randomizer(); ES results = rand.RandomEnum <ES>(); ES results2 = rand.RandomEnum <ES>(); ES results3 = rand.RandomEnum <ES>(); ES results4 = rand.RandomEnum <ES>(); ES results5 = rand.RandomEnum <ES>(); ES results6 = rand.RandomEnum <ES>(); ES results7 = rand.RandomEnum <ES>(); Assert.IsNotNull(results); }
public void DefaultSignalContext() { var entity = Object.Instantiate(new GameObject()); var recorder = new Recorder(); var handler = (ESHandler <GameObject, int>)((a1, a2) => { recorder.Record("First", a1, a2); }); ES.On(entity).Add(handler); Assert.AreEqual(1, ES.On(entity).Count); ES.On(entity).Send(1); ES.Dispose(); Assert.AreEqual(0, ES.On(entity).Count); recorder.Verify("First", entity, 1); }
private void openBtn_Click(object sender, EventArgs e) { ofdEdb.FileName = WLMRegUtil.GetMailMSMessageStore(); if (ofdEdb.ShowDialog(this) == DialogResult.OK) { using (new AH()) using (var es = new ES()) { es.Open(ofdEdb.FileName); folders = es.ReadEntireTable <Folder>("Folders").ToArray(); } folderTree.Nodes.Clear(); Build(folderTree.Nodes, 0, folders, Path.GetDirectoryName(ofdEdb.FileName), CreateNumTag); } }
private static void JungleFarm() { List <Obj_AI_Base> mobs = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, W.Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.Health); if (Config.Item("UseQFarm").GetValue <bool>()) { foreach (Obj_AI_Base minion in mobs) { if (HumanForm) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= Q.Range) { Q.Cast(minion); } if (W.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= W.Range) { W.Cast(); } if (!Q.IsReady() && !W.IsReady()) { R.Cast(); } } } if (!HumanForm) { foreach (Obj_AI_Base minion in mobs) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= QS.Range) { QS.Cast(minion); } if (WS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= WS.Range) { WS.Cast(); } if (ES.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= ES.Range && Config.Item("UseSpiderEFarm").GetValue <bool>()) { ES.Cast(minion); } } } } }
private static List <ListaEspera> GetListas(MySqlDataReader r) { var lista = new List <ListaEspera>(); while (r.Read()) { lista.Add(new ListaEspera() { Senha = r.GetInt32(0), Paciente = r.GetString(1), _DateTime = r.GetMySqlDateTime(2).GetDateTime(), _Status = SetPStatus(r.GetString(3)), Fila = ES.GetFila(r.GetString(4)), Prioridade = r.GetBoolean(5) }); } return(lista); }
private static ListaEspera GetLista(MySqlDataReader r) { ListaEspera lista = null; if (r.Read()) { lista = new ListaEspera() { Senha = r.GetInt32(0), Paciente = r.GetString(1), _DateTime = r.IsDBNull(2) ? DateTime.MinValue : r.GetMySqlDateTime(2).GetDateTime(), _Status = r.IsDBNull(3)? PStatus.Atendido : SetPStatus(r.GetString(3)), Fila = r.IsDBNull(4)? Fila.Nulo : ES.GetFila(r.GetString(4)), Prioridade = r.IsDBNull(5)? false : r.GetBoolean(5) }; } return(lista); }
public string GenerateCommand() { if (c1.IsChecked == true) { return("/testfor " + ES.GetEntity() + (enbt.Text == "" ? "" : " " + enbt.Text)); } else if (c2.IsChecked == true) { return("等待更新"); //return "/testforblock "+loc.GetLocation()+""; } else if (c3.IsChecked == true) { return("等待更新"); } else { return("/execute " + ES.GetEntity() + " " + exeloc.GetLocation() + (detect.IsChecked == true ? " detect " + detectloc.GetLocation() + " " + detectblockinfo.Text : " ") + cmd.Text); } }
protected void Page_Load(object sender, EventArgs e) { string sql = "SELECT datename(YYYY, RegisterTime)+ '-' + DATENAME(MM, RegisterTime) AS MyDate, COUNT(*) as origin FROM UserInfor where UserState='1' GROUP BY DATENAME(YYYY, RegisterTime), DATENAME(MM, RegisterTime),DATEPART(YYYY, RegisterTime),DATEPART(MM, RegisterTime) ORDER BY DATEPART(YYYY, RegisterTime),DATEPART(MM, RegisterTime)"; DataTable TempDataTable = DbHelperSQL.FindTable(2, sql); DataRow[] myrow = new DataRow[TempDataTable.Rows.Count]; TempDataTable.Rows.CopyTo(myrow, 0); double[] myValue = Array.ConvertAll(myrow, new Converter <DataRow, double>(ConvertOriginToDouble)); int num = 5;//待预测数据个数 ES es1 = new ES(myValue, num, 0.8); double[] result = es1.ES_SecResult(); DataColumn dc = new DataColumn("predict", typeof(string)); TempDataTable.Columns.Add(dc); int length = myValue.GetLength(0); int i; for (i = 0; i < (length + num); i++) { if (i >= length) { DataRow dr = TempDataTable.NewRow(); dr[0] = JSON_Class.YearMonthAdd(TempDataTable.Rows[i - 1][0].ToString(), 1); dr[2] = Math.Round(result[i], 0).ToString();//将预测值四舍五入为整数 TempDataTable.Rows.Add(dr); } else { DataRow dr = TempDataTable.Rows[i]; dr[0] = JSON_Class.YearMonthAdd(dr[0].ToString(), -1); dr[2] = Math.Round(result[i], 0).ToString(); } } JSON_Class Object_JSON_Class = new JSON_Class(); string[] c = { "date", "origin", "predict" }; sjson = Object_JSON_Class.JSON_DT_YearMonth(TempDataTable, c);// }
private static void Farm() { Obj_AI_Hero target = TargetSelector.GetTarget(QS.Range, TargetSelector.DamageType.Magical); List <Obj_AI_Base> allminions = MinionManager.GetMinions(Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health); if (Config.Item("UseQFarm").GetValue <bool>()) { foreach (Obj_AI_Base minion in allminions) { if (HumanForm) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= Q.Range) { Q.Cast(minion); } if (W.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= W.Range) { W.Cast(); } R.Cast(); } } foreach (Obj_AI_Base minion in allminions) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= QS.Range) { QS.Cast(minion); } if (WS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= 125) { WS.Cast(); } if (ES.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= ES.Range && Config.Item("UseSpiderEFarm").GetValue <bool>()) { ES.Cast(minion); } } } }
private static void JungleFarm() { var target = SimpleTs.GetTarget(QS.Range, SimpleTs.DamageType.Magical); var mobs = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, W.Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.Health); if (Config.Item("UseQFarm").GetValue <bool>()) { foreach (var minion in mobs) { if (HumanForm) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= Q.Range) { Q.Cast(minion); } if (W.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= W.Range) { W.Cast(); } R.Cast(); } } foreach (var minion in mobs) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= QS.Range) { QS.Cast(minion); } if (WS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= 125) { WS.Cast(); } if (ES.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= ES.Range && Config.Item("UseSpiderEFarm").GetValue <bool>()) { ES.Cast(minion); } } } }
private static void Farm() { List <Obj_AI_Base> allminions = MinionManager.GetMinions(Player.ServerPosition, Q.Range); if (Config.Item("UseQFarm").GetValue <bool>()) { foreach (Obj_AI_Base minion in allminions) { if (HumanForm) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= Q.Range) { Q.Cast(minion); } if (W.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= W.Range) { W.Cast(); } R.Cast(); } if (!HumanForm) { if (QS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= QS.Range) { QS.Cast(minion); } if (WS.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= WS.Range) { WS.Cast(); } if (ES.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= ES.Range && Config.Item("UseSpiderEFarm").GetValue <bool>()) { ES.Cast(minion); } } } } }
public string GenerateCommand() { if (setTime.IsChecked == true) { return("/title " + ES.GetEntity() + " times " + fadeIn.Value + " " + stay.Value + " " + fadeOut.Value); } else { string cmd = ""; if (T.IsChecked == true) { cmd = "/title " + ES.GetEntity() + " title "; } else if (subT.IsChecked == true) { cmd = "/title " + ES.GetEntity() + " subtitle "; } else { cmd = "/title " + ES.GetEntity() + " actionbar "; } return(cmd + doc.GetJsonText()); } }
private static int GetExcelRows(ES.ExcelService es, string sessionId,string primaryKeyValue, string sheetName, ES.Status[] outStatus) { int row = defaultRows; int col = ToIndex(primaryKeyValue); while (es.GetCell(sessionId, sheetName, row, col, false, out outStatus) != null) { row += defaultRows; } return row; }
private bool ConnectToEnterpriseServer(string url, string username, string password) { return(ES.Connect(url, username, password)); }
protected void gvChildGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (ChildFlag) { if (e.Row.RowType == DataControlRowType.DataRow) { string errortbl = Session["Errortbl"].ToString(); com += Convert.ToInt32(e.Row.Cells[1].Text != " " ? e.Row.Cells[1].Text : e.Row.Cells[1].Text = "0"); if (e.Row.Cells[2].Text != " ") { inc += Convert.ToInt32(e.Row.Cells[2].Text); } else { e.Row.Cells[2].Text = "0"; } if (e.Row.Cells[3].Text != " ") { inp += Convert.ToInt32(e.Row.Cells[3].Text); } else { e.Row.Cells[3].Text = "0"; } if (e.Row.Cells[4].Text != " ") { TS += Convert.ToInt32(e.Row.Cells[4].Text); } else { e.Row.Cells[4].Text = "0"; } if (e.Row.Cells[5].Text != " ") { ES += Convert.ToInt32(e.Row.Cells[5].Text); } else { e.Row.Cells[5].Text = "0"; } if (e.Row.Cells[6].Text != " ") { NS += Convert.ToInt32(e.Row.Cells[6].Text); } else { e.Row.Cells[6].Text = "0"; } NoStatus += Convert.ToInt32(e.Row.Cells[7].Text != " " ? e.Row.Cells[7].Text : e.Row.Cells[7].Text = "0"); No_OF_Works += Convert.ToInt32(e.Row.Cells[8].Text); AACost += Convert.ToDecimal(e.Row.Cells[9].Text); TSCost += Convert.ToDecimal(e.Row.Cells[10].Text); TotalProvision += Convert.ToDecimal(e.Row.Cells[11].Text); TotalExp += Convert.ToDecimal(e.Row.Cells[12].Text); } if (e.Row.RowType == DataControlRowType.Footer) { string errortbl = Session["Errortbl"].ToString(); e.Row.Cells[0].Text = "Total"; e.Row.Cells[1].Text = com.ToString(); e.Row.Cells[2].Text = inc.ToString(); e.Row.Cells[3].Text = inp.ToString(); e.Row.Cells[4].Text = TS.ToString(); e.Row.Cells[5].Text = ES.ToString(); e.Row.Cells[6].Text = NS.ToString(); e.Row.Cells[7].Text = NoStatus.ToString(); e.Row.Cells[8].Text = No_OF_Works.ToString(); e.Row.Cells[9].Text = AACost.ToString(); e.Row.Cells[10].Text = TSCost.ToString(); e.Row.Cells[11].Text = TotalProvision.ToString(); e.Row.Cells[12].Text = TotalExp.ToString(); } } else { if (e.Row.RowType == DataControlRowType.DataRow) { string errortbl = Session["Errortbl"].ToString(); if (flag) { dr = Dumy_dt.NewRow(); } flag = false; dr[0] = HeadName; if (e.Row.Cells[0].Text.Trim() == "Completed" || e.Row.Cells[0].Text.Trim() == "पूर्ण") { e.Row.Cells[0].Text = "पूर्ण"; arr[0] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[1] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Incomplete" || e.Row.Cells[0].Text.Trim() == "अपूर्ण") { e.Row.Cells[0].Text = "अपूर्ण"; arr[1] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[2] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Inprogress" || e.Row.Cells[0].Text.Trim() == "Processing" || e.Row.Cells[0].Text.Trim() == "Current" || e.Row.Cells[0].Text.Trim() == "चालू" || e.Row.Cells[0].Text.Trim() == "प्रगतीत") { e.Row.Cells[0].Text = "प्रगतीत"; arr[2] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[3] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Tender Stage" || e.Row.Cells[0].Text.Trim() == "निविदा स्तर") { e.Row.Cells[0].Text = "निविदा स्तर"; arr[3] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[4] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Estimated Stage" || e.Row.Cells[0].Text.Trim() == "अंदाजपत्रकिय स्थर" || e.Row.Cells[0].Text.Trim() == "अंदाजपत्रकिय स्तर") { e.Row.Cells[0].Text = "अंदाजपत्रकिय स्थर"; arr[4] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[5] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Not Started" || e.Row.Cells[0].Text.Trim() == "सुरू करणे" || e.Row.Cells[0].Text.Trim() == "सुरु न झालेली") { e.Row.Cells[0].Text = "सुरु न झालेली"; arr[5] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[6] = e.Row.Cells[1].Text; } else { e.Row.Cells[0].Text = "सध्यास्तिथी उपलब्ध नाही"; dr[7] = e.Row.Cells[1].Text; } //e.Row.Cells[0].BackColor = System.Drawing.Color.Red; TotalWork += Convert.ToDecimal(e.Row.Cells[1].Text); AACost += Convert.ToDecimal(e.Row.Cells[2].Text); TSCost += Convert.ToDecimal(e.Row.Cells[3].Text); TotalProvision += Convert.ToDecimal(e.Row.Cells[4].Text); TotalExp += Convert.ToDecimal(e.Row.Cells[5].Text); } if (e.Row.RowType == DataControlRowType.Footer) { string errortbl = Session["Errortbl"].ToString(); dr[8] = TotalWork.ToString(); dr[9] = AACost.ToString(); dr[10] = TSCost.ToString(); dr[11] = TotalProvision.ToString(); dr[12] = TotalExp.ToString(); Dumy_dt.Rows.Add(dr); flag = true; e.Row.Cells[0].Text = "एकूण"; e.Row.Cells[1].Text = TotalWork.ToString(); e.Row.Cells[2].Text = AACost.ToString(); e.Row.Cells[3].Text = TSCost.ToString(); e.Row.Cells[4].Text = TotalProvision.ToString(); e.Row.Cells[5].Text = TotalExp.ToString(); arr[6] += AACost; arr[7] += TSCost; arr[8] += TotalProvision; arr[9] += TotalExp; } } }
// Вычисление срока наступления public void CalcES() { // Если не источник if (IsEndOf.Count != 0) { if (CanCalculateES()) { OperationLogger.AddMessage("ES" + Name + " = "); // Вычисление первого значения int Max = (int)IsEndOf[0].StartDot.ES + IsEndOf[0].Duration; // Временные переменные используемые для составления описания (логов) вычислений string FirstElemOperationLog = ((int)IsEndOf[0].StartDot.ES).ToString() + " + " + IsEndOf[0].Duration.ToString(); string CalcLog = ""; if (IsEndOf.Count > 1) { OperationLogger.AppendToLastMessage("max{"); } OperationLogger.AppendToLastMessage("ES" + IsEndOf[0].StartDot.Name + " + C" + IsEndOf[0].StartDot.Name + Name); for (int i = 1; i < IsEndOf.Count; i++) { // Вычисление возможного значения int temp = (int)IsEndOf[i].StartDot.ES + IsEndOf[i].Duration; // Формирование сообщения OperationLogger.AppendToLastMessage("; ES" + IsEndOf[i].StartDot.Name + " + C" + IsEndOf[i].StartDot.Name + Name); CalcLog += "; " + ((int)IsEndOf[i].StartDot.ES).ToString() + " + " + IsEndOf[i].Duration.ToString(); // Выбор максимума if (Max < temp) { Max = temp; } } // Запись значения ES = Max; // Окончание сообщения if (IsEndOf.Count > 1) { OperationLogger.AppendToLastMessage("} = max{" + FirstElemOperationLog + CalcLog + "}"); } OperationLogger.AppendToLastMessage(" = " + ES.ToString()); } // Если источник, ES = 0 } else { ES = 0; OperationLogger.AddMessage("ES" + Name + " = "); OperationLogger.AppendToLastMessage(ES.ToString()); } }
public static extern uint SetThreadExecutionState(ES esFlags);
private static ES.RangeCoordinates GetRangeCoordinates(ES.ExcelService es, string sessionId, string[] pos, string primaryKeyValue, string sheetName, ES.Status[] outStatus) { int startCol = ToIndex(pos[0]); int startRow = int.Parse(pos[1]) - 1; ES.RangeCoordinates range = new ES.RangeCoordinates(); range.Column = startCol; range.Row = startRow; range.Width = GetExcelCols(es, sessionId, startRow, sheetName, outStatus); range.Height = GetExcelRows(es, sessionId, primaryKeyValue, sheetName, outStatus); return range; }
// public event EventHandler<EventArgs> DownUpdate; // public event EventHandler<EventArgs> DownOk; private void 载完成事件(object sender, AsyncCompletedEventArgs e) { new Task((() => { try { DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); DownIofo.备注 = "下载任务结束"; if (e.Cancelled && !DownIofo.网络超时) { if (!DownIofo.播放状态 && DownIofo.是否是播放任务) { DownIofo.备注 = "播放窗口关闭"; DownIofo.载状态 = false; 载结束提醒(true, "下载任务结束", DownIofo); return; } DownIofo.继承.待合并文件列表.Add(DownIofo.文件保存路径); DownIofo.备注 = "用户取消,停止下载"; DownIofo.载状态 = false; 载结束提醒(true, "下载任务结束", DownIofo); } else if (!e.Cancelled && !bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号, true)) { DownIofo.继承.待合并文件列表.Add(DownIofo.文件保存路径); DownIofo.载状态 = false; DownIofo.备注 = "下载完成,直播间已关闭"; if (DownIofo.继承 == null) { DownIofo.继承.是否为继承对象 = false; } if (DownIofo.继承.是否为继承对象 && !DownIofo.是否是播放任务) { DownIofo.继承.合并后的文件路径 = 载完成合并FLV(DownIofo, true); if (!string.IsNullOrEmpty(DownIofo.继承.合并后的文件路径)) { DownIofo.文件保存路径 = DownIofo.继承.合并后的文件路径; } } if (!DownIofo.是否是播放任务) { FlvMethod.转码(DownIofo.文件保存路径); } InfoLog.InfoPrintf(DownIofo.房间_频道号 + "房间:" + DownIofo.主播名称 + " 下播,录制完成", InfoLog.InfoClass.载必要提示); foreach (var item in RoomInit.bilibili房间主表) { if (item.唯一码 == DownIofo.房间_频道号) { item.直播状态 = false; break; } } DownIofo.载状态 = false; 载结束提醒(true, "下载任务结束", DownIofo); return; } else { if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号, true) && DownIofo.是否保存) { DownIofo.网络超时 = true; DownIofo.载状态 = false; DownIofo.备注 = "下载流中断,检测到房间仍为开播状态,新建续下任务。"; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); switch (DownIofo.平台) { case "bilibili": { if (!DownIofo.是否是播放任务) { DownIofo.继承.待合并文件列表.Add(DownIofo.文件保存路径); InfoLog.InfoPrintf($"{DownIofo.房间_频道号}:{DownIofo.主播名称}下载任务续下,历史文件加入待合并文件列表:{DownIofo.文件保存路径}", InfoLog.InfoClass.载必要提示); } DownIofo.载状态 = false; Downloader 重连下载对象 = Downloader.新建下载对象( DownIofo.平台, DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.载地址(DownIofo.房间_频道号), "重连", DownIofo.是否保存, DownIofo.主播名称, true, DownIofo.文件保存路径, DownIofo ); if (!重连下载对象.DownIofo.载状态) { try { 重连下载对象.DownIofo.弹幕录制基准时间 = DownIofo.弹幕录制基准时间; 重连下载对象.DownIofo.阿B直播流对象 = DownIofo.阿B直播流对象; 重连下载对象.DownIofo.弹幕储存流 = DownIofo.弹幕储存流; 重连下载对象.DownIofo.礼物储存流 = DownIofo.礼物储存流; 重连下载对象.DownIofo.载状态 = false; 重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); 重连下载对象.DownIofo.备注 = "服务器主动断开连接,直播结束"; foreach (var item in RoomInit.bilibili房间主表) { if (item.唯一码 == DownIofo.房间_频道号) { item.直播状态 = false; break; } } if (DownIofo.继承.是否为继承对象 && !DownIofo.是否是播放任务) { DownIofo.继承.合并后的文件路径 = 载完成合并FLV(DownIofo, true); if (!string.IsNullOrEmpty(DownIofo.继承.合并后的文件路径)) { DownIofo.文件保存路径 = DownIofo.继承.合并后的文件路径; } } if (!DownIofo.是否是播放任务) { FlvMethod.转码(DownIofo.文件保存路径); } DownIofo.备注 = "服务器主动断开连接,直播结束"; 重连下载对象.DownIofo.载状态 = false; 重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); 载结束提醒(true, "下载任务结束", 重连下载对象.DownIofo); } catch (Exception) {} return; } new Task((() => { while (true) { Thread.Sleep(10000); if (重连下载对象.DownIofo.已下载大小bit > 5000) { DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); 载结束提醒(true, "下载任务结束", DownIofo); 重连下载对象.DownIofo.备注 = "完成重连,正在续命.."; //下载对象.DownIofo.下载状态 = true; return; } if (!bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号, true)) { 重连下载对象.DownIofo.备注 = "停止直播"; DownIofo.备注 = "直播停止,下载完成下载完成"; 重连下载对象.DownIofo.载状态 = false; 重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); 重连下载对象.DownIofo.WC.CancelAsync(); MMPU.DownList.Remove(重连下载对象); 载结束提醒(true, "下载任务结束", DownIofo); 载结束提醒(true, "下载任务结束", 重连下载对象.DownIofo); return; } } })).Start(); DownIofo.载状态 = false; break; } default: DownIofo.备注 = "不受支持的平台"; DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); InfoLog.InfoPrintf("该房间的配置文件发现了与当前版本不支持的平台,请检查文件配置或者检查更新", InfoLog.InfoClass.系统错误信息); //下载结束提醒(false); return; } } else { DownIofo.备注 = "直播停止,下载完成下载完成"; 载结束提醒(true, "下载任务结束", DownIofo); DownIofo.载状态 = false; return; } } DownIofo.载状态 = false; DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); DownIofo.备注 = "下载任务结束"; } catch (Exception ES) { InfoLog.InfoPrintf($"录制任务意外终止:\r\n{ES.ToString()}", InfoLog.InfoClass.系统错误信息); DownIofo.载状态 = false; DownIofo.备注 = "录制任务意外终止,已新建续命任务"; 载结束提醒(true, "录制任务意外终止,已新建续命任务", DownIofo); Downloader 载对象 = new Downloader(); try { DownIofo.载状态 = false; 载对象 = Downloader.新建下载对象( DownIofo.平台, DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.载地址(DownIofo.房间_频道号), "前一个下载出现异常,新建下载", DownIofo.是否保存, DownIofo.主播名称, false, DownIofo.文件保存路径 ); } catch (Exception) { try { 载对象.DownIofo.备注 = "新建续下载对象出现异常,放弃新建任务"; 载结束提醒(true, "下载任务结束", DownIofo); 载对象.DownIofo.载状态 = false; 载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); 载对象.DownIofo.WC.CancelAsync(); MMPU.DownList.Remove(载对象); } catch (Exception) { } } } })).Start(); }
private static int GetExcelCols(ES.ExcelService es, string sessionId, int startRow, string sheetName, ES.Status[] outStatus) { int row = startRow; int col = defaultCols; while (es.GetCell(sessionId, sheetName, row, col, false, out outStatus) != null) { col += defaultCols; } return col; }