Skip to content

Commit 62c4b92

Browse files
JoonghyunChoJay Cho
authored andcommitted
Migrate DllImport to LibraryImport in core modules
1 parent 31a6f03 commit 62c4b92

File tree

208 files changed

+5324
-4653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+5324
-4653
lines changed

src/Tizen.Account.AccountManager/Interop/Interop.Account.cs

Lines changed: 78 additions & 77 deletions
Large diffs are not rendered by default.

src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the License);
@@ -16,6 +16,7 @@
1616

1717
using System;
1818
using System.Runtime.InteropServices;
19+
using System.Runtime.InteropServices.Marshalling;
1920
using Tizen.Account.AccountManager;
2021

2122
/// <summary>
@@ -31,51 +32,51 @@ internal static partial class Interop
3132
internal static partial class AccountProvider
3233
{
3334

34-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_create", CallingConvention = CallingConvention.Cdecl)]
35-
internal static extern int Create(out IntPtr handle);
35+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_create", StringMarshalling = StringMarshalling.Utf8)]
36+
internal static partial int Create(out IntPtr handle);
3637

37-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_destroy", CallingConvention = CallingConvention.Cdecl)]
38-
internal static extern int Destroy(IntPtr handle);
38+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_destroy", StringMarshalling = StringMarshalling.Utf8)]
39+
internal static partial int Destroy(IntPtr handle);
3940

40-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_app_id", CallingConvention = CallingConvention.Cdecl)]
41-
internal static extern int GetAppId(IntPtr handle, out string appId);
41+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_app_id", StringMarshalling = StringMarshalling.Utf8)]
42+
internal static partial int GetAppId(IntPtr handle, out string appId);
4243

43-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", CallingConvention = CallingConvention.Cdecl)]
44-
[return: MarshalAs(UnmanagedType.I1)]
45-
internal static extern bool IsFeatureSupported(string appId, string capability);
44+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", StringMarshalling = StringMarshalling.Utf8)]
45+
[return: MarshalAs(UnmanagedType.U1)]
46+
internal static partial bool IsFeatureSupported(string appId, string capability);
4647

47-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", CallingConvention = CallingConvention.Cdecl)]
48-
internal static extern int GetServiceProviderId(IntPtr handle, out string providerId);
48+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", StringMarshalling = StringMarshalling.Utf8)]
49+
internal static partial int GetServiceProviderId(IntPtr handle, out string providerId);
4950

50-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
51-
internal static extern int GetAccountProviderIconPath(IntPtr handle, out string iconPath);
51+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_icon_path", StringMarshalling = StringMarshalling.Utf8)]
52+
internal static partial int GetAccountProviderIconPath(IntPtr handle, out string iconPath);
5253

53-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_small_icon_path", CallingConvention = CallingConvention.Cdecl)]
54-
internal static extern int GetAccountProviderSmallIconPath(IntPtr handle, out string iconPath);
54+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_small_icon_path", StringMarshalling = StringMarshalling.Utf8)]
55+
internal static partial int GetAccountProviderSmallIconPath(IntPtr handle, out string iconPath);
5556

56-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_multiple_account_support", CallingConvention = CallingConvention.Cdecl)]
57-
internal static extern int GetMultipleAccountSupport(IntPtr handle, out int suppport);
57+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_multiple_account_support", StringMarshalling = StringMarshalling.Utf8)]
58+
internal static partial int GetMultipleAccountSupport(IntPtr handle, out int suppport);
5859

59-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label_by_locale", CallingConvention = CallingConvention.Cdecl)]
60-
internal static extern int GetlabelbyLocale(IntPtr handle, string locale, out string label);
60+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label_by_locale", StringMarshalling = StringMarshalling.Utf8)]
61+
internal static partial int GetlabelbyLocale(IntPtr handle, string locale, out string label);
6162

62-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_app_id_exist", CallingConvention = CallingConvention.Cdecl)]
63-
internal static extern int GetAppIdExists(string appId);
63+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_app_id_exist", StringMarshalling = StringMarshalling.Utf8)]
64+
internal static partial int GetAppIdExists(string appId);
6465

65-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", CallingConvention = CallingConvention.Cdecl)]
66-
internal static extern int GetAllAccountProviders(AccountProviderCallback callback, IntPtr data);
66+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", StringMarshalling = StringMarshalling.Utf8)]
67+
internal static partial int GetAllAccountProviders(AccountProviderCallback callback, IntPtr data);
6768

68-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_provider_feature_by_app_id")]
69-
internal static extern int GetAccountProviderFeaturesByAppId(AccountProviderFeatureCallback callback, string appId, IntPtr userData);
69+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_provider_feature_by_app_id", StringMarshalling = StringMarshalling.Utf8)]
70+
internal static partial int GetAccountProviderFeaturesByAppId(AccountProviderFeatureCallback callback, string appId, IntPtr userData);
7071

71-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_provider_feature_all")]
72-
internal static extern int GetAccountProviderFeatures(IntPtr handle, AccountProviderFeatureCallback callback, IntPtr userData);
72+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_provider_feature_all", StringMarshalling = StringMarshalling.Utf8)]
73+
internal static partial int GetAccountProviderFeatures(IntPtr handle, AccountProviderFeatureCallback callback, IntPtr userData);
7374

74-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label")]
75-
internal static extern int GetAccountProviderLabels(IntPtr handle, LabelCallback callback, IntPtr userData);
75+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label", StringMarshalling = StringMarshalling.Utf8)]
76+
internal static partial int GetAccountProviderLabels(IntPtr handle, LabelCallback callback, IntPtr userData);
7677

77-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_label_by_app_id")]
78-
internal static extern int GetLablesByAppId(LabelCallback callback, string appId, IntPtr userData);
78+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_label_by_app_id", StringMarshalling = StringMarshalling.Utf8)]
79+
internal static partial int GetLablesByAppId(LabelCallback callback, string appId, IntPtr userData);
7980

8081

8182
//Callbacks

src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the License);
@@ -16,6 +16,7 @@
1616

1717
using System;
1818
using System.Runtime.InteropServices;
19+
using System.Runtime.InteropServices.Marshalling;
1920
using Tizen.Account.AccountManager;
2021

2122
/// <summary>
@@ -30,68 +31,68 @@ internal static partial class Interop
3031
/// <since_tizen> 3 </since_tizen>
3132
internal static partial class AccountService
3233
{
33-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)]
34-
internal static extern int UpdateAccountToDBById(SafeAccountHandle handle, int id);
34+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", StringMarshalling = StringMarshalling.Utf8)]
35+
internal static partial int UpdateAccountToDBById(SafeAccountHandle handle, int id);
3536

36-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", CallingConvention = CallingConvention.Cdecl)]
37-
internal static extern int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName);
37+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", StringMarshalling = StringMarshalling.Utf8)]
38+
internal static partial int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName);
3839

39-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", CallingConvention = CallingConvention.Cdecl)]
40-
internal static extern int QueryAccountById(int accountId, ref SafeAccountHandle handle);
40+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", StringMarshalling = StringMarshalling.Utf8)]
41+
internal static partial int QueryAccountById(int accountId, ref SafeAccountHandle handle);
4142

42-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", CallingConvention = CallingConvention.Cdecl)]
43-
internal static extern int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData);
43+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", StringMarshalling = StringMarshalling.Utf8)]
44+
internal static partial int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData);
4445

45-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_package_name", CallingConvention = CallingConvention.Cdecl)]
46-
internal static extern int QueryAccountByPackageName(Interop.Account.AccountCallback callback, string packageName, IntPtr userData);
46+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_package_name", StringMarshalling = StringMarshalling.Utf8)]
47+
internal static partial int QueryAccountByPackageName(Interop.Account.AccountCallback callback, string packageName, IntPtr userData);
4748

48-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id", CallingConvention = CallingConvention.Cdecl)]
49-
internal static extern int QueryAccountCapabilityById(Interop.Account.AccountCapabilityCallback callback, int accoutId, IntPtr data);
49+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id", StringMarshalling = StringMarshalling.Utf8)]
50+
internal static partial int QueryAccountCapabilityById(Interop.Account.AccountCapabilityCallback callback, int accoutId, IntPtr data);
5051

51-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)]
52-
internal static extern int UpdateAccountSyncStatusById(int accoutId, int status);
52+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", StringMarshalling = StringMarshalling.Utf8)]
53+
internal static partial int UpdateAccountSyncStatusById(int accoutId, int status);
5354

54-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", CallingConvention = CallingConvention.Cdecl)]
55-
internal static extern int AddAccount(SafeAccountHandle handle, out int accountId);
55+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", StringMarshalling = StringMarshalling.Utf8)]
56+
internal static partial int AddAccount(SafeAccountHandle handle, out int accountId);
5657

57-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", CallingConvention = CallingConvention.Cdecl)]
58-
internal static extern int DeleteAccountById(int accountId);
58+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", StringMarshalling = StringMarshalling.Utf8)]
59+
internal static partial int DeleteAccountById(int accountId);
5960

60-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_user_name", CallingConvention = CallingConvention.Cdecl)]
61-
internal static extern int DeleteAccountByUser(string userName, string packageName);
61+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_user_name", StringMarshalling = StringMarshalling.Utf8)]
62+
internal static partial int DeleteAccountByUser(string userName, string packageName);
6263

63-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_package_name", CallingConvention = CallingConvention.Cdecl)]
64-
internal static extern int DeleteAccountByPackage(string packageName);
64+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_package_name", StringMarshalling = StringMarshalling.Utf8)]
65+
internal static partial int DeleteAccountByPackage(string packageName);
6566

66-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_get_total_count_from_db", CallingConvention = CallingConvention.Cdecl)]
67-
internal static extern int GetAccountCount(out int count);
67+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_get_total_count_from_db", StringMarshalling = StringMarshalling.Utf8)]
68+
internal static partial int GetAccountCount(out int count);
6869

69-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_foreach_account_from_db")]
70-
internal static extern int AccountForeachAccountFromDb(Interop.Account.AccountCallback callback, IntPtr userData);
70+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_foreach_account_from_db", StringMarshalling = StringMarshalling.Utf8)]
71+
internal static partial int AccountForeachAccountFromDb(Interop.Account.AccountCallback callback, IntPtr userData);
7172

72-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability")]
73-
internal static extern int GetAccountByCapability(Interop.Account.AccountCallback callback, string capabilityType, int value, IntPtr userData);
73+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability", StringMarshalling = StringMarshalling.Utf8)]
74+
internal static partial int GetAccountByCapability(Interop.Account.AccountCallback callback, string capabilityType, int value, IntPtr userData);
7475

75-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability_type")]
76-
internal static extern int GetAccountByCapabilityType(Interop.Account.AccountCallback callback, string capabilityType, IntPtr userData);
76+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability_type", StringMarshalling = StringMarshalling.Utf8)]
77+
internal static partial int GetAccountByCapabilityType(Interop.Account.AccountCallback callback, string capabilityType, IntPtr userData);
7778

78-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db")]
79-
internal static extern int GetAllAccountproviders(Interop.AccountProvider.AccountProviderCallback callback, IntPtr userData);
79+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", StringMarshalling = StringMarshalling.Utf8)]
80+
internal static partial int GetAllAccountproviders(Interop.AccountProvider.AccountProviderCallback callback, IntPtr userData);
8081

81-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_provider_feature")]
82-
internal static extern int GetAccountProviderByFeature(Interop.AccountProvider.AccountProviderCallback callback, string key, IntPtr userData);
82+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_provider_feature", StringMarshalling = StringMarshalling.Utf8)]
83+
internal static partial int GetAccountProviderByFeature(Interop.AccountProvider.AccountProviderCallback callback, string key, IntPtr userData);
8384

84-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_app_id")]
85-
internal static extern int GetAccountProviderByAppId(string appId, out IntPtr handle);
85+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_app_id", StringMarshalling = StringMarshalling.Utf8)]
86+
internal static partial int GetAccountProviderByAppId(string appId, out IntPtr handle);
8687

87-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_create")]
88-
internal static extern int CreateAccountSubscriber(out Interop.AccountService.SafeAccountSubscriberHandle handle);
88+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_create", StringMarshalling = StringMarshalling.Utf8)]
89+
internal static partial int CreateAccountSubscriber(out Interop.AccountService.SafeAccountSubscriberHandle handle);
8990

90-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_notification")]
91-
internal static extern int RegisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle, Interop.AccountService.SubscribeCallback callback, IntPtr userData);
91+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_notification", StringMarshalling = StringMarshalling.Utf8)]
92+
internal static partial int RegisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle, Interop.AccountService.SubscribeCallback callback, IntPtr userData);
9293

93-
[DllImport(Libraries.AccountSvc, EntryPoint = "account_unsubscribe_notification")]
94-
internal static extern int UnregisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle);
94+
[LibraryImport(Libraries.AccountSvc, EntryPoint = "account_unsubscribe_notification", StringMarshalling = StringMarshalling.Utf8)]
95+
internal static partial int UnregisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle);
9596

9697
//Callbacks
9798
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]

0 commit comments

Comments
 (0)