From 94816bf97f620f65f20ec3d135ceba7c53ce8b85 Mon Sep 17 00:00:00 2001 From: "manish.r" Date: Thu, 7 Apr 2016 11:03:50 +0530 Subject: [PATCH] Code with Doxygen Comments and TCT Change-Id: Id89cef41e305c3c516b4d997dbaa6f7bd3038661 Signed-off-by: manish.r --- Tizen.Content.MimeType.sln | 22 ++++++ Tizen.Content.MimeType.v12.suo | Bin 0 -> 77824 bytes packaging/csapi-mime-type.manifest | 5 ++ packaging/csapi-mime-type.pc.in | 5 ++ packaging/csapi-mime-type.spec | 77 ++++++++++++++++++++ src/Tizen.Content.MimeType/Interop/Interop.Glib.cs | 23 ++++++ src/Tizen.Content.MimeType/Interop/Interop.Libc.cs | 20 ++++++ .../Interop/Interop.Libraries.cs | 17 +++++ src/Tizen.Content.MimeType/Interop/Interop.Mime.cs | 20 ++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++++ .../Tizen.Content.MimeType.csproj | 75 +++++++++++++++++++ .../Tizen.Content.MimeType.snk | Bin 0 -> 596 bytes .../Tizen.Content.MimeType/MimeExceptionFactory.cs | 40 +++++++++++ .../Tizen.Content.MimeType/MimeUtil.cs | 80 +++++++++++++++++++++ 14 files changed, 420 insertions(+) create mode 100755 Tizen.Content.MimeType.sln create mode 100755 Tizen.Content.MimeType.v12.suo create mode 100644 packaging/csapi-mime-type.manifest create mode 100644 packaging/csapi-mime-type.pc.in create mode 100755 packaging/csapi-mime-type.spec create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Glib.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Mime.cs create mode 100755 src/Tizen.Content.MimeType/Properties/AssemblyInfo.cs create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType.snk create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs diff --git a/Tizen.Content.MimeType.sln b/Tizen.Content.MimeType.sln new file mode 100755 index 0000000..06aacf0 --- /dev/null +++ b/Tizen.Content.MimeType.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Content", "Tizen.Content\Tizen.Content.csproj", "{3EE5842E-7004-43BC-825B-29FFDEC18D4E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3EE5842E-7004-43BC-825B-29FFDEC18D4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EE5842E-7004-43BC-825B-29FFDEC18D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EE5842E-7004-43BC-825B-29FFDEC18D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EE5842E-7004-43BC-825B-29FFDEC18D4E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Tizen.Content.MimeType.v12.suo b/Tizen.Content.MimeType.v12.suo new file mode 100755 index 0000000000000000000000000000000000000000..84c10c6535e5d7486fd6489a79c55bdeb88380fa GIT binary patch literal 77824 zcmeHQ3wRsVl^!SI86HWYK(i@0X$XNvifqd-5+JrLhm<%;6DJLHXs~73kt0h&l1WUG z1p=Ya(gz6z3hgeGWntT;<R%(@?5<{F+M%a~(!zs!Uqy4?0z*9^A{P>SP z{qQeqnC{7Xk$5$7j4Ol6a^&8RqoA_2z+23>Pr(Q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EZ?SSZ&0wRWscdtnz=VMzpw5; zmT~;(6mT+(9^)4c?ES>(vq!JJ)4mTY;`?DqjEf}tve>>)VGN0{DckjZ?(TH+7k!Mo zW~_LH!t`H`-OMl?jhxbdKHxO1({%L0K?Cmr{P$pv)xu7aTh!?Xu2xw9gX0#ZNjV$5 z4H + + + + diff --git a/packaging/csapi-mime-type.pc.in b/packaging/csapi-mime-type.pc.in new file mode 100644 index 0000000..8a7a193 --- /dev/null +++ b/packaging/csapi-mime-type.pc.in @@ -0,0 +1,5 @@ +Name: csapi-mime-type +Description: Tizen MimeType API for C# +Version: @version@ +Libs: -r:@dllpath@/@dllname@ +Requires: diff --git a/packaging/csapi-mime-type.spec b/packaging/csapi-mime-type.spec new file mode 100755 index 0000000..fb2b218 --- /dev/null +++ b/packaging/csapi-mime-type.spec @@ -0,0 +1,77 @@ +%define dllpath %{_libdir}/mono/tizen +%define dllname Tizen.Content.MimeType.dll + +Name: csapi-mime-type +Summary: Tizen MimeType API for C# +Version: 1.0.0 +Release: 1 +Group: Development/Libraries +License: Apache-2.0 +URL: https://www.tizen.org +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest +Source2: %{name}.pc.in + +# TODO: replace mono-compiler, mono-devel to mcs, mono-shlib-cop +BuildRequires: mono-compiler +BuildRequires: mono-devel +# TODO: replace mono-core to gacutil. +# mono-core should provide the symbol 'gacutil' +Requires(post): mono-core +Requires(postun): mono-core + +# P/Invoke Dependencies +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(capi-content-mime-type) +BuildRequires: pkgconfig(csapi-tizen) + +%description +Tizen API for C# + +%package devel +Summary: Development package for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Development package for %{name} + +%prep +%setup -q + +cp %{SOURCE1} . + +%build +# build dll +mcs -target:library -out:%{dllname} -keyfile:Tizen.Content.MimeType/Tizen.Content.MimeType.snk -pkg:'csapi-tizen'\ + Tizen.Content.MimeType/Properties/AssemblyInfo.cs \ + Tizen.Content.MimeType/Interop/*.cs \ + Tizen.Content.MimeType/Tizen.Content.MimeType/*.cs + +# check p/invoke +if [ -x %{dllname} ]; then + RET=`mono-shlib-cop %{dllname}`; \ + CNT=`echo $RET | grep -E "^error:" | wc -l`; \ + if [ $CNT -gt 0 ]; then exit 1; fi +fi + +%install +# copy dll +mkdir -p %{buildroot}%{dllpath} +install -p -m 644 %{dllname} %{buildroot}%{dllpath} + +# generate pkgconfig +mkdir -p %{buildroot}%{_libdir}/pkgconfig +sed -e "s#@version@#%{version}#g" \ + -e "s#@dllpath@#%{dllpath}#g" \ + -e "s#@dllname@#%{dllname}#g" \ + %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc + +%post +gacutil -i %{dllpath}/%{dllname} + +%files +%{dllpath}/%{dllname} + +%files devel +%{_libdir}/pkgconfig/%{name}.pc diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs b/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs new file mode 100755 index 0000000..b2e3f5c --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs @@ -0,0 +1,23 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs new file mode 100755 index 0000000..c968cb2 --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs @@ -0,0 +1,20 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..8fbff9b --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs @@ -0,0 +1,17 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Mime = "libcapi-content-mime-type.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs b/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs new file mode 100755 index 0000000..640719f --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs @@ -0,0 +1,20 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Mime + { + [DllImport(Libraries.Mime, EntryPoint = "mime_type_get_mime_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetMime( + [System.Runtime.InteropServices.InAttribute()] + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string file_extension + , out string mime_type); + + [DllImport(Libraries.Mime, EntryPoint = "mime_type_get_file_extension", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetFile( + [System.Runtime.InteropServices.InAttribute()] + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string mime_type + , out System.IntPtr file_extension, out int length); + } +} \ No newline at end of file diff --git a/src/Tizen.Content.MimeType/Properties/AssemblyInfo.cs b/src/Tizen.Content.MimeType/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..35f4acf --- /dev/null +++ b/src/Tizen.Content.MimeType/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tizen.Content.MimeType")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tizen.Content.MimeType")] +[assembly: AssemblyCopyright("Copyright \u00A9 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("99a90243-7db1-4704-a078-3529c2da4e81")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj new file mode 100755 index 0000000..eb7ac76 --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {3EE5842E-7004-43BC-825B-29FFDEC18D4E} + Library + Properties + Tizen.Content.MimeType + Tizen.Content.MimeType + v4.0 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + Tizen.Content.MimeType.snk + + + + + + + + + + + ..\..\..\..\..\..\..\dll\usr\lib\mono\tizen\Tizen.dll + + + ..\..\..\..\..\..\..\dll\usr\lib\mono\tizen\Tizen.Internals.dll + + + + + + + + + + + + + + + + + + diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType.snk b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.snk new file mode 100755 index 0000000000000000000000000000000000000000..f3d151da2fc456d8bbcb2f021a4de6d87f6c7848 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097P4sii;46ZVFQ{JF}nc-4ZfpLv(NR1pi z?m$k2D#fK`3|TgR1@#@=AEl-^3ju@BIbzbciYg;D(_?Vp-0xvWCh8ONf2^}B93LP$6N(k&I+#~54Hk#Gu`a(!Hh^M8Tu z5w|is)Jt0%W%z}AEZn~*{D zF;Vt|3@FdHH#@e0UW|b_jysDHV<_l6e#2lcDSYEgRhS!FAEFx*dmGD{Zje<;lsWJ0 zKI)`#KWmVV&vFBU-6*Wnl{W&eAMCYhkWMNZJK`OoGeameAXFtN_(2Rug`SryZdCq> zFokQ?-9B8vV{S2y)h@RIG!Ma@xD>gt;{OdQu@vLeWB{Ro-9@4GVn?Dj2V6WP{1$1Q zW}5tl{Xo(zq1%Zg_>m0;U)FdBo}{mY!p6v)j`;eK6_gdpj i)UCgJe^=Yg(SD_v#S+|umS!3|x#f>w*1sCHQI2mN>lz6F literal 0 HcmV?d00001 diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs new file mode 100755 index 0000000..b543ad6 --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Tizen.Content.MimeType +{ + internal class MimeExceptionFactory + { + internal static Exception CreateException(MimeUtil.MimeError err) + { + Exception exp; + switch (err) + { + case MimeUtil.MimeError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case MimeUtil.MimeError.IoError: + { + exp = new SystemException("I/O Error Occured"); + break; + } + case MimeUtil.MimeError.OutOfMemory: + { + exp = new SystemException("Out Of Memory"); + break; + } + default: + { + exp = new InvalidOperationException(""); + break; + } + } + return exp; + } + } +} diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs new file mode 100755 index 0000000..45ce6f8 --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MimeType +{ + /// + /// The MimeUtil API provides functions to map MIME types to file extensions and vice versa. + /// + /// Conversions are provided from file extensions to MIME types and from MIME types to file extensions. + public static class MimeUtil + { + /// + /// Gets the MIME type for the given file extension. + /// The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats + /// + /// The file Extension + /// + /// + /// string mimeType = MimeUtil.GetMimeType("png"); + /// + /// + public static string GetMimeType(string fileExtension) + { + string mime; + int res = Interop.Mime.GetMime(fileExtension, out mime); + if (res != (int)MimeError.None) + { + throw MimeExceptionFactory.CreateException((MimeError)res); + } + return mime; + } + + /// + /// Gets file extensions for the given MIME type. + /// + /// If Successfull, return's the list of file extension strings for the given MIME type. + /// The array of file extension are without the leading dot ('.') + /// The mime type + /// + /// + /// IEnumerable extColl = MimeUtil.GetFileExtension("video/mpeg"); + /// foreach ( string obj in extColl ) + /// { + /// Console.WriteLine(obj); + /// } + /// + /// + public static IEnumerable GetFileExtension(string mime) + { + IntPtr extensionArray = IntPtr.Zero; + int length = -1; + int res = Interop.Mime.GetFile(mime, out extensionArray, out length); + if (res != (int)MimeError.None) + { + throw MimeExceptionFactory.CreateException((MimeError)res); + } + IntPtr[] extensionList = new IntPtr[length]; + Marshal.Copy(extensionArray, extensionList, 0, length); + Collection coll = new Collection(); + foreach (IntPtr extension in extensionList) + { + coll.Add(Marshal.PtrToStringAnsi(extension)); + Interop.Libc.Free(extension); + } + Interop.Libc.Free(extensionArray); + return coll; + } + + internal enum MimeError : int + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< Internal I/O error */ + } + } +} -- 2.7.4