/// </summary>
/// <since_tizen> 3 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
+#pragma warning disable CA1051
protected IDictionary<EventType, object> Handlers = new Dictionary<EventType, object>();
+#pragma warning restore CA1051
/// <summary>
/// Constructor of DefaultCoreBackend class.
/// Exits the mainloop of the backend.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
public abstract void Exit();
+#pragma warning restore CA1716
/// <summary>
/// Releases all resources.
/// Exits the mainloop of the backend.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
void Exit();
+#pragma warning restore CA1716
}
}
/// The class that represents the exception which will be thrown when the application to run is not found
/// </summary>
/// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
public class AppNotFoundException : InvalidOperationException
+#pragma warning restore CA1032
{
/// <summary>
/// Constructor
/// The class that represents the exception which will be thrown when the request failed to launch the application
/// </summary>
/// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
public class LaunchFailedException : InvalidOperationException
+#pragma warning restore CA1032
{
/// <summary>
/// Constructor
/// The class that represents the exception which will be thrown when the launch request is rejected
/// </summary>
/// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
public class LaunchRejectedException : InvalidOperationException
+#pragma warning restore CA1032
{
/// <summary>
/// Constructor
/// The class that represents the exception which will be thrown when the memory is insufficient
/// </summary>
/// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
public class OutOfMemoryException : InvalidOperationException
+#pragma warning restore CA1032
{
/// <summary>
/// Constructor
/// The class that represents the exception which will be thrown when the permission is denied
/// </summary>
/// <since_tizen> 4 </since_tizen>
+#pragma warning disable CA1032
public class PermissionDeniedException : InvalidOperationException
+#pragma warning restore CA1032
{
/// <summary>
/// Constructor
/// Exception class for invalid IO.
/// </summary>
/// <since_tizen> 5 </since_tizen>
+ #pragma warning disable CA1032
public class InvalidIOException : InvalidOperationException { }
/// <summary>
/// </summary>
/// <since_tizen> 5 </since_tizen>
public class InvalidCallbackException : InvalidOperationException { }
+#pragma warning restore CA1032
}
/// <since_tizen> 5 </since_tizen>
public void WriteBundle(Bundle b)
{
+ if (b == null)
+ {
+ return;
+ }
+
Interop.LibRPCPort.Parcel.WriteBundle(_handle, b.SafeBundleHandle.DangerousGetHandle());
}
/// <since_tizen> 5 </since_tizen>
public void Write(byte[] bytes)
{
+ if (bytes == null)
+ {
+ return;
+ }
+
Interop.LibRPCPort.Parcel.Write(_handle, bytes, bytes.Length);
}
#region IDisposable Support
private bool disposedValue = false;
+#pragma warning disable CA1063
private void Dispose(bool disposing)
+#pragma warning restore CA1063
{
if (!disposedValue)
{
/// Gets Port object.
/// </summary>
/// <since_tizen> 5 </since_tizen>
+#pragma warning disable CA1721
protected Port Port { get; private set; }
+#pragma warning restore CA1721
/// <summary>
/// Gets Port object for asynchronous events.
protected void AddPrivilege(string privilege)
{
if (privilege == null)
- throw new ArgumentNullException();
+ {
+ throw new ArgumentNullException(nameof(privilege));
+ }
+
Interop.LibRPCPort.Stub.AddPrivilege(_stub, privilege);
}
/// </code>
/// </example>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1056
public string Uri
+#pragma warning restore CA1056
{
get
{
{
if (control == null)
{
- throw new ArgumentNullException("control");
+ throw new ArgumentNullException(nameof(control));
}
List<string> ids = new List<string>();
{
if (launchRequest == null)
{
- throw new ArgumentNullException("launchRequest");
+ throw new ArgumentNullException(nameof(launchRequest));
}
Interop.AppControl.ErrorCode err;
{
if (launchRequest == null)
{
- throw new ArgumentNullException("launchRequest");
+ throw new ArgumentNullException(nameof(launchRequest));
}
Interop.AppControl.ErrorCode err;
{
if (terminateRequest == null)
{
- throw new ArgumentNullException("terminateRequest");
+ throw new ArgumentNullException(nameof(terminateRequest));
}
Interop.AppControl.ErrorCode err;
/// Class for extra data.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1034
public class ExtraDataCollection
+#pragma warning restore CA1034
{
private readonly SafeAppControlHandle _handle;
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
if (string.IsNullOrEmpty(value))
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraData(_handle, key, value);
if (err != Interop.AppControl.ErrorCode.None)
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
string[] valueArray = value.ToArray();
Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraDataArray(_handle, key, valueArray, valueArray.Length);
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
Interop.AppControl.GetExtraData(_handle, key, out value);
if (value != null)
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
IntPtr valuePtr = IntPtr.Zero;
int len = -1;
{
IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i);
stringList.Add(Marshal.PtrToStringAnsi(charArr));
- Interop.Libc.Free(charArr);
+ _ = Interop.Libc.Free(charArr);
}
- Interop.Libc.Free(valuePtr);
+ _ = Interop.Libc.Free(valuePtr);
value = stringList;
return true;
}
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
Interop.AppControl.ErrorCode err = Interop.AppControl.RemoveExtraData(_handle, key);
if (err != Interop.AppControl.ErrorCode.None)
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
bool isArray = false;
Interop.AppControl.ErrorCode err = Interop.AppControl.IsExtraDataArray(_handle, key, out isArray);
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
string value = string.Empty;
Interop.AppControl.ErrorCode err = Interop.AppControl.GetExtraData(_handle, key, out value);
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
IntPtr valuePtr = IntPtr.Zero;
int len = -1;
{
IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i);
valueArray.Add(Marshal.PtrToStringAnsi(charArr));
- Interop.Libc.Free(charArr);
+ _ = Interop.Libc.Free(charArr);
}
- Interop.Libc.Free(valuePtr);
+ _ = Interop.Libc.Free(valuePtr);
}
return valueArray;
}
/// <summary>
/// Prefer to launch an application as a single mode.
/// </summary>
+#pragma warning disable CA1720
Single = 0,
+#pragma warning restore CA1720
/// <summary>
/// Prefer to launch an application as a group mode.
{
if (args == null)
{
- throw new ArgumentNullException("args");
+ throw new ArgumentNullException(nameof(args));
}
s_CurrentApplication = this;
}
/// Exits the main loop of the application.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1716
public abstract void Exit();
+#pragma warning restore CA1716
#region IDisposable Support
private bool _disposedValue = false; // To detect redundant calls
};
IntPtr infoHandle = GetInfoHandle();
- if (infoHandle != null)
+ if (infoHandle != IntPtr.Zero)
{
err = Interop.ApplicationManager.AppInfoForeachResControl(infoHandle, _resControlCallback, IntPtr.Zero);
if (err != Interop.ApplicationManager.ErrorCode.None)
GC.SuppressFinalize(this);
}
+#pragma warning disable CA1063
private void Dispose(bool disposing)
+#pragma warning restore CA1063
{
if (_disposed)
return;
/// This class is a possible value to use in the InstalledApplicationFilter.
/// </summary>
/// <since_tizen> 5 </since_tizen>
+#pragma warning disable CA1034
public static class Values
+#pragma warning restore CA1034
{
/// <summary>
/// A pre-defined value string for InstalledStorage key. This value indicates that the application is installed at internal storage.
/// This class is a possible key to use in the InstalledApplicationFilter.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1034
public static class Keys
+#pragma warning restore CA1034
{
/// <summary>
/// A key to filter by application id.
/// <since_tizen> 6 </since_tizen>
public static void TerminateBackgroundApplication(ApplicationRunningContext app)
{
+ if (app == null)
+ {
+ throw new ArgumentException("Invalid argument.");
+ }
+
ErrorCode err = Interop.ApplicationManager.AppManagerRequestTerminateBgApp(app._contextHandle);
if (err != Interop.ApplicationManager.ErrorCode.None)
{
GC.SuppressFinalize(this);
}
+#pragma warning disable CA1801
+#pragma warning disable CA1063
private void Dispose(bool disposing)
+#pragma warning restore CA1063
+#pragma warning restore CA1801
{
if (_disposed)
return;
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
AddItem(key, value, 0, value.Length);
}
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
if (offset < 0)
{
- throw new ArgumentOutOfRangeException("offset", offset, "Cannot be less than 0");
+ throw new ArgumentOutOfRangeException(nameof(offset), offset, "Cannot be less than 0");
}
if (offset > value.Length - 1)
{
- throw new ArgumentOutOfRangeException("offset", offset, "Greater than last index of array");
+ throw new ArgumentOutOfRangeException(nameof(offset), offset, "Greater than last index of array");
}
if (count < 1)
{
- throw new ArgumentOutOfRangeException("count", count, "Must be at least 1");
+ throw new ArgumentOutOfRangeException(nameof(count), count, "Must be at least 1");
}
if (offset + count > value.Length)
{
}
else
{
- throw new ArgumentException("Key already exists", "key");
+ throw new ArgumentException("Key already exists", nameof(key));
}
}
}
else
{
- throw new ArgumentException("Key already exists", "key");
+ throw new ArgumentException("Key already exists", nameof(key));
}
}
if (!_keys.Contains(key))
{
string[] valueArray = value.Select(v => v == null ? string.Empty : v).ToArray();
- int ret = Interop.Bundle.AddStringArray(_handle, key, valueArray, valueArray.Count());
+ int ret = Interop.Bundle.AddStringArray(_handle, key, valueArray, valueArray.Length);
BundleErrorFactory.CheckAndThrowException(ret, _handle);
_keys.Add(key);
}
else
{
- throw new ArgumentException("Key already exists", "key");
+ throw new ArgumentException("Key already exists", nameof(key));
}
}
return byteArray;
default:
- throw new ArgumentException("Key does not exist in the bundle", "key");
+ throw new ArgumentException("Key does not exist in the bundle", nameof(key));
}
}
else
{
- throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key");
+ throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", nameof(key));
}
}
return typeof(byte[]) == typeof(T);
default:
- throw new ArgumentException("Key does not exist in the bundle", "key");
+ throw new ArgumentException("Key does not exist in the bundle", nameof(key));
}
}
else
{
- throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key");
+ throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", nameof(key));
}
}
{
SafeBundleHandle handle;
+ if (bundleRaw == null)
+ {
+ throw new ArgumentException("Invalid bundle raw");
+ }
+
handle = Interop.Bundle.BundleDecode(bundleRaw, bundleRaw.Length);
if (ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter)
{
/// <since_tizen> 3 </since_tizen>
protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e)
{
+ if (e == null)
+ {
+ Log.Error(LogTag, "e is null");
+ return;
+ }
+
AppControlReceived?.Invoke(this, e);
}
/// <since_tizen> 3 </since_tizen>
protected virtual void OnLowMemory(LowMemoryEventArgs e)
{
+ if (e == null)
+ {
+ Log.Error(LogTag, "e is null");
+ return;
+ }
+
LowMemory?.Invoke(this, e);
if (e.LowMemoryStatus == LowMemoryStatus.SoftWarning || e.LowMemoryStatus == LowMemoryStatus.HardWarning)
{
/// <since_tizen> 3 </since_tizen>
protected virtual void OnLowBattery(LowBatteryEventArgs e)
{
+ if (e == null)
+ {
+ Log.Error(LogTag, "e is null");
+ return;
+ }
+
LowBattery?.Invoke(this, e);
}
/// <since_tizen> 3 </since_tizen>
protected virtual void OnLocaleChanged(LocaleChangedEventArgs e)
{
+ if (e == null)
+ {
+ Log.Error(LogTag, "e is null");
+ return;
+ }
+
if (!GlobalizationMode.Invariant)
{
ChangeCurrentUICultureInfo(e.Locale);
/// <since_tizen> 3 </since_tizen>
protected virtual void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
{
+ if (e == null)
+ {
+ Log.Error(LogTag, "e is null");
+ return;
+ }
+
if (!GlobalizationMode.Invariant)
{
ChangeCurrentCultureInfo(e.Region);
}
string cultureName = string.Empty;
+#pragma warning disable CA1308
string key = "CultureInfo:" + locale.ToLowerInvariant();
+#pragma warning restore CA1308
IntPtr value = Interop.LibIniParser.GetString(dictionary, key, IntPtr.Zero);
if (value != IntPtr.Zero)
{
/// <summary>
/// The device orientation is 0.
/// </summary>
+#pragma warning disable CA1707
Orientation_0 = 0,
/// <summary>
/// The device orientation is 270.
/// </summary>
Orientation_270 = 270,
+#pragma warning restore CA1707
}
}
\ No newline at end of file
{
internal static class GSourceManager
{
- private static Interop.Glib.GSourceFunc _wrapperHandler;
- private static Object _transactionLock;
- private static ConcurrentDictionary<int, Action> _handlerMap;
- private static int _transactionId;
-
- static GSourceManager()
- {
- _wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
- _transactionLock = new Object();
- _handlerMap = new ConcurrentDictionary<int, Action>();
- _transactionId = 0;
- }
+ private static Interop.Glib.GSourceFunc _wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
+ private static Object _transactionLock = new Object();
+ private static ConcurrentDictionary<int, Action> _handlerMap = new ConcurrentDictionary<int, Action>();
+ private static int _transactionId = 0;
public static void Post(Action action, bool useTizenGlibContext = false)
{
_handlerMap.TryAdd(id, action);
IntPtr source = Interop.Glib.IdleSourceNew();
Interop.Glib.SourceSetCallback(source, _wrapperHandler, (IntPtr)id, IntPtr.Zero);
- Interop.Glib.SourceAttach(source, useTizenGlibContext ? Interop.AppCoreUI.GetTizenGlibContext() : IntPtr.Zero);
+ _ = Interop.Glib.SourceAttach(source, useTizenGlibContext ? Interop.AppCoreUI.GetTizenGlibContext() : IntPtr.Zero);
Interop.Glib.SourceUnref(source);
}
{
if (replyRequest == null)
{
- throw new ArgumentNullException("replyRequest");
+ throw new ArgumentNullException(nameof(replyRequest));
}
Interop.AppControl.ErrorCode err = Interop.AppControl.ReplyToLaunchRequest(replyRequest.SafeAppControlHandle, this.SafeAppControlHandle, (int)result);
if (err != Interop.AppControl.ErrorCode.None)
[EditorBrowsable(EditorBrowsableState.Never)]
public class RecentApplicationControl
{
- private const string LogTag = "Tizen.Applications";
-
private readonly string _pkgId;
internal RecentApplicationControl(String pkgId)
[EditorBrowsable(EditorBrowsableState.Never)]
public class RecentApplicationInfo : ApplicationInfo
{
- private const string LogTag = "Tizen.Applications";
-
/// <summary>
/// Gets the instance ID.
/// </summary>
/// Gets the URI.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+#pragma warning disable CA1056
public string Uri { get; private set; }
+#pragma warning restore CA1056
/// <summary>
/// Gets the launchTime.
/// <returns>true if the handle is released successfully.</returns>
protected override bool ReleaseHandle()
{
- Interop.Bundle.DangerousFree(this.handle);
+ _ = Interop.Bundle.DangerousFree(this.handle);
this.SetHandle(IntPtr.Zero);
return true;
}
Exception err = null;
GSourceManager.Post(() =>
{
+#pragma warning disable CA1031
try
{
d(state);
{
mre.Set();
}
+#pragma warning restore CA1031
});
mre.WaitOne();
if (err != null)
Exception err = null;
GSourceManager.Post(() =>
{
+#pragma warning disable CA1031
try
{
d(state);
{
mre.Set();
}
+#pragma warning restore CA1031
}, true);
mre.WaitOne();
if (err != null)