当前位置: 首页>>代码示例>>C#>>正文


C# GraphState类代码示例

本文整理汇总了C#中GraphState的典型用法代码示例。如果您正苦于以下问题:C# GraphState类的具体用法?C# GraphState怎么用?C# GraphState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GraphState类属于命名空间,在下文中一共展示了GraphState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HasCorrectFinalStates

            public void HasCorrectFinalStates()
            {
                var m1Start = new GraphState () {
                    StateNumber = 0,
                    IsFinal = true
                };

                var m2Start = new GraphState () {
                    StateNumber = 1,
                    IsFinal = true
                };

                var m1 = new Graph () {
                    StartState = m1Start
                };

                var m2 = new Graph () {
                    StartState = m2Start
                };

                var ndfa = m1.Concat (m2);
                var finals = ndfa.FindFinalStates (ndfa.StartState);
                finals.Count.Should ().Be (1);
                finals [0].Should ().Be (m1Start);
            }
开发者ID:tvand7093,项目名称:Xpressional,代码行数:25,代码来源:GraphTests.cs

示例2: CreatesCorrectConnection

            public void CreatesCorrectConnection()
            {
                var m1Start = new GraphState () {
                    StateNumber = 0,
                    IsFinal = true
                };

                var m2Start = new GraphState () {
                    StateNumber = 1,
                    IsFinal = true
                };

                var m1 = new Graph () {
                    StartState = m1Start
                };

                var m2 = new Graph () {
                    StartState = m2Start
                };

                var ndfa = m1.Concat (m2);

                ndfa.StartState.Out[0].Start.Should ().Be (m2Start);
                ndfa.StartState.Out[0].End.Should ().Be (m1Start);
                ndfa.StartState.Out[0].ConnectedBy.Letter.Should ().Be (Word.Epsilon.Letter);
                ndfa.StartState.Out[0].ConnectedBy.Mapping.Should ().Be (Word.Epsilon.Mapping);
            }
开发者ID:tvand7093,项目名称:Xpressional,代码行数:27,代码来源:GraphTests.cs

示例3: PrintStatesOutputs

        /// <summary>
        /// Recursive call to loop over states and print them.
        /// </summary>
        /// <param name="currentState">Current state.</param>
        /// <param name="visited">List of states visited.</param>
        /// <param name="output">List of state outputs.</param>
        void PrintStatesOutputs(GraphState currentState,
			List<GraphState> visited, List<string> output)
        {
            //add this node to the visited list
            visited.Add (currentState);

            //for each connection, recurse and add the output to our master list.
            foreach (var state in currentState.Out) {
                //add the connection friendly string to the master list.
                output.Add(state.ToString());
                if (!visited.Contains (state.End)) {
                    //not seen, so keep going.
                    PrintStatesOutputs(state.End, visited, output);
                }
            }
        }
开发者ID:tvand7093,项目名称:Xpressional,代码行数:22,代码来源:OutputManager.cs

示例4: CreatesOneConnection

            public void CreatesOneConnection()
            {
                var m1Start = new GraphState () {
                    StateNumber = 0,
                    IsFinal = true
                };

                var m2Start = new GraphState () {
                    StateNumber = 1,
                    IsFinal = true
                };

                var m1 = new Graph () {
                    StartState = m1Start
                };

                var m2 = new Graph () {
                    StartState = m2Start
                };

                var ndfa = m1.Concat (m2);
                ndfa.StartState.Out.Count.Should ().Be (1);
            }
开发者ID:tvand7093,项目名称:Xpressional,代码行数:23,代码来源:GraphTests.cs

示例5: renderGraph


//.........这里部分代码省略.........
				this.InitVideoRenderer();
				this.AddDeInterlaceFilter();

				// When capture pin is used, preview works immediately,
				// however this conflicts with file saving.
				// An alternative is to use VMR9
                cat = PinCategory.Preview;
				med = MediaType.Video;
// #if NEWCODE
				if(this.InitSampleGrabber())
				{
					Debug.WriteLine("SampleGrabber added to graph.");

#if DSHOWNET
					hr = captureGraphBuilder.RenderStream(ref cat, ref med, videoDeviceFilter, this.baseGrabFlt, this.videoRendererFilter); 
#else
					hr = captureGraphBuilder.RenderStream(DsGuid.FromGuid(cat), DsGuid.FromGuid(med), videoDeviceFilter, this.baseGrabFlt, this.videoRendererFilter); 
#endif
					if( hr < 0 ) Marshal.ThrowExceptionForHR( hr );
				}
				else
// #endif NEWCODE
				{
#if DSHOWNET
					hr = captureGraphBuilder.RenderStream(ref cat, ref med, videoDeviceFilter, null, this.videoRendererFilter);
#else
					hr = captureGraphBuilder.RenderStream(DsGuid.FromGuid(cat), DsGuid.FromGuid(med), videoDeviceFilter, null, this.videoRendererFilter); 
#endif
					if( hr < 0 ) Marshal.ThrowExceptionForHR( hr );
				}

				// Special option to enable rendering audio via PCI bus
				if((this.AudioViaPci)&&(audioDeviceFilter != null))
				{
					cat = PinCategory.Preview;
					med = MediaType.Audio;
#if DSHOWNET
					hr = captureGraphBuilder.RenderStream( ref cat, ref med, audioDeviceFilter, null, null ); 
#else
                    hr = captureGraphBuilder.RenderStream(DsGuid.FromGuid(cat), DsGuid.FromGuid(med), audioDeviceFilter, null, null);
#endif
					if( hr < 0 )
					{
						Marshal.ThrowExceptionForHR( hr );
					}
				}
				else
					if( (this.AudioViaPci)&&
					(this.audioDeviceFilter == null)&&(this.videoDeviceFilter != null) )
				{
					cat = PinCategory.Preview;
					med = MediaType.Audio;
#if DSHOWNET
					hr = captureGraphBuilder.RenderStream( ref cat, ref med, videoDeviceFilter, null, null ); 
#else
                    hr = captureGraphBuilder.RenderStream(cat, med, videoDeviceFilter, null, null);
#endif
					if( hr < 0 )
					{
						Marshal.ThrowExceptionForHR( hr );
					}
				}

				// Get the IVideoWindow interface
				videoWindow = (IVideoWindow) graphBuilder;

				// Set the video window to be a child of the main window
				hr = videoWindow.put_Owner( previewWindow.Handle );
				if( hr < 0 ) Marshal.ThrowExceptionForHR( hr );

				// Set video window style
#if DSHOWNET
				hr = videoWindow.put_WindowStyle( WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
#else
			    hr = videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings);
#endif
				if( hr < 0 ) Marshal.ThrowExceptionForHR( hr );

				// Position video window in client rect of owner window
				previewWindow.Resize += new EventHandler( onPreviewWindowResize );
				onPreviewWindowResize( this, null );

				// Make the video window visible, now that it is properly positioned
#if DSHOWNET
				hr = videoWindow.put_Visible( DsHlp.OATRUE );
#else
				hr = videoWindow.put_Visible( OABool.True );
#endif
				if( hr < 0 ) Marshal.ThrowExceptionForHR( hr );

				isPreviewRendered = true;
				didSomething = true;
// #if NEWCODE
				SetMediaSampleGrabber();
// #endif NEWCODE
			}

			if ( didSomething )
				graphState = GraphState.Rendered;
		}
开发者ID:rajeper,项目名称:ikarus-osd,代码行数:101,代码来源:Capture.cs

示例6: Stop

		/// <summary> 
		///  Stop the current capture capture. If there is no
		///  current capture, this method will succeed.
		/// </summary>
		public void Stop()
		{
			// Stop the graph if it is running
			// If we have a preview running we should only stop the
			// capture stream. However, if we have a preview stream
			// we need to re-render the graph anyways because we 
			// need to get rid of the capture stream. To re-render
			// we need to stop the entire graph
			if ( mediaControl != null )
			{
				mediaControl.Stop();
			}

			// Config is true when the parametres of the device are to be changed
			
			wantCaptureRendered = false;
			wantPreviewRendered = true;

			// Update the state
			if ( graphState == GraphState.Capturing )
			{
				graphState = GraphState.Rendered;
				if ( CaptureComplete != null )
					CaptureComplete( this, null );
			}

			// Para que cuando volvamos a capturar frames no haya problemas
			firstFrame = true;

			// So we destroy the capture stream IF 
			// we need a preview stream. If we don't
			// this will leave the graph as it is.
			renderStream = false;
			try { renderGraph(); } 
			catch {}
			try { startPreviewIfNeeded(); } 
			catch {}
			
		}
开发者ID:iManbot,项目名称:monoslam,代码行数:43,代码来源:Capture.cs

示例7: CloseInterfaces

        // Shut down capture
        private void CloseInterfaces()
        {
            int hr;

            lock (this)
            {
                if (m_State != GraphState.Exiting)
                {
                    m_State = GraphState.Exiting;

                    // Release the thread (if the thread was started)
                    if (m_mre != null)
                    {
                        m_mre.Set();
                    }
                }

                if (m_mediaCtrl != null)
                {
                    // Stop the graph
                    hr = m_mediaCtrl.Stop();
                    m_mediaCtrl = null;
                }

                if (m_sampGrabber != null)
                {
                    Marshal.ReleaseComObject(m_sampGrabber);
                    m_sampGrabber = null;
                }

                if (m_FilterGraph != null)
                {
                    Marshal.ReleaseComObject(m_FilterGraph);
                    m_FilterGraph = null;
                }
            }
            GC.Collect();
        }
开发者ID:hpavlov,项目名称:occurec,代码行数:39,代码来源:DxPlayer.cs

示例8: Start

        // start playing
        public void Start()
        {
            // If we aren't already playing (or shutting down)
            if (m_State == GraphState.Stopped || m_State == GraphState.Paused)
            {
                m_FrameCounter = 0;

                int hr = m_mediaCtrl.Run();
                DsError.ThrowExceptionForHR(hr);

                m_State = GraphState.Running;
            }
        }
开发者ID:hpavlov,项目名称:occurec,代码行数:14,代码来源:DxPlayer.cs

示例9: Dispose

 // Release everything.
 public void Dispose()
 {
     CloseInterfaces();
     m_State = GraphState.Exiting;
 }
开发者ID:hpavlov,项目名称:occurec,代码行数:6,代码来源:DxPlayer.cs

示例10: Resume

        public void Resume()
        {
            IMediaControl mediaCtrl = m_FilterGraph as IMediaControl;

            int hr = mediaCtrl.Run();
            DsError.ThrowExceptionForHR(hr);

            m_State = GraphState.Running;
        }
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:9,代码来源:Capture.cs

示例11: Dispose

        /// <summary> release everything. </summary>
        public void Dispose()
        {
            ConsoleLogger.logMessage("In Dispose");
            m_State = GraphState.Stopped;
            CloseInterfaces();

            if (bitmapOverlay != null)
                bitmapOverlay.Dispose();
            if (fontOverlay != null)
                fontOverlay.Dispose();
            if (transparentBrush != null)
                transparentBrush.Dispose();
            if (transparentFont != null)
                transparentFont.Dispose();
        }
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:16,代码来源:Capture.cs

示例12: createGraph

 protected void createGraph()
 {
     if ((this.videoDevice == null) && (this.audioDevice == null))
     {
         throw new ArgumentException("The video and/or audio device have not been set. Please set one or both to valid capture devices.\n");
     }
     if (this.graphState < GraphState.Created)
     {
         object obj2;
         GC.Collect();
         this.graphBuilder = (IGraphBuilder) Activator.CreateInstance(System.Type.GetTypeFromCLSID(Clsid.FilterGraph, true));
         Guid clsid = Clsid.CaptureGraphBuilder2;
         Guid gUID = typeof(ICaptureGraphBuilder2).GUID;
         this.captureGraphBuilder = (ICaptureGraphBuilder2) DsBugWO.CreateDsInstance(ref clsid, ref gUID);
         int errorCode = this.captureGraphBuilder.SetFiltergraph(this.graphBuilder);
         if (errorCode < 0)
         {
             Marshal.ThrowExceptionForHR(errorCode);
         }
         if (this.VideoDevice != null)
         {
             this.videoDeviceFilter = (IBaseFilter) Marshal.BindToMoniker(this.VideoDevice.MonikerString);
             errorCode = this.graphBuilder.AddFilter(this.videoDeviceFilter, "Video Capture Device");
             if (errorCode < 0)
             {
                 Marshal.ThrowExceptionForHR(errorCode);
             }
         }
         if (this.AudioDevice != null)
         {
             this.audioDeviceFilter = (IBaseFilter) Marshal.BindToMoniker(this.AudioDevice.MonikerString);
             errorCode = this.graphBuilder.AddFilter(this.audioDeviceFilter, "Audio Capture Device");
             if (errorCode < 0)
             {
                 Marshal.ThrowExceptionForHR(errorCode);
             }
         }
         if (this.VideoCompressor != null)
         {
             this.videoCompressorFilter = (IBaseFilter) Marshal.BindToMoniker(this.VideoCompressor.MonikerString);
             errorCode = this.graphBuilder.AddFilter(this.videoCompressorFilter, "Video Compressor");
             if (errorCode < 0)
             {
                 Marshal.ThrowExceptionForHR(errorCode);
             }
         }
         if (this.AudioCompressor != null)
         {
             this.audioCompressorFilter = (IBaseFilter) Marshal.BindToMoniker(this.AudioCompressor.MonikerString);
             errorCode = this.graphBuilder.AddFilter(this.audioCompressorFilter, "Audio Compressor");
             if (errorCode < 0)
             {
                 Marshal.ThrowExceptionForHR(errorCode);
             }
         }
         Guid capture = PinCategory.Capture;
         Guid interleaved = MediaType.Interleaved;
         Guid riid = typeof(IAMStreamConfig).GUID;
         if (this.captureGraphBuilder.FindInterface(ref capture, ref interleaved, this.videoDeviceFilter, ref riid, out obj2) != 0)
         {
             interleaved = MediaType.Video;
             if (this.captureGraphBuilder.FindInterface(ref capture, ref interleaved, this.videoDeviceFilter, ref riid, out obj2) != 0)
             {
                 obj2 = null;
             }
         }
         this.videoStreamConfig = obj2 as IAMStreamConfig;
         obj2 = null;
         capture = PinCategory.Capture;
         interleaved = MediaType.Audio;
         riid = typeof(IAMStreamConfig).GUID;
         if (this.captureGraphBuilder.FindInterface(ref capture, ref interleaved, this.audioDeviceFilter, ref riid, out obj2) != 0)
         {
             obj2 = null;
         }
         this.audioStreamConfig = obj2 as IAMStreamConfig;
         this.mediaControl = (IMediaControl) this.graphBuilder;
         if (this.videoSources != null)
         {
             this.videoSources.Dispose();
         }
         this.videoSources = null;
         if (this.audioSources != null)
         {
             this.audioSources.Dispose();
         }
         this.audioSources = null;
         if (this.propertyPages != null)
         {
             this.propertyPages.Dispose();
         }
         this.propertyPages = null;
         this.videoCaps = null;
         this.audioCaps = null;
         obj2 = null;
         capture = PinCategory.Capture;
         interleaved = MediaType.Interleaved;
         riid = typeof(IAMTVTuner).GUID;
         if (this.captureGraphBuilder.FindInterface(ref capture, ref interleaved, this.videoDeviceFilter, ref riid, out obj2) != 0)
         {
//.........这里部分代码省略.........
开发者ID:alienwow,项目名称:CSharpProjects,代码行数:101,代码来源:Capture.cs

示例13: Stop

 public void Stop()
 {
     this.wantCaptureRendered = false;
     if (this.mediaControl != null)
     {
         this.mediaControl.Stop();
     }
     if (this.graphState == GraphState.Capturing)
     {
         this.graphState = GraphState.Rendered;
         if (this.CaptureComplete != null)
         {
             this.CaptureComplete(this, null);
         }
     }
     try
     {
         this.renderGraph();
     }
     catch
     {
     }
     try
     {
         this.startPreviewIfNeeded();
     }
     catch
     {
     }
 }
开发者ID:alienwow,项目名称:CSharpProjects,代码行数:30,代码来源:Capture.cs

示例14: Start

 public void Start()
 {
     this.assertStopped();
     this.wantCaptureRendered = true;
     this.renderGraph();
     int errorCode = this.mediaControl.Run();
     if (errorCode != 0)
     {
         Marshal.ThrowExceptionForHR(errorCode);
     }
     this.graphState = GraphState.Capturing;
 }
开发者ID:alienwow,项目名称:CSharpProjects,代码行数:12,代码来源:Capture.cs

示例15: derenderGraph

		/// <summary>
		///  Disconnect and remove all filters except the device
		///  and compressor filters. This is the opposite of
		///  renderGraph(). Soem properties such as FrameRate
		///  can only be set when the device output pins are not
		///  connected. 
		/// </summary>
		protected void derenderGraph()
		{
			// Stop the graph if it is running (ignore errors)
			if ( mediaControl != null )
				mediaControl.Stop();

			// Free the preview window (ignore errors)
			if ( videoWindow != null )
			{
				videoWindow.put_Visible( DsHlp.OAFALSE );
				videoWindow.put_Owner( IntPtr.Zero );
				videoWindow = null;
			}

			
			//ELIMINAR RECURSOS CAPTURA <<<<<<<<<================================================
			/*if ( mediaEvt != null ) 
			{
				int hr = mediaEvt.SetNotifyWindow( IntPtr.Zero, WM_GRAPHNOTIFY, IntPtr.Zero );
				mediaEvt = null;
			}*/

			// Remove the Resize event handler
			if ( PreviewWindow != null )
				previewWindow.Resize -= new EventHandler( onPreviewWindowResize );

			if ( (int)graphState >= (int)GraphState.Rendered )
			{
				// Update the state
				graphState = GraphState.Created;
				isCaptureRendered = false;
				isPreviewRendered = false;

				// Disconnect all filters downstream of the 
				// video and audio devices. If we have a compressor
				// then disconnect it, but don't remove it
				if ( videoDeviceFilter != null )
					removeDownstream( videoDeviceFilter, (videoCompressor==null) );
				if ( audioDeviceFilter != null )
					removeDownstream( audioDeviceFilter, (audioCompressor==null) );

				// These filters should have been removed by the
				// calls above. (Is there anyway to check?)
				muxFilter = null;
				fileWriterFilter = null;
				
				//ELIMINAR RECURSOS CAPTURA <<<<<<<<<================================================
				baseGrabFlt = null;
			}
		}
开发者ID:iManbot,项目名称:monoslam,代码行数:57,代码来源:Capture.cs


注:本文中的GraphState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。