Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdpGie.Core.ProgramManager"/> class.
 /// </summary>
 public ProgramManager()
 {
     this.Time    = 0.0d;
     this.Port    = 8080;
     this.options = new OptionSet()
     {
         {
             "a|asp=",
             "Feed the system an .asp file in order to convert an idp model into drawing instructions.",
             x => this.AspFile = x
         }, {
             "i|idp=",
             "Feed the system an .idp file. The program must be given an .asp file as well in order to paint something.",
             x => this.IdpFile = x
         },
         { "d|idpd=", "Feed the system a .idpd file. Limited interactive mode is enabled.", x => this.IdpdFile = x },
         { "H|idph=", "Feed the system a .idph file that contains the defined hooks.", x => this.HookFile = x },
         { "t|theory=", "The theory to use in the .idp file, only for interactive mode.", x => this.Theory = x },
         { "s|structure=", "The structure to use in the .idp file, only for interactive mode.", x => this.Structure = x }, {
             "v|vocabulary=",
             "The vocabulary to use in the .idp file, only for interactive mode.",
             x => this.Vocabulary = x
         },
         { "o|output=", "The output file (to store for instance LaTeX files).", x => this.OutputFile = x }, {
             "T|time=",
             "The timeframe of the model to plot (interactive sessions will ignore this argument).",
             x => this.Time = double.Parse(x)
         },
         { "m|mode=", "The output mode (cairo, latex, ...).", x => this.OutputMode = x },
         { "h|?|help", "Show this help manual and exit.", x => this.ShowHelp = (x != null) },
         { "list-devices", "List the output devices together with a description.", x => this.ListDevices = (x != null) }, {
             "list-paints",
             "List the paint predicates together with a description.",
             x => this.ListPaints = (x != null)
         }, {
             "list-hooks",
             "List the hooks that can be handled together with a description.",
             x => this.ListHooks = (x != null)
         }, {
             "canvas-size=",
             "The size of the document (for instance the size of the resulting pdf).",
             x => this.CanvasSize = CanvasSize.Parse(x)
         }, {
             "g|geometry=",
             "The geometry of the document (in case one works with chapters).",
             x => this.Geometry = StripGeometry.Parse(x)
         }, {
             "p|port=",
             "The port of the server (if applicable, by default 8080).",
             x => this.Port = int.Parse(x)
         }, { "serverfolder", "The root of the folder of the web server.", x => this.ServerFolder = x }
     };
 }
Exemplo n.º 2
0
        public void TestParse()
        {
            CanvasSize ds;

            ds = CanvasSize.Parse("400x600");
            Assert.AreEqual(400, ds.Width);
            Assert.AreEqual(600, ds.Height);
            Assert.AreEqual(CanvasSize.DefaultMargin, ds.Margin);
            ds = CanvasSize.Parse("400x600x32");
            Assert.AreEqual(400, ds.Width);
            Assert.AreEqual(600, ds.Height);
            Assert.AreEqual(32, ds.Margin);
            ds = CanvasSize.Parse("32 x 400@600");
            Assert.AreEqual(32, ds.Width);
            Assert.AreEqual(400, ds.Height);
            Assert.AreEqual(600, ds.Margin);
        }