/// <summary> Convert a dot-delimited IP address to an integer. /// <p> /// Converts a string value like "10.0.0.5" to an integer. /// /// </summary> /// <param name="key">the name of the property /// </param> /// <returns> the integer value of the specified IP number. /// returns zero if the IP number is not valid. /// </returns> //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.Properties' and 'System.Collections.Specialized.NameValueCollection' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'" public static int getIpProperty(System.Collections.Specialized.NameValueCollection properties, System.Object key) { System.String string_Renamed = (System.String)properties[(System.String)key]; if (string_Renamed == null) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Console.Error.WriteLine("WARN: couldn't find IP value under '" + key + "'"); return(0); } SupportClass.Tokenizer st = new SupportClass.Tokenizer(string_Renamed, "."); int address; try { address = System.Int32.Parse(st.NextToken()) << 24 | System.Int32.Parse(st.NextToken()) << 16 | System.Int32.Parse(st.NextToken()) << 8 | System.Int32.Parse(st.NextToken()); } catch (System.ArgumentOutOfRangeException) { address = 0; System.Console.Error.WriteLine("WARN: invalid color spec '" + string_Renamed + "' in property file"); } return(address); }
/// <summary> Convert a space delimited color tuple string to a color. /// <p> /// Converts a string value like "255 255 0" to a color constant, /// in this case, yellow. /// /// </summary> /// <param name="key">the name of the property /// </param> /// <returns> a Color object equivalent to the provided string contents. /// Returns white if the string is null or can't be converted. /// </returns> //UPGRADE_ISSUE: Class hierarchy differences between 'java.util.Properties' and 'System.Collections.Specialized.NameValueCollection' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'" public static System.Drawing.Color getColorProperty(System.Collections.Specialized.NameValueCollection properties, System.Object key) { System.String string_Renamed = (System.String) properties[(System.String) key]; if (string_Renamed == null) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Console.Error.WriteLine("WARN: couldn't find color tuplet under '" + key + "'"); return System.Drawing.Color.White; } SupportClass.Tokenizer st = new SupportClass.Tokenizer(string_Renamed, " "); System.Drawing.Color c; try { c = System.Drawing.Color.FromArgb(System.Int32.Parse(st.NextToken()), System.Int32.Parse(st.NextToken()), System.Int32.Parse(st.NextToken())); } catch (System.ArgumentOutOfRangeException) { c = System.Drawing.Color.White; System.Console.Error.WriteLine("WARN: invalid color spec '" + string_Renamed + "' in property file"); } return c; }