Ejemplo n.º 1
0
        public string ReturnSymbol_AfterBackslash(string str)
        {
            var reader        = new StringReader(str);
            var escapeHandler = new EscapeHandler();

            return(escapeHandler.HandleSubstring(reader));
        }
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
 protected override void OnMouseDragEnd(bool cancel)
 {
     if (this.mouseDragBase == ControlDesigner.InvalidPoint)
     {
         base.OnMouseDragEnd(cancel);
     }
     else
     {
         Rectangle mouseDragOffset = this.mouseDragOffset;
         ToolboxItem mouseDragTool = this.mouseDragTool;
         Point mouseDragBase = this.mouseDragBase;
         this.mouseDragOffset = Rectangle.Empty;
         this.mouseDragBase = ControlDesigner.InvalidPoint;
         this.mouseDragTool = null;
         this.Control.Capture = false;
         Cursor.Clip = Rectangle.Empty;
         if (!mouseDragOffset.IsEmpty && (this.graphics != null))
         {
             Rectangle rect = new Rectangle(mouseDragOffset.X - this.adornerWindowToScreenOffset.X, mouseDragOffset.Y - this.adornerWindowToScreenOffset.Y, mouseDragOffset.Width, mouseDragOffset.Height);
             int num = FrameWidth(this.mouseDragFrame);
             this.graphics.SetClip(rect);
             using (Region region = new Region(rect))
             {
                 region.Exclude(Rectangle.Inflate(rect, -num, -num));
                 base.BehaviorService.Invalidate(region);
             }
             this.graphics.ResetClip();
         }
         if (this.graphics != null)
         {
             this.graphics.Dispose();
             this.graphics = null;
         }
         if (this.dragManager != null)
         {
             this.dragManager.OnMouseUp();
             this.dragManager = null;
         }
         IEventHandlerService service = (IEventHandlerService) this.GetService(typeof(IEventHandlerService));
         if ((service != null) && (this.escapeHandler != null))
         {
             service.PopHandler(this.escapeHandler);
             this.escapeHandler = null;
         }
         if ((this.statusCommandUI != null) && !mouseDragOffset.IsEmpty)
         {
             System.Design.NativeMethods.POINT pt = new System.Design.NativeMethods.POINT(mouseDragBase.X, mouseDragBase.Y);
             System.Design.NativeMethods.MapWindowPoints(IntPtr.Zero, this.Control.Handle, pt, 1);
             if (this.statusCommandUI != null)
             {
                 this.statusCommandUI.SetStatusInformation(new Rectangle(pt.x, pt.y, mouseDragOffset.Width, mouseDragOffset.Height));
             }
         }
         if (mouseDragOffset.IsEmpty && !cancel)
         {
             if (mouseDragTool != null)
             {
                 try
                 {
                     this.CreateTool(mouseDragTool, mouseDragBase);
                     if (this.toolboxService != null)
                     {
                         this.toolboxService.SelectedToolboxItemUsed();
                     }
                 }
                 catch (Exception exception)
                 {
                     if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
                     {
                         throw;
                     }
                     base.DisplayError(exception);
                 }
             }
         }
         else if (!cancel)
         {
             if (mouseDragTool != null)
             {
                 try
                 {
                     Size size = new Size(DesignerUtils.MinDragSize.Width * 2, DesignerUtils.MinDragSize.Height * 2);
                     if (mouseDragOffset.Width < size.Width)
                     {
                         mouseDragOffset.Width = size.Width;
                     }
                     if (mouseDragOffset.Height < size.Height)
                     {
                         mouseDragOffset.Height = size.Height;
                     }
                     this.CreateTool(mouseDragTool, mouseDragOffset);
                     if (this.toolboxService != null)
                     {
                         this.toolboxService.SelectedToolboxItemUsed();
                     }
                     return;
                 }
                 catch (Exception exception2)
                 {
                     if (System.Windows.Forms.ClientUtils.IsCriticalException(exception2))
                     {
                         throw;
                     }
                     base.DisplayError(exception2);
                     return;
                 }
             }
             ISelectionService service2 = null;
             service2 = (ISelectionService) this.GetService(typeof(ISelectionService));
             if (service2 != null)
             {
                 object[] components = this.GetComponentsInRect(mouseDragOffset, true, false);
                 if (components.Length > 0)
                 {
                     service2.SetSelectedComponents(components);
                 }
             }
         }
     }
 }
 protected override void OnMouseDragBegin(int x, int y)
 {
     Control control = this.Control;
     if (!this.InheritanceAttribute.Equals(InheritanceAttribute.InheritedReadOnly))
     {
         if (this.toolboxService == null)
         {
             this.toolboxService = (IToolboxService) this.GetService(typeof(IToolboxService));
         }
         if (this.toolboxService != null)
         {
             this.mouseDragTool = this.toolboxService.GetSelectedToolboxItem((IDesignerHost) this.GetService(typeof(IDesignerHost)));
         }
     }
     control.Capture = true;
     System.Design.NativeMethods.RECT rect = new System.Design.NativeMethods.RECT();
     System.Design.NativeMethods.GetWindowRect(control.Handle, ref rect);
     Rectangle.FromLTRB(rect.left, rect.top, rect.right, rect.bottom);
     this.mouseDragFrame = (this.mouseDragTool == null) ? FrameStyle.Dashed : FrameStyle.Thick;
     this.mouseDragBase = new Point(x, y);
     ISelectionService service = (ISelectionService) this.GetService(typeof(ISelectionService));
     if (service != null)
     {
         service.SetSelectedComponents(new object[] { base.Component }, SelectionTypes.Click);
     }
     IEventHandlerService service2 = (IEventHandlerService) this.GetService(typeof(IEventHandlerService));
     if ((service2 != null) && (this.escapeHandler == null))
     {
         this.escapeHandler = new EscapeHandler(this);
         service2.PushHandler(this.escapeHandler);
     }
     this.adornerWindowToScreenOffset = base.BehaviorService.AdornerWindowToScreen();
 }
Ejemplo n.º 5
0
 private void OnEnable()
 {
     Instance = this;
 }