- Timestamp:
- 11/13/08 17:06:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Console/IPAdressTextBox.cs
r717 r752 46 46 private System.ComponentModel.Container components = null; 47 47 48 private IPNotation ipNotation = IPNotation.IPv4Decimal;49 private IPNotation newIPNotation = IPNotation.IPv4Decimal;50 private bool bOverwrite = true;51 private bool bPreventLeave = true;48 private IPNotation m_ipNotation = IPNotation.IPv4Decimal; 49 private IPNotation m_newIPNotation = IPNotation.IPv4Decimal; 50 private bool m_bOverwrite = true; 51 private bool m_bPreventLeave = true; 52 52 private System.Windows.Forms.ErrorProvider error; 53 private Regex regexValidNumbers = new Regex("[0-9]");54 private ArrayList arlDelimeter = new ArrayList(new char[] { '.' });53 private Regex m_regexValidNumbers = new Regex("[0-9]"); 54 private ArrayList m_arlDelimeter = new ArrayList(new char[] { '.' }); 55 55 56 56 … … 218 218 set { 219 219 try { 220 if (IPAddressTextBox.ValidateIP(value, this. newIPNotation, this.arlDelimeter))221 base.Text = IPAddressTextBox.MakeValidSpaces(value, this. newIPNotation, this.arlDelimeter);220 if (IPAddressTextBox.ValidateIP(value, this.m_newIPNotation, this.m_arlDelimeter)) 221 base.Text = IPAddressTextBox.MakeValidSpaces(value, this.m_newIPNotation, this.m_arlDelimeter); 222 222 } 223 223 catch { … … 237 237 public bool OverWriteMode { 238 238 get { 239 return this. bOverwrite;239 return this.m_bOverwrite; 240 240 } 241 241 set { 242 if (value != this. bOverwrite) {243 this. bOverwrite = value;242 if (value != this.m_bOverwrite) { 243 this.m_bOverwrite = value; 244 244 this.OnOverWriteChanged(value); 245 245 } … … 257 257 public bool PreventLeaveAtError { 258 258 get { 259 return this. bPreventLeave;259 return this.m_bPreventLeave; 260 260 } 261 261 set { 262 if (value != this. bPreventLeave) {263 this. bPreventLeave = value;262 if (value != this.m_bPreventLeave) { 263 this.m_bPreventLeave = value; 264 264 this.OnPreventLeaveChanged(value); 265 265 } … … 277 277 public IPNotation Notation { 278 278 get { 279 return this. ipNotation;279 return this.m_ipNotation; 280 280 } 281 281 set { 282 if (value != this. ipNotation) {282 if (value != this.m_ipNotation) { 283 283 try { 284 this. newIPNotation = value;285 this.ChangeNotation(this. ipNotation, this.newIPNotation);286 this. ipNotation = this.newIPNotation;287 this.OnNotationChanged(this. newIPNotation);284 this.m_newIPNotation = value; 285 this.ChangeNotation(this.m_ipNotation, this.m_newIPNotation); 286 this.m_ipNotation = this.m_newIPNotation; 287 this.OnNotationChanged(this.m_newIPNotation); 288 288 } 289 289 catch (Exception LastError) { … … 346 346 private void ChangeNotation(IPNotation arg_oldValue, IPNotation arg_newValue) { 347 347 string sTo = ""; 348 ArrayList arlFrom = new ArrayList(this.Text.Replace(" ", "").Split((char[])this. arlDelimeter.ToArray(typeof(char))));348 ArrayList arlFrom = new ArrayList(this.Text.Replace(" ", "").Split((char[])this.m_arlDelimeter.ToArray(typeof(char)))); 349 349 350 350 switch (arg_newValue) { 351 351 case IPNotation.IPv4Decimal: 352 this. regexValidNumbers = new Regex("[0-9]");353 this. arlDelimeter = new ArrayList(new char[] { '.' });352 this.m_regexValidNumbers = new Regex("[0-9]"); 353 this.m_arlDelimeter = new ArrayList(new char[] { '.' }); 354 354 break; 355 355 case IPNotation.IPv4DecimalCIDR: 356 this. regexValidNumbers = new Regex("[0-9]");357 this. arlDelimeter = new ArrayList(new char[] { '.', '/' });356 this.m_regexValidNumbers = new Regex("[0-9]"); 357 this.m_arlDelimeter = new ArrayList(new char[] { '.', '/' }); 358 358 break; 359 359 case IPNotation.IPv4Binary: 360 this. regexValidNumbers = new Regex("[01]");361 this. arlDelimeter = new ArrayList(new char[] { '.' });360 this.m_regexValidNumbers = new Regex("[01]"); 361 this.m_arlDelimeter = new ArrayList(new char[] { '.' }); 362 362 break; 363 363 case IPNotation.IPv4BinaryCIDR: 364 this. regexValidNumbers = new Regex("[01]");365 this. arlDelimeter = new ArrayList(new char[] { '.', '/' });364 this.m_regexValidNumbers = new Regex("[01]"); 365 this.m_arlDelimeter = new ArrayList(new char[] { '.', '/' }); 366 366 break; 367 367 default: … … 502 502 } 503 503 break; 504 504 default: 505 break; 505 506 } 506 507 … … 544 545 if ((char.IsLetterOrDigit(Convert.ToChar(e.KeyValue)) || e.KeyCode == Keys.NumPad0)//Numpad0=96 --> ` 545 546 && iPos < this.TextLength) { 546 if (this. arlDelimeter.Contains(cText[iPos]))547 if (this.m_arlDelimeter.Contains(cText[iPos])) 547 548 iPos += 1; 548 549 this.SelectionStart = iPos; … … 573 574 if ((char.IsLetterOrDigit(Convert.ToChar(e.KeyValue)) || e.KeyCode == Keys.NumPad0)//Numpad0=96 --> ` 574 575 && iPos < this.TextLength) { 575 if (this. arlDelimeter.Contains(cText[iPos]))576 if (this.m_arlDelimeter.Contains(cText[iPos])) 576 577 iPos += 1; 577 578 … … 590 591 //valid input charachters 591 592 if (char.IsControl(e.KeyChar) || 592 regexValidNumbers.IsMatch(e.KeyChar.ToString())) {593 m_regexValidNumbers.IsMatch(e.KeyChar.ToString())) { 593 594 e.Handled = false; 594 595 } else { … … 637 638 protected override void OnValidating(CancelEventArgs e) { 638 639 //e.Cancel = true;//suppress cancel-signal = not validated 639 e.Cancel = (!this.ValidateIP() && this. bPreventLeave);640 e.Cancel = (!this.ValidateIP() && this.m_bPreventLeave); 640 641 base.OnValidating(e); 641 642 } … … 729 730 public string GetPureIPAddress() { 730 731 string s = ""; 731 ArrayList arlIP = new ArrayList(this.Text.Replace(" ", "").Split((char[])this. arlDelimeter.ToArray(typeof(char))));732 ArrayList arlIP = new ArrayList(this.Text.Replace(" ", "").Split((char[])this.m_arlDelimeter.ToArray(typeof(char)))); 732 733 for (int i = 0; i < arlIP.Count; i++) { 733 734 while (arlIP[i].ToString().StartsWith("0")) 734 735 arlIP[i] = arlIP[i].ToString().Substring(1); 735 736 } 736 s = IPAddressTextBox.MakeIP((string[])arlIP.ToArray(typeof(string)), this. ipNotation);737 s = IPAddressTextBox.MakeIP((string[])arlIP.ToArray(typeof(string)), this.m_ipNotation); 737 738 return s; 738 739 } … … 923 924 /// <returns>true/false valid/not</returns> 924 925 private bool ValidateIP() { 925 if (IPAddressTextBox.ValidateIP(this.Text, this. newIPNotation, this.arlDelimeter))926 if (IPAddressTextBox.ValidateIP(this.Text, this.m_newIPNotation, this.m_arlDelimeter)) 926 927 return true; 927 928 else
Note: See TracChangeset
for help on using the changeset viewer.