/// <summary> /// The main method, called as the executable is started. The /// STAThread attibute is used to ensure thread safety for UI /// related components. /// </summary> /// <param name="args">The command line arguments</param> private static void Main(string[] args) { // listen for any unhandled exceptions AppDomain.CurrentDomain.UnhandledException += UnhandledException; #if DEBUG Logger.Instance.echoToConsole = true; #else // echo log messages to the console if verbose specified Logger.Instance.echoToConsole = LineOptionParser.HasFlag(args, ARG_VERBOSE); #endif // print the system information string os = Environment.OSVersion.VersionString; string platform = Environment.Is64BitOperatingSystem ? "x64" : "x86"; Logger.Info("Running on " + os + " " + platform); // Start the UI Application.Init(); //Settings.Default.ThemeName = "theme/gtk-2.0/gtkrc"; //Rc.Parse("./theme/gtk-2.0/gtkrc"); MainWindow window = new MainWindow(); Application.Run(); Logger.Info("Exiting application..."); }
/// <summary> /// Checks for connections to ther contours and adds them to the model. /// </summary> /// <param name="model">The model to add the connections to.</param> /// <param name="args">The line arguments that might specify connections.</param> /// <param name="name">The name of the contour these args correspond to.</param> /// <param name="sourcePoint">Whether to add start or finish connections.</param> private static void GetConnections(Model model, string[] args, string name, SourcePoint sourcePoint) { List <int> indicies; string flag = (sourcePoint == SourcePoint.Start) ? ARG_START : ARG_FINISH; if (args != null && LineOptionParser.GetValueIndicies(args, flag, out indicies)) { foreach (int index in indicies) { string targetName; TargetPoint targetPoint; float minZ = float.MinValue; float maxZ = float.MaxValue; if (GetTargetPoint(args[index], out targetPoint)) { targetName = args[index + 1]; } else { string[] range = args[index].Substring(1, args[index].Length - 2).Split(','); ParseRange(range[0], ref minZ, true); ParseRange(range[1], ref maxZ, false); GetTargetPoint(args[index + 1], out targetPoint); targetName = args[index + 2]; } model.AddConnection(new Connection(name, targetName, sourcePoint, targetPoint, minZ, maxZ)); } } }
/// <summary> /// Finds if a contour is open or closed. /// </summary> /// <param name="args">The arguments for a line.</param> /// <returns>True if the contour is open, and true if unspecified.</returns> private static bool GetIsOpen(string[] args) { string openClosed; if (args != null && LineOptionParser.GetValueAsString(args, ARG_OPEN_CLOSED, out openClosed)) { return(openClosed != VAL_CLOSED); } return(true); }
/// <summary> /// Finds the type of a contour. /// </summary> /// <param name="args">The arguments for a line.</param> /// <returns>The specified type, or straight if unspecified.</returns> private static ContourType GetContourType(string[] args) { string lineType; if (args != null && LineOptionParser.GetValueAsString(args, ARG_LINE_TYPE, out lineType)) { switch (lineType) { case VAL_STRAIGHT: return(ContourType.Straight); case VAL_BEZIER: return(ContourType.Bezier); case VAL_ELLIPTICAL: return(ContourType.Elliptical); case VAL_TUBE: return(ContourType.Tubing); } } return(ContourType.Straight); }