Exemple #1
0
        private void downButton_Click(object sender, EventArgs e)
        {
            // move down
            IISMoverFunction oTempUp   = new IISMoverFunction();
            IISMoverFunction oTempDown = new IISMoverFunction();
            int _iIndex = 0;

            foreach (IISMoverFunction oThisMoverFunction in Program.oIISMoverList.lIISMoverFunctions)
            {
                if (taskListBox.SelectedItem.Equals(oThisMoverFunction.Name))
                {
                    oTempDown = oThisMoverFunction;
                    oTempUp   = Program.oIISMoverList.lIISMoverFunctions[(_iIndex + 1)];
                    break;
                }
                _iIndex++;
            }
            Program.oIISMoverList.lIISMoverFunctions[_iIndex]       = oTempUp;
            Program.oIISMoverList.lIISMoverFunctions[(_iIndex + 1)] = oTempDown;
            RefreshTaskList();
        }
Exemple #2
0
        public String Load() // saves an IISListMoverFunctionList
        {
            String sResult = "Successfully loaded.";
            String sLine;

            String[] lComponents;
            int      iCounter    = 0;
            int      iKVPCounter = 0;
            bool     bIsKVP      = false;

            Program.oSourceFileDialog.Multiselect = false;
            if (Program.oSourceFileDialog.ShowDialog() == DialogResult.OK)
            {
                StreamReader oStreamReader = new StreamReader(Program.oSourceFileDialog.FileName);
                sLine = oStreamReader.ReadLine();
                IISMoverFunction oThisMoverFunction = new IISMoverFunction();
                while (sLine != null)
                {
                    bIsKVP = true;
                    // detect new IISMoverFunction
                    if (sLine.Contains("ItemID:"))
                    {
                        if (iCounter > 0)
                        {
                            this.lIISMoverFunctions.Add(oThisMoverFunction);
                        }
                        iCounter++;
                        oThisMoverFunction = new IISMoverFunction();

                        oThisMoverFunction.ID = Int32.Parse(sLine.Replace("ItemID:", ""));
                        bIsKVP = false;
                    }
                    if (sLine.Contains("ItemName:"))
                    {
                        oThisMoverFunction.Name = sLine.Replace("ItemName:", "");
                        bIsKVP = false;
                    }
                    if (sLine.Contains("ItemType:"))
                    {
                        oThisMoverFunction.Type = Int32.Parse(sLine.Replace("ItemType:", ""));
                        bIsKVP = false;
                    }
                    if (bIsKVP)
                    {
                        sLine       = sLine.Replace("[", "");
                        sLine       = sLine.Replace("]", "");
                        lComponents = sLine.Split(',');
                        if (iKVPCounter == 0)
                        {
                            oThisMoverFunction.dKVPs = new Dictionary <string, string>();
                        }
                        iKVPCounter++;
                        oThisMoverFunction.dKVPs.Add(lComponents[0].ToString().Trim(), lComponents[1].ToString().Trim());
                    }
                    else
                    {
                        // reset the key value pair counter
                        iKVPCounter = 0;
                    }
                    sLine = oStreamReader.ReadLine();
                }
                if (bIsKVP)
                {
                    this.lIISMoverFunctions.Add(oThisMoverFunction);
                }
                oStreamReader.Close();
            }
            Program.oSourceFileDialog.Multiselect = true;
            return(sResult);
        }