Example #1
0
        //------------------------------------------------------------------------------
        public static Boolean setIni(string filePath, string fileName, string IpAppName, string IpKeyName, string IpValue)
        {
            string inifile = filePath + g_ini_file;

            IniControl.WritePrivateProfileString(IpAppName, IpKeyName, IpValue, inifile);

            return(true);
        }
Example #2
0
        //------------------------------------------------------------------------------
        public static Boolean setIni(string fileName, string IpAppName, string IpKeyName, string IpValue)
        {
            string inifile = g_ini_file;    //Path + File

            if (fileName != "")
            {
                inifile = fileName;
            }
            IniControl.WritePrivateProfileString(IpAppName, IpKeyName, IpValue, inifile);

            return(true);
        }
Example #3
0
        //------------------------------------------------------------------------------
        public static Boolean ReadBool(string fileName, string IpAppName, string IpKeyName)
        {
            string        inifile = g_ini_file; //Path + File
            StringBuilder result  = new StringBuilder(255);

            IniControl.GetPrivateProfileString(IpAppName, IpKeyName, "error", result, 255, inifile);

            if (result.ToString() == "True" || result.ToString() == "1")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        //------------------------------------------------------------------------------
        public static string getIni(string fileName, string IpAppName, string IpKeyName)
        {
            string inifile = g_ini_file;    //Path + File

            if (fileName != "")
            {
                inifile = fileName;
            }

            StringBuilder result = new StringBuilder(255);

            IniControl.GetPrivateProfileString(IpAppName, IpKeyName, "error", result, 255, inifile);


            return(result.ToString());
        }
Example #5
0
        //------------------------------------------------------------------------------
        public static string ReadString(string fileName, string IpAppName, string IpKeyName, string Default)
        {
            string inifile = g_ini_file;    //Path + File

            StringBuilder result = new StringBuilder(255);

            IniControl.GetPrivateProfileString(IpAppName, IpKeyName, "error", result, 255, inifile);

            if (result.ToString() == "error")
            {
                return(Default);
            }
            else
            {
                return(result.ToString());
            }
        }
Example #6
0
        //------------------------------------------------------------------------------
        public static int ReadInteger(string fileName, string IpAppName, string IpKeyName, int Default)
        {
            try
            {
                string inifile = g_ini_file;    //Path + File

                StringBuilder result = new StringBuilder(255);
                IniControl.GetPrivateProfileString(IpAppName, IpKeyName, "error", result, 255, inifile);

                if (result.ToString() == "error")
                {
                    return(Default);
                }
                else
                {
                    return(Convert.ToInt16(result));
                }
            }
            catch
            {
                return(Default);
            }
        }