public EntlookRelmove(Wrapped.Wrapped socket, Form1 mainform) { int EID = socket.readInt(); sbyte dx = (sbyte)socket.readByte(); sbyte dy = (sbyte)socket.readByte(); sbyte dz = (sbyte)socket.readByte(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID, mainform); if (thisEnt != null) { thisEnt.yaw = yaw; thisEnt.pitch = pitch; thisEnt.X += dx; thisEnt.Y += dy; thisEnt.Z += dz; if (mainform.following == true && thisEnt.name == mainform.fname) { mainform.location[0] = thisEnt.X / 32; mainform.location[1] = thisEnt.Y / 32; mainform.location[2] = thisEnt.Z / 32; mainform.location[3] = thisEnt.Y / 32 + 1; } } }
//WorstFit Decreasing Algorithm Using Priority Queue Button private void button6_Click(object sender, EventArgs e) { if (InputFolder == null) { button1.Focus(); errorProvider1.SetError(textBox1, "Please Choose Input Path"); } else if (OutputFolder == null) { button2.Focus(); errorProvider1.SetError(textBox2, "Please Choose Input Path"); } else if (textBox3 == null) { textBox3.Focus(); errorProvider1.SetError(textBox3, "Please Enter Folder Capacity"); } else { functions f = new functions(); string pathfortxt = InputFolder; string filename = "AudiosInfo"; List <int> l = new List <int>(); f.readinformation(ref l, pathfortxt, filename); string oldpath = InputFolder; string name = "Audios"; string newpath = OutputFolder; timer1.Start(); f.using_priortyqueue(ref l, 100, oldpath, name, newpath); timer1.Stop(); label8.Text = TimeSpan.FromSeconds(time).Duration().ToString(); time = 0; MessageBox.Show("WorstFit Algorithm\nUsing Priority Queue\nIs Done", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public EntTeleport(Wrapped.Wrapped socket, Form1 Mainform) { int EID = socket.readInt(); int X = socket.readInt(); int Y = socket.readInt(); int Z = socket.readInt(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID, Mainform); if (thisEnt != null) { thisEnt.X = X; thisEnt.Y = Y; thisEnt.Z = Z; thisEnt.yaw = yaw; thisEnt.pitch = pitch; if (Mainform.following == true && thisEnt.name == Mainform.fname) { Mainform.location[0] = thisEnt.X / 32; Mainform.location[1] = thisEnt.Y / 32; Mainform.location[2] = thisEnt.Z / 32; Mainform.location[3] = thisEnt.Y / 32 + 1; } } }
private void editSummary_Click(object sender, EventArgs e) { try { if (dataGrid.SelectedRows.Count > 0 || dataGrid.SelectedCells.Count > 0) { int selectedrowindex = dataGrid.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dataGrid.Rows[selectedrowindex]; int selectedSummary = Convert.ToInt32(selectedRow.Cells["summaryNumber"].Value); newSummary editSummary = new newSummary(selectedSummary); editSummary.ShowDialog(); summariesList_Load(sender, e); } } catch (Exception ex) { functions functions = new functions(); if (!functions.CheckForInternetConnection(storage.inUseDomain)) { MessageBox.Show(GlobalStrings.ConnectionToServerLost, GlobalStrings.ConnectionLost, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(GlobalStrings.Error + ": " + ex.Message, GlobalStrings.CriticalError, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public List <functions> LoadChildNodes(int ParentId, int level) { DataTable dtParent = GetByParentID(ParentId); if (dtParent.Rows.Count > 0) { foreach (DataRow dr in dtParent.Rows) { string str = ""; functions func = new functions(); for (int i = 0; i < level; i++) { str += "\\__"; } func.FunctionID = Int32.Parse(dr["FunctionID"].ToString()); func.ParentID = Int32.Parse(dr["ParentID"].ToString()); func.FunctionName = str + dr["FunctionName"].ToString(); func.Url = dr["Url"].ToString(); func.Indexes = Int32.Parse(dr["Indexes"].ToString()); parent.Add(func); LoadChildNodes(func.FunctionID, level + 1); } } return(parent); }
public void Post([FromBody] Classes.Mutant m) { if (m == null) { this.HttpContext.Response.StatusCode = 500; } else { if (m.DNA.Length > 0) { functions _f = new functions(); if (_f.isMutant(m)) { this.HttpContext.Response.StatusCode = 200; } else { this.HttpContext.Response.StatusCode = 403; } } else { this.HttpContext.Response.StatusCode = 500; } } }
private void languageDropDown_DropDownClosed(object sender, EventArgs e) { var functions = new functions(); switch (languageDropDown.SelectedItem) { case "Português": if (Thread.CurrentThread.CurrentUICulture != System.Globalization.CultureInfo.GetCultureInfo("pt-PT")) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pt-PT"); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-PT"); Properties.Settings.Default.Language = "pt-PT"; Properties.Settings.Default.Save(); this.Controls.Clear(); InitializeComponent(); languageDropDown.SelectedIndex = languageDropDown.FindStringExact("Português"); versionLBL.Text = functions.GetSoftwareVersion(); } break; default: if (Thread.CurrentThread.CurrentUICulture != System.Globalization.CultureInfo.GetCultureInfo("en-US")) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); Properties.Settings.Default.Language = "en-US"; Properties.Settings.Default.Save(); this.Controls.Clear(); InitializeComponent(); languageDropDown.SelectedIndex = languageDropDown.FindStringExact("English"); versionLBL.Text = functions.GetSoftwareVersion(); } break; } }
public EntlookRelmove(Wrapped.Wrapped socket, Form1 mainform) { int EID = socket.readInt(); sbyte dx = (sbyte)socket.readByte(); sbyte dy = (sbyte)socket.readByte(); sbyte dz = (sbyte)socket.readByte(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID, mainform); if (thisEnt != null) { thisEnt.yaw = yaw; thisEnt.pitch = pitch; thisEnt.X += dx; thisEnt.Y += dy; thisEnt.Z += dz; if (mainform.following == true && thisEnt.name == mainform.fname) { mainform.location[0] = thisEnt.X / 32; mainform.location[1] = thisEnt.Y / 32; mainform.location[2] = thisEnt.Z /32; mainform.location[3] = thisEnt.Y / 32 + 1; } } }
public void isInputValid(char s) { functions _f = new functions(); bool ValidInput = _f.InputValid(s); Assert.Equal(true, ValidInput); }
protected void Page_Load(object sender, EventArgs e) { try {//////////security//////////// if (Session["AUserName"] != null) { functions ULC = new functions(); bool ck; string st1 = Request.PhysicalApplicationPath; string st2 = Request.PhysicalPath; string[] s = st2.Split(new char[] { '/', '\\' }); string st3 = s.GetValue(s.Length - 1).ToString(); ck = ULC.Check(st3, Session["AUserName"].ToString(), Session["AUserName"].ToString()); if (ck == true) {///////////security///////// if (!IsPostBack) { binddata(); lblemp.Text = Session["AUserName"].ToString(); lblformno.Text = Request.QueryString["requisition_id"].ToString(); lbldate.Text = DateTime.Now.ToShortDateString(); }//end of postback cn = new SqlConnection(ConfigurationManager.AppSettings["CMS"]); cn.Open(); da = new SqlDataAdapter("select p.project_name, pr.status_by_emp,pr.user_id,pr.requisition_gen_date from mdx_purchase_requisition pr,mdx_projects p where requisition_id='" + lblformno.Text + "' and p.project_id=pr.project_id", cn); ds = new DataSet(); da.Fill(ds); foreach (DataRow dr in ds.Tables[0].Rows) { lblprojectid.Text = dr["project_name"].ToString(); lblaccepted_by_emp.Text = dr["status_by_emp"].ToString(); lblempname.Text = dr["user_id"].ToString(); lblordergendate.Text = dr["requisition_gen_date"].ToString(); }//end of foreach cmd3 = new SqlCommand("select top_user from mdx_emp_relations where user_id='" + lblaccepted_by_emp.Text + "'", cn); lblacepted_by_topuser.Text = (String)cmd3.ExecuteScalar(); }//end of if(ck==true) else { Response.Redirect("../noprivilise.aspx"); } //end of else } //end of if(session["AUserName"]!=null) else { Response.Redirect("../Default.aspx"); } //end of else } //end of try catch (Exception ex) { //Response.Write("<script language='javascript'>alert('" + ex.Message.ToString() + "' )</script>"); lblerr_msg.Text = ex.Message.ToString();; lblerr_msg.Visible = true; }//end of catch finally { } //end of finally } //end of pageload
public EntTeleport(Wrapped.Wrapped socket, Form1 Mainform) { int EID = socket.readInt(); int X = socket.readInt(); int Y = socket.readInt(); int Z = socket.readInt(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID, Mainform); if (thisEnt != null) { thisEnt.X = X ; thisEnt.Y = Y; thisEnt.Z = Z; thisEnt.yaw = yaw; thisEnt.pitch = pitch; if (Mainform.following == true && thisEnt.name == Mainform.fname) { Mainform.location[0] = thisEnt.X / 32; Mainform.location[1] = thisEnt.Y / 32; Mainform.location[2] = thisEnt.Z / 32; Mainform.location[3] = thisEnt.Y / 32 + 1; } } }
protected void Page_Load(object sender, EventArgs e) { functions a = new functions(); if (!IsPostBack) { sector.DataSource = a.dropdown_bind("sector"); sector.DataBind(); sector.DataTextField = "name"; sector.DataValueField = "id"; sector.DataBind(); sector.Items.Insert(0, new ListItem("Select a sector", "-1")); project_state.DataSource = a.dropdown_bind("project_state"); project_state.DataBind(); project_state.DataTextField = "name"; project_state.DataValueField = "id"; project_state.DataBind(); project_state.Items.Insert(0, new ListItem("Select a Project State", "-1")); implementation_agency.DataSource = a.dropdown_bind("implementation_agency"); implementation_agency.DataBind(); implementation_agency.DataTextField = "name"; implementation_agency.DataValueField = "id"; implementation_agency.DataBind(); implementation_agency.Items.Insert(0, new ListItem("Select a Implementation Agency", "-1")); } }
//resetter outlook private void button5_Click(object sender, EventArgs e) { button5.Text = "Resetter.."; button5.BackColor = Color.Orange; var command = new functions(); bool FullClean = false; try { if (checkBox1.Checked == true) { FullClean = true; } textBox2.AppendText(command.resetOutlook(FullClean)); button5.BackColor = Color.Green; button5.Text = "Resatt OK"; } catch (Exception err) { button5.Text = "Feilet"; button5.BackColor = Color.Red; textBox2.AppendText(err.ToString()); } }
public EntMetadata(Wrapped.Wrapped socket, Form1 mainform) { socket.readInt(); functions parser = new functions(); parser.readMetadata(socket); }
public void Cart2() { functions db = GetComponent <functions>(); db.Conn(); string validator = ""; int session_id = PlayerPrefs.GetInt("Id"); int quantity = int.Parse(product3.text); db.CheckCart(ProductName2, session_id); Debug.Log(Checkif); if (Checkif == 0) { //update db.UpdateCart(session_id, ProductName2, quantity); } else { //insert db.AddCart(session_id, ProductName2, quantity); Debug.Log("Product Added to Cart"); } }
protected void submit_Click(object sender, EventArgs e) { functions a = new functions(); string sql = "Insert into for_project_submission (state_government,address) VALUES ('" + category.SelectedValue + "','" + System.Security.SecurityElement.Escape(address.Text) + "')"; a.execute_sql(sql); Response.Redirect("nodal_officer.aspx"); }
public creativeInventory(Wrapped.Wrapped socket, Form1 mainform, short slot, Classes.Item clicked) { functions helper = new functions(); socket.SendByte(0x6b); socket.writeShort(slot); helper.writeSlot(clicked, socket); }
protected void submit_Click(object sender, EventArgs e) { functions a = new functions(); string sql = "Insert into feedback (name,organization,addresss_line_1,addresss_line_2,telephone,email,designation,message,date,time,ip) VALUES ('" + System.Security.SecurityElement.Escape(name.Text) + "','" + System.Security.SecurityElement.Escape(organization.Text) + "','" + System.Security.SecurityElement.Escape(addresss_line_1.Text) + "','" + System.Security.SecurityElement.Escape(addresss_line_2.Text) + "','" + System.Security.SecurityElement.Escape(telephone.Text) + "','" + System.Security.SecurityElement.Escape(email.Text) + "','" + System.Security.SecurityElement.Escape(designation.Text) + "','" + System.Security.SecurityElement.Escape(message.Text) + "','" + DateTime.Now.ToString("HH:mm:ss") + "','" + DateTime.Now.ToString("MM-dd-yyyy") + "','" + Request.UserHostAddress + "')"; a.execute_sql(sql); Response.Redirect("feedback_thank_you.aspx"); }
public SetSlot(Wrapped.Wrapped socket, Form1 mainform) { byte windowId = socket.readByte(); short slot = socket.readShort(); functions Parser = new functions(); Parser.readSlot(socket, true, mainform, slot); }
protected void Page_Load(object sender, EventArgs e) { try { ///////////////Security//////////// if (Session["AUserName"] != null) { functions ULC = new functions(); bool ck; string st1 = Request.PhysicalApplicationPath; string st2 = Request.PhysicalPath; string[] s = st2.Split(new char[] { '/', '\\' }); string st3 = s.GetValue(s.Length - 1).ToString(); ck = ULC.Check(st3, Session["AUserName"].ToString(), Session["AUserName"].ToString()); ///////////Security//////////// if (ck == true) { //Put user code to initialize the page here if (!IsPostBack) { fun.fnfill(ddlproject, "select project_id,project_name from mdx_projects where project_id in(select project_id from mdx_emp_project_assign where user_id='" + Session["AUserName"] + "')"); lblemp.Text = Session["AUserName"].ToString(); lblformno.Text = formautonumber(); bindgrid(); labeldate.Text = DateTime.Now.ToShortDateString(); lblformdate.Text = DateTime.Now.ToShortDateString(); int count = 10; if (ViewState["dt"] != null) { DataTable dt = (DataTable)ViewState["dt"]; bindgrid(count); } else { bindgrid(count); } } //end of if(!ispostback) } //end of if(ck==true) else { Response.Redirect("../noprivilise.aspx"); } }//end of if (Session["AUserName"] != null) else { Response.Redirect("../Default.aspx"); } }//end of try catch (Exception ex) { lblerr_msg.Text = ex.Message.ToString(); lblerr_msg.Visible = true; } finally { } }//end of pageload
private void deleteSummary_Click(object sender, EventArgs e) { if (workspaceResponse.contents[workspaceResponse.contents.FindIndex(x => x.workspaceName == workspaceName)].write) { try { if (dataGrid.SelectedRows.Count > 0 || dataGrid.SelectedCells.Count > 0) { DialogResult boxResponse = MessageBox.Show(summariesListStrings.DeleteSummaryQuestion, summariesListStrings.DeleteSummary, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (boxResponse == DialogResult.Yes) { int selectedrowindex = dataGrid.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dataGrid.Rows[selectedrowindex]; int selectedSummary = Convert.ToInt32(selectedRow.Cells["summaryNumber"].Value); string jsonResponse = functions.APIRequest("DELETE", null, "user/" + storage.userID + "/summary/" + response.contents[response.contents.FindIndex(x => x.summaryNumber == selectedSummary && x.workspaceID == storage.currentWorkspaceID)].ID); simpleServerResponse serverResponse; serverResponse = JsonConvert.DeserializeObject <simpleServerResponse>(jsonResponse); if (serverResponse.status) { summariesList_Load(sender, e); } else { if (serverResponse.errors == null || serverResponse.errors.Length < 1) { MessageBox.Show(summariesListStrings.RowNotExistLong, summariesListStrings.RowDoesNotExist, MessageBoxButtons.OK, MessageBoxIcon.Warning); summariesList_Load(sender, e); } else { MessageBox.Show(GlobalStrings.Error + ": " + serverResponse.errors + "\n" + jsonResponse, GlobalStrings.CriticalError, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } catch (Exception ex) { functions functions = new functions(); if (!functions.CheckForInternetConnection(storage.inUseDomain)) { MessageBox.Show(GlobalStrings.ConnectionToServerLost, GlobalStrings.ConnectionLost, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(GlobalStrings.Error + ": " + ex.Message + "\n" + ex.StackTrace + "\n" + ex.Source, GlobalStrings.CriticalError, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show(summariesListStrings.ReadOnlyWorkspace, summariesListStrings.ReadOnly, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void isNotMutateDNA(bool expected) { Classes.Mutant _person = new Classes.Mutant(new string[] { "ATGCGA", "CAGTGC", "TTATTT", "AGACGG", "GCGTCA", "TCACTG" }); bool isMutante = false; functions _f = new functions(); isMutante = _f.isMutant(_person); Assert.Equal(expected, isMutante); }
public void isMutateDNALess(bool expected) { Classes.Mutant _person = new Classes.Mutant(new string[] { "A", "C", "T", "A", "C", "T" }); bool isMutante = false; functions _f = new functions(); isMutante = _f.isMutant(_person); Assert.Equal(expected, isMutante); }
protected void Page_Load(object sender, EventArgs e) { try {///////////security//////////////// if (Session["AUserName"] != null) { functions ULC = new functions(); bool ck; string st1 = Request.PhysicalApplicationPath; string st2 = Request.PhysicalPath; string[] s = st2.Split(new char[] { '/', '\\' }); string st3 = s.GetValue(s.Length - 1).ToString(); ck = ULC.Check(st3, Session["AUserName"].ToString(), Session["AUserName"].ToString()); if (ck == true) {//////////security///////////////// if (!IsPostBack) { binddata(); lbldate1.Text = DateTime.Now.ToShortDateString(); lblemp.Text = Session["AUserName"].ToString(); string str = Request.QueryString["sno"].ToString(); cn = new SqlConnection(ConfigurationManager.AppSettings["CMS"]); cn.Open(); da = new SqlDataAdapter("select distinct sno,status,status_changed_by,user_id from mdx_daily_report_account_details where sno='" + str + "'", cn); ds = new DataSet(); da.Fill(ds, "mdx_daily_report_account_details"); foreach (DataRow dr in ds.Tables["mdx_daily_report_account_details"].Rows) { lblstatus.Text = dr["status"].ToString(); lblstatus_changedby.Text = dr["status_changed_by"].ToString(); lbluserid.Text = dr["user_id"].ToString(); } //end of foreach cn.Close(); } //end of postback } //end of if(ck==true) else { Response.Redirect("../noprivilise.aspx"); } //end of else } //end of if(session["AUserName"]!=null) else { Response.Redirect("../Default.aspx"); } //end of else } //end of try catch (Exception ex) { // Response.Write("<script language='javascript'>alert('" + ex.Message.ToString() + "' )</script>"); lblerr_msg.Text = ex.Message.ToString(); lblerr_msg.Visible = true; }//end of catch finally { } //finally } //end of page load
protected void Page_Load(object sender, EventArgs e) { try { ///////////////Security//////////// if (Session["AUserName"] != null) { functions ULC = new functions(); bool ck; string st1 = Request.PhysicalApplicationPath; string st2 = Request.PhysicalPath; string[] s = st2.Split(new char[] { '/', '\\' }); string st3 = s.GetValue(s.Length - 1).ToString(); ck = ULC.Check(st3, Session["AUserName"].ToString(), Session["AUserName"].ToString()); ///////////////Security//////////// if (ck == true) {//Put user code to initialize the page here if (!IsPostBack) { lblemp.Text = Session["AUserName"].ToString(); lblorderdate.Text = DateTime.Now.ToShortDateString(); cn = new SqlConnection(ConfigurationManager.AppSettings["CMS"]); cn.Open(); cmd = new SqlCommand("select role_id from mdx_emp_relations where top_user='******' ", cn); int roleid = Convert.ToInt32(cmd.ExecuteScalar()); if (roleid == 1) { bindtopuser();//call the function to binding of the topuser details } else if (roleid == 2) { binddata(); } cn.Close(); } //end of if(!ispostback) } //end of if(ck==true) else { Response.Redirect("../noprivilise.aspx"); } }//end of if(Session["AUserName"] != null) else { Response.Redirect("../Default.aspx"); } } catch (Exception ex) { lblerr_msg.Text = ex.Message.ToString(); lblerr_msg.Visible = true; } finally { } }//end of page load
public void isMutateDNA(bool expected) { Classes.Mutant _person = new Classes.Mutant(); _person.DNA = new string[] { "ATGCGA", "CAGTGC", "TTATGT", "AGAAGG", "CCCCTA", "TCACTG" }; bool isMutante = false; functions _f = new functions(); isMutante = _f.isMutant(_person); Assert.Equal(expected, isMutante); }
protected void submit_Click(object sender, EventArgs e) { functions a = new functions(); MD5 md5Hash = MD5.Create(); string hash_password = a.md5hash(md5Hash, password.Text); string sql = "Insert into users (title, first_name, surname, organisation, position, landline, mobile, state, type, approve, password, email) VALUES ('" + title.SelectedValue + "','" + first_name.Text + "','" + surname.Text + "','" + organisation.Text + "','" + position.Text + "','" + landline.Text + "','" + mobile.Text + "','" + state.SelectedValue + "','" + type.Value + "','" + approve.Value + "','" + hash_password + "','" + email.Text + "')"; a.execute_sql(sql); Response.Redirect("data_entry_officer.aspx"); }
public void Ost() { functions f = new functions(); var ex = Assert.Throws <Exception>(() => f.Ost(5, 0)); Assert.That(ex.Message, Is.EqualTo("Значения должны быть > 0")); Assert.DoesNotThrow(() => f.Ost(5, 2)); }
public void Chet() { //создание объекта, содержащего функцию functions f = new functions(); //проверка возвращаемого значения, в первом случае оно должно быть истинно //во втором ложно Assert.IsTrue(f.chet(4)); Assert.IsFalse(f.chet(5)); }
protected void loadRootPath() { functions fs = functions.getInstance(); if (fs.isNullRootPath()) { Uri MyUrl = Request.Url; fs.setRootPath(MyUrl); } }
// GET: Home //public ActionResult profile() //{ // //AspNetUser Aspuser =new // // (from c in db.AspNetUsers // // where c.Id == User.Identity.GetUserId() // // select c).ToList(); // return View(); //} public ActionResult About() { ViewBag.Message = "The generation done successfully"; CollegeDatabaseEntities10 _db = new CollegeDatabaseEntities10(); var del = (from x in db.LectureTimes select x); db.LectureTimes.RemoveRange(del); var dell = (from x in db.SectionTimes select x); db.SectionTimes.RemoveRange(dell); // var res = functions.Generatelecandsec() List <GroupModel> GrpList = new List <GroupModel>(); functions func = new functions(); var res = func.Generate_lect(ref GrpList); var assin = func.generatesecs(GrpList); var lecTimeTable = new LectureTime(); foreach (var item in res) { var crs_id = _db.Courses.Where(x => x.Name == item.CourseName).Select(x => x.ID).Single(); lecTimeTable = new LectureTime() { Course_id = crs_id, Room_id = item.RoomId, DayOfWeek = item.Day, Grp_id = item.GrpId, StartHour = item.StartHour }; _db.LectureTimes.Add(lecTimeTable); _db.SaveChanges(); Console.WriteLine("{0} : {1} : {2}", item.CourseName, item.StartHour, item.Day.ToString()); } foreach (var item in assin) { if (item.RoomId != -1) { SectionTime x = new SectionTime(); x.Course_id = item.CourseId; x.Section_id = item.SectionId; x.Room_id = item.RoomId; x.DayOfWeek = item.Day; x.StartHour = item.Start; x.isLab = item.IsLab; x.isSection = item.IsSection; // if(item.Tasids) x.Ta_id = item.Tasids[0]; _db.SectionTimes.Add(x); _db.SaveChanges(); } } return(View()); }
public Entlook(Wrapped.Wrapped socket, Form1 mainform) { int EID = socket.readInt(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID, mainform); thisEnt.yaw = yaw; thisEnt.pitch = pitch; }
public Entlook(Wrapped.Wrapped socket, Form1 mainform) { int EID = socket.readInt(); byte yaw = socket.readByte(); byte pitch = socket.readByte(); functions helper = new functions(); Classes.Entity thisEnt = helper.getEntbyID(EID,mainform); if (thisEnt != null) { thisEnt.yaw = yaw; thisEnt.pitch = pitch; } }
// Client to server only public placeBlock(int x, byte y, int z, byte dir, Item block, Wrapped.Wrapped sock) { functions helper = new functions(); sock.writeByte(0x0F); sock.writeInt(x); sock.writeByte(y); sock.writeInt(z); sock.writeByte(dir); helper.writeSlot(block, sock); sock.writeByte(9); sock.writeByte(9); sock.writeByte(9); }
public void import() { if (!File.Exists("imports\\" + Name + ".Cbot")) return; Packets.chatMessage cm = new Packets.chatMessage(mainform.nh.socket, mainform, "Importing...", true); StreamReader fileReader = new StreamReader("imports\\" + Name + ".Cbot"); string temp = ""; functions help = new functions(); int mx; int myy; int myz; int mtype; blocks.Clear(); while (fileReader.EndOfStream == false) { blocks.Add(fileReader.ReadLine()); } fileReader.Close(); cm = new Packets.chatMessage(mainform.nh.socket, mainform, "File Loaded!", true); for (int i = 0; i < blocks.Count; i++) { temp = blocks[i]; mx = int.Parse(temp.Substring(0, temp.IndexOf(","))); temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1)); myz = int.Parse(temp.Substring(0, temp.IndexOf(","))); temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1)); myy = int.Parse(temp.Substring(0, temp.IndexOf(","))); temp = temp.Substring(temp.IndexOf(",") + 1, temp.Length - (temp.IndexOf(",") + 1)); mtype = int.Parse(temp.Substring(0,temp.IndexOf(":"))); if (mtype != 0) { help.moveTo(myz + x, myy + y + 1, mx + z, mainform); //mainform.location[0] = myz + x; //mainform.location[1] = (myy + y) + 1; //mainform.location[2] = mx + z; //mainform.location[3] = mainform.location[1] + 1; Packets.PlayerPosition pp = new Packets.PlayerPosition(mainform.nh.socket, mainform); Packets.creativeInventory ci = new Packets.creativeInventory(mainform.nh.socket,mainform,40,ctos(mtype)); // System.Threading.Thread.Sleep(100); Packets.placeBlock myblock = new Packets.placeBlock(myz + x, (byte)(myy + y), mx + z, 3, ctos(mtype), mainform.nh.socket); } } }
public SpawnNamedEntity(Wrapped.Wrapped socket, Form1 mainform) { int EID = socket.readInt(); string Name = socket.readString(); int X = socket.readInt(); int Y = socket.readInt(); int Z = socket.readInt(); byte Yaw = socket.readByte(); byte Pitch = socket.readByte(); short heldItem = socket.readShort(); functions parser = new functions(); parser.readMetadata(socket); Classes.Entity newPlayer = new Classes.Entity(EID, Name, X, Y, Z, Yaw, Pitch, heldItem); mainform.Entitys.Add(newPlayer); }
void handle() { // The Entity we're updating.. int EID = socket.readInt(); // Which slot we're updating (0 = held, 1-4 = armour slots) short slot = socket.readShort(); //Have to handle the item now. if (EID == mainform.EntityID) { functions slotHandler = new functions(); slotHandler.readSlot(socket, true, mainform, slot); } else { functions slotHandler = new functions(); slotHandler.otherSlot(socket, mainform, EID, slot); } }
public SpawnMob(Wrapped.Wrapped socket, Form1 Mainform) { int EID = socket.readInt(); byte type = socket.readByte(); int X = socket.readInt(); int Y = socket.readInt(); int Z = socket.readInt(); byte Pitch = socket.readByte(); byte headPitch = socket.readByte(); byte Yaw = socket.readByte(); socket.readShort(); socket.readShort(); socket.readShort(); functions parser = new functions(); parser.readMetadata(socket); Classes.Entity newMob = new Classes.Entity(EID, ((functions.entityId)type).ToString(), X, Y, Z, Yaw, Pitch, 0); Mainform.Entitys.Add(newMob); }
public void checkWinner_TestNumbers() { char[,] input = { { '1', '2', '3' }, { '4', '5', '6' }, { '7', '8', '9' } }; functions test = new functions(); Assert.AreEqual(false, test.checkWinner(input)); }
static void Main(string[] args) { functions fn1 = new functions(); Settings st1 = new Settings(); st1 = Settings_Functions.getSettings(); Environment.SetEnvironmentVariable("CLASSPATH", st1.var_ENV_User, EnvironmentVariableTarget.User); if(File.Exists(st1.location_Workflows + "\\new_custom.jar")) { try { if (File.Exists(st1.location_Workflows + "\\custom.jar")) { File.Delete(st1.location_Workflows + "\\custom.jar"); } Console.WriteLine("Overriding custom.jar with new file"); File.Move(st1.location_Workflows + "\\new_custom.jar", st1.location_Workflows + "\\custom.jar"); } catch(Exception e) { Console.WriteLine(e.Message); } } else { Console.WriteLine("No new Custom.jar detected"); } if (!File.Exists(st1.location_Workflows + "\\Updates\\upd_jwf.exe")) { Console.WriteLine("No new Updates detected"); if (args.Length == 0) { Console.WriteLine("Starting Sirsi client with no Arguments"); try { Process pr = new Process(); ProcessStartInfo prs = new ProcessStartInfo(); prs.UseShellExecute = true; prs.FileName = st1.location_Workflows + "\\Jre\\bin\\javaw.exe"; prs.WorkingDirectory = st1.location_Workflows; prs.Arguments = "-Dworkflows.directory="+ "\"" + st1.location_Workflows + "\"" + " -Xms512m -Xmx512m -jar workflows.jar"; pr.StartInfo = prs; pr.Start(); } catch (Exception e) { Console.WriteLine(e.Message); } } else { Console.WriteLine("Starting Sirsi client with " + args[0] + " Argument"); try { Process pr = new Process(); ProcessStartInfo prs = new ProcessStartInfo(); prs.UseShellExecute = true; prs.FileName = st1.location_Workflows + "\\Jre\\bin\\javaw.exe"; prs.WorkingDirectory = st1.location_Workflows; prs.Arguments = "-Dworkflows.directory=" + "\"" + st1.location_Workflows + "\"" + " -Xms512m -Xmx512m -jar workflows.jar -w" + args[0]; pr.StartInfo = prs; pr.Start(); } catch (Exception e) { Console.WriteLine(e.Message); } } } else { Console.WriteLine("Updating Sirsi Client"); try { if (File.Exists(st1.location_Workflows + "\\Updates\\new_jwf.exe")) { File.Delete(st1.location_Workflows + "\\Updates\\new_jwf.exe"); } Console.WriteLine("Overriding upd_jwf.jar with new file"); File.Move(st1.location_Workflows + "\\Updates\\upd_jwf.exe", st1.location_Workflows + "\\Updates\\new_jwf.exe"); Process pr = new Process(); ProcessStartInfo prs = new ProcessStartInfo(); prs.UseShellExecute = true; prs.FileName = st1.location_Workflows + "\\Updates\\new_jwf.exe"; prs.WorkingDirectory = st1.location_Workflows; prs.Arguments = ""; pr.StartInfo = prs; pr.Start(); } catch (Exception e) { Console.WriteLine(e.Message); } } Thread.Sleep(6000); }
///////////////////// // Private methods // ///////////////////// /// <summary> /// Converts numeric function types to function pointers for filter processing. /// Used to convert the enum type coming from the XML config to delegate. /// </summary> private func set_Function(functions p_function) { switch (p_function) { case (functions.sin): return sin; case (functions.square): return square; case (functions.cube): return cube; default: return none; } }
public void checkBoard_test_X_Picked(bool expected, int input) { char[,] arr = { { 'X', 'X', 'X' }, { 'X', 'X', 'X' }, { 'X', 'X', 'X' } }; functions test = new functions(); Assert.AreEqual(expected, test.checkBoard(input, arr)); }
public void checkWinner_Test_Diag_O_1() { char[,] input = { { 'O', '2', '3' }, { '4', 'O', '6' }, { '7', '8', 'O' } }; functions test = new functions(); Assert.AreEqual(true, test.checkWinner(input)); }
private void handle() { functions func = new functions(); string name = "", message = "", type = "", color = "", style = ""; Message = socket.readString(); var root = JObject.Parse(Message); foreach (KeyValuePair<String, JToken> app in root) { var appName = app.Key; switch (appName) { case "text": message = app.Value.ToString(); if (message.Contains(" ")) name = func.strip_codes(message.Substring(0, message.IndexOf(" ")).Replace("<", "").Replace(">", "").Replace(":", "").Replace(" ", "")); type = "chat"; break; case "translate": type = app.Value.ToString(); break; case "using": name = app.Value.First.ToString(); message = app.Value.Last.ToString(); break; case "color": color = app.Value.ToString(); break; case "italic": if (app.Value.ToString() == "true") style = "italic"; break; } if (type == "chat.type.admin") { if (app.Value.HasValues == true) { name = app.Value[0].ToString(); JObject thisObj = JObject.Parse(app.Value[1].ToString()); foreach (KeyValuePair<String, JToken> part in thisObj) { var topName = part.Key; switch (topName) { case "translate": type = part.Value.ToString(); break; case "using": message = part.Value.First.ToString(); name = part.Value.Last.ToString(); break; } } } } } // Now with the JSON Parsed, we have to add some special message cases. switch (type) { case "multiplayer.player.joined": message = name + " Joined the server"; break; case "multiplayer.player.left": message = name + " Left the server"; break; case "death.attack.outOfWorld": message = name + " fell out of the world!"; break; case "death.attack.explosion.player": message = name + " was blown up by " + message; break; case "death.attack.mob": message = name + " was killed by a " + message; break; case "chat.type.text": message = name + ": " + message; commandHandler ch = new commandHandler(socket, mainform, name, message); break; case "chat": commandHandler h = new commandHandler(socket, mainform, name, message); break; case "chat.type.emote": message = "§d" + name + " " + message; break; case "chat.type.announcement": message = "§d[" + name + "]:§f " + message; break; case "commands.tp.success": message = name + " teleported to " + message; break; case "commands.op.success": message = name + " was promoted to Op"; break; default: message = Message; break; } if (color != "") message = convertCode(message, color); handleColors(message,style); if (mainform.ircmode == 2 || mainform.ircmode == 3) { string[] args = message.Split(' '); string username = args[0].Replace("<", "").Replace(">", "").Replace(":", "").Replace(" ", ""); username = func.strip_codes(username); if (!(username == mainform.username && message.Contains("IRC: <"))) mainform.ircmessage(mainform.translate_colors(message)); } }
public void checkBoard_test(bool expected, int input) { char[,] arr = { { '1', '2', '3' }, { '4', '5', '6' }, { '7', '8', '9' } }; functions test = new functions(); Assert.AreEqual(expected, test.checkBoard(input, arr)); }
public void checkWinner_Test_Diag_X_2() { char[,] input = { { '1', '2', 'X' }, { '4', 'X', '6' }, { 'X', '8', '9' } }; functions test = new functions(); Assert.AreEqual(true, test.checkWinner(input)); }