Beispiel #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////
        /// PUBLIC API
        ////////////////////////////////////////////////////////////////////////////////////////////////

        public void SetBlendMask(ObjectMask _level)
        {
            switch (_level)
            {
            case ObjectMask.AAR_OBJECTMASK_NONE:
                gameObject.layer = 0;
                break;

            case ObjectMask.AAR_OBJECTMASK_PROJECTORONLY:
                gameObject.layer = m_ProjectorOnlyLayer;
                break;

            case ObjectMask.AAR_OBJECTMASK_HOLOLENSONLY:
                gameObject.layer = m_HololensOnlyLayer;
                break;

            case ObjectMask.AAR_OBJECTMASK_BLENDING:
                gameObject.layer     = m_BlendableLayer;
                BlendAmountProjector = 1;
                BlendAmountHololens  = 1;
                break;

            case ObjectMask.AAR_OBJECTMASK_VIRTUALOBJECT:
                gameObject.layer = m_VirtualObjectLayer;
                break;

            case ObjectMask.AAR_OBJECTMASK_VIRTUALTEXTURE:
                gameObject.layer = m_VirtualTextureLayer;
                break;
            }

            CreateUVMapping();
        }
Beispiel #2
0
        internal override bool IsValidProperty(Principal p, string propertyName)
        {
            ObjectMask value = ObjectMask.None;

            if (s_validPropertyMap.TryGetValue(propertyName, out value))
            {
                return((s_maskMap[p.GetType()] & value) > 0 ? true : false);
            }
            else
            {
                Debug.Fail("Property not found");
                return(false);
            }
        }
Beispiel #3
0
#pragma warning disable CA1810 // Initialize reference type static fields inline
        static SAMStoreCtx()
#pragma warning restore CA1810
        {
            //
            // Load the *PropertyMappingTableByProperty and *PropertyMappingTableByWinNT tables
            //
            s_userPropertyMappingTableByProperty = new Hashtable();
            s_userPropertyMappingTableByWinNT    = new Hashtable();

            s_groupPropertyMappingTableByProperty = new Hashtable();
            s_groupPropertyMappingTableByWinNT    = new Hashtable();

            s_computerPropertyMappingTableByProperty = new Hashtable();
            s_computerPropertyMappingTableByWinNT    = new Hashtable();

            s_validPropertyMap = new Dictionary <string, ObjectMask>();

            s_maskMap = new Dictionary <Type, ObjectMask>();
            s_maskMap.Add(typeof(UserPrincipal), ObjectMask.User);
            s_maskMap.Add(typeof(ComputerPrincipal), ObjectMask.Computer);
            s_maskMap.Add(typeof(GroupPrincipal), ObjectMask.Group);
            s_maskMap.Add(typeof(Principal), ObjectMask.Principal);

            for (int i = 0; i < s_propertyMappingTableRaw.GetLength(0); i++)
            {
                string propertyName   = s_propertyMappingTableRaw[i, 0] as string;
                Type   principalType  = s_propertyMappingTableRaw[i, 1] as Type;
                string winNTAttribute = s_propertyMappingTableRaw[i, 2] as string;
                FromWinNTConverterDelegate fromWinNT = s_propertyMappingTableRaw[i, 3] as FromWinNTConverterDelegate;
                ToWinNTConverterDelegate   toWinNT   = s_propertyMappingTableRaw[i, 4] as ToWinNTConverterDelegate;

                Debug.Assert(propertyName != null);
                Debug.Assert((winNTAttribute != null && fromWinNT != null) || (fromWinNT == null));
                Debug.Assert(principalType == typeof(Principal) || principalType.IsSubclassOf(typeof(Principal)));

                // Build the table entry.  The same entry will be used in both tables.
                // Once constructed, the table entries are treated as read-only, so there's
                // no danger in sharing the entries between tables.
                PropertyMappingTableEntry propertyEntry = new PropertyMappingTableEntry();
                propertyEntry.propertyName = propertyName;
                propertyEntry.suggestedWinNTPropertyName = winNTAttribute;
                propertyEntry.winNTToPapiConverter       = fromWinNT;
                propertyEntry.papiToWinNTConverter       = toWinNT;

                // Add it to the appropriate tables
                List <Hashtable> byPropertyTables = new List <Hashtable>();
                List <Hashtable> byWinNTTables    = new List <Hashtable>();

                ObjectMask BitMask = 0;

                if (principalType == typeof(UserPrincipal))
                {
                    byPropertyTables.Add(s_userPropertyMappingTableByProperty);
                    byWinNTTables.Add(s_userPropertyMappingTableByWinNT);
                    BitMask = ObjectMask.User;
                }
                else if (principalType == typeof(ComputerPrincipal))
                {
                    byPropertyTables.Add(s_computerPropertyMappingTableByProperty);
                    byWinNTTables.Add(s_computerPropertyMappingTableByWinNT);
                    BitMask = ObjectMask.Computer;
                }
                else if (principalType == typeof(GroupPrincipal))
                {
                    byPropertyTables.Add(s_groupPropertyMappingTableByProperty);
                    byWinNTTables.Add(s_groupPropertyMappingTableByWinNT);
                    BitMask = ObjectMask.Group;
                }
                else
                {
                    Debug.Assert(principalType == typeof(Principal));

                    byPropertyTables.Add(s_userPropertyMappingTableByProperty);
                    byPropertyTables.Add(s_computerPropertyMappingTableByProperty);
                    byPropertyTables.Add(s_groupPropertyMappingTableByProperty);

                    byWinNTTables.Add(s_userPropertyMappingTableByWinNT);
                    byWinNTTables.Add(s_computerPropertyMappingTableByWinNT);
                    byWinNTTables.Add(s_groupPropertyMappingTableByWinNT);
                    BitMask = ObjectMask.Principal;
                }

                if ((winNTAttribute == null) || (winNTAttribute == "*******"))
                {
                    BitMask = ObjectMask.None;
                }

                ObjectMask currentMask;
                if (s_validPropertyMap.TryGetValue(propertyName, out currentMask))
                {
                    s_validPropertyMap[propertyName] = currentMask | BitMask;
                }
                else
                {
                    s_validPropertyMap.Add(propertyName, BitMask);
                }

                // *PropertyMappingTableByProperty
                // If toWinNT is null, there's no PAPI->WinNT mapping for this property
                // (it's probably read-only, e.g., "LastLogon").
                //                if (toWinNT != null)
                //                {
                foreach (Hashtable propertyMappingTableByProperty in byPropertyTables)
                {
                    if (propertyMappingTableByProperty[propertyName] == null)
                    {
                        propertyMappingTableByProperty[propertyName] = new ArrayList();
                    }

                    ((ArrayList)propertyMappingTableByProperty[propertyName]).Add(propertyEntry);
                }
                //                }

                // *PropertyMappingTableByWinNT
                // If fromLdap is null, there's no direct WinNT->PAPI mapping for this property.
                // It's probably a property that requires custom handling, such as an IdentityClaim.
                if (fromWinNT != null)
                {
                    string winNTAttributeLower = winNTAttribute.ToLowerInvariant();

                    foreach (Hashtable propertyMappingTableByWinNT in byWinNTTables)
                    {
                        if (propertyMappingTableByWinNT[winNTAttributeLower] == null)
                        {
                            propertyMappingTableByWinNT[winNTAttributeLower] = new ArrayList();
                        }

                        ((ArrayList)propertyMappingTableByWinNT[winNTAttributeLower]).Add(propertyEntry);
                    }
                }
            }
        }