// Wywolywane w OnPublic if (sa[0] == ".cip" && sa.Length == 3 && user.Nick == "xrs") { connection.Sender.RequestTopic(channel); Say(channel,"Proboje zmienic: "+sa[1]+" ipcount na: "+sa[2]); Thread.Sleep(1000); ChangeIPCount(sa[1],Int32.Parse(sa[2])); } // OnTopicRequest public void OnTopicRequest(string channel, string topic) { this.topic = topic; Say(channel,"this.topic = topic"); } // Say public void Say(string kanal, string tekst) { connection.Sender.PublicMessage(kanal,tekst); } //ChangeIPCount public void ChangeIPCount(string IP, int NewCount) { Say(channel,"Regex"); Regex exp = new Regex("\\.[0-9]+/[0-9]+/[0-9]+"); MatchCollection matches = exp.Matches(topic); foreach (Match match in matches) { string val = match.Value.Substring(1); string[] vala = val.Split(new char[] { '/' }); if (vala[0] == IP) { Say("#gaad",vala[0]+"/"+vala[1]+"/"+vala[2]); CIPTopic(vala[0],vala[1],vala[2],NewCount.ToString()); } } } // CIPTopic public void CIPTopic (string IP, string lastwe, string oldcount, string newcount) { Say(channel,"CIPT"); int OstatnieWE = Int32.Parse(lastwe); int StaryCount = Int32.Parse(oldcount); int NowyCount = Int32.Parse(newcount); int NowyIleZostalo = NowyCount - OstatnieWE; int StaryIleZostalo = StaryCount - OstatnieWE; string stare_dane = IP+"/"+OstatnieWE.ToString()+"/"+StaryCount.ToString()+" ["+StaryIleZostalo.ToString()+"]"; string nowe_dane = IP+"/"+OstatnieWE.ToString()+"/"+NowyCount.ToString()+" ["+NowyIleZostalo.ToString()+"]"; string temptopic = topic.Replace(stare_dane,nowe_dane); Say("#gaad", stare_dane + " stare dane"); Say("#gaad", nowe_dane + " nowe dane"); Say("#gaad", temptopic); this.topic = temptopic; }