예제 #1
0
        public bool LoadFromFile(string file, KeyFileFlags flags)
        {
            IntPtr error;
            IntPtr native_file = Marshaller.StringToFilenamePtr(file);
            bool   ret         = g_key_file_load_from_file(Handle, native_file, (int)flags, out error);

            Marshaller.Free(native_file);
            if (error != IntPtr.Zero)
            {
                throw new GException(error);
            }
            return(ret);
        }
예제 #2
0
        public bool LoadFromDataDirs(string file, out string full_path, KeyFileFlags flags)
        {
            IntPtr error;
            IntPtr native_full_path;
            IntPtr native_file = Marshaller.StringToPtrGStrdup(file);
            bool   ret         = g_key_file_load_from_data_dirs(Handle, native_file, out native_full_path, (int)flags, out error);

            Marshaller.Free(native_file);
            if (error != IntPtr.Zero)
            {
                throw new GException(error);
            }
            full_path = Marshaller.PtrToStringGFree(native_full_path);
            return(ret);
        }
예제 #3
0
        public bool LoadFromData(byte[] data, KeyFileFlags flags)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            IntPtr error;
            bool   ret = g_key_file_load_from_data(Handle, data, new UIntPtr((ulong)data.Length), (int)flags, out error);

            if (error != IntPtr.Zero)
            {
                throw new GException(error);
            }
            return(ret);
        }
예제 #4
0
		public KeyFile (string file, KeyFileFlags flags) : this ()
		{
			LoadFromFile (file, flags);
		}
예제 #5
0
		public bool LoadFromFile (string file, KeyFileFlags flags)
		{
			IntPtr error;
			IntPtr native_file = Marshaller.StringToFilenamePtr (file);
			bool ret = g_key_file_load_from_file (Handle, native_file, (int) flags, out error);
			Marshaller.Free (native_file);
			if (error != IntPtr.Zero) throw new GException (error);
			return ret;
		}
예제 #6
0
		public bool LoadFromDirs (string file, string[] search_dirs, out string full_path, KeyFileFlags flags)
		{
			IntPtr error;
			IntPtr native_full_path;
			IntPtr native_file = Marshaller.StringToPtrGStrdup (file);
			IntPtr native_search_dirs = Marshaller.StringArrayToStrvPtr (search_dirs);
			bool ret = g_key_file_load_from_dirs (Handle, native_file, native_search_dirs, out native_full_path, (int) flags, out error);
			Marshaller.Free (native_file);
			Marshaller.StrFreeV (native_search_dirs);
			if (error != IntPtr.Zero) throw new GException (error);
			full_path = Marshaller.PtrToStringGFree (native_full_path);
			return ret;
		}
예제 #7
0
		public bool LoadFromData (byte[] data, KeyFileFlags flags)
		{
			if (data == null)
				throw new ArgumentNullException ("data");
			IntPtr error;
			bool ret = g_key_file_load_from_data (Handle, data, new UIntPtr ((ulong) data.Length), (int) flags, out error);
			if (error != IntPtr.Zero) throw new GException (error);
			return ret;
		}
예제 #8
0
 public KeyFile(string file, KeyFileFlags flags) : this()
 {
     LoadFromFile(file, flags);
 }