All pastes #339794 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-04 09:27 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace VPerf
{
    public partial class frmMain : Form
    {
        public int stralone =0 ;

        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            string[] argv = Environment.GetCommandLineArgs();

            string FileToUse = String.Empty;
            string Potential = String.Empty;

            string StartupPath = argv[0];
            StartupPath = StartupPath.Substring(0, StartupPath.LastIndexOf('\\') + 1);

            Potential = StartupPath + "default.vp1";

            if (File.Exists(Potential))
            {
                FileToUse = Potential;
            }

            if (argv.Length == 2)
            {
                if (argv[1] == "-standalone") 
                {
                    stralone = 1; //we will run in standalone mode
                }
                else
                {
                    if (File.Exists(argv[1]))
                    {
                        FileToUse = argv[1];
                    }
                    else if (Directory.Exists(argv[1]))
                    {
                        Potential = String.Format("{0}{1}{2}",
                            argv[1],
                            argv[1][argv[1].Length - 1] == '\\' ? String.Empty : "\\",
                            "default.vp1");

                        if (File.Exists(Potential))
                        {
                            FileToUse = Potential;
                        }
                    }
                }
            }

            if (stralone==0 && FileToUse.Length == 0)
            {
                vpScriptnotfound();
            }
            else
            {
                if (stralone != 1) {
                    initParser(); //Looks like we got a script to process
                }
            }
        }

        public void vpScriptnotfound()
        {
            //MessageBox.Show("No vpscript file found, or specified", "Error: VP terminated");
            Application.Exit();
        }

        public void initParser()
        {
            //vpParser optVp = new vpParser(vplocation, 1);
            MessageBox.Show("parser initiated");
            
        }
    }
}