示例#1
0
文件: Form1.cs 项目: yazici/promenade
        private void button1_Click(object sender, EventArgs e)
        {
            sharpSettingsDat origsettings = settings;

            // RunInstallerAttribute experiment
            settings.m_parallel_invocs  = parallelInvocs;
            settings.m_simMode          = "r";
            settings.m_appMode          = isConsole ? "c" : "g";
            settings.m_execMode         = isParallel ? "p" : "s";
            settings.m_pod              = isQuadruped ? "q" : "b";
            settings.m_charcount_serial = characterAmount;
            //
            settingsFileHandler.writeSettings(settings);

            Process winapp = new Process();

            winapp.StartInfo.FileName = "WinApp_Release.exe";
            //winapp.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
            winapp.StartInfo.UseShellExecute = false;
            //winapp.StartInfo.RedirectStandardOutput = true;
            winapp.Start();
            winapp.WaitForExit();
            settings = origsettings;
            settingsFileHandler.writeSettings(settings);
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            sharpSettingsDat origsettings = settings;

            // RunInstallerAttribute experiment
            settings.m_parallel_invocs = parallelInvocs;
            settings.m_simMode = "r";
            settings.m_appMode = isConsole ? "c" : "g";
            settings.m_execMode = isParallel ? "p" : "s";
            settings.m_pod = isQuadruped ? "q" : "b";
            settings.m_charcount_serial = characterAmount;
            //
            settingsFileHandler.writeSettings(settings);

            Process winapp = new Process();
            winapp.StartInfo.FileName = "WinApp_Release.exe";
            //winapp.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
            winapp.StartInfo.UseShellExecute = false;
            //winapp.StartInfo.RedirectStandardOutput = true;
            winapp.Start();
            winapp.WaitForExit();
            settings = origsettings;
            settingsFileHandler.writeSettings(settings);
        }
 public bool loadSettings(ref sharpSettingsDat p_settingsfile)
 {
     string exePathPrefix = Application.StartupPath;
     string path = exePathPrefix + "\\..\\settings.txt";
     List<string> rows = new List<string>(File.ReadAllLines(path));
     int optCounter = 0;
     for (int i = 0; i < rows.Count; i++)
     {
         if (rows[i] != "" && rows[i][0] != '#')
         {
             // a writeable
             switch (optCounter)
             {
                 case 0:
                     p_settingsfile.m_fullscreen = rows[i] == "1" ? true : false;
                     break;
                 case 1:
                     p_settingsfile.m_appMode = rows[i];
                     break;
                 case 2:
                     p_settingsfile.m_wwidth = Convert.ToInt32(rows[i]);
                     break;
                 case 3:
                     p_settingsfile.m_wheight = Convert.ToInt32(rows[i]);
                     break;
                 case 4:
                     p_settingsfile.m_simMode = rows[i];
                     break;
                 case 5:
                     p_settingsfile.m_measurementRuns = Convert.ToInt32(rows[i]);
                     break;
                 case 6:
                     p_settingsfile.m_pod = rows[i];
                     break;
                 case 7:
                     p_settingsfile.m_execMode = rows[i];
                     break;
                 case 8:
                     p_settingsfile.m_charcount_serial = Convert.ToInt32(rows[i]);
                     break;
                 case 9:
                     p_settingsfile.m_parallel_invocs = Convert.ToInt32(rows[i]);
                     break;
                 case 10:
                     p_settingsfile.m_charOffsetX = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 11:
                     p_settingsfile.m_startPaused = rows[i] == "1" ? true : false;
                     break;
                 case 12:
                     p_settingsfile.m_optmesSteps = Convert.ToInt32(rows[i]);
                     break;
                 case 13:
                     p_settingsfile.m_optW_fd = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 14:
                     p_settingsfile.m_optW_fv = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 15:
                     p_settingsfile.m_optW_fh = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 16:
                     p_settingsfile.m_optW_fr = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 17:
                     p_settingsfile.m_optW_fp = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 default:
                     // do nothing
                     break;
             }
             optCounter++;
         }
     }
     return true;
 }
 public void writeSettings(sharpSettingsDat p_settingsfile)
 {
     string exePathPrefix = Application.StartupPath;
     string path = exePathPrefix + "\\..\\settings.txt";
     List<string> rows = new List<string>(File.ReadAllLines(path));
     // go through each row, assume they are in order
     int optCounter = 0;
     for (int i = 0; i < rows.Count; i++)
     {
         if (rows[i] != "" && rows[i][0] != '#')
         {
             // a writeable
             switch (optCounter)
             {
                 case 0:
                     rows[i] = p_settingsfile.m_fullscreen ? "1" : "0";
                     break;
                 case 1:
                     rows[i] = p_settingsfile.m_appMode;
                     break;
                 case 2:
                     rows[i] = p_settingsfile.m_wwidth.ToString();
                     break;
                 case 3:
                     rows[i] = p_settingsfile.m_wheight.ToString();
                     break;
                 case 4:
                     rows[i] = p_settingsfile.m_simMode;
                     break;
                 case 5:
                     rows[i] = p_settingsfile.m_measurementRuns.ToString();
                     break;
                 case 6:
                     rows[i] = p_settingsfile.m_pod;
                     break;
                 case 7:
                     rows[i] = p_settingsfile.m_execMode;
                     break;
                 case 8:
                     rows[i] = p_settingsfile.m_charcount_serial.ToString();
                     break;
                 case 9:
                     rows[i] = p_settingsfile.m_parallel_invocs.ToString();
                     break;
                 case 10:
                     rows[i] = p_settingsfile.m_charOffsetX.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 11:
                     rows[i] = p_settingsfile.m_startPaused ? "1" : "0";
                     break;
                 case 12:
                     rows[i] = p_settingsfile.m_optmesSteps.ToString();
                     break;
                 case 13:
                     rows[i] = p_settingsfile.m_optW_fd.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 14:
                     rows[i] = p_settingsfile.m_optW_fv.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 15:
                     rows[i] = p_settingsfile.m_optW_fh.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 16:
                     rows[i] = p_settingsfile.m_optW_fr.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 case 17:
                     rows[i] = p_settingsfile.m_optW_fp.ToString(System.Globalization.CultureInfo.InvariantCulture);
                     break;
                 default:
                     // do nothing
                     break;
             }
             optCounter++;
         }
     }
     // resave, using altered rows structure
     File.WriteAllLines(path, rows.ToArray());
 }
示例#5
0
        public void writeSettings(sharpSettingsDat p_settingsfile)
        {
            string        exePathPrefix = Application.StartupPath;
            string        path          = exePathPrefix + "\\..\\settings.txt";
            List <string> rows          = new List <string>(File.ReadAllLines(path));
            // go through each row, assume they are in order
            int optCounter = 0;

            for (int i = 0; i < rows.Count; i++)
            {
                if (rows[i] != "" && rows[i][0] != '#')
                {
                    // a writeable
                    switch (optCounter)
                    {
                    case 0:
                        rows[i] = p_settingsfile.m_fullscreen ? "1" : "0";
                        break;

                    case 1:
                        rows[i] = p_settingsfile.m_appMode;
                        break;

                    case 2:
                        rows[i] = p_settingsfile.m_wwidth.ToString();
                        break;

                    case 3:
                        rows[i] = p_settingsfile.m_wheight.ToString();
                        break;

                    case 4:
                        rows[i] = p_settingsfile.m_simMode;
                        break;

                    case 5:
                        rows[i] = p_settingsfile.m_measurementRuns.ToString();
                        break;

                    case 6:
                        rows[i] = p_settingsfile.m_pod;
                        break;

                    case 7:
                        rows[i] = p_settingsfile.m_execMode;
                        break;

                    case 8:
                        rows[i] = p_settingsfile.m_charcount_serial.ToString();
                        break;

                    case 9:
                        rows[i] = p_settingsfile.m_parallel_invocs.ToString();
                        break;

                    case 10:
                        rows[i] = p_settingsfile.m_charOffsetX.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 11:
                        rows[i] = p_settingsfile.m_startPaused ? "1" : "0";
                        break;

                    case 12:
                        rows[i] = p_settingsfile.m_optmesSteps.ToString();
                        break;

                    case 13:
                        rows[i] = p_settingsfile.m_optW_fd.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 14:
                        rows[i] = p_settingsfile.m_optW_fv.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 15:
                        rows[i] = p_settingsfile.m_optW_fh.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 16:
                        rows[i] = p_settingsfile.m_optW_fr.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 17:
                        rows[i] = p_settingsfile.m_optW_fp.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    default:
                        // do nothing
                        break;
                    }
                    optCounter++;
                }
            }
            // resave, using altered rows structure
            File.WriteAllLines(path, rows.ToArray());
        }
示例#6
0
        public bool loadSettings(ref sharpSettingsDat p_settingsfile)
        {
            string        exePathPrefix = Application.StartupPath;
            string        path          = exePathPrefix + "\\..\\settings.txt";
            List <string> rows          = new List <string>(File.ReadAllLines(path));
            int           optCounter    = 0;

            for (int i = 0; i < rows.Count; i++)
            {
                if (rows[i] != "" && rows[i][0] != '#')
                {
                    // a writeable
                    switch (optCounter)
                    {
                    case 0:
                        p_settingsfile.m_fullscreen = rows[i] == "1" ? true : false;
                        break;

                    case 1:
                        p_settingsfile.m_appMode = rows[i];
                        break;

                    case 2:
                        p_settingsfile.m_wwidth = Convert.ToInt32(rows[i]);
                        break;

                    case 3:
                        p_settingsfile.m_wheight = Convert.ToInt32(rows[i]);
                        break;

                    case 4:
                        p_settingsfile.m_simMode = rows[i];
                        break;

                    case 5:
                        p_settingsfile.m_measurementRuns = Convert.ToInt32(rows[i]);
                        break;

                    case 6:
                        p_settingsfile.m_pod = rows[i];
                        break;

                    case 7:
                        p_settingsfile.m_execMode = rows[i];
                        break;

                    case 8:
                        p_settingsfile.m_charcount_serial = Convert.ToInt32(rows[i]);
                        break;

                    case 9:
                        p_settingsfile.m_parallel_invocs = Convert.ToInt32(rows[i]);
                        break;

                    case 10:
                        p_settingsfile.m_charOffsetX = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 11:
                        p_settingsfile.m_startPaused = rows[i] == "1" ? true : false;
                        break;

                    case 12:
                        p_settingsfile.m_optmesSteps = Convert.ToInt32(rows[i]);
                        break;

                    case 13:
                        p_settingsfile.m_optW_fd = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 14:
                        p_settingsfile.m_optW_fv = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 15:
                        p_settingsfile.m_optW_fh = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 16:
                        p_settingsfile.m_optW_fr = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    case 17:
                        p_settingsfile.m_optW_fp = Convert.ToSingle(rows[i], System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    default:
                        // do nothing
                        break;
                    }
                    optCounter++;
                }
            }
            return(true);
        }
示例#7
0
        void runCurrentConfig()
        {
            measurementStatusListBox.Items.Clear();
            progressBar_characterPrcnt.Value = 0;

            measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Running Experiment...");

            int stepsz = measurementIncChars;

            sharpSettingsDat origsettings = settings;

            // RunInstallerAttribute experiment
            settings.m_parallel_invocs = parallelInvocs;
            settings.m_simMode = "m";
            settings.m_appMode = isConsole ? "c" : "g";
            string exetextversion = isParallel ? "parallel" : "serial";
            settings.m_execMode = isParallel ? "p" : "s";
            string exetextpod = isQuadruped ? "quadruped" : "biped";
            settings.m_pod = isQuadruped ? "q" : "b";

            settings.m_measurementRuns = measurementRuns;

            if (measurementMaxCharsTarget > 1)
                measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment for " + exetextpod + " is " + exetextversion + ", with " + measurementRuns + " runs for each measurement.");
            else
                measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment for " + exetextpod + " has 1 " + exetextversion + " scenario, with " + measurementRuns + " runs.");
            if (isParallel) measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Parallel loop invocations will be" + parallelInvocs + ".");
            int mcount = 0;
            for (int i = 0; i <= measurementMaxCharsTarget; i += stepsz)
            {
                mcount++;
                int charCount = i;
                if (charCount == 0)
                {
                    charCount = 1;
                    if (stepsz == 1) i++; // make next 2 if step size is only 1
                    measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Executing Control with 1 character");
                }
                else
                {
                    measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Executing Measurement(" + mcount + ") with " + charCount + " characters");
                }
                // write settings
                settings.m_charcount_serial = charCount;
                settingsFileHandler.writeSettings(settings);
                //
                Process winapp = new Process();
                winapp.StartInfo.FileName = "WinApp_Release.exe";
                //winapp.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
                winapp.StartInfo.UseShellExecute = false;
                //winapp.StartInfo.RedirectStandardOutput = true;
                winapp.Start();
                //Console.WriteLine(winapp.StandardOutput.ReadToEnd());
                winapp.WaitForExit();
                progressBar_characterPrcnt.Value = (int)(100.0f * ((float)i) / ((float)measurementMaxCharsTarget));
                progressBar_characterPrcnt.Update();
                progressBar_configPrcnt.Update();
                Application.DoEvents();
            }
            measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment finished!");

            string exePathPrefix = Application.StartupPath;
            SoundPlayer simpleSound = new SoundPlayer(exePathPrefix + "/../Music_Box.wav");
            simpleSound.Play();
            progressBar_characterPrcnt.Value = 100;

            settings = origsettings;
            settingsFileHandler.writeSettings(settings);
        }
示例#8
0
文件: Form1.cs 项目: yazici/promenade
        void runCurrentConfig()
        {
            measurementStatusListBox.Items.Clear();
            progressBar_characterPrcnt.Value = 0;

            measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Running Experiment...");

            int stepsz = measurementIncChars;

            sharpSettingsDat origsettings = settings;

            // RunInstallerAttribute experiment
            settings.m_parallel_invocs = parallelInvocs;
            settings.m_simMode         = "m";
            settings.m_appMode         = isConsole ? "c" : "g";
            string exetextversion = isParallel ? "parallel" : "serial";

            settings.m_execMode = isParallel ? "p" : "s";
            string exetextpod = isQuadruped ? "quadruped" : "biped";

            settings.m_pod = isQuadruped ? "q" : "b";

            settings.m_measurementRuns = measurementRuns;

            if (measurementMaxCharsTarget > 1)
            {
                measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment for " + exetextpod + " is " + exetextversion + ", with " + measurementRuns + " runs for each measurement.");
            }
            else
            {
                measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment for " + exetextpod + " has 1 " + exetextversion + " scenario, with " + measurementRuns + " runs.");
            }
            if (isParallel)
            {
                measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Parallel loop invocations will be" + parallelInvocs + ".");
            }
            int mcount = 0;

            for (int i = 0; i <= measurementMaxCharsTarget; i += stepsz)
            {
                mcount++;
                int charCount = i;
                if (charCount == 0)
                {
                    charCount = 1;
                    if (stepsz == 1)
                    {
                        i++;              // make next 2 if step size is only 1
                    }
                    measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Executing Control with 1 character");
                }
                else
                {
                    measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Executing Measurement(" + mcount + ") with " + charCount + " characters");
                }
                // write settings
                settings.m_charcount_serial = charCount;
                settingsFileHandler.writeSettings(settings);
                //
                Process winapp = new Process();
                winapp.StartInfo.FileName = "WinApp_Release.exe";
                //winapp.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
                winapp.StartInfo.UseShellExecute = false;
                //winapp.StartInfo.RedirectStandardOutput = true;
                winapp.Start();
                //Console.WriteLine(winapp.StandardOutput.ReadToEnd());
                winapp.WaitForExit();
                progressBar_characterPrcnt.Value = (int)(100.0f * ((float)i) / ((float)measurementMaxCharsTarget));
                progressBar_characterPrcnt.Update();
                progressBar_configPrcnt.Update();
                Application.DoEvents();
            }
            measurementStatusListBox.TopIndex = measurementStatusListBox.Items.Add("Experiment finished!");

            string      exePathPrefix = Application.StartupPath;
            SoundPlayer simpleSound   = new SoundPlayer(exePathPrefix + "/../Music_Box.wav");

            simpleSound.Play();
            progressBar_characterPrcnt.Value = 100;

            settings = origsettings;
            settingsFileHandler.writeSettings(settings);
        }