Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
 public Group(IndiebackendAPI api, ApiGroup <TPublic, TPrivate> res, string profileToken, NotificationsApi notifications)
 {
     _profileToken = profileToken;
     UpdateFromApi(res);
     _api = api;
     _notificationsApi = notifications;
 }
 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;
         }
     }
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 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;
         }
     }
 }
 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
     }
 }
 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);
 internal static bool IsOn(ApiGroup flag)
 {
     return ((modFlags & flag) != ApiGroup.Off);
 }
Exemplo n.º 15
0
 internal static bool IsOn(ApiGroup flag)
 {
     return((modFlags & flag) != ApiGroup.Off);
 }
    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
 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;
     }
 }
 internal static ApiGroup SetApiGroupBits (ApiGroup mask, ApiGroup bits) {
     lock (_setBitsLock) {
         ApiGroup tmp = modFlags;
         if( mask != ApiGroup.Off ){
             modFlags ^= (bits ^ tmp) & mask;
         }
         return tmp;
     }
 }
    //+//////////////////////////////////////////////////////////////////////////////////////////
    //
    //  SERVICES
    //

    //
    //  MODULE-WIDE APIGROUP BITS
    //

#if BID_USE_ALL_APIGROUP
    internal static ApiGroup GetApiGroupBits (ApiGroup mask) {
        return modFlags & mask;
    }
 internal static bool AreOn(ApiGroup flags) {
     return (modFlags & flags) == flags;
 }
 internal static bool IsOn(ApiGroup flag) {
     return (modFlags & flag) != 0;
 }
Exemplo n.º 22
0
 internal static bool IsOn(ApiGroup flag)
 {
     return(false);
 }
 internal static void DllBidEntryPoint(ref IntPtr hID, int bInitAndVer, IntPtr unused1,
                                     uint propBits, ref ApiGroup pGblFlags, IntPtr unused2,
                                     IntPtr unused3, IntPtr unused4, IntPtr unused5);
Exemplo n.º 24
0
    internal static bool IsOn (ApiGroup flag)
	{
        return false;
    }