Example #1
0
        static void Main(string[] args)
        {
            bool ConsoleMode = args.Length > 1;

            if (ConsoleMode)
            {
                AllocConsole();

                var inputFile  = args[0];
                var outputFile = args[1];

                var tool = new TEXTool();
                tool.OpenFile(inputFile, new FileStream(inputFile, FileMode.Open, FileAccess.Read));
                tool.SaveFile(outputFile);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainForm form = new MainForm();

                // Open With..
                if (args.Length > 0)
                {
                    form.Tool.OpenFile(args[0], new FileStream(args[0], FileMode.Open, FileAccess.Read));
                }

                Application.Run(form);
            }
        }
Example #2
0
        private void SaveFileDialog()
        {
            if (Tool.CurrentFile == null)
            {
                return;
            }

            using (SaveFileDialog dialog = new SaveFileDialog())
            {
                dialog.Filter     = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
                dialog.DefaultExt = "png";

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    Tool.SaveFile(dialog.FileName);
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            bool ConsoleMode = args.Length > 1;

            if (ConsoleMode)
            {
                AllocConsole();

                var inputFile  = args[0];
                var outputFile = args[1];

                var tool = new TEXTool();
                tool.OpenFile(inputFile, new FileStream(inputFile, FileMode.Open, FileAccess.Read));
                tool.FileOpened += (sender, ev) => {
                    tool.SaveFile(outputFile);
                };
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainForm form = new MainForm();

                // Open With..
                //if (args.Length > 0)
                //    form.Tool.OpenFile(args[0], new FileStream(args[0], FileMode.Open, FileAccess.Read));

                Task t = new Task(() =>
                {
                    Thread.Sleep(1000);
                    if (args.Length > 0)
                    {
                        form.OpenExternalFile(args[0]);
                    }
                });
                t.Start();

                Application.Run(form);
            }
        }