Пример #1
0
        public int AddHandle(ulong addr, ulong obj, int hndType, uint refCnt, uint dependentTarget, ulong appDomain)
        {
            // If we fail to get the MT of this object, just skip it and keep going
            if (!GetMethodTables(obj, out ulong mt, out ulong cmt))
            {
                return(_max-- > 0 ? 1 : 0);
            }

            ClrHandle handle = new ClrHandle()
            {
                Address         = addr,
                Object          = obj,
                Type            = _heap.GetObjectType(obj),
                HandleType      = (HandleType)hndType,
                RefCount        = refCnt,
                AppDomain       = _runtime.GetAppDomainByAddress(appDomain),
                DependentTarget = dependentTarget
            };

            if (dependentTarget != 0)
            {
                handle.DependentType = _heap.GetObjectType(dependentTarget);
            }

            Handles.Add(handle);
            handle = handle.GetInteriorHandle();
            if (handle != null)
            {
                Handles.Add(handle);
            }

            // Stop if we have too many handles (likely infinite loop in dac due to
            // inconsistent data).
            return(_max-- > 0 ? 1 : 0);
        }
Пример #2
0
 public void Start()
 {
     Handles.Add(
         KojiBridge.ObservableColorOfKey(key).DidChange.Subscribe(Observable_DidChange, true)
         );
     Observable_DidChange(Color.green);
 }
Пример #3
0
        internal void AppendStackTraceForHandle(JniHandleInfo handle, string append)
        {
            if (!Handles.Contains(handle))
            {
                Handles.Add(handle);
            }

            StringBuilder stack;

            if (!stacks.TryGetValue(handle, out stack))
            {
                stacks.Add(handle, new StringBuilder(append));
                return;
            }
            if (stack.Length > 0)
            {
                stack.Append("\n");
            }
            stack.Append(append);

            if (append.Contains(".get_class_ref()"))
            {
                SetTypesFromStackTraceEntry(append, append.LastIndexOf(".get_class_ref()", StringComparison.Ordinal));
            }
            else if (append.EndsWith("..cctor()", StringComparison.Ordinal))
            {
                SetTypesFromStackTraceEntry(append, append.LastIndexOf("..cctor()", StringComparison.Ordinal));
            }
            else if (append.Contains("..ctor("))
            {
                SetTypesFromStackTraceEntry(append, append.LastIndexOf("..ctor(", StringComparison.Ordinal));
            }
        }
Пример #4
0
    public void Start()
    {
        image = GetComponent <Image>();

        observableSprite = KojiBridge.ObservableSpriteOfKey(key);
        Handles.Add(observableSprite.DidChange.Subscribe(ObservableSprite_DidChange, true));
    }
Пример #5
0
    public void Start()
    {
        tilemap = GetComponent <Tilemap>();

        observableColor = KojiBridge.ObservableColorOfKey(key);
        Handles.Add(observableColor.DidChange.Subscribe(ObservableSpriteColor_DidChange, true));
    }
Пример #6
0
        public HexagonType()
        {
            this.ShapeConcentricFill = true;

            this.Joins = JoinStyle.miter;

            this.Path = "m@0,l,10800@0,21600@1,21600,21600,10800@1,xe";

            this.Formulas = new List <string>();
            Formulas.Add("val #0");
            Formulas.Add("sum width 0 #0");
            Formulas.Add("sum height 0 #0");
            Formulas.Add("prod @0 2929 10000");
            Formulas.Add("sum width 0 @3");
            Formulas.Add("sum height 0 @3");

            this.AdjustmentValues = "5400";

            this.ConnectorLocations = "Rectangle";

            this.TextboxRectangle = "1800,1800,19800,19800;3600,3600,18000,18000;6300,6300,15300,15300";

            this.Handles = new List <Handle>();
            Handle HandleOne = new Handle();

            HandleOne.position = "#0,topLeft";
            HandleOne.xrange   = "0,10800";
            Handles.Add(HandleOne);
        }
Пример #7
0
        public int AddHandle(ulong addr, ulong obj, int hndType, uint refCnt, uint dependentTarget, ulong appDomain)
        {
            ulong mt;
            ulong cmt;

            // If we fail to get the MT of this object, just skip it and keep going
            if (!GetMethodTables(obj, out mt, out cmt))
                return _max-- > 0 ? 1 : 0;

            ClrHandle handle = new ClrHandle();
            handle.Address = addr;
            handle.Object = obj;
            handle.Type = _heap.GetObjectType(obj);
            handle.HandleType = (HandleType)hndType;
            handle.RefCount = refCnt;
            handle.AppDomain = _runtime.GetAppDomainByAddress(appDomain);
            handle.DependentTarget = dependentTarget;

            if (dependentTarget != 0)
                handle.DependentType = _heap.GetObjectType(dependentTarget);

            Handles.Add(handle);
            handle = handle.GetInteriorHandle();
            if (handle != null)
                Handles.Add(handle);

            // Stop if we have too many handles (likely infinite loop in dac due to
            // inconsistent data).
            return _max-- > 0 ? 1 : 0;
        }
Пример #8
0
        public WedgeRoundedRectCalloutType()
        {
            this.ShapeConcentricFill = false;

            this.Joins = JoinStyle.miter;

            this.Path = "m3600,qx,3600l0@8@12@24,0@9,,18000qy3600,21600l@6,21600@15@27@7,21600,18000,21600qx21600,18000l21600@9@18@30,21600@8,21600,3600qy18000,l@7,0@21@33@6,xe";

            this.Formulas = new List <string>();
            this.Formulas.Add("sum 10800 0 #0");
            this.Formulas.Add("sum 10800 0 #1");
            this.Formulas.Add("sum #0 0 #1");
            this.Formulas.Add("sum @0 @1 0");
            this.Formulas.Add("sum 21600 0 #0");
            this.Formulas.Add("sum 21600 0 #1");
            this.Formulas.Add("if @0 3600 12600");
            this.Formulas.Add("if @0 9000 18000");
            this.Formulas.Add("if @1 3600 12600");
            this.Formulas.Add("if @1 9000 18000");
            this.Formulas.Add("if @2 0 #0");
            this.Formulas.Add("if @3 @10 0");
            this.Formulas.Add("if #0 0 @11");
            this.Formulas.Add("if @2 @6 #0");
            this.Formulas.Add("if @3 @6 @13");
            this.Formulas.Add("if @5 @6 @14");
            this.Formulas.Add("if @2 #0 21600");
            this.Formulas.Add("if @3 21600 @16");
            this.Formulas.Add("if @4 21600 @17");
            this.Formulas.Add("if @2 #0 @6");
            this.Formulas.Add("if @3 @19 @6");
            this.Formulas.Add("if #1 @6 @20");
            this.Formulas.Add("if @2 @8 #1");
            this.Formulas.Add("if @3 @22 @8");
            this.Formulas.Add("if #0 @8 @23");
            this.Formulas.Add("if @2 21600 #1");
            this.Formulas.Add("if @3 21600 @25");
            this.Formulas.Add("if @5 21600 @26");
            this.Formulas.Add("if @2 #1 @8");
            this.Formulas.Add("if @3 @8 @28");
            this.Formulas.Add("if @4 @8 @29");
            this.Formulas.Add("if @2 #1 0");
            this.Formulas.Add("if @3 @31 0");
            this.Formulas.Add("if #1 0 @32");
            this.Formulas.Add("val #0");
            this.Formulas.Add("val #1");

            this.AdjustmentValues = "1350,25920";

            this.ConnectorLocations = "10800,0;0,10800;10800,21600;21600,10800;@34,@35";

            this.TextboxRectangle = "791,791,20809,20809";

            this.Handles = new List <Handle>();
            Handle HandleOne = new Handle();

            HandleOne.position = "#0,#1";
            Handles.Add(HandleOne);
        }
 private void RegisterImpl(HandleRef unmanaged)
 {
     if (!Handles.ContainsKey(unmanaged.Handle))
     {
         Handles.Add(unmanaged.Handle,
                     new Reference(GCHandle.Alloc(unmanaged.Wrapper,
                                                  GCHandleType.Weak)));
     }
 }
 private void RegisterImpl(IntPtr unmanaged)
 {
     if (!Handles.ContainsKey(unmanaged))
     {
         Handles.Add(unmanaged,
                     new Reference(GCHandle.Alloc(null,
                                                  GCHandleType.Weak)));
     }
 }
Пример #11
0
        private HookHandle AddInternal(IntPtr callback, ulong begin, ulong end, Instruction inst)
        {
            var ptr = IntPtr.Zero;

            Emulator.Bindings.HookAdd(ref ptr, Bindings.HookType.Instructions, callback, IntPtr.Zero, begin, end, inst._id);

            var handle = new HookHandle(ptr);

            Handles.Add(handle);

            return(handle);
        }
Пример #12
0
        private HookHandle AddInternal(Delegate callback, ulong begin, ulong end, Instruction inst)
        {
            var ptr         = IntPtr.Zero;
            var callbackPtr = Marshal.GetFunctionPointerForDelegate(callback);

            Emulator.Bindings.HookAdd(Emulator.Handle, ref ptr, UnicornHookType.Instructions, callbackPtr, IntPtr.Zero, begin, end, inst._id);

            var handle = new HookHandle(ptr, callback);

            Handles.Add(handle);

            return(handle);
        }
        public WedgeEllipseCalloutType()
        {
            this.ShapeConcentricFill = false;

            this.Joins = JoinStyle.miter;

            this.Path = "wr,,21600,21600@15@16@17@18l@21@22xe";

            this.Formulas = new List <string>();
            this.Formulas.Add("val #0");
            this.Formulas.Add("val #1");
            this.Formulas.Add("sum 10800 0 #0");
            this.Formulas.Add("sum 10800 0 #1");
            this.Formulas.Add("atan2 @2 @3");
            this.Formulas.Add("sumangle @4 11 0");
            this.Formulas.Add("sumangle @4 0 11");
            this.Formulas.Add("cos 10800 @4");
            this.Formulas.Add("sin 10800 @4");
            this.Formulas.Add("cos 10800 @5");
            this.Formulas.Add("sin 10800 @5");
            this.Formulas.Add("cos 10800 @6");
            this.Formulas.Add("sin 10800 @6");
            this.Formulas.Add("sum 10800 0 @7");
            this.Formulas.Add("sum 10800 0 @8");
            this.Formulas.Add("sum 10800 0 @9");
            this.Formulas.Add("sum 10800 0 @10");
            this.Formulas.Add("sum 10800 0 @11");
            this.Formulas.Add("sum 10800 0 @12");
            this.Formulas.Add("mod @2 @3 0");
            this.Formulas.Add("sum @19 0 10800");
            this.Formulas.Add("if @20 #0 @13");
            this.Formulas.Add("if @20 #1 @14");

            this.AdjustmentValues = "1350,25920";

            this.ConnectorLocations = "10800,0;3163,3163;0,10800;3163,18437;10800,21600;18437,18437;21600,10800;18437,3163;@21,@22";

            this.TextboxRectangle = "3163,3163,18437,18437";

            this.Handles = new List <Handle>();
            Handle HandleOne = new Handle();

            HandleOne.position = "#0,#1";
            Handles.Add(HandleOne);
        }
Пример #14
0
        private void Initialise()
        {
            if (Handles.Count < HandleCount)
            {
                for (var i = Handles.Count; i < HandleCount; i++)
                {
                    Handles.Add(new BrightnessSelectorHandle(i));
                }
            }
            else if (HandleCount < Handles.Count)
            {
                for (var i = HandleCount; i < Handles.Count; i++)
                {
                    Handles.RemoveAt(i);
                }
            }

            Invalidate();
        }
Пример #15
0
        private void ParseHandles(XmlReader r)
        {
            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                if (r.Name == "Handle")
                {
                    Handles.Add(new GenericPostureHandle(r));
                }
                else
                {
                    string outerXml = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in XML: {0}", outerXml);
                }
            }

            r.ReadEndElement();
        }
Пример #16
0
    public void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();

        Vector3 originalBounds = spriteRenderer.sprite.bounds.size;
        Vector3 originalScale  = spriteRenderer.transform.localScale;

        originalSize = new Vector3(
            originalBounds.x * originalScale.x,
            originalBounds.y * originalScale.y,
            originalBounds.z * originalScale.z
            );

        originalTileSize = spriteRenderer.size;

        observableSprite = KojiBridge.ObservableSpriteOfKey(key);
        Handles.Add(observableSprite.DidChange.Subscribe(ObservableSprite_DidChange, true));
        if (test != null)
        {
            ObservableSprite_DidChange(test);
        }
    }
Пример #17
0
            public ReferencedObject(SqHostObject hostObj, object obj, out ulong handleIndex)
            {
                try
                {
                    Handle = GCHandle.Alloc(obj, GCHandleType.Normal);
                }
                catch (Exception e)
                {
                    throw new Exception($"Could not allocate object of type {obj.GetType()} when making an SqHostObject: {e.ToString()}");
                }
                ReleaseHook = new Squirrel.Unmanaged.SqReleaseHook(
                    (ptr, _) =>
                {
                    unsafe
                    {
                        Handles[*(ulong *)ptr].Handle.Free();
                        Handles.Remove(*(ulong *)ptr);
                    }
                    return(1);
                }
                    );
                Index = NextHandleIndex;
                var attemptsToFindNextIndex = 0UL;

                do
                {
                    NextHandleIndex = unchecked (NextHandleIndex + 1);
                    attemptsToFindNextIndex++;
                } while (attemptsToFindNextIndex < ulong.MaxValue && Handles.ContainsKey(NextHandleIndex));
                handleIndex = Index;
                Handles.Add(handleIndex, this);

                hostObj.PushSelf();
                ScriptHandler.Squirrel.SetReleaseHook(-1, ReleaseHook);
                ScriptHandler.Squirrel.Pop(1);
            }
Пример #18
0
 internal void RegisterHandle(LocalizationUnitHandle handle)
 {
     Handles.Add(handle);
     RefreshUnitReference();
     handle.BindReference(this);
 }
Пример #19
0
 internal CurlMultiErrors TryAddHandle(CURLResource handle)
 {
     return(LastError = Handles.Add(handle) ? CurlMultiErrors.CURLM_OK : CurlMultiErrors.CURLM_ADDED_ALREADY);
 }
Пример #20
0
 public void Start()
 {
     Handles.Add(
         KojiBridge.ObservableStringOfKey(key).DidChange.Subscribe(Observable_DidChange, true)
         );
 }
 public void RegisterHandle(IUserInputReceiver handle, IPoint point)
 {
     Handles.Add(handle, point);
     handle.FingerDown += HandleOnMouseLeftButtonDown;
 }
Пример #22
0
        private void Refresh()
        {
            if (!preventAutoGUI)
            {
                Clear();

                if (Localizer.Instance == null)
                {
                    Add(new Label("Localizer is not loaded. Try refresh."));
                    return;
                }
            }

            foreach (var handle in Handles)
            {
                handle.Dispose();
            }

            Handles.Clear();
            UnaddedPacks.Clear();

            if (!string.IsNullOrEmpty(UnitPath) && !string.IsNullOrEmpty(Key))
            {
                foreach (var pack in Localizer.Instance.Packs)
                {
                    var handle = pack.RequestUnitHandle(UnitPath);
                    if (!handle.IsEmpty())
                    {
                        if (handle.TryGetText(Key, out string value))
                        {
                            Handles.Add(handle);
                            continue;
                        }
                    }

                    UnaddedPacks.Add(pack);
                    handle.Dispose();
                }
            }

            if (!preventAutoGUI)
            {
                ImguiContainer = new IMGUIContainer(() =>
                {
                    var r    = this.ImguiContainer.contentRect;
                    r.width -= 20f;
                    r.x     += 20f;
                    OnGUI(r);
                    this.ImguiContainer.style.height = GetPropertyHeight();
                });
                Add(ImguiContainer);
            }

            return;

            //以下、UIElements用コード

            /*
             *
             * var visualTree =
             *  AssetDatabase.LoadAssetAtPath(
             *      "Assets/Ruccho/ORLL/Unity/Scripts/Editor/LocalizedTextField/LocalizedTextField.uxml",
             *      typeof(VisualTreeAsset)) as VisualTreeAsset;
             * VisualElement uxml = visualTree.CloneTree();
             * this.Add(uxml);
             *
             * foreach (var handle in Handles)
             * {
             *  AddLocalizationElement(handle, Key);
             * }
             *
             *
             * refreshButton = this.Q<Button>("refresh");
             * refreshButton.clickable.clickedWithEventInfo += RefreshButton_Clicked;
             *
             * var addButton = this.Q<Button>("add");
             * var m = new ContextualMenuManipulator((e) =>
             * {
             *  if (!string.IsNullOrEmpty(UnitPath) && !string.IsNullOrEmpty(Key))
             *      foreach (var pack in Localizer.Instance.Packs)
             *      {
             *          var handle = pack.RequestUnitHandle(UnitPath);
             *          if (!handle.IsEmpty())
             *          {
             *              if (handle.TryGetText(Key, out string value))
             *              {
             *                  handle.Dispose();
             *                  continue;
             *              }
             *          }
             *
             *          handle.Dispose();
             *          e.menu.AppendAction($"{pack.Name} ({pack.Guid})", a =>
             *              {
             *                  pack.RequestUnitHandle(UnitPath, true).AddKey(Key);
             *
             *                  Refresh();
             *              },
             *              a => DropdownMenuAction.AlwaysEnabled(a));
             *      }
             * });
             * m.target = addButton;
             * m.activators.Clear();
             *
             * m.activators.Add(new ManipulatorActivationFilter() {button = MouseButton.LeftMouse, clickCount = 1});
             */
        }