コード例 #1
0
        private bool NeedLoad(ApiGroup api)
        {
            foreach (var type in api.Types)
            {
                if (!type.IsClass)
                {
                    continue;
                }

                if (typeof(IAction).IsAssignableFrom(type) || typeof(IEntity).IsAssignableFrom(type))
                {
                    if (!_assemblies.ContainsKey(api.ModelId))
                    {
                        _assemblies.Add(api.ModelId, api.Assembly);
                    }

                    _assemblyXmlList.Add(api.Assembly.ManifestModule.Name.Replace(".dll", ".xml"));

                    if (typeof(IAction).IsAssignableFrom(type))
                    {
                        _apiGroupList.Add(api);
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #2
0
        private ApiGroup GetApiGroup(Assembly assembly)
        {
            try
            {
                var group = new ApiGroup()
                {
                    Assembly = assembly
                };

                foreach (var type in assembly.GetTypes())
                {
                    if (!type.IsClass)
                    {
                        continue;
                    }

                    if ((typeof(IAction).IsAssignableFrom(type) || typeof(IEntity).IsAssignableFrom(type)) && !type.IsAbstract && !type.IsInterface)
                    {
                        group.Types.Add(type);
                    }
                }

                return(group);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
コード例 #3
0
 public Group(IndiebackendAPI api, ApiGroup <TPublic, TPrivate> res, string profileToken, NotificationsApi notifications)
 {
     _profileToken = profileToken;
     UpdateFromApi(res);
     _api = api;
     _notificationsApi = notifications;
 }
コード例 #4
0
 private static void doneEntryPoint()
 {
     if (modID == NoData)
     {
         modFlags = ApiGroup.Off;
     }
     else
     {
         try
         {
             NativeMethods.DllBidEntryPoint(ref modID, 0, IntPtr.Zero, 0xd0000000, ref modFlags, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
             NativeMethods.DllBidFinalize();
         }
         catch
         {
             modFlags = ApiGroup.Off;
         }
         finally
         {
             cookieObject.Invalidate();
             modID = NoData;
             modFlags = ApiGroup.Off;
         }
     }
 }
コード例 #5
0
ファイル: ApiProxy.cs プロジェクト: Apollo3zehn/Vibrometer
        private static IntPtr GetAddress(ApiGroup group, IntPtr address)
        {
            IntPtr realAddress;

            realAddress = address;

            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                if (group == ApiGroup.AxisSwitch)
                {
                    realAddress = IntPtr.Add(fakeArray, ApiProxy.SWITCH_OFFSET * SystemParameters.BYTE_COUNT);
                }
                else
                {
                    // - # of ports     = 2
                    // - AXI GPIO width = 4 bytes       (SystemParameters.BYTE_COUNT)
                    // - GPIO offset    = 8 bytes       (ApiProxy.GPIO_OFFSET)
                    // ==============================================================
                    // total size per dual port GPIO = 4 * 2 + (8 - 4) = 8 + 4 = 12 bytes
                    realAddress = IntPtr.Add(fakeArray, (int)(group - 1) * (ApiProxy.GPIO_OFFSET + SystemParameters.BYTE_COUNT));
                }
            }

            return(realAddress);
        }
コード例 #6
0
 private static void doneEntryPoint()
 {
     if (modID == NoData)
     {
         modFlags = ApiGroup.Off;
     }
     else
     {
         try
         {
             NativeMethods.DllBidEntryPoint(ref modID, 0, IntPtr.Zero, 0xd0000000, ref modFlags, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
             NativeMethods.DllBidFinalize();
         }
         catch
         {
             modFlags = ApiGroup.Off;
         }
         finally
         {
             cookieObject.Invalidate();
             modID    = NoData;
             modFlags = ApiGroup.Off;
         }
     }
 }
コード例 #7
0
 private static void deterministicStaticInit()
 {
     __noData = (IntPtr) (-1);
     __defaultCmdSpace = (IntPtr) (-1);
     modFlags = ApiGroup.Off;
     modIdentity = string.Empty;
     ctrlCallback = new CtrlCB(Bid.SetApiGroupBits);
     cookieObject = new BindingCookie();
     hCookie = GCHandle.Alloc(cookieObject, GCHandleType.Pinned);
 }
コード例 #8
0
 private void UpdateFromApi(ApiGroup <TPublic, TPrivate> res)
 {
     Id          = res.Id;
     AppId       = res.AppId;
     Name        = res.Name;
     Leader      = res.Leader;
     Members     = res.Members;
     PublicData  = res.PublicData;
     PrivateData = res.PrivateData;
 }
コード例 #9
0
 private static void deterministicStaticInit()
 {
     __noData          = (IntPtr)(-1);
     __defaultCmdSpace = (IntPtr)(-1);
     modFlags          = ApiGroup.Off;
     modIdentity       = string.Empty;
     ctrlCallback      = new CtrlCB(Bid.SetApiGroupBits);
     cookieObject      = new BindingCookie();
     hCookie           = GCHandle.Alloc(cookieObject, GCHandleType.Pinned);
 }
コード例 #10
0
 public ApiRecord(ApiParameter parameter, ApiGroup group, string displayName, string description, int offset, int shift, int size, uint min, uint max)
 {
     this.Parameter   = parameter;
     this.Group       = group;
     this.DisplayName = displayName;
     this.Description = description;
     this.Offset      = offset;
     this.Shift       = shift;
     this.Size        = size;
     this.Min         = min;
     this.Max         = max;
 }
コード例 #11
0
 public ApiRecord(ApiParameter parameter, ApiGroup group, string displayName, string description, int offset, int shift, int size)
 {
     this.Parameter   = parameter;
     this.Group       = group;
     this.DisplayName = displayName;
     this.Description = description;
     this.Offset      = offset;
     this.Shift       = shift;
     this.Size        = size;
     this.Min         = 0;
     this.Max         = (uint)(Math.Pow(2, size) - 1);
 }
コード例 #12
0
 internal static ApiGroup SetApiGroupBits(ApiGroup mask, ApiGroup bits)
 {
     lock (_setBitsLock)
     {
         ApiGroup modFlags = Bid.modFlags;
         if (mask != ApiGroup.Off)
         {
             Bid.modFlags ^= (bits ^ modFlags) & mask;
         }
         return(modFlags);
     }
 }
コード例 #13
0
 internal static void DllBidEntryPoint(ref IntPtr hID, int bInitAndVer, string sIdentity,
                                     uint propBits, ref ApiGroup pGblFlags, CtrlCB fAddr,
                                     ref BIDEXTINFO pExtInfo, IntPtr pHooks, IntPtr pHdr);
コード例 #14
0
 internal static bool IsOn(ApiGroup flag)
 {
     return ((modFlags & flag) != ApiGroup.Off);
 }
コード例 #15
0
 internal static bool IsOn(ApiGroup flag)
 {
     return((modFlags & flag) != ApiGroup.Off);
 }
コード例 #16
0
    private static void doneEntryPoint()
    {
        if (modID == NoData) {
            modFlags = ApiGroup.Off;
            return;
        }

        try {
            NativeMethods.DllBidEntryPoint( ref modID, 0, IntPtr.Zero,
                                            configFlags, ref modFlags,
                                            IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero );
            NativeMethods.DllBidFinalize();
        }
        catch {
            //
            //  We do intentionally catch everything because no matter what happens
            //  we don't want any exception to escape when we're in context of a finalizer.
            //  Note that critical exceptions such as ThreadAbortException could be
            //  propagated anyway (CLR 2.0 and above).
            //
            modFlags = ApiGroup.Off;    // This is 'NoOp', just to not have empty catch block.
        }
        finally {
            cookieObject.Invalidate();
            modID = NoData;
            modFlags = ApiGroup.Off;
        }

    } // doneEntryPoint
コード例 #17
0
 internal static ApiGroup SetApiGroupBits(ApiGroup mask, ApiGroup bits)
 {
     lock (_setBitsLock)
     {
         ApiGroup modFlags = Bid.modFlags;
         if (mask != ApiGroup.Off)
         {
             Bid.modFlags ^= (bits ^ modFlags) & mask;
         }
         return modFlags;
     }
 }
コード例 #18
0
 internal static ApiGroup SetApiGroupBits (ApiGroup mask, ApiGroup bits) {
     lock (_setBitsLock) {
         ApiGroup tmp = modFlags;
         if( mask != ApiGroup.Off ){
             modFlags ^= (bits ^ tmp) & mask;
         }
         return tmp;
     }
 }
コード例 #19
0
    //+//////////////////////////////////////////////////////////////////////////////////////////
    //
    //  SERVICES
    //

    //
    //  MODULE-WIDE APIGROUP BITS
    //

#if BID_USE_ALL_APIGROUP
    internal static ApiGroup GetApiGroupBits (ApiGroup mask) {
        return modFlags & mask;
    }
コード例 #20
0
 internal static bool AreOn(ApiGroup flags) {
     return (modFlags & flags) == flags;
 }
コード例 #21
0
 internal static bool IsOn(ApiGroup flag) {
     return (modFlags & flag) != 0;
 }
コード例 #22
0
ファイル: MobileStubs.cs プロジェクト: zixing131/mono
 internal static bool IsOn(ApiGroup flag)
 {
     return(false);
 }
コード例 #23
0
 internal static void DllBidEntryPoint(ref IntPtr hID, int bInitAndVer, IntPtr unused1,
                                     uint propBits, ref ApiGroup pGblFlags, IntPtr unused2,
                                     IntPtr unused3, IntPtr unused4, IntPtr unused5);
コード例 #24
0
ファイル: MobileStubs.cs プロジェクト: Profit0004/mono
    internal static bool IsOn (ApiGroup flag)
	{
        return false;
    }