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); } } } }
private void OnEnable() { if (references == null) { references = new ReferenceDictionary(); } }
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); }
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)); }
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); }
internal override bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents) { if (!base.RecursiveEquals(other, visitedContents)) { return(false); } return(ShowInList == ((PlainField)other).ShowInList); }
internal virtual bool RecursiveEquals(Field other, ReferenceDictionary <Content, Content> visitedContents) { if (other == null || other.GetType() != GetType()) { return(false); } return(FieldId == other.FieldId); }
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)); } }
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); } }
public void Shutdown(bool wait = false) { ReferenceDictionary <DistSession> .Clear(); ReferenceDictionary <DistClient> .Clear(); ReferenceDictionary <DistObject> .Clear(); DistManager_shutDown(GetNativeReference(), wait); }
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))); }
public ObjectReferenceManager() { if (instance == null) { instance = this; } if (references == null) { references = new ReferenceDictionary(); } }
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); }
static private DistSession GetSession(IntPtr s) { DistSession session = ReferenceDictionary <DistSession> .GetObject(s); if (session == null) { session = new DistSession(s); } return(session); }
static private DistObject GetObject(IntPtr o) { DistObject obj = ReferenceDictionary <DistObject> .GetObject(o); if (obj == null) { obj = Reference.CreateObject(o) as DistObject; } return(obj); }
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); } }
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); } }
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); }
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); }
private static bool TryFindAssetReferencesAsMaterial(Object unityObject, ReferenceDictionary dictionary) { var material = unityObject as Material; if (material == null) { return(false); } FindMaterialReferenceRecursive(material, dictionary); return(true); }
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(); }
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); } }
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)))); }
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); }
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); }
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++; } }
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); } } }
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)); }
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); } }
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); }