private CSS GetCss() { var sheet = new CSS(); sheet.Analyze(DefaultEpubCss); var hrefs = _opfRoot .Elements(_opfns + "manifest") .Elements(_opfns + "item") .Where(e => { var mediaType = e.Attribute("media-type"); return(mediaType != null && mediaType.Value == "text/css"); }) .Attributes("href").Select(h => h.Value); foreach (var href in hrefs) { Stream stream = _zip.GetFileStream(_opfPath + href, false, true); if (stream != null) { sheet.Analyze(new StreamReader(stream).ReadToEnd()); } } return(sheet); }
//begin the event if start button clicked protected void ButtonStart_Click(object sender, EventArgs e) { CSS Manager = new CSS(); bool confirmation = false; Event updateMe = new Event(); //Event updateMe = (Event)Session["Event"]; //get event info updateMe.EventID = Convert.ToInt32(((Event)Session["Event"]).EventID); updateMe = Manager.GetEvent(updateMe); //update event with start time updateMe.EventStart = DateTime.Now.ToUniversalTime(); confirmation = Manager.UpdateEventStatus(updateMe); if (confirmation) { tbStart.Text = updateMe.EventStart.ToLocalTime().ToLongTimeString(); tbEnd.Text = "The Event has started."; ButtonStart.Enabled = false; ButtonEnd.Enabled = true; TimerForTableRefresh.Enabled = true; } }
//update facilitator password protected void UpdatePasswordBtn_Click(object sender, EventArgs e) { CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; CSS requestDirector = new CSS(); //get facilitator info Facilitator activeFac = new Facilitator(); activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name); activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID); //if valid password, update facilitator account with new hash if (activeFac.Password == requestDirector.CreatePasswordHash(oldPasswordtxt.Text, activeFac.Salt)) { activeFac.Password = requestDirector.CreatePasswordHash(Passwordtxt.Text, activeFac.Salt); if (requestDirector.UpdateFacilitator(activeFac)) { Pswdlbl.Text = "Account Password Updated"; } else { Pswdlbl.Text = "Account Password Update Failed"; } } }
public void BuildCharts(string criteria, string math) { CSS Director = new CSS(); //get event info Event theEvent = new Event(); theEvent.EventID = ((Event)Session["Event"]).EventID; theEvent = Director.GetEvent(theEvent); theEvent.Evaluators = Director.GetEvaluatorsForEvent(theEvent.EventID); DateTime defaultTime = Convert.ToDateTime("1800-01-01 12:00:00 PM"); if (criteria != "All Evaluations") { theEvent.Evaluators.RemoveAll(o => o.Criteria != criteria); } foreach (Evaluator ev in theEvent.Evaluators) { ev.EvaluatorEvaluations.RemoveAll(x => x.Rating == 999); } //if event has evaluator data, construct the chart if (theEvent.Evaluators.Count > 0) { Highcharts chart = Director.CreateChart(theEvent); ltrChart.Text = chart.ToHtmlString(); //generate chart with mean/mode/median Highcharts mathChart = Director.MakeMathChart(theEvent, math); meanChart.Text = mathChart.ToHtmlString(); } }
protected void ButtonLogin_Click(object sender, EventArgs e) { //only validate if user has agreed to terms if (consentCheck.Checked) { CSS RequestManager = new CSS(); //validate user login info if (RequestManager.IsAuthenticated(EmailTxt.Text, PasswordTxt.Text)) { //if //get info for email input Facilitator pullFacilitator = RequestManager.GetFacilitatorByEmail(EmailTxt.Text); string roles = pullFacilitator.Roles; //create authentication cookie FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, RequestManager.GetFacilitatorByEmail(EmailTxt.Text).FacilitatorID.ToString(), DateTime.Now, DateTime.Now.AddHours(24), RememberChk.Checked, roles); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); //create consent cookie if there isn't one var consentCookie = Request.Cookies["ConsentCookie"]; if (consentCookie == null) { HttpCookie newConsent = new HttpCookie("ConsentCookie", "true"); //set cookie to expire in 100 days newConsent.Expires = DateTime.UtcNow.AddDays(100); Response.Cookies.Add(newConsent); } string Redirect; Redirect = Request["ReturnUrl"]; if (Redirect == null) { Redirect = "Default.aspx"; } Response.Redirect(Redirect, true); } else { MsgLbl.Text = "Your email or password is incorrect"; } } else { consentCheck.ForeColor = System.Drawing.Color.Red; } }
private CSS GetCss() { CSS sheet = new CSS(); sheet.Analyze(DefaultFb2Css); return(sheet); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { Facilitator newFac = new Facilitator(); CSS RequestDirector = new CSS(); bool Confirmation; //if getfacilitator returns default facilitator values, that email has not been used if (RequestDirector.GetFacilitatorByEmail(EmailTxt.Text).Email == default(string)) { newFac.FirstName = FirstNameTxt.Text; newFac.LastName = LastNameTxt.Text; newFac.Title = TitleTxt.Text; newFac.Email = EmailTxt.Text; newFac.Organization = OrgTxt.Text; newFac.Location = LocTxt.Text; //generate password hash newFac.Salt = RequestDirector.CreateSalt(5); newFac.Password = RequestDirector.CreatePasswordHash(PasswordTxt.Text, newFac.Salt); newFac.Roles = "Facilitator|"; //attempt to create an account Confirmation = RequestDirector.CreateFacilitator(newFac); //if account creation successful, log in and redirect to home if (Confirmation) { if (RequestDirector.IsAuthenticated(EmailTxt.Text, PasswordTxt.Text)) { Facilitator pullFacilitator = RequestDirector.GetFacilitatorByEmail(EmailTxt.Text); string roles = pullFacilitator.Roles; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, RequestDirector.GetFacilitatorByEmail(EmailTxt.Text).FacilitatorID.ToString(), DateTime.Now, DateTime.Now.AddMinutes(60), false, roles); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); Response.Redirect("Default.aspx"); } else { MsgLbl.Text = "Your email or password is incorrect"; } } else { MsgLbl.Text = "Error creating account."; } } else { MsgLbl.Text = "This email is already associated with an account."; } }
//end event when button clicked protected void ButtonEnd_Click(object sender, EventArgs e) { CSS Manager = new CSS(); bool confirmation = false; //get event info Event updateMe = new Event(); updateMe.EventID = Convert.ToInt32(((Event)Session["Event"]).EventID); updateMe = Manager.GetEvent(updateMe); //update event with end time updateMe.EventEnd = DateTime.Now.ToUniversalTime(); updateMe.EventKey = "ZZZZ"; confirmation = Manager.UpdateEventStatus(updateMe); //generate table and charts if (confirmation) { //Reload page Session["criteria"] = "All Evaluations"; Session["math"] = "Mean"; Response.Redirect("ViewEvent.aspx", true); } }
public CSS GetStyles(IEnumerable <Style> styles) { CSS css = new CSS(); //生产Style模版对应的CSS Style foreach (Style s in styles) { var id = s.StyleId; var type = s.Type.ToString(); Style linkedS = null; if (s.LinkedStyle != null) { var linkedId = s.LinkedStyle.Val; var s1 = from ls in styles where ls.StyleId.Value == linkedId select ls; var k = s1.Count(); if (k > 0) { linkedS = s1.ElementAt(0); } } css.AddStyle(this.GetStyle(s, linkedS)); } return(css); }
private void InitEuroService() { var dateRateCurrencies = database.DateRateCurrencyRepository.GetWhere(d => d.MeasureDate == DateTime.Today).ToList(); if (dateRateCurrencies.Any()) { foreach (DateRateCurrency dateRateCurrency in dateRateCurrencies) { EuroCurrencyRates.Add(new CurrencyRate(dateRateCurrency.Currency.Name, dateRateCurrency.Rate)); } } else { var currencies = CurrencyConverterService.GetCurrencyTags(); float rate; string currencyName; for (int i = 0; i < 33; i++) { currencyName = currencies[i]; rate = CSS.GetExchangeRate("eur", currencyName); EuroCurrencyRates.Add(new CurrencyRate(currencyName, rate)); dateRateCurrencies.Add(new DateRateCurrency(DateTime.Today, rate, i + 1)); } database.DateRateCurrencyRepository.AddRange(dateRateCurrencies); database.Complete(); } }
protected void DeleteEvent_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); string EventID = ((Button)sender).ID; EventID = EventID.Replace("EventDelete", ""); Event selectedEvent = new Event(); selectedEvent.EventID = Convert.ToInt32(EventID); //Delete event data bool confirmation; List <Question> qs = new List <Question>(); qs = RequestDirector.GetQuestions(selectedEvent.EventID); foreach (Question q in qs) { confirmation = RequestDirector.DeleteQuestion(q); } confirmation = RequestDirector.DeleteEventData(selectedEvent); //Delete event confirmation = RequestDirector.DeleteEvent(selectedEvent); //refresh to remove from list Response.Redirect("Events.aspx"); }
public MessageBoxForm(String title,CSS.IM.XMPP.protocol.client.Message msg,string username,string pswd) { InitializeComponent(); Msg = msg; this.username = username; this.pswd = pswd; //Msg.SetTag("subject","mq"); this.Text = title; switch (msg.GetTag("subject")) { case null: this.lllab.Text = Msg.Body; break; case "window": MqMessage mqMsg = MarkMessage_Mq(Msg); try { this.lllab.Text = mqMsg.Msg; this.lllab.Tag = mqMsg; } catch (Exception ex) { this.lllab.Text = "消息格式错误," + ex.Message; } break; } //this.Location = new System.Drawing.Point(100, 100); //this.Cursor = System.Windows.Forms.Cursors.Hand; }
/// <summary> /// Konstruktor, setzt den HTML und JS auf string.Empty /// </summary> public ContentFileManager(string scriptMethodName) { using (var entities = new Vape4LifeEntities()) { var serverScriptMethod = entities.ServerScriptMethods.AsNoTracking().FirstOrDefault(s => s.Name == scriptMethodName); if (serverScriptMethod == null) { throw new Exception("Der ServerScriptMethod-Name wurde nicht in der DB gefunden!"); } entities.ReloadebleContentHTMLs.AsNoTracking() .Where(r => r.IdfServerScriptMethod == serverScriptMethod.IdServerScriptMethod) .ToList() .ForEach(r => HTML.Add(r.FilePath)); entities.ReloadebleContentJS.AsNoTracking() .Where(r => r.IdfServerScriptMethod == serverScriptMethod.IdServerScriptMethod) .ToList() .ForEach(r => JS.Add(r.FilePath)); entities.ReloadebleContentCSSes.AsNoTracking() .Where(r => r.IdfServerScriptMethod == serverScriptMethod.IdServerScriptMethod) .ToList() .ForEach(r => CSS.Add(r.FilePath)); AlloewdToReload = true; } }
public override IEnumerable <TokenBase> GetTokens() { _css = new CSS(); var html = new HtmlDocument { OptionOutputAsXml = true, OptionReadEncoding = false }; html.Load(_reader); var root = html.DocumentNode.SelectSingleNode("//body"); var cssNode = html.DocumentNode.SelectSingleNode("//style"); if (cssNode != null) { _css.Analyze(cssNode.InnerText); } var stack = new Stack <TextVisualProperties>(); var item = new TextVisualProperties(); stack.Push(item); return(ParseTokens(root, stack, new TokenIndex())); }
public GenCodesForm() { InitializeComponent(); db = new DbDataContext(); CSS.LoadData(db); }
protected void LeaveBtn_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Evaluator eval = new Evaluator(); eval.EvaluatorID = ((Evaluator)Session["Evaluator"]).EvaluatorID; DateTime defaultTime = Convert.ToDateTime("1800-01-01 12:00:00 PM"); Event eve = new Event(); eve.EventID = ((Event)Session["Event"]).EventID; eve = RequestDirector.GetEvent(eve); if (eve.EventEnd == defaultTime) { bool success = RequestDirector.DeleteEvaluatorEventData(eve, eval); if (success) { Response.Redirect("Default.aspx"); } } else { Response.Redirect("Default.aspx"); } }
public void SetTextStyle(CSS css) { switch (css) { case CSS.BodyFont: LabelText.fontSize = TacoConfig.Instance.BodyFont.Size; break; case CSS.HeaderFont: LabelText.fontSize = TacoConfig.Instance.HeaderFont.Size; break; case CSS.InputFont: LabelText.fontSize = TacoConfig.Instance.InputFont.Size; break; case CSS.MessageFont: LabelText.fontSize = TacoConfig.Instance.MessageFont.Size; break; } }
/// <summary> /// 初始化接收消息队列 /// </summary> /// <param name="msg">消息</param> /// <param name="ip">发送者IP</param> /// <param name="port">发送者端口</param> /// <param name="sender">发送者套接字对像</param> public UDPReceiveMessage(CSS.IM.Library.Class.Msg msg, System.Net.IPAddress ip, int port, object sender) { this.Msg = msg; this.Ip = ip; this.Port = port; this.Sender = sender; }
// Methods public Fb2TokenParser(XNamespace ns, XElement root, CSS styleSheet, List<BookChapter> chapters, Dictionary<string, int> anchors) { _ns = ns; _root = root; _styleSheet = styleSheet; _chapters = chapters; _anchors = anchors; }
// Methods public Fb2TokenParser(XNamespace ns, XElement root, CSS styleSheet, List <BookChapter> chapters, Dictionary <string, int> anchors) { _ns = ns; _root = root; _styleSheet = styleSheet; _chapters = chapters; _anchors = anchors; }
protected void UpdateBtn_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Event currentEvent = new Event(); currentEvent.EventID = ((Event)Session["Event"]).EventID; bool success; currentEvent = RequestDirector.GetEvent(currentEvent); currentEvent.Performer = tbPerformer.Text; currentEvent.Description = tbDesc.Text; currentEvent.Location = tbLocation.Text; currentEvent.OpenMsg = tbOpen.Text; currentEvent.CloseMsg = tbClose.Text; currentEvent.Date = DateTime.Today; string crit = ""; if (allCritLB.Items.Count > 0) { foreach (ListItem i in allCritLB.Items) { crit += (i.Text + '|'); } crit.TrimEnd('|'); } else { crit = "Overall Quality"; } currentEvent.VotingCrit = crit; success = RequestDirector.UpdateEventInfo(currentEvent); if (success) { List <Question> questions = new List <Question>(); questions = RequestDirector.GetQuestions(currentEvent.EventID); foreach (Question q in questions) { RequestDirector.DeleteQuestion(q); } Question qu; foreach (ListItem li in allQsLB.Items) { qu = new Question(); qu.EventID = currentEvent.EventID; qu.QuestionText = li.Text; RequestDirector.AddQuestion(qu); } } }
//update facilitator account info protected void UpdateBtn_Click(object sender, EventArgs e) { CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; CSS requestDirector = new CSS(); //get facilitator info Facilitator activeFac = new Facilitator(); activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name); activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID); //check if facilitator changed email if (Emailtxt.Text != activeFac.Email) { //if new email, check if email already in use if (requestDirector.GetFacilitatorByEmail(Emailtxt.Text).Email == default(string)) { activeFac.Email = Emailtxt.Text; activeFac.FirstName = FNametxt.Text; activeFac.LastName = LNametxt.Text; activeFac.Title = Titletxt.Text; activeFac.Organization = Orgtxt.Text; activeFac.Location = Loctxt.Text; if (requestDirector.UpdateFacilitator(activeFac)) { Msglbl.Text = "Account Information Updated"; } else { Msglbl.Text = "Account Information Update Failed"; } } else { Msglbl.Text = "That email is used by another account"; } } else { activeFac.Email = Emailtxt.Text; activeFac.FirstName = FNametxt.Text; activeFac.LastName = LNametxt.Text; activeFac.Title = Titletxt.Text; activeFac.Organization = Orgtxt.Text; activeFac.Location = Loctxt.Text; if (requestDirector.UpdateFacilitator(activeFac)) { Msglbl.Text = "Account Information Updated"; } else { Msglbl.Text = "Account Information Update Failed"; } } }
public object Get(CSS unused) { Response.AddHeader("Content-Type", "text/css"); // Check the query string to see if we should return the minified // version of the CSS; default value will be 'true' if it isn't there var minify = int.Parse(Request.QueryString.Get("minify") ?? "1") == 1; return GenerateFile("css", minify); }
private void SetLabelValueByStyle(CSS.Styles style) { CSS SSL = new CSS(); FieldInfo myFields = SSL.GetType() .GetField(m_LabelStyle.ToString(), BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance); if (myFields != null) { Deserialize(ref m_Label, (string)myFields.GetValue(SSL)); } }
public void AfterSelection_ShouldNavigateBack() { var css = new CSS() { ID = Guid.NewGuid() }; ViewModel.ListViewSelectedItem = css; Assert.Equal(1, Services.MockNavigation.GoBackCallCount); }
public void AfterSelection_PreferencesShouldBeSet() { var css = new CSS() { ID = Guid.NewGuid() }; ViewModel.ListViewSelectedItem = css; Assert.Equal(css.ID, Services.MockPreferences.StyleSheetID); }
public void IncomingMessage(CSS.IM.XMPP.protocol.client.Message msg) { try { CSS.IM.XMPP.protocol.client.Message top_msg = new XMPP.protocol.client.Message(); top_msg.SetTag("FName", this.Font.Name);//获得字体名称 top_msg.SetTag("FSize", this.Font.Size);//字体大小 top_msg.SetTag("FBold", true);//是否粗体 top_msg.SetTag("FItalic", this.Font.Italic);//是否斜体 top_msg.SetTag("FStrikeout", this.Font.Strikeout);//是否删除线 top_msg.SetTag("FUnderline", true);//是否下划线 Color cl; if (XmppConn.MyJID.User == msg.From.Resource) { cl = Color.FromArgb(33, 119, 207);//获取颜色 } else { cl = Color.Red;//获取颜色 } byte[] cby = BitConverter.GetBytes(cl.ToArgb()); top_msg.SetTag("CA", cby[0]); top_msg.SetTag("CR", cby[1]); top_msg.SetTag("CG", cby[2]); top_msg.SetTag("CB", cby[3]); string nickname = msg.GetTag("NickName").ToString(); if (nickname == null) { nickname = msg.From.Resource; } if (nickname.Trim().Length == 0) { nickname = msg.From.Resource; } nickname=nickname + "(" + msg.From.Resource + ")"; top_msg.Body = nickname + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second; RTBRecord_Show(top_msg, false); //RTBRecord.AppendTextAsRtf(msg.From.User + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second + "\n", new Font(this.Font, FontStyle.Underline | FontStyle.Bold), CSS.IM.Library.ExtRichTextBox.RtfColor.Red, CSS.IM.Library.ExtRichTextBox.RtfColor.White); RTBRecord_Show(msg, false); if (CSS.IM.UI.Util.Path.MsgSwitch) CSS.IM.UI.Util.SoundPlayEx.MsgPlay(CSS.IM.UI.Util.Path.MsgPath); //new Font(this.Font, FontStyle.Underline | FontStyle.Bold), //CSS.IM.Library.ExtRichTextBox.RtfColor.Red, //CSS.IM.Library.ExtRichTextBox.RtfColor.White } catch (Exception) { } }
public async Task DeleteAsync(CSS sheet) { await _database.InsertAsync(new DeletedItem() { ID = sheet.ID, DateDeleted = DateTime.UtcNow }); await _database.DeleteAsync(sheet); return; }
public void AddGroupChat(CSS.IM.XMPP.Jid jid) { ChatGroupControl chatgroup = new ChatGroupControl(jid); chatgroup.FCType = FCType; //chatgroup.TextName = jid.Bare; chatgroup.Location = new Point(1, (ItemHeight+1) * this.Controls.Count); chatgroup.Size = new Size(this.Width - 2, ItemHeight); chatgroup.ChatGroupOpenEvent += new ChatGroupControl.ChatGroupOpenDelegate(chatgroup_ChatGroupOpenEvent); Controls.Add(chatgroup); }
private void SetLabelValueByStyle(CSS.Styles style) { CSS SSL = new CSS(); FieldInfo myFields = SSL.GetType() .GetField(m_LabelStyle.ToString(), BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance); if (myFields != null) { Deserialize(ref m_Label, (string)myFields.GetValue(SSL)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CSS RequestDirector = new CSS(); DateTime defaultTime = Convert.ToDateTime("1800-01-01 12:00:00 PM"); Event ActiveEvent = new Event(); ActiveEvent.EventID = ((Event)Session["Event"]).EventID; ActiveEvent = RequestDirector.GetEvent(ActiveEvent); } }
public void Connect(string css_server, int css_port) { _CSS = new CSS(); _Games = _CSS.Games; // Register for updates going forward (this helps in case games are added after blast): _delegateGameUpdate = new Games.GameUpdateDelegate(Games_GameUpdated); _Games.RegisterForGameUpdate(ref _delegateGameUpdate, false); CSSConnect(css_server, css_port); System.Threading.Thread.Sleep(5000); }
public Task <int> SaveAsync(CSS sheet) { if (sheet.ID != Guid.Empty) { return(_database.UpdateAsync(sheet)); } else { sheet.ID = Guid.NewGuid(); return(_database.InsertAsync(sheet)); } }
public Event GetEvent(string eventID) { //this method gets all the event data using the CSS director Random rand = new Random(); CSS Director = new CSS(); Event ActiveEvent = new Event(); ActiveEvent.EventID = Convert.ToInt32(eventID); ActiveEvent = Director.GetEvent(ActiveEvent); return(ActiveEvent); }
private void Calculate_Click(object sender, EventArgs e) { //Declare Swimmer's Label, so we can write the Swimmer's Name, and store it with his/her proper Data string swimmerName; swimmerName = Console.ReadLine(); swimmerName = lblSwimerName.ToString(); //Declarations double longDistance; double longTime; double shortDistance; double shortTime; double workoutDistance; double workingTime; double CSS; //Critical Swim Speed double NSS; //Normalized Swim Speed double IF; //Intensity Factor double TSS; //Training Stress Score //Inputs //This 4 lines (with code) are used to calculate the CSS longDistance = double.Parse(lblLongerDistance.Text); longTime = double.Parse(lblLongerTime.Text); shortDistance = double.Parse(lblShorterDistance.Text); shortTime = double.Parse(lblShorterTime.Text); //This 2 lines of code are used to calculate the NSS workoutDistance = double.Parse(lblWorkoutDistance.Text); workingTime = double.Parse(lblWorkingTime.Text); //Processing CSS = (longDistance - shortDistance) / (longTime - shortTime); //Calculates the CSS NSS = (workoutDistance / workingTime); //Calculates tge NSS IF = (NSS / CSS); //Calculates the IF TSS = ((Math.Pow(IF, 3)) * (workingTime / 3600) * 100); //Calculates the TSS //OutPut lblCSS.Text = CSS.ToString(); lblNSS.Text = NSS.ToString(); lblIF.Text = IF.ToString(); lblTSS.Text = TSS.ToString(); }
protected void acceptCookie_Click(object sender, EventArgs e) { CSS requestManager = new CSS(); //create cookie stating that user has accepted cookie use HttpCookie consentCookie = new HttpCookie("ConsentCookie", "true"); //set cookie to expire in 100 days consentCookie.Expires = DateTime.UtcNow.AddDays(100); Response.Cookies.Add(consentCookie); Page.Response.Redirect(Page.Request.Url.ToString(), true); }
protected void GenKeyBtn_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Event currentEvent = new Event(); currentEvent.EventID = ((Event)Session["Event"]).EventID; bool success; currentEvent = RequestDirector.GetEvent(currentEvent); currentEvent.EventKey = RequestDirector.GenKey(3); currentEvent.Date = DateTime.Today; success = RequestDirector.UpdateEventInfo(currentEvent); if (success) { upTable.Visible = true; PanelButtons.Visible = true; PanelPreLabel.Visible = false; PanelPostLabel.Visible = true; tbEventID.Text = currentEvent.EventKey; tbPerformer.ReadOnly = true; tbDesc.ReadOnly = true; tbLocation.ReadOnly = true; tbOpen.ReadOnly = true; tbClose.ReadOnly = true; allCritLB.Enabled = false; allQsLB.Enabled = false; newQTB.Visible = false; critTxt.Visible = false; AddCritBTN.Enabled = false; AddCritBTN.Visible = false; RemoveCritBRN.Enabled = false; RemoveCritBRN.Visible = false; AddQBTN.Enabled = false; AddQBTN.Visible = false; RemoveQBTN.Enabled = false; RemoveQBTN.Visible = false; GenKeyBtn.Enabled = false; GenKeyBtn.Visible = false; UpdateBtn.Enabled = false; UpdateBtn.Visible = false; TimerForTableRefresh.Enabled = true; } else { tbEventID.Text = "Error Generating Key"; } }
public void ResetStyle(CSS.Styles style,LabelFontSizeDefine size = LabelFontSizeDefine.LABEL_SIZE_NONE) { if (! m_bIsAviliable) { return; } m_LabelStyle = style; // get style information SetLabelValueByStyle(style); // set font size if (size != LabelFontSizeDefine.LABEL_SIZE_NONE) { m_Label.fontSize = (int)(size); } }
/// <summary> /// �����µ�Socketͨ���������� /// </summary> private void AcceptClientSocket(object sender, CSS.IM.Library.Net.SockEventArgs e) { if (OnAcceptClientSocket != null) OnAcceptClientSocket(sender, e); }
/// <summary> /// UDP���ݵ����¼� /// </summary> /// <param name="e">UDP���ݲ���</param> private void sockUDP1_DataArrival(object sender,CSS.IM.Library.Net.SockEventArgs e) { //if (e.Data.Length < 10) return; CSS.IM.Library.Class.msgFile msg = new CSS.IM.Library.Class.msgFile(e.Data); this.DataArrival(msg,CSS.IM.Library.Class.NatClass.FullCone, e.IP,e.Port); }
/// <summary> /// sockUDP �����ļ����� /// </summary> /// <param name="msg">�ļ���Ϣ</param> private void sendData(CSS.IM.Library.Class.msgFile msg) { try { //if (this.netClass == CSS.IM.Library.Class.NetCommunicationClass.LanUDP)//����Ǿ�����ͨ�� this.sockUDP1.Send(this.OppositeUDPIP,this.OppositeUDPPort, msg.getBytes());//����UDP�������ݵ��Է�������IP��˿� } catch { } }
/// <summary> /// ���ӿͻ��������ﵽ�����õ�����ֵ /// </summary> private void MaxConnectCountArrival(object sender, CSS.IM.Library.Net.SockEventArgs e) { if (OnMaxConnectCountArrival != null) OnMaxConnectCountArrival(sender,e); }
/// <summary> /// Sends an Iq synchronous and return the response or null on timeout /// </summary> /// <param name="iq">The IQ to send</param> /// <param name="timeout"></param> /// <returns>The response IQ or null on timeout</returns> public IQ SendIq(CSS.IM.XMPP.protocol.client.IQ iq, int timeout) { synchronousResponse = null; AutoResetEvent are = new AutoResetEvent(false); SendIq(iq, new IqCB(SynchronousIqResult), are); if (!are.WaitOne(timeout, true)) { // Timed out lock (m_grabbing) { if (m_grabbing.ContainsKey(iq.Id)) m_grabbing.Remove(iq.Id); } return null; } return synchronousResponse; }
internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { Dictionary<int, int> i = new Dictionary<int, int>(); i[0] = 1; i[1] = 0; AMI_MyClass_opNVI cb = new AMI_MyClass_opNVI(i); p.opNV_async(cb, i); cb.check(); } { Dictionary<string, string> i = new Dictionary<string, string>(); i["a"] = "b"; i["b"] = "a"; AMI_MyClass_opNRI cb = new AMI_MyClass_opNRI(i); p.opNR_async(cb, i); cb.check(); } { Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>(); Dictionary<int, int> id = new Dictionary<int, int>(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; AMI_MyClass_opNDVI cb = new AMI_MyClass_opNDVI(i); p.opNDV_async(cb, i); cb.check(); } { Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> id = new Dictionary<string, string>(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; AMI_MyClass_opNDRI cb = new AMI_MyClass_opNDRI(i); p.opNDR_async(cb, i); cb.check(); } { OV i = new OV(); i[0] = 1; i[1] = 0; AMI_MyClass_opOVI cb = new AMI_MyClass_opOVI(i); p.opOV_async(cb, i); cb.check(); } { OR i = new OR(); i["a"] = "b"; i["b"] = "a"; AMI_MyClass_opORI cb = new AMI_MyClass_opORI(i); p.opOR_async(cb, i); cb.check(); } { ODV i = new ODV(); OV id = new OV(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; AMI_MyClass_opODVI cb = new AMI_MyClass_opODVI(i); p.opODV_async(cb, i); cb.check(); } { ODR i = new ODR(); OR id = new OR(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; AMI_MyClass_opODRI cb = new AMI_MyClass_opODRI(i); p.opODR_async(cb, i); cb.check(); } { Dictionary<string, ODV> i = new Dictionary<string, ODV>(); OV iid = new OV(); iid[0] = 1; iid[1] = 0; ODV id = new ODV(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opNODVI cb = new AMI_MyClass_opNODVI(i); p.opNODV_async(cb, i); cb.check(); } { Dictionary<string, ODR> i = new Dictionary<string, ODR>(); OR iid = new OR(); iid["a"] = "b"; iid["b"] = "a"; ODR id = new ODR(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opNODRI cb = new AMI_MyClass_opNODRI(i); p.opNODR_async(cb, i); cb.check(); } { ONDV i = new ONDV(); Dictionary<int, int> iid = new Dictionary<int, int>(); iid[0] = 1; iid[1] = 0; Dictionary<string, Dictionary<int, int>> id = new Dictionary<string, Dictionary<int, int>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opONDVI cb = new AMI_MyClass_opONDVI(i); p.opONDV_async(cb, i); cb.check(); } { ONDR i = new ONDR(); Dictionary<string, string> iid = new Dictionary<string, string>(); iid["a"] = "b"; iid["b"] = "a"; Dictionary<string, Dictionary<string, string>> id = new Dictionary<string, Dictionary<string, string>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opONDRI cb = new AMI_MyClass_opONDRI(i); p.opONDR_async(cb, i); cb.check(); } { int[] ii = new int[] { 1, 2 }; Dictionary<string, int[]> i = new Dictionary<string, int[]>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDAISI cb = new AMI_MyClass_opNDAISI(i); p.opNDAIS_async(cb, i); cb.check(); } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); Dictionary<string, CIS> i = new Dictionary<string, CIS>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDCISI cb = new AMI_MyClass_opNDCISI(i); p.opNDCIS_async(cb, i); cb.check(); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); Dictionary<string, List<int>> i = new Dictionary<string, List<int>>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDGISI cb = new AMI_MyClass_opNDGISI(i); p.opNDGIS_async(cb, i); cb.check(); } { string[] ii = new string[] { "a", "b" }; Dictionary<string, string[]> i = new Dictionary<string, string[]>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDASSI cb = new AMI_MyClass_opNDASSI(i); p.opNDASS_async(cb, i); cb.check(); } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); Dictionary<string, CSS> i = new Dictionary<string, CSS>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDCSSI cb = new AMI_MyClass_opNDCSSI(i); p.opNDCSS_async(cb, i); cb.check(); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); Dictionary<string, List<string>> i = new Dictionary<string, List<string>>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDGSSI cb = new AMI_MyClass_opNDGSSI(i); p.opNDGSS_async(cb, i); cb.check(); } { int[] ii = new int[] { 1, 2 }; ODAIS i = new ODAIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODAISI cb = new AMI_MyClass_opODAISI(i); p.opODAIS_async(cb, i); cb.check(); } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); ODCIS i = new ODCIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODCISI cb = new AMI_MyClass_opODCISI(i); p.opODCIS_async(cb, i); cb.check(); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); ODGIS i = new ODGIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODGISI cb = new AMI_MyClass_opODGISI(i); p.opODGIS_async(cb, i); cb.check(); } { string[] ii = new string[] { "a", "b" }; ODASS i = new ODASS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODASSI cb = new AMI_MyClass_opODASSI(i); p.opODASS_async(cb, i); cb.check(); } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); ODCSS i = new ODCSS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODCSSI cb = new AMI_MyClass_opODCSSI(i); p.opODCSS_async(cb, i); cb.check(); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); ODGSS i = new ODGSS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODGSSI cb = new AMI_MyClass_opODGSSI(i); p.opODGSS_async(cb, i); cb.check(); } }
private void asyncTCPClient1_OnDataArrival(object sender, CSS.IM.Library.Net.SockEventArgs e) { //if (e.Data.Length < 10) return; CSS.IM.Library.Class.msgFile msg = new CSS.IM.Library.Class.msgFile(e.Data); this.DataArrival(msg,CSS.IM.Library.Class.NatClass.Tcp ,null,0); }
private void asyncTCPClient1_OnConnected(object sender, CSS.IM.Library.Net.SockEventArgs e) { //CSS.IM.Library.Calculate.WirteLog("������"); CSS.IM.Library.Class.msgFile msg = new CSS.IM.Library.Class.msgFile((byte)CSS.IM.Library.Class.ProtocolFileTransmit.GetFileTransmitProxyID, -1, -1, 0, new byte[1]); this.asyncTCPClient1.SendData(msg.getBytes());//�������������ת����ID�� }
public Presence(CSS.IM.XMPP.protocol.client.ShowType show, string status) : this() { this.Show = show; this.Status = status; }
/// <summary> /// �ͻ��˶Ͽ����� /// </summary> private void Close(object sender, CSS.IM.Library.Net.SockEventArgs e) { if (OnClose != null) OnClose(sender,e ); }
/// <summary> /// ���ն��������� /// </summary> private void DataArrival(object sender, CSS.IM.Library.Net.SockEventArgs e) { if (OnDataArrival != null) OnDataArrival(sender ,e); }
private void myTcp_OnClose(object sender, CSS.IM.Library.Net.SockEventArgs e) { CloseClientSocket(sender as MyTcp);//�ر�SOCKET }
/// <summary> /// 更新消息显示 /// </summary> /// <param name="msg"></param> /// <param name="isSend"></param> public void RTBRecord_Show(CSS.IM.XMPP.protocol.client.Message msg, bool isSend) { System.Drawing.FontStyle fontStyle = new System.Drawing.FontStyle(); System.Drawing.Font ft = null; #region 获取字体 try { if (msg.GetTagBool("FBold")) { fontStyle = System.Drawing.FontStyle.Bold; } if (msg.GetTagBool("FItalic")) { fontStyle = fontStyle | System.Drawing.FontStyle.Italic; } if (msg.GetTagBool("FStrikeout")) { fontStyle = fontStyle | System.Drawing.FontStyle.Strikeout; } if (msg.GetTagBool("FUnderline")) { fontStyle = fontStyle | System.Drawing.FontStyle.Underline; } ft = new System.Drawing.Font(msg.GetTag("FName"), float.Parse(msg.GetTag("FSize")), fontStyle); } catch (Exception) { ft = RTBRecord.Font; } #endregion #region 获取颜色 Color cl = RTBRecord.ForeColor; try { byte[] cby = new byte[4]; cby[0] = Byte.Parse(msg.GetTag("CA")); cby[1] = Byte.Parse(msg.GetTag("CR")); cby[2] = Byte.Parse(msg.GetTag("CG")); cby[3] = Byte.Parse(msg.GetTag("CB")); cl = Color.FromArgb(BitConverter.ToInt32(cby, 0)); } catch { cl = RTBRecord.ForeColor; } #endregion int iniPos = this.RTBRecord.TextLength;//获得当前记录richBox中最后的位置 String msgtext = msg.Body; //RTBRecord.Focus(); RTBRecord.Select(RTBRecord.TextLength, 0); RTBRecord.ScrollToCaret(); string face = ""; try { face = msg.GetTag("face").ToString(); } catch (Exception) { face = ""; } if (face != "")//如果消息中有图片,则添加图片 { string[] imagePos = face.Split('|'); int addPos = 0;// int currPos = 0;//当前正要添加的文本位置 int textPos = 0; for (int i = 0; i < imagePos.Length - 1; i++) { string[] imageContent = imagePos[i].Split(',');//获得图片所在的位置、图片名称 currPos = Convert.ToInt32(imageContent[0]);//获得图片所在的位置 this.RTBRecord.AppendText(msgtext.Substring(textPos, currPos - addPos)); this.RTBRecord.SelectionStart = this.RTBRecord.TextLength; textPos += currPos - addPos; addPos += currPos - addPos; Image image = null; if (emotionDropdown == null) { emotionDropdown = new EmotionDropdown(); } if (emotionDropdown.faces.ContainsKey(imageContent[1])) { if (this.RTBRecord.findPic(imageContent[1]) == null) image = ResClass.GetImgRes("_" + int.Parse(imageContent[1].ToString()).ToString()); else image = this.RTBRecord.findPic(imageContent[1]).Image; } else { String img_str = msg.GetTag(imageContent[1]); try { if (msg.From.Bare == XmppConn.MyJID.Bare) { image = Image.FromFile(Util.sendImage + imageContent[1].ToString() + ".gif"); } else { image = Image.FromFile(Util.receiveImage + imageContent[1].ToString() + ".gif"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } this.RTBRecord.addGifControl(imageContent[1], image); addPos++; } this.RTBRecord.AppendText(msgtext.Substring(textPos, msgtext.Length - textPos) + " \n"); } else { this.RTBRecord.AppendText(msgtext + "\n"); } //RTBRecord.Focus(); this.RTBRecord.Select(iniPos, this.RTBRecord.TextLength - iniPos); this.RTBRecord.SelectionFont = ft; this.RTBRecord.SelectionColor = cl; this.RTBRecord.Select(this.RTBRecord.TextLength, 0); this.RTBRecord.ScrollToCaret(); //this.RTBRecord.Focus(); }
private void asyncTCPClient1_OnDisconnected(object sender, CSS.IM.Library.Net.SockEventArgs e) { //CSS.IM.Library.Calculate.WirteLog("��������Ͽ�����"); }
public XmppConnection(CSS.IM.XMPP.net.SocketConnectionType type) : this() { m_SocketConnectionType = CSS.IM.XMPP.net.SocketConnectionType.Direct; }
private void asyncTCPClient1_OnError(object sender, CSS.IM.Library.Net.SockEventArgs e) { //CSS.IM.Library.Calculate.WirteLog("�ļ��������"+ e.ErrorCode + e.ErrorMessage ); }
/// <summary> /// An IQ Element is received. Now check if its one we are looking for and /// raise the event in this case. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnIq(object sender, CSS.IM.XMPP.protocol.client.IQ iq) { if (iq == null) return; string id = iq.Id; if(id == null) return; TrackerData td; lock (m_grabbing) { td = (TrackerData) m_grabbing[id]; if (td == null) { return; } m_grabbing.Remove(id); } td.cb(this, iq, td.data); }
private void DataArrival(CSS.IM.Library.Class.msgFile msg, CSS.IM.Library.Class.NatClass netClass, System.Net.IPAddress Ip, int Port) { switch (msg.InfoClass) { case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.GetFileTransmitProxyID://����Լ��ӷ������ϻ����ת����ID { this.serverSelfID = msg.SendID; if (this.serverOppositeID != -1)//����Ƿ��ͷ������ת����ID������߶Է���ʼ�ս��ļ� { this.netClass = CSS.IM.Library.Class.NetCommunicationClass.TCP;//��ʶ��ǰͨ��Э��ΪTCP //this._mtu = 1200;//�����������ļ�ʱ����MTUֵ����Ϊ1200ʹ·���������ǽת������ msg.InfoClass = (byte)CSS.IM.Library.Class.ProtocolFileTransmit.BeginTransmit; msg.SendID = this.serverSelfID; msg.RecID = this.serverOppositeID; this.sendData(msg); } else if (this.getFileProxyID != null)//����ǽ��շ��������ת����ID��֮�Է� this.getFileProxyID(this, this.serverSelfID); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.FileTransmit://����ļ��������� { //Calculate.WirteLog("�����ļ����Է�"); this.sendFile((int)msg.pSendPos);//�����ļ����Է� } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.GetFileBlock :// ��öԷ�������ļ����ݰ� { //Calculate.WirteLog("�յ��ļ�����"); this.ReceivedFileBlock(msg);//�Է������ļ����ݹ���,�������ݵ��ļ� } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.BeginTransmit://�����Ѿ��������Է�Ҫ��ʼ�����ļ� { this.serverOppositeID = msg.SendID;//��öԷ�ID if (netClass == CSS.IM.Library.Class.NatClass.Tcp)//�����TCPͨ�� { this.netClass = CSS.IM.Library.Class.NetCommunicationClass.TCP;//����TCPЭ�鴫���ļ� } else { this.netClass = CSS.IM.Library.Class.NetCommunicationClass.WanNoProxyUDP;//����UDPЭ�鴫�� } if (this.fileTransmitConnected != null)//����ͨ�ųɹ��¼������˳�ͨ�Ų��� this.fileTransmitConnected(this, this.netClass); if (!this.IsSendState)//����ļ���û�п�ʼ���ͣ����� this.sendRequestGetFileData();//�����ļ����Է� //Calculate.WirteLog("�����Ѿ��������Է�Ҫ��ʼ�����ļ�"); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.FileTranstmitOver ://�ļ�������� { this.onFileTransmitted(); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.HandshakeLAN://�յ��Է�������UDP�������� { this.OppositeUDPIP = Ip;//�������öԷ��ľ�����IP this.OppositeUDPPort = Port;//�������öԷ��ľ�����UDP�˿� msg.InfoClass =(byte)CSS.IM.Library.Class.ProtocolFileTransmit.IsOppositeRecSelfLanUDPData;//���߶Է��յ�����������Ϣ this.sockUDP1.Send(this.OppositeUDPIP, this.OppositeUDPPort, msg.getBytes()); //Calculate.WirteLog(this._IsSend.ToString()+ "�յ��Է�������UDP��������:"+ Ip.ToString() +":"+ Port.ToString()); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.IsOppositeRecSelfLanUDPData://�Է��յ��Լ����͵ľ�����UDP�������� { this.netClass = CSS.IM.Library.Class.NetCommunicationClass.LanUDP;//��ʶ��Է�����������ͨ�ųɹ� if (this._IsSend)//����Ƿ����ļ���һ�����ҶԷ���֮�յ��Լ����������ݣ���ͨ��ͨ����ͨ { //this._mtu = 1400;//�����������ļ�ʱ����MTUֵ����Ϊ5120��5k������ٶ� msg.InfoClass = (byte)CSS.IM.Library.Class.ProtocolFileTransmit.BeginTransmit; msg.SendID = 0; this.sendData(msg);//���߶Է���ʼ�����ļ� } //Calculate.WirteLog(Ip.ToString() + ":" + Port.ToString() + "�Է��յ��Լ����͵ľ�����UDP��������" + this._IsSend.ToString()); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.HandshakeWAN ://�յ��Է�������UDP�������� { this.OppositeUDPIP = Ip;//�������öԷ��Ĺ�����IP this.OppositeUDPPort = Port;//�������öԷ��Ĺ�����UDP�˿� msg.InfoClass = (byte)CSS.IM.Library.Class.ProtocolFileTransmit.IsOppositeRecSelfWanUDPData ;//���߶Է��յ�����������Ϣ this.sockUDP1.Send(this.OppositeUDPIP, this.OppositeUDPPort, msg.getBytes()); //Calculate.WirteLog(this._IsSend.ToString()+ "�յ��Է�������UDP��������:"+ Ip.ToString() +":"+ Port.ToString()); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.IsOppositeRecSelfWanUDPData://�Է��յ��Լ����͵ľ�����UDP�������� { this.netClass = CSS.IM.Library.Class.NetCommunicationClass.WanNoProxyUDP;//��ʶ��Է�����������ֱ��ͨ�ųɹ� if (this._IsSend)//����Ƿ����ļ���һ�����ҶԷ���֮�յ��Լ����������ݣ���ͨ��ͨ����ͨ { //this._mtu = 1200;//�����������ļ�ʱ����MTUֵ����Ϊ1200��1k�ٶ� msg.InfoClass = (byte)CSS.IM.Library.Class.ProtocolFileTransmit.BeginTransmit; msg.SendID = 0; this.sendData(msg);//���߶Է���ʼ�����ļ� } //Calculate.WirteLog(Ip.ToString() + ":" + Port.ToString() + "�Է��յ��Լ����͵ľ�����UDP��������" + this._IsSend.ToString()); } break; case (byte)CSS.IM.Library.Class.ProtocolFileTransmit.GetUDPWANInfo://��÷��������ص��ļ��������ֹ�����UDP�˿� { this.selfUDPPort=msg.SendID;//�������öԷ��Ĺ�����UDP�˿� if (!this.IsGetWanUDP && this.fileTransmitGetUDPPort != null) { this.IsGetWanUDP = true;//��ʶ�Ѿ�������WAN UDP�˿ڻ�ȡ�¼� this.fileTransmitGetUDPPort(this, this.selfUDPPort, true); } //Calculate.WirteLog(this._IsSend.ToString() + "��÷��������ص��ļ��������ֹ�����UDP�˿�:" + this.selfUDPPort); } break; } }
private void OnIqComponent(object sender, CSS.IM.XMPP.protocol.component.IQ iq) { OnIq(sender, iq); }
//���Է������ļ����ݿ���� /// <summary> /// ����Է������ļ����ݿ� /// </summary> private void ReceivedFileBlock(CSS.IM.Library.Class.msgFile msg) { if (msg.pSendPos > this.currGetPos)//��������������ݴ��ڵ�ǰ��õ����� { if (this.IsReadWriteFile(this.currGetPos)) { //�����Ƕ�һ���ļ����ڴ���� //FileBlock = new byte[this._FileLen]; if (this.currReadCount + 1 == this.readFileCount)//��������һ�ζ�д�ļ����������ļ�β����ȫ�����뵽�ڴ� FileBlock = new byte[this._FileLen - this.currReadCount * this.maxReadWriteFileBlock]; else FileBlock = new byte[this.maxReadWriteFileBlock]; this.currReadCount++;//�ļ�����������1 } int offSet = this.currGetPos % this.maxReadWriteFileBlock;// ���Ҫ��д�ڴ�ľ���λ�� Buffer.BlockCopy(msg.FileBlock, 0, this.FileBlock, offSet, msg.FileBlock.Length);//���䱣����Buffer�ֽ����� this.currGetPos = (int)msg.pSendPos; //if (this.fileTransmitting != null)//�����յ������ļ������¼� // this.fileTransmitting(this, new fileTransmitEvnetArgs(this._IsSend, this._fullFileName, this._fileName, "", this._FileLen, this.currGetPos, this.FileMD5Value)); if (this.IsReadWriteFile(this.currGetPos) || this.currGetPos == this._FileLen) { ////////////////////////�ļ����� FileStream fw = new FileStream(this._fullFileName, FileMode.CreateNew, FileAccess.Write, FileShare.Read); //fw.Seek(fw.l, SeekOrigin.Begin);//�ϴη��͵�λ�� fw.Write(this.FileBlock, 0, this.FileBlock.Length); //�����д�����������첽��ʽ //fw.BeginRead(myData.Buffer, 0, assignSize, new AsyncCallback(AsyncRead), myData); ///ʵ�ֶ��߳�ͬʱ��д�ļ� fw.Close(); fw.Dispose(); onFileTransmitted();//�����ļ���������¼� /////////////////////////// } if (this.currGetPos == this._FileLen)//����ļ�������ɣ�������������¼� { msg.InfoClass = (byte)CSS.IM.Library.Class.ProtocolFileTransmit.FileTranstmitOver; msg.SendID = this.serverSelfID; msg.RecID = this.serverOppositeID; this.sendData(msg);//���߶Է��ļ�������� onFileTransmitted();//�����ļ���������¼� //return;//�ļ����� } this.sendRequestGetFileData();//���۵�ǰ��ö������ݣ���Ҫ��Է�������һ���ݰ� } }
public Presence(CSS.IM.XMPP.protocol.client.ShowType show, string status, int priority) : this(show, status) { this.Priority = priority; }
/// <summary> /// �쳣���� /// </summary> private void Error(object sender, CSS.IM.Library.Net.SockEventArgs e) { if (OnError != null) OnError(sender ,e); }