private static void SaveINIFile(ICustomControl c, String path, String value)
        {
            try
            {
                Util.IniFile  file  = new Util.IniFile(c.cd.MainDestination);
                List <String> nodes = path.Split('\\').ToList();

                file.IniWriteValue(nodes[0], nodes[1], value);
                System.Diagnostics.Debug.WriteLine(">>.Ini Saved value from: " + c.cd.Name);

                ReReadControl(c);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("*** ERROR *** There was an exception while saving changes in file for: " + c.cd.Name);
                System.Diagnostics.Debug.WriteLine(e.Message);
                Model.getInstance().logCreator.Append("[ERROR] Writing file for " + c.cd.Name);
            }
        }
Beispiel #2
0
        private void txtPesquisa_TextChanged(object sender, EventArgs e)
        {
            try
            {
                short index = -1;
                lstItens.Items.Clear();
                Util.IniFile iniFile = new Util.IniFile(Auxil.Properties.Settings.Default.Processos);

                Pesquisar(txtPesquisa.Text.ToString());

                lstItens.Sorted = Properties.Settings.Default.OrdenarLista;
                lstItens.Sorted = true;
                //Verifica se o texto informado é um diretório
                if (!string.IsNullOrEmpty(txtPesquisa.Text.Trim()) &&
                    !Path.GetInvalidPathChars().Contains(txtPesquisa.Text.Trim()[0]) && Path.IsPathRooted(txtPesquisa.Text.Trim()))
                {
                    try
                    {
                        DirectoryInfo dInfo = new System.IO.DirectoryInfo(txtPesquisa.Text.Trim());
                        if (dInfo.Exists)
                        {
                            BuscaCaminhos(dInfo);
                        }
                        else if (txtPesquisa.Text.LastIndexOf(@"\") > 1)
                        {
                            dInfo = new System.IO.DirectoryInfo(txtPesquisa.Text.Substring(0, txtPesquisa.Text.LastIndexOf(@"\") + 1));
                            if (dInfo.Exists)
                            {
                                BuscaCaminhos(dInfo, txtPesquisa.Text.Substring(txtPesquisa.Text.LastIndexOf(@"\") + 1));
                            }
                        }
                    }
                    catch (ArgumentException)
                    { }
                }
                //
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }