wasSharpNET – Diff between revs 11 and 27

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 11 Rev 27
Line 23... Line 23...
23 if (ipAdressBytes.Length != subnetMaskBytes.Length) 23 if (ipAdressBytes.Length != subnetMaskBytes.Length)
24 throw new ArgumentException("Lengths of IP address and subnet mask do not match."); 24 throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
Line 25... Line 25...
25   25  
26 var broadcastAddress = new byte[ipAdressBytes.Length]; 26 var broadcastAddress = new byte[ipAdressBytes.Length];
27 for (var i = 0; i < broadcastAddress.Length; i++) -  
28 { 27 for (var i = 0; i < broadcastAddress.Length; i++)
29 broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255)); -  
30 } 28 broadcastAddress[i] = (byte) (ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255));
31 return new IPAddress(broadcastAddress); 29 return new IPAddress(broadcastAddress);
Line 32... Line 30...
32 } 30 }
33   31  
Line 39... Line 37...
39 if (ipAdressBytes.Length != subnetMaskBytes.Length) 37 if (ipAdressBytes.Length != subnetMaskBytes.Length)
40 throw new ArgumentException("Lengths of IP address and subnet mask do not match."); 38 throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
Line 41... Line 39...
41   39  
42 var broadcastAddress = new byte[ipAdressBytes.Length]; 40 var broadcastAddress = new byte[ipAdressBytes.Length];
43 for (var i = 0; i < broadcastAddress.Length; i++) -  
44 { 41 for (var i = 0; i < broadcastAddress.Length; i++)
45 broadcastAddress[i] = (byte)(ipAdressBytes[i] & subnetMaskBytes[i]); -  
46 } 42 broadcastAddress[i] = (byte) (ipAdressBytes[i] & subnetMaskBytes[i]);
47 return new IPAddress(broadcastAddress); 43 return new IPAddress(broadcastAddress);
Line 48... Line 44...
48 } 44 }
49   45  
Line 53... Line 49...
53 var network2 = address2.GetNetworkAddress(subnetMask); 49 var network2 = address2.GetNetworkAddress(subnetMask);
Line 54... Line 50...
54   50  
55 return network1.Equals(network2); 51 return network1.Equals(network2);
56 } 52 }
57 } 53 }
58 } 54 }