Exemple #1
0
 /// <summary>
 /// Loads the data.
 /// </summary>
 public override void LoadData()
 {
     this.version            = base.reader.ReadFixed();
     this.fontRevision       = base.reader.ReadFixed();
     this.checkSumAdjustment = base.reader.ReadULONG();
     if (base.reader.ReadULONG() != 0x5f0f3cf5L)
     {
         throw new PdfReadFontException("magic number of header not match.");
     }
     this.flags      = base.reader.ReadUSHORT();
     this.unitsPerEm = base.reader.ReadUSHORT();
     base.reader.Skip(0x10L);
     this.xMin     = base.reader.ReadSHORT();
     this.yMin     = base.reader.ReadSHORT();
     this.xMax     = base.reader.ReadSHORT();
     this.yMax     = base.reader.ReadSHORT();
     this.macStyle = (MacStyles)(base.reader.ReadUSHORT() & 0xfffffff);
     base.reader.Skip(4L);
     this.locaVersion = base.reader.ReadSHORT();
     base.LoadData();
 }
Exemple #2
0
        public override bool Process(ProcessCommandLineArgs args)
        {
            var command = args.Command;

            try
            {
                AppDomain.CurrentDomain.UnhandledException += (sender, e) => UnhandledExceptionReporter(e.ExceptionObject);

#if MAC
                MacStyles.Apply();
#endif
                var app = new Pablo.Interface.PabloApplication();
                // app.UnhandledException += (sender, e) => UnhandledExceptionReporter(e.ExceptionObject);

                string fileName = command.GetValue("file", "f") ?? command.GenericCommand;
                bool?  editMode = null;

                // if (string.IsNullOrEmpty(fileName))
                // {
                //  var activationArguments = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
                //  if (activationArguments != null)
                //  {
                //      var args = activationArguments.ActivationData;
                //      if (args != null && args.Length > 0)
                //      {
                //          if (!args[0].EndsWith(".application", StringComparison.InvariantCultureIgnoreCase))
                //              fileName = args[0];
                //      }
                //  }
                // }
                if (string.IsNullOrEmpty(fileName))
                {
                    fileName = command.GetValue("edit", "e");
                    editMode = true;
                }

                if (!string.IsNullOrEmpty(fileName))
                {
                    app.Initialized += delegate
                    {
                        //ClickOnceUpdate.CheckForUpdate ();
                        app.Main.LoadFile(fileName, true, editMode: editMode);
                    };
                }

                /*
                 * else {
                 *      app.Initialized += delegate
                 *      {
                 *              ClickOnceUpdate.CheckForUpdate ();
                 *      };
                 * }*/
                app.Run();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"An error occurred.  Please report this information to https://github.com/cwensley/pablodraw/issues:\n {ex}");
                ShowErrorDialog(ex);
                throw;
            }

            return(true);
        }