예제 #1
0
 /// <summary>
 /// Parses the string representing rotation damping to a ObjectManager.Damping. Error messages are written when necessary.
 /// </summary>
 /// <param name="value">String representation.</param>
 /// <param name="damp">Output damping.</param>
 /// <param name="field">Actual field name.</param>
 /// <param name="filename">File name.</param>
 /// <param name="line">Actual line number string.</param>
 private static void ParseRotateDamping(string value, ref ObjectManager.Damping damp, string field, int line, string filename)
 {
     string[] s = value.Split(',');
     if (s.Length == 2)
     {
         double nf, dr;
         if (!double.TryParse(s[0], System.Globalization.NumberStyles.Float, Culture, out nf))
         {
             Debug.AddMessage(Debug.MessageType.Error, false, "NaturalFrequency is invalid in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
         }
         else if (!double.TryParse(s[1], System.Globalization.NumberStyles.Float, Culture, out dr))
         {
             Debug.AddMessage(Debug.MessageType.Error, false, "DampingRatio is invalid in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
         }
         else if (nf <= 0.0)
         {
             Debug.AddMessage(Debug.MessageType.Error, false, "NaturalFrequency is expected to be positive in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
         }
         else if (dr <= 0.0)
         {
             Debug.AddMessage(Debug.MessageType.Error, false, "DampingRatio is expected to be positive in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
         }
         else
         {
             damp = new ObjectManager.Damping(nf, dr);
         }
     }
     else
     {
         Debug.AddMessage(Debug.MessageType.Error, false, "Exactly 2 arguments are expected in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
     }
 }
예제 #2
0
		/// <summary>
		/// Parses the string representing rotation damping to a ObjectManager.Damping. Error messages are written when necessary.
		/// </summary>
		/// <param name="value">String representation.</param>
		/// <param name="damp">Output damping.</param>
		/// <param name="field">Actual field name.</param>
		/// <param name="filename">File name.</param>
		/// <param name="line">Actual line number string.</param>
		private static void ParseRotateDamping(string value, ref ObjectManager.Damping damp, string field, int line, string filename){
			string[] s = value.Split(',');
			if (s.Length == 2) {
				double nf, dr;
				if (!double.TryParse(s[0], System.Globalization.NumberStyles.Float, Culture, out nf)) {
					Debug.AddMessage(Debug.MessageType.Error, false, "NaturalFrequency is invalid in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
				} else if (!double.TryParse(s[1], System.Globalization.NumberStyles.Float, Culture, out dr)) {
					Debug.AddMessage(Debug.MessageType.Error, false, "DampingRatio is invalid in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
				} else if (nf <= 0.0) {
					Debug.AddMessage(Debug.MessageType.Error, false, "NaturalFrequency is expected to be positive in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
				} else if (dr <= 0.0) {
					Debug.AddMessage(Debug.MessageType.Error, false, "DampingRatio is expected to be positive in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
				} else {
					damp = new ObjectManager.Damping(nf, dr);
				}
			} else {
				Debug.AddMessage(Debug.MessageType.Error, false, "Exactly 2 arguments are expected in " + field + " at line " + line.ToString(Culture) + " in file " + filename);
			}
		}