protected bool Poll(int microSeconds, SelectMode mode)
        {
            fd_set readFDs = null;
            fd_set writeFDs = null;

            if (mode == SelectMode.SelectRead)
            {
                readFDs = new fd_set();
                readFDs.FD_ZERO();
                readFDs.FD_SET(mSocket);
            }
            if (mode == SelectMode.SelectWrite)
            {
                writeFDs = new fd_set();
                writeFDs.FD_ZERO();
                writeFDs.FD_SET(mSocket);
            }

            Int32 ret = select(0, readFDs, null, null, null);

            //Console.WriteLine("select returned: {0}", ret);

            if (readFDs.FD_ISSET(mSocket))
            {
                return true;
            }
            return false;
        }
Ejemplo n.º 2
0
        public void AddCallback(SelectMode mode, Socket socket, Action<Socket> callback)
        {
            _selectable.AddCallback(mode, socket, callback);

            // If we have changed the selectable sockets interup the select to wait on the new sockets.
            if (socket != _reader)
                InterruptSelect();
        }
Ejemplo n.º 3
0
 internal override bool Poll(int microseconds, SelectMode mode)
 {
     if (this.acceptedSock == null)
     {
         throw new IOException("Not accepted yet");
     }
     return this.acceptedSock.Poll(microseconds, mode);
 }
Ejemplo n.º 4
0
	public static void PreferencesGUI () {

		// Load the preferences
		if (!prefsLoaded) {
			LoadPrefs();
			prefsLoaded = true;
			OnWindowResize();
		}
		
		settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(136));
		// Geometry Settings
		GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

		_selectMode = (SelectMode)EditorGUILayout.EnumPopup("Default Selection Mode", _selectMode);
		
		_faceColor = EditorGUILayout.ColorField("Selected Face Color", _faceColor);

		_defaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", _defaultMaterial, typeof(Material), false);

		defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

		GUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Default Collider");
		defaultColliderType = (int)((ProBuilder.ColliderType)EditorGUILayout.EnumPopup( (ProBuilder.ColliderType)defaultColliderType ));
		GUILayout.EndHorizontal();

		if((ProBuilder.ColliderType)defaultColliderType == ProBuilder.ColliderType.MeshCollider)
			_forceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", _forceConvex);

		_showNotifications = EditorGUILayout.Toggle("Show Editor Notifications", _showNotifications);

		pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);

		pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will have their pivot points set to the first available vertex, ensuring that the object's vertices are placed on-grid."), pbForceGridPivot);

		GUILayout.Space(4);

		GUILayout.Label("Texture Editing Settings", EditorStyles.boldLabel);

		defaultHideFaceMask = EditorGUILayout.Toggle("Hide face mask", defaultHideFaceMask);

		EditorGUILayout.EndScrollView();

		GUILayout.Space(4);

		GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

		if(GUI.Button(resetRect, "Use defaults"))
			ResetToDefaults();

		ShortcutSelectPanel();
		ShortcutEditPanel();

		// Save the preferences
		if (GUI.changed)
			SetPrefs();
	}
Ejemplo n.º 5
0
        public IAsyncResult BeginPoll(int microSeconds,
            SelectMode mode,
            AsyncCallback callback)
        {
            AsyncPollCaller caller = new AsyncPollCaller(Poll);
            //AsyncCallback cb = new AsyncCallback(AsyncPollCallback);

            IAsyncResult result = caller.BeginInvoke(microSeconds, mode, callback, caller);

            return result;
        }
Ejemplo n.º 6
0
		public PalPanel()
		{
			this.SetStyle(ControlStyles.DoubleBuffer|ControlStyles.UserPaint|ControlStyles.AllPaintingInWmPaint,true);
			myPal = null;
			this.MouseDown+=new MouseEventHandler(mouseDown);
			//Width=(width+2*space)*NumAcross;
			//Height=(height+2*space)*NumAcross;
			clickX=-100;
			clickY=-100;
			selIdx=-1;
			mode = SelectMode.Single;
		}
Ejemplo n.º 7
0
        public ColorSelectDialog(Control parentCtrl, SelectMode mode)
        {
            InitializeComponent();

            if (mode == SelectMode.Color)
            {
                stampBButton.Visible = false;
                stampSButton.Visible = false;
                this.Width -= 206;
            }

            this.Top = parentCtrl.Top + parentCtrl.Height;
            this.Left = parentCtrl.Left;
        }
	static void SetMaterial(SelectMode sm)
	{
		switch(sm)
		{
			case SelectMode.Face:
				selectionMaterial = new Material(Shader.Find("Hidden/ProBuilder/UnlitColor"));
				break;
			case SelectMode.Vertex:
				vertexHandleSize = pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);
				selectionMaterial = new Material(Shader.Find("Hidden/ProBuilder/VertexBillboard"));
				selectionMaterial.SetTexture("_MainTex", (Texture2D)Resources.Load("Textures/VertOff", typeof(Texture2D)));
				break;
		}

		selectionMaterial.SetColor("_Color", faceSelectionColor);	// todo - remove this and use vertex colors
	}
Ejemplo n.º 9
0
        public static void Poll(this Socket socket, SelectMode mode, CancellationToken cancellationToken)
        {
            if (!cancellationToken.CanBeCanceled)
                return;

            if (socket != null)
            {
                do
                {
                    cancellationToken.ThrowIfCancellationRequested();
                } while (!socket.Poll(1000, mode));
            }

            else
                cancellationToken.ThrowIfCancellationRequested();
        }
Ejemplo n.º 10
0
        public SelectCards(Player player, IEnumerable<CardInstance> candidates, SelectMode mode, string message)
            : base(player.Game)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            else if (candidates == null)
            {
                throw new ArgumentNullException("candidates");
            }

            Player = player;
            Candidates = candidates.Where(card => !card.Behaviors.Has<Behaviors.IUnselectable>()).ToList().ToIndexable();
            Message = message ?? String.Empty;
            Mode = mode;
        }
        internal override ActionResult StartActivation()
        {
            if (!CanCreateNewPolyShape())
            {
                return(new ActionResult(ActionResult.Status.Canceled, "Canceled Create Poly Shape"));
            }

            GameObject go = new GameObject("PolyShape");

            UndoUtility.RegisterCreatedObjectUndo(go, "Create Poly Shape");
            PolyShape      poly = Undo.AddComponent <PolyShape>(go);
            ProBuilderMesh pb   = Undo.AddComponent <ProBuilderMesh>(go);

            pb.CreateShapeFromPolygon(poly.m_Points, poly.extrude, poly.flipNormals);
            EditorUtility.InitObject(pb);

            // Special case - we don't want to reset the grid pivot because we rely on it to set the active plane for
            // interaction, regardless of whether snapping is enabled or not.
            if (ProGridsInterface.SnapEnabled() || ProGridsInterface.GridVisible())
            {
                Vector3 pivot;
                if (ProGridsInterface.GetPivot(out pivot))
                {
                    go.transform.position = pivot;
                }
            }
            MeshSelection.SetSelection(go);
            poly.polyEditMode = PolyShape.PolyEditMode.Path;

            m_RestorePreviousMode       = true;
            m_PreviousMode              = ProBuilderEditor.selectMode;
            ProBuilderEditor.selectMode = SelectMode.Object;

            m_Tool = ScriptableObject.CreateInstance <PolyShapeTool>();
            ((PolyShapeTool)m_Tool).polygon = poly;
            ToolManager.SetActiveTool(m_Tool);

            Undo.RegisterCreatedObjectUndo(m_Tool, "Open PolyShape Tool");

            ToolManager.activeToolChanging     += LeaveTool;
            ProBuilderEditor.selectModeChanged += OnSelectModeChanged;

            return(new ActionResult(ActionResult.Status.Success, "Create Poly Shape"));
        }
Ejemplo n.º 12
0
        public void SetValue(string value, SelectMode selectMode)
        {
            if (selectMode == SelectMode.Value)
            {
                try
                {
                    _element.SelectByValue(value);
                }
                catch (NoSuchElementException)
                {
                    try
                    {
                        _element.SelectByText(value);
                    }
                    catch (NoSuchElementException)
                    {
                    }
                }
            }
            else if (selectMode == SelectMode.Text)
            {
                try
                {
                    _element.SelectByText(value);
                }
                catch (NoSuchElementException)
                {
                    throw new NoSuchElementException("Cannot locate option with text: " + value);
                }
            }
            else if (selectMode == SelectMode.Index)
            {
                try
                {
                    _element.SelectByIndex(Int32.Parse(value));
                }
                catch (NoSuchElementException)
                {
                    throw new NoSuchElementException("Cannot location option at index: " + value);
                }
            }

            this.OnChange();
        }
Ejemplo n.º 13
0
        internal override bool Poll(int microSeconds, SelectMode mode)
        {
            int millis = 0;

            if (microSeconds < 0)
            {
                millis = Int32.MaxValue;
            }
            else
            {
                millis = microSeconds / 1000;
            }

            UdpConnectionContract /*.Imp*/ conn = (UdpConnectionContract)m_Conn.Acquire();

            try {
                if (conn.InState(UdpConnectionContract.State.Closed /*.Value*/))
                {
                    throw new ObjectDisposedException("socket");
                }

                switch (mode)
                {
                case SelectMode.SelectRead:
                    return(PollSelectRead(conn, millis));

                //break;
                case SelectMode.SelectWrite:
                    return(PollSelectWrite(conn, millis));

                //break;
                case SelectMode.SelectError:
                    return(false);

                // We don't support any of the requisite operations
                //break;
                default:
                    throw new NotSupportedException();
                }
            }
            finally {
                m_Conn.Release(conn);
            }
        }
Ejemplo n.º 14
0
        private static bool Set(HashSet <LogLineIndex> indices, LogLineIndex index, SelectMode selectMode)
        {
            if (selectMode == SelectMode.Replace)
            {
                if (indices.Count != 1 ||
                    !indices.Contains(index))
                {
                    indices.Clear();
                    indices.Add(index);
                    return(true);
                }
            }
            else if (indices.Add(index))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 15
0
        internal static SelectMode GetTextureMode(this SelectMode mode)
        {
            if (mode.ContainsFlag(SelectMode.Face))
            {
                mode = (mode & ~SelectMode.Face) | SelectMode.TextureFace;
            }

            if (mode.ContainsFlag(SelectMode.Edge))
            {
                mode = (mode & ~SelectMode.Edge) | SelectMode.TextureEdge;
            }

            if (mode.ContainsFlag(SelectMode.Vertex))
            {
                mode = (mode & ~SelectMode.Vertex) | SelectMode.TextureVertex;
            }

            return(mode);
        }
Ejemplo n.º 16
0
        private void btnScanFill_Click(object sender, EventArgs e)
        {
            if (isRender == true || selectedID == -1)
            {
                return;
            }
            selectMode = SelectMode.SCANLINE;
            openGLControl.OpenGL.RenderMode(OpenGL.GL_RENDER);
            shapes[selectedID].fillColor = fillColor;
            shapes[selectedID].isFill    = true;
            shapes[selectedID].fillType  = FillType.SCANLINE;
            Filler fill = new Filler(openGLControl.OpenGL);
            double time = fill.ScanFill(shapes[selectedID], shapes[selectedID].fillColor);

            SwitchMode();

            txtTime.Text = time.ToString() + "ms";
            ;
        }
Ejemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        btn_Normal.onClick.AddListener(() =>
        {
            selectType = SelectMode.Normal;
            SceneManager.LoadScene("Main");
        });
        btn_Hard.onClick.AddListener(() =>
        {
            selectType = SelectMode.Hard;
            SceneManager.LoadScene("Main");
        });

        btn_NoEnd.onClick.AddListener(() =>
        {
            selectType = SelectMode.NoEnd;
            SceneManager.LoadScene("Main");
        });
    }
 private void OnDecideMode(SelectMode iMode)
 {
     Object.Destroy(this._ctrlTitleSelectMode.get_gameObject());
     Mem.Del <CtrlTitleSelectMode>(ref this._ctrlTitleSelectMode);
     if (iMode != SelectMode.Appointed)
     {
         if (iMode == SelectMode.Inheriting)
         {
             Observable.FromCoroutine <AsyncOperation>((IObserver <AsyncOperation> observer) => TitleTaskManager.GotoLoadScene(observer)).Subscribe(delegate(AsyncOperation x)
             {
                 x.set_allowSceneActivation(true);
             }).AddTo(base.get_gameObject());
         }
     }
     else
     {
         TitleTaskManager.ReqMode(TitleTaskManagerMode.NewGame);
     }
 }
Ejemplo n.º 19
0
        public new bool Poll(int microSeconds, SelectMode mode)
        {
            int[] fileDescriptorSet = new int[2] {
                1, _socket
            };
            int result = NativeMethods.select(0, mode == SelectMode.SelectRead ? fileDescriptorSet : null, mode == SelectMode.SelectWrite ? fileDescriptorSet : null, mode == SelectMode.SelectError ? fileDescriptorSet : null, IntPtr.Zero);

            if (result == -1)
            {
                ThrowOnSocketError(result, true);
            }

            if (fileDescriptorSet[0] == 0)
            {
                return(false);
            }

            return(fileDescriptorSet[1] == _socket);
        }
Ejemplo n.º 20
0
    public static void LoadPrefs()
    {
        _faceColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultFaceColor );

        pbDefaultSelectedVertexColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultSelectedVertexColor );
        pbDefaultVertexColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultVertexColor );

        if(!EditorPrefs.HasKey( pb_Constant.pbDefaultOpenInDockableWindow))
            EditorPrefs.SetBool(pb_Constant.pbDefaultOpenInDockableWindow, true);

        defaultHideFaceMask = (EditorPrefs.HasKey(pb_Constant.pbDefaultHideFaceMask)) ? EditorPrefs.GetBool(pb_Constant.pbDefaultHideFaceMask) : false;

        defaultOpenInDockableWindow = EditorPrefs.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);

        pbDefaultSelectionMode = pb_Preferences_Internal.GetEnum<SelectMode>(pb_Constant.pbDefaultSelectionMode);
        defaultColliderType = (int)pb_Preferences_Internal.GetEnum<ColliderType>(pb_Constant.pbDefaultCollider);

        pbDragCheckLimit 	= pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex 		= pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot 	= pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot 	= pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);

        pbPerimeterEdgeExtrusionOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeExtrusionOnly);
        pbPerimeterEdgeBridgeOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);

        pbPBOSelectionOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);

        pbVertexHandleSize = pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);

        if(EditorPrefs.HasKey(pb_Constant.pbDefaultMaterial))
        {
            _defaultMaterial = (Material) AssetDatabase.LoadAssetAtPath(pb_Constant.pbDefaultMaterial, typeof(Material));
            if(_defaultMaterial == null)
                _defaultMaterial = pb_Constant.DefaultMaterial;
        }

        defaultShortcuts = EditorPrefs.HasKey(pb_Constant.pbDefaultShortcuts) ?
            pb_Shortcut.ParseShortcuts(EditorPrefs.GetString(pb_Constant.pbDefaultShortcuts)) :
            pb_Shortcut.DefaultShortcuts();

        _showNotifications = EditorPrefs.HasKey(pb_Constant.pbShowEditorNotifications) ?
            EditorPrefs.GetBool(pb_Constant.pbShowEditorNotifications) : true;
    }
Ejemplo n.º 21
0
        public static SocketError Poll(SafeCloseSocket handle, int microseconds, SelectMode mode, out bool status)
        {
            IntPtr rawHandle = handle.DangerousGetHandle();

            IntPtr[] fileDescriptorSet = new IntPtr[2] {
                (IntPtr)1, rawHandle
            };
            Interop.Winsock.TimeValue IOwait = new Interop.Winsock.TimeValue();

            // A negative timeout value implies an indefinite wait.
            int socketCount;

            if (microseconds != -1)
            {
                MicrosecondsToTimeValue((long)(uint)microseconds, ref IOwait);
                socketCount =
                    Interop.Winsock.select(
                        0,
                        mode == SelectMode.SelectRead ? fileDescriptorSet : null,
                        mode == SelectMode.SelectWrite ? fileDescriptorSet : null,
                        mode == SelectMode.SelectError ? fileDescriptorSet : null,
                        ref IOwait);
            }
            else
            {
                socketCount =
                    Interop.Winsock.select(
                        0,
                        mode == SelectMode.SelectRead ? fileDescriptorSet : null,
                        mode == SelectMode.SelectWrite ? fileDescriptorSet : null,
                        mode == SelectMode.SelectError ? fileDescriptorSet : null,
                        IntPtr.Zero);
            }

            if ((SocketError)socketCount == SocketError.SocketError)
            {
                status = false;
                return(GetLastSocketError());
            }

            status = (int)fileDescriptorSet[0] != 0 && fileDescriptorSet[1] == rawHandle;
            return(SocketError.Success);
        }
Ejemplo n.º 22
0
        // Get the object & mesh selection that the mouse is currently nearest.
        // A ProBuilderMesh is returned because double click actions need to know what the last selected pb_Object was.
        // If deepClickOffset is specified, the object + deepClickOffset in the deep select stack will be returned (instead of next).
        internal static float MouseRayHitTest(
            Vector3 mousePosition,
            SelectMode selectionMode,
            ScenePickerPreferences pickerOptions,
            SceneSelection selection,
            bool allowUnselected = false)
        {
            if (selectionMode.ContainsFlag(SelectMode.Edge | SelectMode.TextureEdge))
            {
                return(EdgeRaycast(mousePosition, pickerOptions, allowUnselected, selection));
            }

            if (selectionMode.ContainsFlag(SelectMode.Vertex | SelectMode.TextureVertex))
            {
                return(VertexRaycast(mousePosition, pickerOptions, allowUnselected, selection));
            }

            return(FaceRaycast(mousePosition, pickerOptions, allowUnselected, selection, 0, true));
        }
Ejemplo n.º 23
0
 public void SetCurrent(View P, SelectMode Mode)
 {
     if ((Current != P))
     {
         Lock();
         FocusView(Current, false);
         if (Mode != SelectMode.EnterSelect)
         {
             SelectView(Current, false);
         }
         if (Mode != SelectMode.LeaveSelect)
         {
             SelectView(P, true);
         }
         FocusView(P, true);
         Current = P;
         Unlock();
     }
 }
Ejemplo n.º 24
0
        public void SetValues(string[] values, SelectMode selectMode)
        {
            foreach (var value in values)
            {
                SetValue(value, selectMode);
            }

            if (_element.AllSelectedOptions.Count == 0)
            {
                if (selectMode == SelectMode.Value)
                {
                    throw new SelectException("Selection failed. No option values matched collection provided.");
                }
                else if (selectMode == SelectMode.Text)
                {
                    throw new SelectException("Selection failed. No options text matched collection provided.");
                }
            }
        }
Ejemplo n.º 25
0
        public void SelectCurrentField(TekFieldView newfield)
        {
            if (newfield == null)
            {
                CurrentMode = SelectMode.smNone;
            }
            else
            {
                if (CurrentMode == SelectMode.smNone)
                {
                    _currentMode = SelectMode.smSingle;
                }
                switch (CurrentMode)
                {
                case SelectMode.smSingle:
                    if (_currentFieldView != null && _currentFieldView.IsSelected)
                    {
                        _currentFieldView.SetSelected(false);
                    }
                    newfield.SetSelected(!newfield.IsSelected);
                    foreach (TekFieldView field in MultiselectFieldView)
                    {
                        field.SetMultiSelected(false);
                    }
                    MultiselectFieldView.Clear();
                    break;

                case SelectMode.smMultiple:
                    newfield.SetMultiSelected(!newfield.IsMultiSelected);
                    if (!MultiselectFieldView.Contains(newfield))
                    {
                        MultiselectFieldView.Add(newfield);
                    }
                    else
                    {
                        MultiselectFieldView.Remove(newfield);
                    }
                    break;
                }
                _currentFieldView = newfield;
            }
        }
        void map_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if ((Keyboard.Modifiers & ModifierKeys.Shift) == 0)
            {
                SelectedElements.Clear();
            }

            switch (selectMode)
            {
            case SelectMode.Click:
                foreach (var shape in from shape in shapes let g2 = e.GetPosition(shape) let x = shape.InputHitTest(g2) where x == shape select shape)
                {
                    if (SelectedElements.Contains(shape))
                    {
                        SelectedElements.Remove(shape);
                    }
                    else
                    {
                        SelectedElements.Add(shape);
                    }
                }
                break;

            case SelectMode.Polygon:
            {
                CanvasToPtvMercator(e.GetPosition(map));
                // mapControl.PanAndZoom.IsActive = true;
                polyPoints.Add(polyPoints[0]);

                foreach (var shape in from shape in shapes let pp1 = (new Point(GetLeft(shape), GetTop(shape))) let x = dragPolygon.InputHitTest(pp1) where x == dragPolygon where !SelectedElements.Contains(shape) select shape)
                {
                    SelectedElements.Add(shape);
                }

                Children.Remove(dragPolygon);
                dragPolygon = null;
            }
            break;
            }

            selectMode = SelectMode.None;
        }
Ejemplo n.º 27
0
    public void FaceSelectFloodFill(Voxel voxel, int faceI, Substance substance)
    {
        if (voxel == null)
        {
            return;
        }
        if (voxel.substance != substance)
        {
            return;
        }
        VoxelFace face = voxel.faces[faceI];

        if (face.IsEmpty())
        {
            return;
        }
        if (face.addSelected || face.storedSelected) // stop at boundaries of stored selection
        {
            return;
        }
        SelectFace(voxel, faceI);

        Vector3 position = voxel.transform.position;

        for (int sideNum = 0; sideNum < 4; sideNum++)
        {
            int     sideFaceI = Voxel.SideFaceI(faceI, sideNum);
            Vector3 newPos    = position + Voxel.OppositeDirectionForFaceI(sideFaceI);
            FaceSelectFloodFill(VoxelAt(newPos, false), faceI, substance);
        }

        if (selectMode != SelectMode.FACE)
        {
            selectionBounds = voxel.GetFaceBounds(faceI);
        }
        else
        {
            selectionBounds.Encapsulate(voxel.GetFaceBounds(faceI));
        }
        selectMode = SelectMode.FACE;
        SetMoveAxes(position + new Vector3(0.5f, 0.5f, 0.5f) - Voxel.OppositeDirectionForFaceI(faceI) / 2);
    }
Ejemplo n.º 28
0
        void Poll(SelectMode mode, CancellationToken cancellationToken)
        {
            if (!cancellationToken.CanBeCanceled)
            {
                return;
            }

            if (Socket != null)
            {
                do
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    // wait 1/4 second and then re-check for cancellation
                } while (!Socket.Poll(250000, mode));
            }
            else
            {
                cancellationToken.ThrowIfCancellationRequested();
            }
        }
Ejemplo n.º 29
0
        public void Finish()
        {
            //rev3 note temp remark...
            try
            {
                mSelect = SelectMode.Single;

                mUltraTree.MouseClick -= mUltraTree_MouseClick;

                //rev2 multi selection시에 clear  되지 않도록 변경.
                ClearSelection();

                RemoveToolsOnDesignExplorer(mExplorerTreeConfig);
                SetSignSelectMenu(mExplorerTreeConfig.ContextMenu);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 30
0
 private void SelectMode_SelectedIndexChanged(object sender, EventArgs e)
 {
     // CheckComPorts();
     if (SelectMode.GetSelected(0))
     {
         textBox1.Clear();
         kyMChkBx.Checked       = true;
         kyMChkBx2.Checked      = false;
         KeyControlls48.Visible = true;
         textBox1.AppendText("48 KEYMODE SELECTED\n");
     }
     else if (SelectMode.GetSelected(1))
     {
         textBox1.Clear();
         kyMChkBx2.Checked      = true;
         kyMChkBx.Checked       = false;
         KeyControlls48.Visible = false;
         textBox1.AppendText("24 KEYMODE SELECTED\n");
     }
 }
Ejemplo n.º 31
0
        private void SelectItems(SelectMode mode)
        {
            foreach (ListViewItem item in lvwFiles.Items)
            {
                switch (mode)
                {
                case SelectMode.All:
                    item.Checked = true;
                    break;

                case SelectMode.None:
                    item.Checked = false;
                    break;

                case SelectMode.Change:
                    item.Checked = !item.Checked;
                    break;
                }
            }
        }
Ejemplo n.º 32
0
        public static void Poll(this Socket socket, SelectMode mode, CancellationToken cancellationToken)
        {
            if (!cancellationToken.CanBeCanceled)
            {
                return;
            }

            if (socket != null)
            {
                do
                {
                    cancellationToken.ThrowIfCancellationRequested();
                } while (!socket.Poll(1000, mode));
            }

            else
            {
                cancellationToken.ThrowIfCancellationRequested();
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// 点を選択してドラック出来る状態か検索する クリックしたときに呼ぶ
        /// </summary>
        ///  /// <param name="mouse"></param>
        public void SearchSelectPoint(MouseEventArgs mouse)
        {
            var pontcnt = m_list.Count();

            //すべての開始点を調べる
            for (int i = 0; i < pontcnt; i++)
            {
                if (isSearchSelectStartPoint(mouse, i))
                {
                    //開始点を選択
                    m_SelectPoint      = i;
                    m_isMoveStartPoint = true;

                    m_SelectMode = SelectMode.SelectStart;
                    return;
                }
            }
            //制御点1を選択
            if (isSearchSelectControlPoint(mouse))
            {
                m_isMoveControl1Point = true;
                return;
            }
            //制御点2を選択
            if (isSearchSelectContro2Point(mouse))
            {
                m_isMoveControl2Point = true;
                return;
            }
            //終了点を選択
            if (isSearchSelectEndPoint(mouse))
            {
                m_isMoveEndPoint = true;
                m_SelectMode     = SelectMode.SelectEnd;
                return;
            }
            //無選択
            m_isMoveStartPoint = false;
            m_isMoveEndPoint   = false;
            m_SelectMode       = SelectMode.None;
        }
        public bool Poll(uint id, SelectMode sm)
        {
            if ((sm == SelectMode.SelectRead))
            {
                if (mReadDone.WaitOne(TIMEOUT_MILLISECONDS))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if ((sm == SelectMode.SelectWrite))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 35
0
        public void SetSelected(IEnumerable <LogLineIndex> indices, SelectMode selectMode)
        {
            if (selectMode == SelectMode.Replace)
            {
                _selectedIndices.Clear();
                if (indices != null)
                {
                    foreach (LogLineIndex index in indices)
                    {
                        _selectedIndices.Add(index);
                    }
                }

                var fn = OnSelectionChanged;
                fn?.Invoke(_selectedIndices);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 36
0
    public static void LoadPrefs()
    {
        _faceColor = pb_Preferences_Internal.GetColor(pb_Constant.pbDefaultFaceColor);

        if (!EditorPrefs.HasKey(pb_Constant.pbDefaultOpenInDockableWindow))
        {
            EditorPrefs.SetBool(pb_Constant.pbDefaultOpenInDockableWindow, true);
        }

        defaultHideFaceMask = (EditorPrefs.HasKey(pb_Constant.pbDefaultHideFaceMask)) ? EditorPrefs.GetBool(pb_Constant.pbDefaultHideFaceMask) : false;

        defaultOpenInDockableWindow = EditorPrefs.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);

        pbDefaultSelectionMode = pb_Preferences_Internal.GetEnum <SelectMode>(pb_Constant.pbDefaultSelectionMode);
        defaultColliderType    = (int)pb_Preferences_Internal.GetEnum <ProBuilder.ColliderType>(pb_Constant.pbDefaultCollider);

        pbDragCheckLimit   = pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex      = pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot   = pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot = pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);

        pbPerimeterEdgeExtrusionOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeExtrusionOnly);
        pbPerimeterEdgeBridgeOnly    = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);

        if (EditorPrefs.HasKey(pb_Constant.pbDefaultMaterial))
        {
            _defaultMaterial = (Material)Resources.LoadAssetAtPath(pb_Constant.pbDefaultMaterial, typeof(Material));
            if (_defaultMaterial == null)
            {
                _defaultMaterial = ProBuilder.DefaultMaterial;
            }
        }

        defaultShortcuts = EditorPrefs.HasKey(pb_Constant.pbDefaultShortcuts) ?
                           pb_Shortcut.ParseShortcuts(EditorPrefs.GetString(pb_Constant.pbDefaultShortcuts)) :
                           pb_Shortcut.DefaultShortcuts();

        _showNotifications = EditorPrefs.HasKey(pb_Constant.pbShowEditorNotifications) ?
                             EditorPrefs.GetBool(pb_Constant.pbShowEditorNotifications) : true;
    }
Ejemplo n.º 37
0
        void DrawSceneHandlesInternal(SelectMode mode)
        {
            if (Event.current.type != EventType.Repaint)
                return;

            // Update the scale based on EditorGUIUtility.pixelsPerPoints in case the DPI would have changed.
            SetMaterialsScaleAttribute();

            switch (mode)
            {
                case SelectMode.Edge:
                case SelectMode.TextureEdge:
                {
                    // When in Edge mode, use the same material for wireframe
                    Render(m_WireHandles, m_ForceEdgeLinesGL ? m_GlWireMaterial : m_EdgeMaterial, s_EdgeUnselectedColor, CompareFunction.LessEqual, false);
                    Render(m_SelectedEdgeHandles, m_ForceEdgeLinesGL ? m_GlWireMaterial : m_EdgeMaterial, s_EdgeSelectedColor, s_DepthTestHandles ? CompareFunction.LessEqual : CompareFunction.Always, true);
                    break;
                }
                case SelectMode.Face:
                case SelectMode.TextureFace:
                {
                    Render(m_WireHandles, m_ForceWireframeLinesGL ? m_GlWireMaterial : m_WireMaterial, s_WireframeColor, CompareFunction.LessEqual, false);
                    Render(m_SelectedFaceHandles, m_FaceMaterial, s_FaceSelectedColor, s_DepthTestHandles);
                    break;
                }
                case SelectMode.Vertex:
                case SelectMode.TextureVertex:
                {
                    Render(m_WireHandles, m_ForceWireframeLinesGL ? m_GlWireMaterial : m_WireMaterial, s_WireframeColor, CompareFunction.LessEqual, false);
                    Render(m_VertexHandles, m_VertMaterial, s_VertexUnselectedColor, CompareFunction.LessEqual, false);
                    Render(m_SelectedVertexHandles, m_VertMaterial, s_VertexSelectedColor, s_DepthTestHandles);
                    break;
                }
                default:
                {
                    Render(m_WireHandles, m_ForceWireframeLinesGL ? m_GlWireMaterial : m_WireMaterial, s_WireframeColor, CompareFunction.LessEqual, false);
                    break;
                }
            }
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Checks for context socket availability.
        /// Socket.Poll supports integer as microseconds parameter.
        /// This limits the usable command timeout value
        /// to 2,147 seconds: (2,147 x 1,000,000 less than  max_int).
        /// In order to bypass this limit, the availability of
        /// the socket is checked in 2,147 seconds cycles
        /// </summary>
        /// <returns><c>true</c>, if for context socket availability was checked, <c>false</c> otherwise.</returns>
        /// <param name="context">Context.</param>
        /// <param name="selectMode">Select mode.</param>
        internal bool CheckForContextSocketAvailability(NpgsqlConnector context, SelectMode selectMode)
        {
            /* Socket.Poll supports integer as microseconds parameter.
             * This limits the usable command timeout value
             * to 2,147 seconds: (2,147 x 1,000,000 < max_int).
             */
            const int limitOfSeconds = 2147;

            bool socketPoolResponse = false;
            int  secondsToWait      = context.Mediator.CommandTimeout;

            /* In order to bypass this limit, the availability of
             * the socket is checked in 2,147 seconds cycles
             */
            while ((secondsToWait > limitOfSeconds) && (!socketPoolResponse))      //
            {
                socketPoolResponse = context.Socket.Poll(1000000 * limitOfSeconds, selectMode);
                secondsToWait     -= limitOfSeconds;
            }

            return(socketPoolResponse || context.Socket.Poll(1000000 * secondsToWait, selectMode));
        }
Ejemplo n.º 39
0
    private void Start()
    {
        _gameManager = FindObjectOfType <GameManager>();

        if (this.sceneName == "Game" && !_gameManager.isVs)
        {
            if (_gameManager.caloriesQuantity > _gameManager.caloriesToGet)
            {
                index = 0;
            }
            else
            {
                index = 1;
            }
        }
        if (this.sceneName == "Menu")
        {
            _selectMode      = FindObjectOfType <SelectMode>();
            this.sceneToLoad = _selectMode.sceneToLoad;
        }
        StartCoroutine(TypeRoutine());
    }
Ejemplo n.º 40
0
        /* This overload is needed as the async Connect method
         * also needs to check the socket error status, but
         * getsockopt(..., SO_ERROR) clears the error.
         */
        internal bool Poll(int time_us, SelectMode mode, out int socket_error)
        {
            if (disposed && closed)
            {
                throw new ObjectDisposedException(GetType().ToString());
            }

            if (mode != SelectMode.SelectRead &&
                mode != SelectMode.SelectWrite &&
                mode != SelectMode.SelectError)
            {
                throw new NotSupportedException("'mode' parameter is not valid.");
            }

            int  error;
            bool result = Poll_internal(socket, mode, time_us, out error);

            if (error != 0)
            {
                throw new SocketException(error);
            }

            socket_error = (int)GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);

            if (mode == SelectMode.SelectWrite && result)
            {
                /* Update the connected state; for
                 * non-blocking Connect()s this is
                 * when we can find out that the
                 * connect succeeded.
                 */
                if (socket_error == 0)
                {
                    connected = true;
                }
            }

            return(result);
        }
Ejemplo n.º 41
0
 public void SubstanceSelect(Substance substance)
 {
     foreach (Voxel v in substance.voxels)
     {
         for (int i = 0; i < 6; i++)
         {
             if (!v.faces[i].IsEmpty())
             {
                 SelectFace(v, i);
                 if (selectMode != SelectMode.SURFACE)
                 {
                     selectionBounds = v.GetFaceBounds(i);
                 }
                 else
                 {
                     selectionBounds.Encapsulate(v.GetFaceBounds(i));
                 }
                 selectMode = SelectMode.SURFACE;
             }
         }
     }
 }
Ejemplo n.º 42
0
 public void RemoveCallback(SelectMode mode, Socket socket)
 {
     lock (_gate)
     {
         switch (mode)
         {
             case SelectMode.SelectRead:
                 _readCallbacks.Remove(socket);
                 break;
             case SelectMode.SelectWrite:
                 var callbackQueue = _writeCallbacks[socket];
                 callbackQueue.Dequeue();
                 if (callbackQueue.Count == 0)
                     _writeCallbacks.Remove(socket);
                 break;
             case SelectMode.SelectError:
                 _errorCallbacks.Remove(socket);
                 break;
             default:
                 throw new ArgumentOutOfRangeException("mode");
         }
     }
 }
Ejemplo n.º 43
0
        public void AddCallback(SelectMode mode, Socket socket, Action<Socket> callback)
        {
            lock (_gate)
            {
                switch (mode)
                {
                    case SelectMode.SelectRead:
                        _readCallbacks.Add(socket, callback);
                        break;
                    case SelectMode.SelectWrite:
                        Queue<Action<Socket>> callbackQueue;
                        if (!_writeCallbacks.TryGetValue(socket, out callbackQueue))
                            _writeCallbacks.Add(socket, callbackQueue = new Queue<Action<Socket>>());
                        callbackQueue.Enqueue(callback);
                        break;
                    case SelectMode.SelectError:
                        _errorCallbacks.Add(socket, callback);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException("mode");
                }

            }
        }
Ejemplo n.º 44
0
		extern static bool Poll_internal (IntPtr socket, SelectMode mode, int timeout, out int error);
Ejemplo n.º 45
0
		static bool Poll_internal (SafeSocketHandle safeHandle, SelectMode mode, int timeout, out int error)
		{
			bool release = false;
			try {
				safeHandle.DangerousAddRef (ref release);
				return Poll_internal (safeHandle.DangerousGetHandle (), mode, timeout, out error);
			} finally {
				if (release)
					safeHandle.DangerousRelease ();
			}
		}
Ejemplo n.º 46
0
		public bool Poll (int time_us, SelectMode mode)
		{
			ThrowIfDisposedAndClosed ();

			if (mode != SelectMode.SelectRead && mode != SelectMode.SelectWrite && mode != SelectMode.SelectError)
				throw new NotSupportedException ("'mode' parameter is not valid.");

			int error;
			bool result = Poll_internal (safe_handle, mode, time_us, out error);

			if (error != 0)
				throw new SocketException (error);

			if (mode == SelectMode.SelectWrite && result && !is_connected) {
				/* Update the is_connected state; for non-blocking Connect()
				 * this is when we can find out that the connect succeeded. */
				if ((int) GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error) == 0)
					is_connected = true;
			}

			return result;
		}
 /// <summary>
 /// 学籍异动类型
 /// </summary>
 /// <returns></returns>
 public static SelectList StudentEnrolmentChangeTypeList(SelectMode mode = SelectMode.Default)
 {
     return SelectListFactory.ToSelectList(mode, _studentEnrolmentChangeTypes);
 }
Ejemplo n.º 48
0
        // Determines the status of the socket.
        public bool Poll(int microSeconds, SelectMode mode)
        {
            if (CleanedUp)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            bool status;
            SocketError errorCode = SocketPal.Poll(_handle, microSeconds, mode, out status);
            GlobalLog.Print("Socket#" + Logging.HashString(this) + "::Poll() Interop.Winsock.select returns socketCount:" + (int)errorCode);

            // Throw an appropriate SocketException if the native call fails.
            if (errorCode != SocketError.Success)
            {
                // Update the internal state of this socket according to the error before throwing.
                SocketException socketException = new SocketException((int)errorCode);
                UpdateStatusAfterSocketError(socketException);
                if (s_loggingEnabled)
                {
                    Logging.Exception(Logging.Sockets, this, "Poll", socketException);
                }
                throw socketException;
            }

            return status;
        }
Ejemplo n.º 49
0
        internal bool Poll(int microSeconds, SelectMode mode) {
            if (m_CleanedUp){
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            Socket chkStreamSocket = m_StreamSocket;
            if (chkStreamSocket == null) {
                throw new IOException(SR.GetString(SR.net_io_readfailure, SR.GetString(SR.net_io_connectionclosed)));
            }

            return chkStreamSocket.Poll(microSeconds, mode);
        }
Ejemplo n.º 50
0
 public override void SelectObjects(IEnumerable<CamViewState.SelObj> selObjEnum, SelectMode mode = SelectMode.Set)
 {
     base.SelectObjects(selObjEnum, mode);
     DualityEditorApp.Select(this, new ObjectSelection(selObjEnum.Select(s => s.ActualObject)), mode);
 }
Ejemplo n.º 51
0
        /// <devdoc>
        ///    <para>
        ///       Determines the status of the socket.
        ///    </para>
        /// </devdoc>
        public bool Poll(int microSeconds, SelectMode mode) {
            if (CleanedUp) {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            IntPtr handle = m_Handle.DangerousGetHandle();
            IntPtr[] fileDescriptorSet = new IntPtr[2] { (IntPtr) 1, handle };
            TimeValue IOwait = new TimeValue();

            //
            // negative timeout value implies indefinite wait
            //
            int socketCount;
            if (microSeconds != -1) {
                MicrosecondsToTimeValue((long)(uint)microSeconds, ref IOwait);
                socketCount =
                    UnsafeNclNativeMethods.OSSOCK.select(
                        0,
                        mode==SelectMode.SelectRead ? fileDescriptorSet : null,
                        mode==SelectMode.SelectWrite ? fileDescriptorSet : null,
                        mode==SelectMode.SelectError ? fileDescriptorSet : null,
                        ref IOwait);
            }
            else {
                socketCount =
                    UnsafeNclNativeMethods.OSSOCK.select(
                        0,
                        mode==SelectMode.SelectRead ? fileDescriptorSet : null,
                        mode==SelectMode.SelectWrite ? fileDescriptorSet : null,
                        mode==SelectMode.SelectError ? fileDescriptorSet : null,
                        IntPtr.Zero);
            }
            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Poll() UnsafeNclNativeMethods.OSSOCK.select returns socketCount:" + socketCount);

            //
            // if the native call fails we'll throw a SocketException
            //
            if ((SocketError)socketCount==SocketError.SocketError) {
                //
                // update our internal state after this socket error and throw
                //
                SocketException socketException = new SocketException();
                UpdateStatusAfterSocketError(socketException);
                if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "Poll", socketException);
                throw socketException;
            }
            if ((int)fileDescriptorSet[0]==0) {
                return false;
            }
            return fileDescriptorSet[1] == handle;
        }
Ejemplo n.º 52
0
        public static unsafe SocketError Poll(SafeCloseSocket handle, int microseconds, SelectMode mode, out bool status)
        {
            uint* fdSet = stackalloc uint[Interop.Sys.FD_SETSIZE_UINTS];
            Interop.Sys.FD_ZERO(fdSet);

            Interop.Sys.FD_SET(handle.FileDescriptor, fdSet);

            int fdCount = 0;
            uint* readFds = null;
            uint* writeFds = null;
            uint* errorFds = null;
            switch (mode)
            {
                case SelectMode.SelectRead:
                    readFds = fdSet;
                    fdCount = handle.FileDescriptor + 1;
                    break;

                case SelectMode.SelectWrite:
                    writeFds = fdSet;
                    fdCount = handle.FileDescriptor + 1;
                    break;

                case SelectMode.SelectError:
                    errorFds = fdSet;
                    fdCount = handle.FileDescriptor + 1;
                    break;
            }

            int socketCount = 0;
            Interop.Error err = Interop.Sys.Select(fdCount, readFds, writeFds, errorFds, microseconds, &socketCount);
            if (err != Interop.Error.SUCCESS)
            {
                status = false;
                return GetSocketErrorForErrorCode(err);
            }

            status = Interop.Sys.FD_ISSET(handle.FileDescriptor, fdSet);
            return SocketError.Success;
        }
Ejemplo n.º 53
0
		/// <summary>
		/// Determines the status of the VirtualSocket.
		/// </summary>
		/// <param name="microSeconds">The time to wait for a response, in microseconds.</param>
		/// <param name="mode">One of the <see cref="SelectMode"/> values.</param>
		/// <returns>See the Socket documentation for the return values.</returns>
		/// <remarks>This property is not supported for SSL/TLS sockets. It can only be used if the SecureProtocol is set to None. Asynchronous behavior in SSL or TLS mode can be achieved by calling the asynchronous methods.</remarks>
		/// <exception cref="NotSupportedException">The mode parameter is not one of the SelectMode values -or- the socket is in SSL or TLS mode.</exception>
		/// <exception cref="SocketException">An operating system error occurs while accessing the VirtualSocket.</exception>
		/// <exception cref="ObjectDisposedException">The VirtualSocket has been closed.</exception>
		/// <remarks>Set microSeconds parameter to a negative integer if you would like to wait indefinitely for a response.</remarks>
		public override bool Poll(int microSeconds, SelectMode mode) {
			if (SecureProtocol != SecureProtocol.None)
				throw new NotSupportedException("The Poll method is not supported in SSL or TLS mode. Use the asynchronous methods and the Available property instead.");
			return base.Poll(microSeconds, mode);
		}
Ejemplo n.º 54
0
		void Poll (SelectMode mode, CancellationToken cancellationToken)
		{
#if NETFX_CORE
			cancellationToken.ThrowIfCancellationRequested ();
#else
			if (!cancellationToken.CanBeCanceled)
				return;

			if (Socket != null) {
				do {
					cancellationToken.ThrowIfCancellationRequested ();
					// wait 1/4 second and then re-check for cancellation
				} while (!Socket.Poll (250000, mode));
			} else {
				cancellationToken.ThrowIfCancellationRequested ();
			}
#endif
		}
Ejemplo n.º 55
0
		public abstract bool Poll(int microSeconds, SelectMode mode);
        public override void SelectObjects(IEnumerable<CamViewState.SelObj> selObjEnum, SelectMode mode = SelectMode.Set)
        {
            base.SelectObjects(selObjEnum, mode);
            if (!selObjEnum.Any()) return;

            // Change shape selection
            if (selObjEnum.OfType<SelShape>().Any())
            {
                var shapeQuery = selObjEnum.OfType<SelShape>();
                var distinctShapeQuery = shapeQuery.GroupBy(s => s.Body).First(); // Assure there is only one collider active.
                SelShape[] selShapeArray = distinctShapeQuery.ToArray();

                // First, select the associated Collider
                DualityEditorApp.Select(this, new ObjectSelection(selShapeArray[0].Body.GameObj), SelectMode.Set);
                // Then, select actual ShapeInfos
                DualityEditorApp.Select(this, new ObjectSelection(selShapeArray.Select(s => s.ActualObject)), mode);
            }

            // Change collider selection
            else if (selObjEnum.OfType<SelBody>().Any())
            {
                // Deselect ShapeInfos
                DualityEditorApp.Deselect(this, ObjectSelection.Category.Other);
                // Select Collider
                DualityEditorApp.Select(this, new ObjectSelection(selObjEnum.OfType<SelBody>().Select(s => s.ActualObject)), mode);
            }
        }
Ejemplo n.º 57
0
		public override bool Poll(int microSeconds, SelectMode mode) {
			return _socket.Poll(microSeconds, mode);
		}
Ejemplo n.º 58
0
		public bool Poll (int time_us, SelectMode mode)
		{
			if (disposed && closed)
				throw new ObjectDisposedException (GetType ().ToString ());

			if (mode != SelectMode.SelectRead &&
			    mode != SelectMode.SelectWrite &&
			    mode != SelectMode.SelectError)
				throw new NotSupportedException ("'mode' parameter is not valid.");

			int error;
			bool result = Poll_internal (socket, mode, time_us, out error);
			if (error != 0)
				throw new SocketException (error);

			if (mode == SelectMode.SelectWrite && result && !connected) {
				/* Update the connected state; for
				 * non-blocking Connect()s this is
				 * when we can find out that the
				 * connect succeeded.
				 */
				if ((int)GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error) == 0) {
					connected = true;
				}
			}
			
			return result;
		}
Ejemplo n.º 59
0
    public static void PreferencesGUI()
    {
        // Load the preferences
        if (!prefsLoaded) {
            LoadPrefs();
            prefsLoaded = true;
            OnWindowResize();
        }

        settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(136));
        // Geometry Settings
        GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

        pbDefaultSelectionMode = (SelectMode)EditorGUILayout.EnumPopup("Default Selection Mode", pbDefaultSelectionMode);

        _faceColor = EditorGUILayout.ColorField("Selected Face Color", _faceColor);

        pbDefaultVertexColor = EditorGUILayout.ColorField("Vertex Color", pbDefaultVertexColor);
        pbDefaultSelectedVertexColor = EditorGUILayout.ColorField("Selected Vertex Color", pbDefaultSelectedVertexColor);

        pbVertexHandleSize = EditorGUILayout.FloatField("Vertex Handle Size", pbVertexHandleSize);

        _defaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", _defaultMaterial, typeof(Material), false);

        defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Default Collider");
        defaultColliderType = (int)((ColliderType)EditorGUILayout.EnumPopup( (ColliderType)defaultColliderType ));
        GUILayout.EndHorizontal();

        if((ColliderType)defaultColliderType == ColliderType.MeshCollider)
            pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);

        _showNotifications = EditorGUILayout.Toggle("Show Editor Notifications", _showNotifications);

        pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);

        pbForceVertexPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Vertex Point", "If true, new objects will automatically have their pivot point set to a vertex instead of the center."), pbForceVertexPivot);
        pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."), pbForceGridPivot);

        pbPerimeterEdgeExtrusionOnly = EditorGUILayout.Toggle(new GUIContent("Edge Extrude from Perimeters Only", "If true, only edges on the perimeters of an object may be extruded.  If false, you may extrude any edge you like (for those who like to live dangerously)."), pbPerimeterEdgeExtrusionOnly);
        pbPerimeterEdgeBridgeOnly = EditorGUILayout.Toggle(new GUIContent("Bridge Perimeter Edges Only", "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."), pbPerimeterEdgeBridgeOnly);

        pbPBOSelectionOnly = EditorGUILayout.Toggle(new GUIContent("Only PBO are Selectable", "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"), pbPBOSelectionOnly);

        GUILayout.Space(4);

        GUILayout.Label("Texture Editing Settings", EditorStyles.boldLabel);

        defaultHideFaceMask = EditorGUILayout.Toggle("Hide face mask", defaultHideFaceMask);

        EditorGUILayout.EndScrollView();

        GUILayout.Space(4);

        GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

        if(GUI.Button(resetRect, "Use defaults"))
            ResetToDefaults();

        ShortcutSelectPanel();
        ShortcutEditPanel();

        // Save the preferences
        if (GUI.changed)
            SetPrefs();
    }
Ejemplo n.º 60
0
        public static unsafe SocketError Poll(SafeCloseSocket handle, int microseconds, SelectMode mode, out bool status)
        {
            var fdset = new Interop.libc.fd_set();
            fdset.Set(handle.FileDescriptor);

            // TODO: this should probably be 0 if readfds, writefds, and errorfds are all null
            int nfds = handle.FileDescriptor + 1;
            Interop.libc.fd_set* readfds = mode == SelectMode.SelectRead ? &fdset : null;
            Interop.libc.fd_set* writefds = mode == SelectMode.SelectWrite ? &fdset : null;
            Interop.libc.fd_set* errorfds = mode == SelectMode.SelectError ? &fdset : null;

            int socketCount = 0;
            if (microseconds != -1)
            {
                var tv = new Interop.libc.timeval(microseconds);
                socketCount = Interop.libc.select(nfds, readfds, writefds, errorfds, &tv);
            }
            else
            {
                socketCount = Interop.libc.select(nfds, readfds, writefds, errorfds, null);
            }

            if (socketCount == -1)
            {
                status = false;
                return SocketError.SocketError; // TODO: should this be SCH.GetLastSocketError()?
            }

            status = fdset.IsSet(handle.FileDescriptor);
            return (SocketError)socketCount;
        }