Exemplo n.º 1
0
    public void LoadGeoExtend()
    {
        try
        {
            Checker chk = new Checker();
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            if (chk.IsWindows())
            {
                appPath += Path.DirectorySeparatorChar + this.geo_extend_file + ".exe";
            }
            else
            {
                appPath += Path.DirectorySeparatorChar + this.geo_extend_file;
            }

            StreamReader str0 = StreamReader.Null;
            string output = "";
            Process prc = new Process();
            prc.StartInfo.FileName = appPath;
            //prc.StartInfo.Arguments = "\"" + DataFile + "\"";
            prc.StartInfo.UseShellExecute = false;
            prc.StartInfo.Arguments = "\"" + DataFile + "\"";
            prc.StartInfo.CreateNoWindow = true;
            prc.StartInfo.RedirectStandardOutput = true;
            prc.Start();
            str0 = prc.StandardOutput;
            output = str0.ReadToEnd();
            prc.WaitForExit();
            str0.Close();

            string[] SubStrings = output.Split(' ');
            if (SubStrings[0] == "BoundingBox:")
            {
                this.mdControl1.GEO_ExtendListBox.Items.Clear();
                string tmp = Convert.ToDouble((string)SubStrings[1]).ToString() + ";" + Convert.ToDouble((string)SubStrings[2]).ToString() + ";" + Convert.ToDouble((string)SubStrings[3]).ToString() + ";" + Convert.ToDouble((string)SubStrings[4]).ToString();
                this.mdControl1.GEO_ExtendListBox.Items.Add(tmp);
            }
            else
            {
                MessageBox.Show(GlobalStrings.MsgNoValidGeogrExtFound);
            }
        }
        catch
        {
            MessageBox.Show(GlobalStrings.MsgErrorGeoExtendModule);
        }
    }