private void ConvertProgram(string fileName, string selection)
        {
            SettingsPropertyCollection pc = Properties.Settings.Default.Properties;
            FileInfo      fi = new FileInfo(fileName);
            StringBuilder sb = new StringBuilder();

            using (StreamReader sr = fi.OpenText()) {
                string text = string.Empty;
                try {
                    text = sr.ReadToEnd();
                } catch (OutOfMemoryException oome) {
                    ENGINEERINGDataSet.ProcessError(oome);
                } catch (IOException ioe) {
                    ENGINEERINGDataSet.ProcessError(ioe);
                }

                sb.Append(text);

                System.Collections.Specialized.StringCollection sc = Properties.Settings.Default.machines;
                foreach (string m in sc)
                {
                    SettingsProperty sp     = pc[m];
                    SettingsProperty target = pc[selection];
                    System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(string[]));

                    string[] sps  = (string[])xs.Deserialize(new System.Xml.XmlTextReader(sp.DefaultValue.ToString(), System.Xml.XmlNodeType.Element, null));
                    string[] tgts = (string[])xs.Deserialize(new System.Xml.XmlTextReader(target.DefaultValue.ToString(), System.Xml.XmlNodeType.Element, null));

                    sb.Replace(sps[0], tgts[0]);
                    sb.Replace(sps[1], tgts[1]);
                }
            }
            this.SaveFile(fi, sb);
        }
 private void AddItem(string item)
 {
     try {
         if (!this.lbBatch.Items.Contains(item) && item.ToUpper().EndsWith(@".LAX"))
         {
             this.lbBatch.Items.Add(item);
         }
     } catch (ArgumentNullException ane) {
         ENGINEERINGDataSet.ProcessError(ane);
     } catch (SystemException se) {
         ENGINEERINGDataSet.ProcessError(se);
     }
 }
 private void SaveFile(FileInfo file, StringBuilder sb)
 {
     using (StreamWriter sw = new StreamWriter(file.FullName, false)) {
         try {
             sw.Write(sb.ToString());
         } catch (ObjectDisposedException ode) {
             ENGINEERINGDataSet.ProcessError(ode);
         } catch (NotSupportedException nse) {
             ENGINEERINGDataSet.ProcessError(nse);
         } catch (IOException ioe) {
             ENGINEERINGDataSet.ProcessError(ioe);
         }
     }
 }
 private void fillCombobox()
 {
     System.Collections.Specialized.StringCollection pc = Properties.Settings.Default.machines;
     foreach (string m in pc)
     {
         try {
             this.cbxMachines.Items.Add(m);
         } catch (ArgumentNullException ane) {
             ENGINEERINGDataSet.ProcessError(ane);
         } catch (SystemException se) {
             ENGINEERINGDataSet.ProcessError(se);
         }
     }
 }