AniDBmini.ConfigFile.Write C# (CSharp) Method

Write() public static method

Write data to the ini file
public static Write ( string Key, string Value ) : void
Key string
Value string
return void
        public static void Write(string Key, string Value)
        {
            CheckDefaultConfig();
            WinAPI.WritePrivateProfileString(configSection, Key, Value, configPath);
        }

Usage Example

        private bool SetMPCHCLocation()
        {
            string pFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.Filter           = "MPC-HC main executable|mpc-hc.exe;mpc-hc64.exe";
            dlg.InitialDirectory = (System.IO.Directory.Exists(pFilesPath + @"\Media Player Classic - Home Cinema") ?
                                    pFilesPath + @"\Media Player Classic - Home Cinema" : pFilesPath);

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                if (System.IO.Path.GetFileNameWithoutExtension(dlg.FileName) == "mpc-hc64" && IntPtr.Size == 4)
                {
                    MessageBox.Show("Media Player Classic - Home Cinema 64bit will not work\nwith the 32bit version of " + MainWindow.m_AppName + ".\n\n" +
                                    "Please use the 64bit version of " + MainWindow.m_AppName + ".\nOr use the 32bit version of Media Player Classic - Home Cinema.",
                                    "Alert!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    ConfigFile.Write("mpcPath", dlg.FileName);
                    return(true);
                }
            }

            return(false);
        }
All Usage Examples Of AniDBmini.ConfigFile::Write