예제 #1
0
            static private void OnEvent_callback(IntPtr instance, IntPtr e)
            {
                DistClient client = ReferenceDictionary <DistClient> .GetObject(instance);

                if (client != null)
                {
                    DistEvent @event = Reference.CreateObject(e) as DistEvent;

                    if (@event != null)
                    {
                        if (client.UseAutoProperty && @event.GetType().IsDefined(typeof(DistPropertyAutoRestore), true))
                        {
                            @event.RestorePropertiesAndFields();
                        }

                        try
                        {
                            client.OnEvent?.Invoke(client, @event);
                        }
                        catch (Exception ex)
                        {
                            Message.SendException("DistClient", ex);
                        }
                    }
                }
            }
예제 #2
0
 private void OnEnable()
 {
     if (references == null)
     {
         references = new ReferenceDictionary();
     }
 }
예제 #3
0
        private static bool TryFindAssetReferencesAsGameObject(Object unityObject, HashSet <Object> searchedAsset,
                                                               ReferenceDictionary dictionary)
        {
            var gameObject = unityObject as GameObject;

            if (gameObject == null)
            {
                return(false);
            }

            dictionary.AddReference(gameObject);

            var prefabStatus = PrefabUtility.GetPrefabInstanceStatus(gameObject);

            if (prefabStatus == PrefabInstanceStatus.Connected)
            {
                var prefabRoot = PrefabUtility.GetNearestPrefabInstanceRoot(gameObject);
                if (prefabRoot == gameObject)
                {
                    var prefabPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(gameObject);
                    var prefab     = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath);
                    dictionary.AddReference(gameObject, prefab);
                    FindAssetReferencesRecursive(prefab, searchedAsset, dictionary);
                }
            }

            foreach (var component in gameObject.GetComponents <Component>())
            {
                FindAssetReferencesRecursive(component, searchedAsset, dictionary);
            }

            return(true);
        }
예제 #4
0
        protected override void DeepCopyMembers(Field field, ReferenceDictionary <object, object> visited)
        {
            base.DeepCopyMembers(field, visited);
            var extensionField = (ExtensionField)field;

            extensionField.ContentMapping = ContentMapping?
                                            .ToDictionary(pair => pair.Key, pair => pair.Value.DeepCopy(visited));
        }
예제 #5
0
        protected override void DeepCopyMembers(Field field, ReferenceDictionary <object, object> visited)
        {
            base.DeepCopyMembers(field, visited);
            var entityField = (EntityField)field;

            entityField.CloneDefinition = CloneDefinition?.DeepCopy(visited);
            entityField.Content         = Content?.DeepCopy(visited);
        }
예제 #6
0
        internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
        {
            if (!base.RecursiveEquals(other, visitedContents))
            {
                return(false);
            }

            return(ShowInList == ((PlainField)other).ShowInList);
        }
예제 #7
0
        internal virtual bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
        {
            if (other == null || other.GetType() != GetType())
            {
                return(false);
            }

            return(FieldId == other.FieldId);
        }
예제 #8
0
            static private void OnEvent_callback(IntPtr instance, IntPtr sender, UInt64 event_id, IntPtr a0, IntPtr a1, IntPtr a2, IntPtr a3, IntPtr a4, IntPtr a5, IntPtr a6, IntPtr a7, IntPtr a8, IntPtr a9)
            {
                DynamicEventReceiver recv = ReferenceDictionary <DynamicEventReceiver> .GetObject(instance);

                if (recv != null)
                {
                    recv.OnEvent?.Invoke(recv, Reference.CreateObject(sender) as DynamicEventInterface, event_id, new DynamicType(a0), new DynamicType(a1), new DynamicType(a2), new DynamicType(a3), new DynamicType(a4), new DynamicType(a5), new DynamicType(a6), new DynamicType(a7), new DynamicType(a8), new DynamicType(a9));
                }
            }
예제 #9
0
        protected override IEnumerable <Point> GetPoints(DataPointSegment segment)
        {
            AxisPlotDirection plotDirection = this.model.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            ReferenceDictionary <string, Delegate> valueExtractor = plotDirection == AxisPlotDirection.Vertical ? VerticalPlotValueExtractors : HorizontalPlotValueExtractors;

            foreach (Point point in StepSeriesHelper.GetPoints(segment, this.model as StepSeriesModel, this.renderPoints, valueExtractor))
            {
                yield return(point);
            }
        }
예제 #10
0
            public void Shutdown(bool wait = false)
            {
                ReferenceDictionary <DistSession> .Clear();

                ReferenceDictionary <DistClient> .Clear();

                ReferenceDictionary <DistObject> .Clear();

                DistManager_shutDown(GetNativeReference(), wait);
            }
예제 #11
0
 internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
 {
     return(base.RecursiveEquals(other, visitedContents) &&
            PreloadingMode == ((EntityField)other).PreloadingMode &&
            RelationCondition == ((EntityField)other).RelationCondition &&
            ClonePrototypeCondition == ((EntityField)other).ClonePrototypeCondition &&
            Content.RecursiveEquals(((EntityField)other).Content, visitedContents) &&
            (CloneDefinition == null
                ? ((EntityField)other).CloneDefinition == null
                : CloneDefinition.RecursiveEquals(((EntityField)other).CloneDefinition, visitedContents)));
 }
예제 #12
0
 public ObjectReferenceManager()
 {
     if (instance == null)
     {
         instance = this;
     }
     if (references == null)
     {
         references = new ReferenceDictionary();
     }
 }
예제 #13
0
            static private bool OnExec_callback(IntPtr instance, IntPtr message)
            {
                DebugCommandStation client = ReferenceDictionary <DebugCommandStation> .GetObject(instance);

                if (client != null && client.OnExec != null)
                {
                    return(client.OnExec.Invoke(Marshal.PtrToStringUni(message)));
                }

                return(true);
            }
예제 #14
0
            static private DistSession GetSession(IntPtr s)
            {
                DistSession session = ReferenceDictionary <DistSession> .GetObject(s);

                if (session == null)
                {
                    session = new DistSession(s);
                }

                return(session);
            }
예제 #15
0
            static private DistObject GetObject(IntPtr o)
            {
                DistObject obj = ReferenceDictionary <DistObject> .GetObject(o);

                if (obj == null)
                {
                    obj = Reference.CreateObject(o) as DistObject;
                }

                return(obj);
            }
예제 #16
0
            static private void OnNewObject_callback(IntPtr instance, IntPtr o, IntPtr session)
            {
                DistClient client = ReferenceDictionary <DistClient> .GetObject(instance);

                try
                {
                    client?.OnNewObject?.Invoke(client, GetObject(o), GetSession(session));
                }
                catch (Exception ex)
                {
                    Message.SendException("DistClient", ex);
                }
            }
예제 #17
0
            static private void OnTick_callback(IntPtr instance)
            {
                DistClient client = ReferenceDictionary <DistClient> .GetObject(instance);

                try
                {
                    client?.OnTick?.Invoke(client);
                }
                catch (Exception ex)
                {
                    Message.SendException($"DistClient", ex);
                }
            }
예제 #18
0
        internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
        {
            if (!base.RecursiveEquals(other, visitedContents))
            {
                return(false);
            }

            var otherAsAssociation = (Association)other;

            return(CloningMode == otherAsAssociation.CloningMode &&
                   DeletingMode == otherAsAssociation.DeletingMode &&
                   UpdatingMode == otherAsAssociation.UpdatingMode);
        }
예제 #19
0
            public DistSession GetSession(string sessionName, bool create = false, bool global = false, ServerPriority prio = ServerPriority.PRIO_NORMAL)
            {
                IntPtr s = DistManager_getSession(GetNativeReference(), sessionName, create, global, prio);

                DistSession session = ReferenceDictionary <DistSession> .GetObject(s);

                if (session == null)
                {
                    session = new DistSession(s);
                }

                return(session);
            }
예제 #20
0
        private static bool TryFindAssetReferencesAsMaterial(Object unityObject, ReferenceDictionary dictionary)
        {
            var material = unityObject as Material;

            if (material == null)
            {
                return(false);
            }

            FindMaterialReferenceRecursive(material, dictionary);

            return(true);
        }
예제 #21
0
        private UnityObjectReferenceChain(IEnumerable <Object> objects)
        {
            var hashSet    = new HashSet <Object>();
            var dictionary = new ReferenceDictionary();

            foreach (var @object in objects)
            {
                dictionary.AddReference(@object);
                FindAssetReferencesRecursive(@object, hashSet, dictionary);
            }

            Result = dictionary.CreateReadonlyDictionary();
        }
예제 #22
0
            static private void OnRemoveAttributes_callback(IntPtr instance, IntPtr notif, IntPtr o, IntPtr session)
            {
                DistClient client = ReferenceDictionary <DistClient> .GetObject(instance);

                try
                {
                    client?.OnRemoveAttributes?.Invoke(client, new DistNotificationSet(notif), GetObject(o), GetSession(session));
                }
                catch (Exception ex)
                {
                    Message.SendException("DistClient", ex);
                }
            }
예제 #23
0
        internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents)
        {
            if (!base.RecursiveEquals(other, visitedContents))
            {
                return(false);
            }

            var otherExtensionField = (ExtensionField)other;

            return(ContentMapping.Values.Count == otherExtensionField.ContentMapping.Values.Count &&
                   ContentMapping.Values
                   .All(x => otherExtensionField.ContentMapping.Values
                        .Any(y => y.ContentId == x.ContentId && x.RecursiveEquals(y, visitedContents))));
        }
예제 #24
0
        internal Field DeepCopy(ReferenceDictionary <object, object> visited)
        {
            if (visited.TryGetValue(this, out object value))
            {
                return((Field)value);
            }

            var field = (Field)MemberwiseClone();

            visited[this] = field;

            DeepCopyMembers(field, visited);

            return(field);
        }
예제 #25
0
        internal Content DeepCopy(ReferenceDictionary <object, object> visited)
        {
            if (visited.TryGetValue(this, out object value))
            {
                return((Content)value);
            }

            var content = (Content)MemberwiseClone();

            visited[this] = content;

            content.Fields = Fields?.ConvertAll(field => field.DeepCopy(visited));

            return(content);
        }
예제 #26
0
        protected override IEnumerable <Windows.Foundation.Point> GetTopPoints(DataPointSegment segment)
        {
            AxisPlotDirection plotDirection = this.model.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            ReferenceDictionary <string, Delegate> valueExtractor = plotDirection == AxisPlotDirection.Vertical ? VerticalRangePlotValueExtractors : HorizontalRangePlotValueExtractors;
            Func <DataPoint, Point> topPointGetter = (Func <DataPoint, Point>)valueExtractor[TopPointGetter];

            int pointIndex = segment.StartIndex;

            while (pointIndex <= segment.EndIndex)
            {
                var currentPoint = this.renderPoints[pointIndex];
                yield return(topPointGetter(currentPoint));

                pointIndex++;
            }
        }
예제 #27
0
            static private void OnAction_callback(IntPtr instance, NodeActionEvent action, IntPtr native_context_ref, IntPtr native_trigger_ref, IntPtr native_traverser_ref, IntPtr userdata)
            {
                NodeAction na = ReferenceDictionary <NodeAction> .GetObject(instance);

                if (na != null)
                {
                    if (action != NodeActionEvent.REMOVE)
                    {
                        na.OnAction?.Invoke(na, action, CreateObject(native_context_ref) as Context, CreateObject(native_trigger_ref) as NodeActionProvider, CreateObject(native_traverser_ref) as TraverseAction, userdata);
                    }
                    else
                    {
                        na.OnAction?.Invoke(na, action, CreateObject(native_context_ref) as Context, null, CreateObject(native_traverser_ref) as TraverseAction, native_trigger_ref);
                    }
                }
            }
예제 #28
0
    public AssemblyDefinition Resolve(AssemblyNameReference assemblyNameReference, ReaderParameters parameters)
    {
        if (parameters == null)
        {
            parameters = new ReaderParameters();
        }

        string fileFromDerivedReferences;

        if (ReferenceDictionary.TryGetValue(assemblyNameReference.Name, out fileFromDerivedReferences))
        {
            return(GetAssembly(fileFromDerivedReferences, parameters));
        }

        return(TryToReadFromDirs(assemblyNameReference, parameters));
    }
예제 #29
0
            static private void OnRemoveSession_callback(IntPtr instance, IntPtr session)
            {
                DistClient client = ReferenceDictionary <DistClient> .GetObject(instance);

                if (client != null)
                {
                    try
                    {
                        client.OnRemoveSession?.Invoke(client, GetSession(session));
                    }
                    catch (Exception ex)
                    {
                        Message.SendException("DistClient", ex);
                    }

                    ReferenceDictionary <DistSession> .RemoveObject(session);
                }
            }
예제 #30
0
        protected override IList <Point> GetBottomPoints(AreaRenderContext context)
        {
            AxisPlotDirection plotDirection = this.model.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            ReferenceDictionary <string, Delegate> valueExtractor = plotDirection == AxisPlotDirection.Vertical ? VerticalRangePlotValueExtractors : HorizontalRangePlotValueExtractors;
            Func <DataPoint, Point> bottomPointGetter             = (Func <DataPoint, Point>)valueExtractor[BottomPointGetter];

            DataPointSegment currentSegment = context.CurrentSegment;
            List <Point>     points         = new List <Point>();
            int pointIndex = currentSegment.StartIndex;

            while (pointIndex <= currentSegment.EndIndex)
            {
                var currentPoint = this.renderPoints[pointIndex];
                points.Add(bottomPointGetter(currentPoint));
                pointIndex++;
            }

            return(points);
        }