Beispiel #1
0
        public void SetLocaleStringList(string group_name, string key, string locale, string[] list)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (locale == null)
            {
                throw new ArgumentNullException("locale");
            }
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name);
            IntPtr native_key        = Marshaller.StringToPtrGStrdup(key);
            IntPtr native_locale     = Marshaller.StringToPtrGStrdup(locale);
            IntPtr native_list       = Marshaller.StringArrayToStrvPtr(list);

            g_key_file_set_locale_string_list(Handle, native_group_name, native_key, native_locale, native_list, new UIntPtr((ulong)list.Length));
            Marshaller.Free(native_group_name);
            Marshaller.Free(native_key);
            Marshaller.Free(native_locale);
            Marshaller.StrFreeV(native_list);
        }
Beispiel #2
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);
        }