[NUI] dali_1.2.66, nui_0.2.66 version release
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / VersionCheck.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19
20 namespace Tizen.NUI
21 {
22     //This version should be updated and synced for every Dali native release
23     internal static class Version
24     {
25         public const int daliVer1 = 1;
26         public const int daliVer2 = 2;
27         public const int daliVer3 = 66;
28         public const int nuiVer1 = 0;
29         public const int nuiVer2 = 2;
30         public const int nuiVer3 = 66;
31         public const string nuiRelease = "";
32
33
34         static internal bool DaliVersionMatchWithNUI()
35         {
36             int ver1 = -1;
37             int ver2 = -1;
38             int ver3 = -1;
39
40             try
41             {
42                 if (NDalicManualPINVOKE.NativeVersionCheck(ref ver1, ref ver2, ref ver3))
43                 {
44                     if (ver1 != daliVer1 || ver2 != daliVer2 || ver3 != daliVer3)
45                     {
46                         NUILog.Error($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali= { ver1 }.{ ver2}.{ ver3}");
47                         throw new System.InvalidOperationException($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali={ ver1 }.{ ver2}.{ ver3}");
48                     }
49                 }
50                 else
51                 {
52                     NUILog.Error($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali= { ver1 }.{ ver2}.{ ver3}");
53                     throw new System.InvalidOperationException($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali={ ver1 }.{ ver2}.{ ver3}");
54                 }
55             }
56             catch (Exception)
57             {
58                 NUILog.Error($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali= { ver1 }.{ ver2}.{ ver3}");
59                 throw new System.InvalidOperationException($"Dali native version mismatch error! nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3} but dali={ ver1 }.{ ver2}.{ ver3}");
60             }
61             NUILog.Debug($"version info: nui={ nuiVer1}.{ nuiVer2}.{ nuiVer3}, dali= { ver1 }.{ ver2}.{ ver3}");
62             return true;
63         }
64     }
65 }