示例#1
0
        void EditBots()
        {
            if (listView1.CheckedItems.Count > 0)
            {
                foreach (ListViewItem item in listView1.CheckedItems)
                {
                    var rp = new RobotProperties();
                    rp.Script         = item.SubItems[0].Text;
                    rp.Priority       = RobotsConfigTools.GetProcessPriorityFromName(item.SubItems[1].Text);
                    rp.Texture        = item.SubItems[2].Text;
                    m_RobotProperties = null;
                    EditRobot(rp);
                    if (null != m_RobotProperties)
                    {
                        listView1.Items[listView1.Items.IndexOf(item)].SubItems[0].Text = m_RobotProperties.Script;
                        listView1.Items[listView1.Items.IndexOf(item)].SubItems[1].Text = m_RobotProperties.Priority.ToString();
                        listView1.Items[listView1.Items.IndexOf(item)].SubItems[2].Text = m_RobotProperties.Texture;
                    }
                }

                m_RobotsPropertiesList.Clear();
                foreach (ListViewItem item in listView1.Items)
                {
                    var rp = new RobotProperties(item.SubItems[0].Text, item.SubItems[2].Text, RobotsConfigTools.GetProcessPriorityFromName(item.SubItems[1].Text));

                    m_RobotsPropertiesList.Add(rp);
                }
            }
        }
 public FormRobotProperties(RobotProperties robprop, CustomEventPublisher publisher)
 {
     InitializeComponent();
     m_RobotProperties = robprop;
     m_EventPublisher  = publisher;
     InitScriptsList();
     InitPriorityList();
     InitTextureList();
 }
示例#3
0
        void SaveRobotsCfg()
        {
            var robtbl = new RobotProperties [m_RobotsPropertiesList.Count];
            int n      = 0;

            foreach (RobotProperties rp in m_RobotsPropertiesList)
            {
                robtbl[n] = rp;
                n++;
            }
            m_ConfigTools.SaveRobotsConfigFile(robtbl);
        }
示例#4
0
        void AddNewBot()
        {
            var rp = new RobotProperties();

            m_RobotProperties = null;
            EditRobot(rp);
            if (null != m_RobotProperties)
            {
                m_RobotsPropertiesList.Add(rp);
                var item = new ListViewItem(rp.Script, 0);
                item.SubItems.Add(rp.Priority.ToString());
                item.SubItems.Add(rp.Texture);
                listView1.Items.Add(item);
            }
        }
示例#5
0
        void DeleteBots()
        {
            if (listView1.CheckedItems.Count > 0)
            {
                foreach (ListViewItem item in listView1.CheckedItems)
                {
                    listView1.Items.Remove(item);
                }

                m_RobotsPropertiesList.Clear();
                foreach (ListViewItem item in listView1.Items)
                {
                    var rp = new RobotProperties(item.SubItems[0].Text, item.SubItems[2].Text, RobotsConfigTools.GetProcessPriorityFromName(item.SubItems[1].Text));

                    m_RobotsPropertiesList.Add(rp);
                }
            }
        }
示例#6
0
        public static ArrayList GetRobotsFromConfigFile(string sCfgFile)
        {
            var             retList = new ArrayList();
            RobotProperties robotProperties;
            var             saRet         = new string[255];
            var             saPrior       = new string[255];
            var             saBodyTexture = new string[255];

            if (File.Exists(sCfgFile))
            {
                using (var sr = new StreamReader(sCfgFile))
                {
                    String       line;
                    string[]     saSplit = null;
                    const string sDelim  = " ";
                    char[]       delim   = sDelim.ToCharArray();
                    while ((line = sr.ReadLine()) != null)
                    {
                        robotProperties        = new RobotProperties();
                        saSplit                = line.Split(delim, 3);
                        robotProperties.Script = saSplit[0];
                        if (2 < saSplit.Length)
                        {
                            robotProperties.Texture = saSplit[2];
                        }
                        if (1 < saSplit.Length)
                        {
                            robotProperties.Priority = GetProcessPriorityFromName(saSplit[1]);
                        }
                        retList.Add(robotProperties);
                    }
                }
            }
            else
            {
                MessageBox.Show(global::RobEnvMK.Properties.Resources.Text_FileDoesNotExist + " " + sCfgFile);
                Application.Exit();
            }

            return(retList);
        }
示例#7
0
        void EditRobot(RobotProperties rp)
        {
            var RobProp = new FormRobotProperties(rp, m_Publisher);

            RobProp.ShowDialog();
        }
示例#8
0
 void OnRobotPropertiesChanged(object sender, CustomEventArgs e)
 {
     m_RobotProperties = e.RobotProperties;
 }
示例#9
0
 public CustomEventArgs(RobotProperties rp)
 {
     m_RobotProperties = rp;
 }