Exemplo n.º 1
0
 public NodeGenes(Types _type, OutputMode _outputMode = OutputMode.Normal, int _IOIndex = 0)
 {
     type       = _type;
     outputMode = _outputMode;
     IOIndex    = _IOIndex;
     value      = 0;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Default contructor
 /// </summary>
 public GraphvizGraph()
 {
     m_Url                = null;
     m_BackgroundColor    = Color.White;
     m_IsCentered         = false;
     m_ClusterRank        = ClusterMode.Local;
     m_Comment            = null;
     m_IsCompounded       = false;
     m_IsConcentrated     = false;
     m_Font               = null;
     m_FontColor          = Color.Black;
     m_Label              = null;
     m_LabelJustification = LabelJustification.C;
     m_LabelLocation      = LabelLocation.B;
     m_Layers             = new GraphvizLayerCollection();
     m_McLimit            = 1.0;
     m_NodeSeparation     = 0.25;
     m_IsNormalized       = false;
     m_NsLimit            = -1;
     m_NsLimit1           = -1;
     m_OutputOrder        = OutputMode.BreadthFirst;
     m_PageSize           = new Size(0, 0);
     m_PageDirection      = PageDirection.BL;
     m_Quantum            = 0;
     m_RankSeparation     = 0.5;
     m_Ratio              = RatioMode.Auto;
     m_IsReMinCross       = false;
     m_Resolution         = 0.96;
     m_Rotate             = 0;
     m_SamplePoints       = 8;
     m_SearchSize         = 30;
     m_Size               = new Size(0, 0);
     m_StyleSheet         = null;
 }
        public static void AddLog4NetLogging(this IServiceCollection services, LogLevel logLevel,
                                             OutputMode outputMode)
        {
            switch (outputMode)
            {
            case OutputMode.Console:
                services.AddLogging(opt =>
                {
                    opt.ClearProviders();
                    opt.AddLog4Net(Path.Combine("Properties", "log4net-console.config"));
                    opt.SetMinimumLevel(logLevel);
                });
                break;

            case OutputMode.File:
                services.AddLogging(opt =>
                {
                    opt.ClearProviders();
                    opt.AddLog4Net(Path.Combine("Properties", "log4net-file.config"));
                    opt.SetMinimumLevel(logLevel);
                });

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(outputMode), outputMode, null);
            }
        }
Exemplo n.º 4
0
        public async Task Handle(CommandRequest request)
        {
            OutputMode outputMode = CommandParser.ParseOutputMode(request.GetArg(1, "text"));

            if (outputMode == OutputMode.CSV)
            {
                await request.WriteLine("Id,Name,Remote Endpoint,Current Plane,Viewport");
            }

            foreach (NibriClient client in server.AppServer.NibriClients)
            {
                object[] lineParams = new object[] {
                    client.Id,
                    client.Name,
                    client.RemoteEndpoint,
                    client.CurrentPlane.Name,
                    client.CurrentViewPort
                };
                string outputLine = string.Format("{0}: {1} from {1}, on {3} looking at {4}", lineParams);

                if (outputMode == OutputMode.CSV)
                {
                    outputLine = string.Join(",", lineParams);
                }

                await request.WriteLine(outputLine);
            }
            await request.WriteLine();

            if (outputMode == OutputMode.Text)
            {
                await request.WriteLine($"Total {server.AppServer.ClientCount} clients");
            }
        }
Exemplo n.º 5
0
        private string SelectOutputPath(OutputMode mode)
        {
            switch (mode)
            {
            case OutputMode.Movie:
                // Get target movie path
                var sfd = new SaveFileDialog()
                {
                    Filter = "AVI Files (*.avi)|*.avi"
                };
                if (sfd.ShowDialog(this) == DialogResult.OK)
                {
                    return(sfd.FileName);
                }
                else
                {
                    return(null);
                }

            case OutputMode.ImageSequence:
                // Get target directory path
                var fbd = new FolderBrowserDialog();
                if (fbd.ShowDialog(this) == DialogResult.OK)
                {
                    return(fbd.SelectedPath);
                }
                else
                {
                    return(null);
                }

            default:
                throw new InvalidOperationException();
            }
        }
 public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is bool)
     {
         OutputMode outputMode = (OutputMode)Enum.Parse(typeof(OutputMode), parameter.ToString(), true);
         if ((bool)value)
         {
             return(outputMode);
         }
         else
         {
             foreach (OutputMode item in Enum.GetValues(typeof(OutputMode)))
             {
                 if (item != outputMode)
                 {
                     return(item);
                 }
             }
             return(outputMode);
         }
     }
     else if (value is OutputMode)
     {
         return(value.ToString().Equals(parameter.ToString(), StringComparison.InvariantCultureIgnoreCase));
     }
     else
     {
         return(Binding.DoNothing);
     }
 }
Exemplo n.º 7
0
        public void A_row_is_written_for_each_item_and_a_header_for_each_column(
            OutputMode outputMode
            )
        {
            var options = new[]
            {
                new Option("-s", "a short option"),
                new Option("--very-long", "a long option")
            };

            var view = new OptionsHelpView(options);

            view.Render(new ConsoleRenderer(_terminal, outputMode), new Region(0, 0, 30, 3));

            var lines = _terminal.RenderOperations();

            lines
            .Should()
            .BeEquivalentSequenceTo(
                Cell("Option       ", 0, 0),
                Cell("              ", 13, 0),
                Cell("-s           ", 0, 1),
                Cell("a short option", 13, 1),
                Cell("--very-long  ", 0, 2),
                Cell("a long option ", 13, 2)
                );
        }
        //Hook up this altrernate handler to try out the event-based API

        async Task RecordAudioAlternate()
        {
            if (!recorder.IsRecording)
            {
                recorder.AudioInputReceived -= Recorder_AudioInputReceived;
                recorder.AudioInputReceived += Recorder_AudioInputReceived;

                updateUI(false);

                await recorder.StartRecording();

                updateUI(true, "Stop");

                var recognitionMode = (RecognitionMode)Enum.Parse(typeof(RecognitionMode), RecognitionModePicker.SelectedItem.ToString());
                var profanityMode   = (ProfanityMode)Enum.Parse(typeof(ProfanityMode), ProfanityModePicker.SelectedItem.ToString());
                outputMode = (OutputMode)Enum.Parse(typeof(OutputMode), OutputModePicker.SelectedItem.ToString());

                //set the selected recognition mode & profanity mode
                bingSpeechClient.RecognitionMode = recognitionMode;
                bingSpeechClient.ProfanityMode   = profanityMode;

                if (StreamSwitch.IsToggled)
                {
                    throw new Exception("Use RecordAudio() with the Stream API - this is older code");
                }
            }
            else             //Stop button clicked
            {
                updateUI(false, true);

                //stop the recording... recorded audio will be used in the Recorder_AudioInputReceived handler below
                await recorder.StopRecording();
            }
        }
Exemplo n.º 9
0
 public override void SetStatus(OutputMode status)
 {
     foreach (var output in outputs)
     {
         output.SetStatus(status);
     }
 }
Exemplo n.º 10
0
 public override void WriteTo(TextWriter writer, OutputMode outputMode)
 {
     for (var i = 0; i < _children.Count; i++)
     {
         _children[i].WriteTo(writer, outputMode);
     }
 }
Exemplo n.º 11
0
        public void Size_to_content_grid_with_wide_region_adjusts_to_content_size(OutputMode outputMode)
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.SizeToContent(), ColumnDefinition.SizeToContent());
            grid.SetRows(RowDefinition.SizeToContent(), RowDefinition.SizeToContent());
            grid.SetChild(new ContentView("The quick"), 0, 0);
            grid.SetChild(new ContentView("brown fox"), 1, 0);
            grid.SetChild(new ContentView("jumped over"), 0, 1);
            grid.SetChild(new ContentView("the sleepy"), 1, 1);

            var console  = new TestConsole();
            var renderer = new ConsoleRenderer(console, outputMode);

            grid.Render(renderer, new Region(0, 0, 25, 3));

            console.Events.Should().BeEquivalentSequenceTo(
                new TestConsole.CursorPositionChanged(new Point(0, 0)),
                new TestConsole.ContentWritten("The quick    "),
                new TestConsole.CursorPositionChanged(new Point(13, 0)),
                new TestConsole.ContentWritten("brown fox "),
                new TestConsole.CursorPositionChanged(new Point(0, 1)),
                new TestConsole.ContentWritten("jumped over  "),
                new TestConsole.CursorPositionChanged(new Point(13, 1)),
                new TestConsole.ContentWritten("the sleepy"));
        }
Exemplo n.º 12
0
        /// <summary>
        ///     Установка режима вывода информации на экран
        /// </summary>
        private void ScreenOutputBtn_Click(object sender, EventArgs e)
        {
            outputMode = OutputMode.OnForm;
            outputPath = "screen";

            SelectedOFileLbl.Text = "Данные будут выведены на экран";
        }
        HttpRequestMessage CreateRequest(OutputMode outputMode)
        {
            try
            {
                var uriBuilder = new UriBuilder(SpeechEndpoint.Protocol,
                                                SpeechEndpoint.Host,
                                                SpeechEndpoint.Port,
                                                SpeechEndpoint.Path);
                uriBuilder.Path += $"/{RecognitionMode.ToString ().ToLower ()}/cognitiveservices/{ApiVersion}";
                uriBuilder.Query = $"language={RecognitionLanguage}&format={outputMode.ToString ().ToLower ()}&profanity={ProfanityMode.ToString ().ToLower ()}";

                Debug.WriteLine($"{DateTime.Now} :: Request Uri: {uriBuilder.Uri}");

                var request = new HttpRequestMessage(HttpMethod.Post, uriBuilder.Uri);

                request.Headers.TransferEncodingChunked = true;
                request.Headers.ExpectContinue          = true;
                request.Headers.Authorization           = new AuthenticationHeaderValue(Constants.Keys.Bearer, AuthClient.Token);
                request.Headers.Accept.ParseAdd(Constants.MimeTypes.Json);
                request.Headers.Accept.ParseAdd(Constants.MimeTypes.Xml);
                request.Headers.Host = SpeechEndpoint.Host;

                return(request);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                throw;
            }
        }
Exemplo n.º 14
0
 public override void Report(OutputMode mode, string message)
 {
     foreach (var output in outputs)
     {
         output.Report(mode, message);
     }
 }
 public void Apply(DeviceContext context, OutputMode outputMode, ShaderResourceView secondaryNormalMap)
 {
     context.PixelShader.Set(PickShader(outputMode));
     context.PixelShader.SetShaderResources(ShaderSlots.MaterialTextureStart, textureViews);
     context.PixelShader.SetShaderResource(ShaderSlots.MaterialTextureStart + textureViews.Length, secondaryNormalMap ?? defaultBumpTexture);
     context.PixelShader.SetConstantBuffer(ShaderSlots.MaterialConstantBufferStart, constantBuffer);
 }
Exemplo n.º 16
0
        public int __sceSasSetOutputmode(uint SasCorePointer, OutputMode OutputMode)
        {
            var SasCore = GetSasCore(SasCorePointer);

            SasCore.OutputMode = OutputMode;
            return(0);
        }
Exemplo n.º 17
0
        public static ITerminal GetTerminal(
            this IConsole console,
            bool preferVirtualTerminal = true,
            OutputMode outputMode      = OutputMode.Auto)
        {
            if (console == null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            if (console is ITerminal t)
            {
                return(t);
            }

            if (console.IsOutputRedirected)
            {
                return(null);
            }

            ITerminal terminal;

            if (preferVirtualTerminal &&
                VirtualTerminalMode.TryEnable() is VirtualTerminalMode virtualTerminalMode &&
                virtualTerminalMode.IsEnabled)
            {
                terminal = new VirtualTerminal(
                    console,
                    virtualTerminalMode);
            }
Exemplo n.º 18
0
        public static bool Initialize( OutputMode mode )
        {
            m_logLevel = LogLevel.Debug;

            switch( mode )
            {
            case OutputMode.OutputWindow:
                m_stream = Console.OpenStandardOutput();
                m_writer = new StreamWriter( m_stream );
                break;

            case OutputMode.Console:
                m_stream = Console.OpenStandardOutput();
                m_writer = new StreamWriter( m_stream );
                break;

            case OutputMode.File:
                DateTime now = DateTime.Now;
                string dir = Application.StartupPath;
                m_stream = new FileStream( dir + @"\log" + now.ToString( @"yyyy_MM_dd_HH_mm_ss" ) + @".txt", FileMode.Create );
                m_writer = new StreamWriter( m_stream );
                break;
            }

            m_writer.AutoFlush = true;

            return true;
        }
Exemplo n.º 19
0
        static bool RunOutputCmd(string[] args)
        {
            if (args.Length != 2)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                ConsoleManager.WriteLine("Invalid number of arguments");
                Console.ResetColor();
                return(false);
            }

            switch (args[1].ToUpperInvariant())
            {
            case "BIN":
                byteOutputMode = OutputMode.Binary;
                return(true);

            case "DEC":
                byteOutputMode = OutputMode.Decimal;
                return(true);

            case "HEX":
                byteOutputMode = OutputMode.Hexadecimal;
                return(true);

            default:
                Console.ForegroundColor = ConsoleColor.Red;
                ConsoleManager.WriteLine("Invalid output format \"" + args[1] + "\"");
                Console.ResetColor();
                return(false);
            }
        }
Exemplo n.º 20
0
        public void Star_grid_lays_out_in_even_grid(OutputMode outputMode)
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.Star(1), ColumnDefinition.Star(1));
            grid.SetRows(RowDefinition.Star(1), RowDefinition.Star(1));
            grid.SetChild(new ContentView("The quick"), 0, 0);
            grid.SetChild(new ContentView("brown fox"), 1, 0);
            grid.SetChild(new ContentView("jumped"), 0, 1);
            grid.SetChild(new ContentView("over"), 1, 1);

            var terminal = new TestTerminal();
            var renderer = new ConsoleRenderer(terminal, outputMode);

            grid.Render(renderer, new Region(0, 0, 10, 4));

            terminal.Events.Should().BeEquivalentSequenceTo(
                new TestTerminal.CursorPositionChanged(new Point(0, 0)),
                new TestTerminal.ContentWritten("The  "),
                new TestTerminal.CursorPositionChanged(new Point(0, 1)),
                new TestTerminal.ContentWritten("quick"),
                new TestTerminal.CursorPositionChanged(new Point(5, 0)),
                new TestTerminal.ContentWritten("brown"),
                new TestTerminal.CursorPositionChanged(new Point(5, 1)),
                new TestTerminal.ContentWritten("fox  "),
                new TestTerminal.CursorPositionChanged(new Point(0, 2)),
                new TestTerminal.ContentWritten("jumpe"),
                new TestTerminal.CursorPositionChanged(new Point(0, 3)),
                new TestTerminal.ContentWritten("     "),
                new TestTerminal.CursorPositionChanged(new Point(5, 2)),
                new TestTerminal.ContentWritten("over "),
                new TestTerminal.CursorPositionChanged(new Point(5, 3)),
                new TestTerminal.ContentWritten("     "));
        }
Exemplo n.º 21
0
        public SoftwareRasterizerCore(Renderer renderer)
        {
            rasterizerMode = RasterizerMode.Both;
            outputMode     = OutputMode.Color;

            this.renderer = renderer;

            D3D11.Texture2DDescription texture2DDescription = new D3D11.Texture2DDescription
            {
                CpuAccessFlags    = D3D11.CpuAccessFlags.Write,
                BindFlags         = D3D11.BindFlags.None,
                Format            = DXGI.Format.R8G8B8A8_UNorm,
                Width             = renderer.width,
                Height            = renderer.height,
                OptionFlags       = D3D11.ResourceOptionFlags.None,
                MipLevels         = 1,
                ArraySize         = 1,
                SampleDescription = { Count = 1, Quality = 0 },
                Usage             = D3D11.ResourceUsage.Staging
            };

            backbufferBitmap = new Bitmap(renderer.width, renderer.height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            depthbufferBitmap = new Bitmap(renderer.width, renderer.height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            screenTexture = new D3D11.Texture2D(renderer.device, texture2DDescription);
        }
Exemplo n.º 22
0
        public bool Parse(byte[] report)
        {
            if (report[0] != 0 || report[1] != 0x047 || report.Length != 9)
            {
                return(false);
            }
            VersionMajor     = report[2] >> 4;
            VersionMinor     = report[2] & 0x0f;
            HardwareRevision = report[3] & 0x0f;
            DevType          = (DeviceType)(report[3] >> 4);
            var v = new Version(VersionMajor, VersionMinor);

            if (v >= Version.Parse("1.5"))
            {
                IsLegacy = false;
                Output   = (OutputMode)report[4];
                Inputs   = (InputSources)report[5];
            }
            else
            {
                IsLegacy = true;
                NGC      = (NGCMode)report[4];
                N64      = (N64Mode)report[5];
                SNES     = (SnesMode)report[6];
            }
            DeviceID    = (ushort)((report[7] << 8) | report[8]);
            PICRevision = (byte)(DeviceID & 0x0F);
            DeviceID   &= 0xFFF0;
            return(true);
        }
Exemplo n.º 23
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="mode">出力モード</param>
 /// <param name="inputCSRoot">入力:C#のルートパス</param>
 /// <param name="inputFile">出力:TypeScriptのルートパス</param>
 /// <param name="outputTSRoot">出力:TypeScriptのルートパス</param>
 private Config(OutputMode mode, RootPath inputCSRoot, RootPath outputTSRoot, FilePath inputFile)
 {
     Mode         = mode;
     InputCSRoot  = inputCSRoot;
     InputFile    = inputFile;
     OutputTSRoot = outputTSRoot;
 }
Exemplo n.º 24
0
        public void Fixed_grid_lays_out_fixed_rows_and_columns(OutputMode outputMode)
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.Fixed(6), ColumnDefinition.Fixed(4));
            grid.SetRows(RowDefinition.Fixed(1), RowDefinition.Fixed(2));
            grid.SetChild(new ContentView("The quick"), 0, 0);
            grid.SetChild(new ContentView("brown fox"), 1, 0);
            grid.SetChild(new ContentView("jumped over"), 0, 1);
            grid.SetChild(new ContentView("the sleepy"), 1, 1);

            var terminal = new TestTerminal();
            var renderer = new ConsoleRenderer(terminal, outputMode);

            grid.Render(renderer, new Region(0, 0, 10, 4));

            terminal.Events
            .Should()
            .BeEquivalentSequenceTo(
                new TestTerminal.CursorPositionChanged(new Point(0, 0)),
                new TestTerminal.ContentWritten("The   "),
                new TestTerminal.CursorPositionChanged(new Point(6, 0)),
                new TestTerminal.ContentWritten("brow"),
                new TestTerminal.CursorPositionChanged(new Point(0, 1)),
                new TestTerminal.ContentWritten("jumped"),
                new TestTerminal.CursorPositionChanged(new Point(0, 2)),
                new TestTerminal.ContentWritten("over  "),
                new TestTerminal.CursorPositionChanged(new Point(6, 1)),
                new TestTerminal.ContentWritten("the "),
                new TestTerminal.CursorPositionChanged(new Point(6, 2)),
                new TestTerminal.ContentWritten("slee"));
        }
Exemplo n.º 25
0
        public void Size_to_content_grid_with_narrow_region_increases_row_height(OutputMode outputMode)
        {
            var grid = new GridView();

            grid.SetColumns(ColumnDefinition.SizeToContent(), ColumnDefinition.SizeToContent());
            grid.SetRows(RowDefinition.SizeToContent(), RowDefinition.SizeToContent());
            grid.SetChild(new ContentView("The quick"), 0, 0);
            grid.SetChild(new ContentView("brown fox"), 1, 0);
            grid.SetChild(new ContentView("jumped over"), 0, 1);
            grid.SetChild(new ContentView("the sleepy"), 1, 1);

            var terminal = new TestTerminal();
            var renderer = new ConsoleRenderer(terminal, outputMode);

            grid.Render(renderer, new Region(0, 0, 18, 3));

            terminal.Events.Should().BeEquivalentSequenceTo(
                new TestTerminal.CursorPositionChanged(new Point(0, 0)),
                new TestTerminal.ContentWritten("The quick    "),
                new TestTerminal.CursorPositionChanged(new Point(0, 1)),
                new TestTerminal.ContentWritten("             "),
                new TestTerminal.CursorPositionChanged(new Point(13, 0)),
                new TestTerminal.ContentWritten("brown"),
                new TestTerminal.CursorPositionChanged(new Point(13, 1)),
                new TestTerminal.ContentWritten("fox  "),
                new TestTerminal.CursorPositionChanged(new Point(0, 2)),
                new TestTerminal.ContentWritten("jumped over  "),
                new TestTerminal.CursorPositionChanged(new Point(13, 2)),
                new TestTerminal.ContentWritten("the s"));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Outputs attributes of a SqlCommand.
        /// </summary>
        /// <param name="cmd">SqlCommand</param>
        /// <param name="om">OutputMode</param>
        public static void OutputCommand(SqlCommand cmd, OutputMode om)
        {
            StringBuilder sbOutput = new StringBuilder();

            sbOutput.Append("Outputting \"" + cmd.CommandText + "\":");
            sbOutput.Append(System.Environment.NewLine);

            foreach (SqlParameter param in cmd.Parameters)
            {
                sbOutput.Append(param.ParameterName + " = ");

                if (IsText(param.SqlDbType))
                {
                    sbOutput.Append("'");
                }
                sbOutput.Append(param.Value);
                if (IsText(param.SqlDbType))
                {
                    sbOutput.Append("'");
                }

                sbOutput.Append(System.Environment.NewLine);
            }

            _OutputCommand(sbOutput.ToString(), om);
        }
Exemplo n.º 27
0
        //Hook up this altrernate handler to try out the event-based API

        async Task RecordAudioAlternate()
        {
            if (!recorder.IsRecording)
            {
                recorder.AudioInputReceived -= Recorder_AudioInputReceived;
                recorder.AudioInputReceived += Recorder_AudioInputReceived;

                updateUI(false);

                await recorder.StartRecording();

                updateUI(true, "Detener");

                var recognitionMode = (RecognitionMode)Enum.Parse(typeof(RecognitionMode), 0.ToString ());
                var profanityMode   = (ProfanityMode)Enum.Parse(typeof(ProfanityMode), 0.ToString ());
                outputMode = (OutputMode)Enum.Parse(typeof(OutputMode), 0.ToString ());

                //set the selected recognition mode & profanity mode
                bingSpeechClient.RecognitionMode = recognitionMode;
                bingSpeechClient.ProfanityMode   = profanityMode;
            }
            else             //Stop button clicked
            {
                updateUI(false, true);

                //stop the recording... recorded audio will be used in the Recorder_AudioInputReceived handler below
                await recorder.StopRecording();
            }
        }
        public static string stateNodePartialPathToStr(T_S_S_Node curStateNode, OutputMode mode)
        {
            StringBuilder strBuilder = new StringBuilder();

            if (mode == OutputMode.console)
            {
                strBuilder.AppendLine("----curStateNode's partial path info[Line]:");
            }

            if (curStateNode.PassLine.Count == 0)
            {
                strBuilder.Append("[Empty],");
            }
            else
            {
                strBuilder.Append("[");
                for (int i = 0; i < curStateNode.PassLine.Count - 1; i++)
                {
                    strBuilder.AppendFormat("{0}-", curStateNode.PassLine[i]);
                }
                strBuilder.AppendFormat("{0}],", curStateNode.PassLine.Last());
            }

            if (mode == OutputMode.console)
            {
                strBuilder.AppendLine("----curStateNode's partial path info[stateNode]:");
            }

            Stack <int> nodePahStack = new Stack <int>();
            var         preNode      = curStateNode;

            while (preNode != null)
            {
                nodePahStack.Push(preNode.ID);
                preNode = preNode.PrevNode;

                if (nodePahStack.Count > 10000)
                {
                    return(strBuilder.ToString());

                    throw new StackOverflowException("stateNodePartialPathToStr()死循环");
                }
            }
            if (nodePahStack.Count == 0)
            {
                strBuilder.AppendLine("[Empty]");
            }
            else
            {
                strBuilder.Append("[");
                while (nodePahStack.Count > 1)
                {
                    strBuilder.AppendFormat("{0}-", nodePahStack.Pop());
                }
                strBuilder.AppendFormat("{0}]", nodePahStack.Pop());
            }

            return(strBuilder.ToString());
        }
Exemplo n.º 29
0
        public Form1()
        {
            try
            {
                Nuitrack.Init("");
            }
            catch (System.Exception exception)
            {
                Console.WriteLine("Cannot initialize Nuitrack.");
                throw exception;
            }

            try
            {
                // Create and setup all required modules
                _depthSensor     = DepthSensor.Create();
                _colorSensor     = ColorSensor.Create();
                _userTracker     = UserTracker.Create();
                _skeletonTracker = SkeletonTracker.Create();
            }
            catch (System.Exception exception)
            {
                Console.WriteLine("Cannot create Nuitrack module.");
                throw exception;
            }

            _depthSensor.SetMirror(false);

            // Add event handlers for all modules
            _depthSensor.OnUpdateEvent             += onDepthSensorUpdate;
            _colorSensor.OnUpdateEvent             += onColorSensorUpdate;
            _userTracker.OnUpdateEvent             += onUserTrackerUpdate;
            _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate;

            Nuitrack.onIssueUpdateEvent += onIssueDataUpdate;

            mode      = _depthSensor.GetOutputMode();
            colorMode = _colorSensor.GetOutputMode();

            if (mode.XRes < colorMode.XRes)
            {
                mode.XRes = colorMode.XRes;
            }
            if (mode.YRes < colorMode.YRes)
            {
                mode.YRes = colorMode.YRes;
            }

            _bitmap = new DirectBitmap(mode.XRes, mode.YRes);
            for (int y = 0; y < mode.YRes; ++y)
            {
                for (int x = 0; x < mode.XRes; ++x)
                {
                    _bitmap.SetPixel(x, y, Color.FromKnownColor(KnownColor.Aqua));
                }
            }

            InitializeComponent();
        }
Exemplo n.º 30
0
        public void RenderToRegion(
            Span span,
            Region region)
        {
            if (region == null)
            {
                throw new ArgumentNullException(nameof(region));
            }

            if (span == null)
            {
                span = Span.Empty();
            }
            else if (_resetAfterRender)
            {
                span = new ContainerSpan(
                    span,
                    ForegroundColorSpan.Reset(),
                    BackgroundColorSpan.Reset());
            }

            SpanVisitor visitor = null;

            if (_mode == OutputMode.Auto)
            {
                _mode = _terminal?.DetectOutputMode() ??
                        OutputMode.PlainText;
            }

            switch (_mode)
            {
            case OutputMode.NonAnsi:
                visitor = new NonAnsiRenderingSpanVisitor(
                    _terminal,
                    region);
                break;

            case OutputMode.Ansi:
                visitor = new AnsiRenderingSpanVisitor(
                    _console,
                    region);
                break;

            case OutputMode.PlainText:
                visitor = new FileRenderingSpanVisitor(
                    _console.Out,
                    new Region(region.Left,
                               region.Top,
                               region.Width,
                               region.Height,
                               false));
                break;

            default:
                throw new NotSupportedException();
            }

            visitor.Visit(span);
        }
Exemplo n.º 31
0
 public RunManager(Type env, Type[] bots, int iterations, bool Visible, OutputMode outputMode)
 {
     this.envType    = env;
     this.botTypes   = bots;
     this.iterations = iterations;
     this.Visible    = Visible;
     this.outputMode = outputMode;
 }
Exemplo n.º 32
0
 public RegexProcessContext(string matchRegexExpression, RegexOptions matchRegexOptions, string replaceRegexPattern, string inputText, RegexMode currentMode, OutputMode outputMode)
 {
     MatchRegexExpression = matchRegexExpression;
     MatchRegexOptions = matchRegexOptions;
     InputText = inputText;
     CurrentMode = currentMode;
     OutputMode = outputMode;
     if (replaceRegexPattern == null)
     {
         replaceRegexPattern = String.Empty;
     }
     ReplaceRegexPattern = replaceRegexPattern.Replace("\\n", Environment.NewLine).Replace("\\t", "	");
 }
Exemplo n.º 33
0
		public int __sceSasSetOutputmode(uint SasCorePointer, OutputMode OutputMode)
		{
			var SasCore = GetSasCore(SasCorePointer);

			//throw(new NotImplementedException());
			try
			{
				return 0;
				//return SasCore.OutputMode;
			}
			finally
			{
				SasCore.OutputMode = OutputMode;
			}
		}
Exemplo n.º 34
0
        /// <summary>
        /// Outputs attributes of a SqlCommand.
        /// </summary>
        /// <param name="cmd">SqlCommand</param>
        /// <param name="om">OutputMode</param>
        public static void OutputCommand(SqlCommand cmd, OutputMode om)
        {
            StringBuilder sbOutput = new StringBuilder();

              sbOutput.Append("Outputting \"" +cmd.CommandText+ "\":");
              sbOutput.Append(System.Environment.NewLine);

              foreach (SqlParameter param in cmd.Parameters) {
            sbOutput.Append(param.ParameterName+ " = ");

            if (IsText(param.SqlDbType)) sbOutput.Append("'");
            sbOutput.Append(param.Value);
            if (IsText(param.SqlDbType)) sbOutput.Append("'");

            sbOutput.Append(System.Environment.NewLine);
              }

              _OutputCommand(sbOutput.ToString(), om);
        }
Exemplo n.º 35
0
        private string SelectOutputPath(OutputMode mode)
        {
            switch (mode)
            {
                case OutputMode.Movie:
                    // Get target movie path
                    var sfd = new SaveFileDialog() { Filter = "AVI Files (*.avi)|*.avi" };
                    if (sfd.ShowDialog(this) == DialogResult.OK) return sfd.FileName;
                    else return null;

                case OutputMode.ImageSequence:
                    // Get target directory path
                    var fbd = new FolderBrowserDialog();
                    if (fbd.ShowDialog(this) == DialogResult.OK) return fbd.SelectedPath;
                    else return null;

                default:
                    throw new InvalidOperationException();
            }
        }
Exemplo n.º 36
0
        public ApplicationViewModel(ISyllablesService syllablesService, ITranscriptionService transcriptionService,
                                    IPlaybackService playbackService)
        {
            Guard.NotNull(syllablesService, "syllablesService");
            Guard.NotNull(transcriptionService, "transcriptionService");
            Guard.NotNull(playbackService, "playbackService");

            this._syllablesService = syllablesService;
            this._transcriptionService = transcriptionService;
            this._playbackService = playbackService;

            this._playbackService.PlaybackCompleted += this.PlaybackServiceOnPlaybackCompleted;

            this._inputText = "";
            this._isInputTextBoxEnabled = true;
            this._outputMode = OutputMode.Transcription;
            this.OutputText = "";
            this._words = new List<string>();

            this.Commands = new ApplicationViewModelCommands(this);
        }
Exemplo n.º 37
0
 public abstract Task<HttpResponseMessage> GetSearchResponseMessageAsync(int count = 0, OutputMode outputMode = OutputMode.Xml);
Exemplo n.º 38
0
		//[HlePspNotImplemented]
		public uint __sceSasInit(uint SasCorePointer, int GrainSamples, int MaxVoices, OutputMode OutputMode, int SampleRate)
		{
			if (SampleRate != 44100) throw (new NotImplementedException("(SampleRate != 44100)"));
			if (MaxVoices != 32) throw (new NotImplementedException("(MaxVoices != 32)"));
			//if (MaxVoices != 32) throw (new NotImplementedException("(MaxVoices != 32)"));

			var SasCore = GetSasCore(SasCorePointer, CreateIfNotExists: true);
			{
				SasCore.Initialized = true;
				SasCore.GrainSamples = GrainSamples;
				SasCore.MaxVoices = MaxVoices;
				SasCore.OutputMode = OutputMode;
				SasCore.SampleRate = SampleRate;
			}

			VoiceOnCount = new int[SasCore.GrainSamples];
			BufferTemp = new StereoIntSoundSample[SasCore.GrainSamples];
			BufferShort = new StereoShortSoundSample[SasCore.GrainSamples];
			MixBufferShort = new StereoShortSoundSample[SasCore.GrainSamples];

			return 0;
		}
Exemplo n.º 39
0
 public FSdebugMessages(bool _debugMode, OutputMode _outputMode, float _postToScreenDuration)
 {
     debugMode = _debugMode;
         outputMode = _outputMode;
         postToScreenDuration = _postToScreenDuration;
 }
		static Debug ()
		   {
			Mode = OutputMode.Debugger;
		   }
Exemplo n.º 41
0
        private string DoRequest(HttpWebRequest wreq, OutputMode outputMode)
        {
            Interlocked.Increment(ref _requestCount);

            using (HttpWebResponse wres = (HttpWebResponse) wreq.GetResponse())
            {
                StreamReader r = new StreamReader(wres.GetResponseStream());

                string xml = r.ReadToEnd();

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xml);

                XmlElement root = xmlDoc.DocumentElement;

                if (OutputMode.Xml == outputMode)
                {
                    XmlNode status = root.SelectSingleNode("/results/status");

                    if (status.InnerText != "OK")
                        throw new ApplicationException("Error making API call.");
                }
                else if (OutputMode.Rdf == outputMode)
                {
                    XmlNamespaceManager nm = new XmlNamespaceManager(xmlDoc.NameTable);
                    nm.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
                    nm.AddNamespace("aapi", "http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#");
                    XmlNode status = root.SelectSingleNode("/rdf:RDF/rdf:Description/aapi:ResultStatus", nm);

                    if (status.InnerText != "OK")
                        throw new ApplicationException("Error making API call.");
                }

                return xml;
            }
        }
Exemplo n.º 42
0
 /// <summary>
 /// Initializes a new ConsoleAdapter class.
 /// </summary>
 /// <param name="mode">The OutputMode.</param>
 public ConsoleAdapter(OutputMode mode)
 {
     OutputMode = mode;
 }
Exemplo n.º 43
0
 public Interpreter(string[] statements, OutputMode m)
 {
     this.statements = statements;
     outputMode = m;
     tape = new byte[256]; //create a tape with 256 8-bit memory cells
 }
Exemplo n.º 44
0
        public uint __sceSasInit(uint SasCorePointer, int GrainSamples, int MaxVoices, OutputMode OutputMode, int SampleRate)
        {
            if (SampleRate != 44100) throw (new NotImplementedException("(SampleRate != 44100)"));
            if (MaxVoices != 32) throw (new NotImplementedException("(MaxVoices != 32)"));
            //if (MaxVoices != 32) throw (new NotImplementedException("(MaxVoices != 32)"));

            var SasCore = GetSasCore(SasCorePointer, CreateIfNotExists: true);
            {
                SasCore.Initialized = true;
                SasCore.GrainSamples = GrainSamples;
                SasCore.MaxVoices = MaxVoices;
                SasCore.OutputMode = OutputMode;
                SasCore.SampleRate = SampleRate;
            }
            return 0;
        }
Exemplo n.º 45
0
        /// <summary>
        /// Get XML Stats Data
        /// </summary>
        public string GetStats(int id, OutputMode mode=OutputMode.XML)
        {
            Dictionary<string, string> Params = new Dictionary<string, string>();
            Params.Add ("action", "get_stats");
            Params.Add ("plan", this.plan);
            Params.Add ("user", this.user);
            Params.Add ("pass", this.pass);
            Params.Add ("mode", mode.ToString().ToLower()); //XML or JSON
            Params.Add ("eid", id.ToString());

            string bruto= GetResponse(this.urlBase, Params, this.apiMethod);
            if (bruto.Substring (0, 2) == "KO") {
                throw new TeenvioException (bruto);
            }
            return GetResponse(this.urlBase, Params, this.apiMethod);
        }
Exemplo n.º 46
0
 public void setOutputMode(OutputMode outputMode)
 {
     this.outputMode = outputMode;
 }
Exemplo n.º 47
0
 public FSdebugMessages(bool _debugMode, string _moduleName)
 {
     debugMode = _debugMode;
     outputMode = OutputMode.log;
     moduleName = _moduleName + ": ";
 }
Exemplo n.º 48
0
 /// <summary>
 /// Set output state for a specfic port.
 /// </summary>
 public void SetOutputState(int port, int power_setpoint, OutputMode mode, RegulationMode regulation_mode, int turn_ratio, RunState run_state, int tacho_limit)
 {
     byte[] message = new byte[12];
     if (!RequestResponse)
         message[0] = 0x80;
     message[1] = 0x04;
     message[2] = (byte)port;
     message[3] = (byte)Convert.ToSByte(power_setpoint);
     message[4] = (byte)mode;
     message[5] = (byte)regulation_mode;
     message[6] = (byte)Convert.ToSByte(turn_ratio);
     message[7] = (byte)run_state;
     message[8] = (byte)tacho_limit;
     message[9] = (byte)(tacho_limit >> 8);
     message[10] = (byte)(tacho_limit >> 16);
     message[11] = (byte)(tacho_limit >> 24);
     robot.Send(message);
 }
Exemplo n.º 49
0
 public abstract Task<HttpResponseMessage> GetSearchResponseMessageAsync(SearchResultArgs args, OutputMode outputMode = OutputMode.Xml);
Exemplo n.º 50
0
        /// <summary>
        /// Responsible for the actual output to the display.
        /// </summary>
        /// <param name="strOutput">string</param>
        /// <param name="om">OutputMode</param>
        private static void _OutputCommand(string strOutput, OutputMode om)
        {
            switch (om) {
            case OutputMode.Trace:
              HttpContext.Current.Trace.Write(strOutput);
            break;
            case OutputMode.Response:
              HttpContext.Current.Response.Write(strOutput);
            break;

            // This needs to be the last case switch because there is no break;
            case OutputMode.Exception:
              throw new Exception(strOutput);
              }
        }
Exemplo n.º 51
0
        public void EncodeVideoAsync(string inputFilePath, string outputFilePath, OutputMode outputMode, Control caller)
        {
            string encodingCommand = "-ab 192000";
            int threadCount = 2;

            EncodeVideoAsync(new VideoFile(inputFilePath), encodingCommand, outputFilePath, caller, threadCount);
        }
Exemplo n.º 52
0
 private void OutputResult(string output, OutputMode mode = OutputMode.Append)
 {
     switch (mode)
     {
         case OutputMode.Set:
             txtOutput.Text = output;
             break;
         case OutputMode.Append:
             StringBuilder sbOutput = new StringBuilder(txtOutput.Text);
             sbOutput.AppendLine(output);
             txtOutput.Text = sbOutput.ToString();
             break;
     }
 }
Exemplo n.º 53
0
        public CulvertView()
        {
            mCurrentSection = null;

            mViewMode = ViewMode.Section;
            mOutputMode = OutputMode.ServiceCombination;
            mLoadMode = LoadMode.EarthFill;
            mLabelMode = LabelMode.None;
            mEnvelopeMode = EnvelopeMode.Envelope;

            mDrawingPadding = 50;
            mDimensionOffset = 0.2f;
            mTextSize = 0.1f;

            mFormWorkColor = Color.DarkBlue;
            mShadingColor = Color.LightGray;
            mDimensionColor = Color.Black;
            mLoadColor = Color.Black;

            mNegativeForceColor = Color.Red;
            mPositiveForceColor = Color.Blue;
            mEnvelopeForceColor = Color.Purple;
            mFillTransparency = 0.65f;

            mLineThickness = 3.0f;
            mDimensionLineThickness = 1.0f;

            ResizeRedraw = true;
            InitializeComponent();
        }
Exemplo n.º 54
0
 private void OutputResult(List<string> outputs, OutputMode mode = OutputMode.Append)
 {
     StringBuilder sbOutput = new StringBuilder();
     foreach (string output in outputs)
     {
         sbOutput.AppendLine(output);
     }
     OutputResult(sbOutput.ToString(), mode);
 }
Exemplo n.º 55
0
 /**
  * Starts archiving an OpenTok session.
  *
  * <p>
  * Clients must be actively connected to the OpenTok session for you to successfully start
  * recording an archive.
  * <p>
  * You can only record one archive at a time for a given session. You can only record
  * archives of sessions that uses the OpenTok Media Router (sessions with the media mode set
  * to routed); you cannot archive sessions with the media mode set to relayed.
  * <p>
  * Note that you can have the session be automatically archived by setting the archiveMode
  * parameter of the OpenTok.CreateSession() method to ArchiveMode.ALWAYS.
  *
  * @param sessionId The session ID of the OpenTok session to archive.
  *
  * @param name The name of the archive. You can use this name to identify the archive. It is
  * a property of the Archive object, and it is a property of archive-related events in the
  * OpenTok client libraries.
  *
  * @param hasVideo Whether the archive will record video (true) or not (false). The default
  * value is true (video is recorded). If you set both <code>hasAudio</code> and
  * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method
  * results in an error.
  *
  * @param hasAudio Whether the archive will record audio (true) or not (false). The default
  * value is true (audio is recorded). If you set both <code>hasAudio</code> and
  * <code>hasVideo</code> to false, the call to the <code>StartArchive()</code> method
  * results in an error.
  *
  * @param outputMode Whether all streams in the archive are recorded to a single file
  * (<code>OutputMode.COMPOSED</code>, the default) or to individual files
  * (<code>OutputMode.INDIVIDUAL</code>).
  *
  * @return The Archive object. This object includes properties defining the archive,
  * including the archive ID.
  */
 public Archive StartArchive(string sessionId, string name = "", bool hasVideo = true, bool hasAudio = true, OutputMode outputMode = OutputMode.COMPOSED)
 {
     if (String.IsNullOrEmpty(sessionId))
     {
         throw new OpenTokArgumentException("Session not valid");
     }
     string url = string.Format("v2/partner/{0}/archive", this.ApiKey);
     var headers = new Dictionary<string, string> { { "Content-type", "application/json" } };
     var data = new Dictionary<string, object>() { { "sessionId", sessionId }, { "name", name }, { "hasVideo", hasVideo }, { "hasAudio", hasAudio }, { "outputMode", outputMode.ToString().ToLower() } };
     string response = Client.Post(url, headers, data);
     return OpenTokUtils.GenerateArchive(response, ApiKey, ApiSecret, OpenTokServer);
 }
 public AlchemyAPI_BaseParams setOutputMode(OutputMode outputMode)
 {
     this.outputMode = outputMode;
     return this;
 }
 public ProcessingMode(OutputMode mode, string root, string output)
 {
     outputMode = mode;
     rootPath = root;
     outputPath = output;
 }
		/// <summary>
		/// Communication modes handling
		/// </summary>

		public virtual bool setOutputMode(OutputMode mode)
		{
			base.OutputMode = mode;
			if (mode == OutputMode.Handset)
			{
				unregisterHeadsetReceiver();
				m_audioManager.SpeakerphoneOn = false;
			}
			else
			{
				m_audioManager.SpeakerphoneOn = true;
				registerHeadsetReceiver();
			}
			return true;
		}
	   static Trace ()
		   {
			Mode = OutputMode.Debugger;
		   }
Exemplo n.º 60
0
 /// <summary>
 /// Default contructor
 /// </summary>
 public GraphvizGraph()
 {
     m_Url=null;
     m_BackgroundColor=Color.White;
     m_IsCentered=false;
     m_ClusterRank=ClusterMode.Local;
     m_Comment=null;
     m_IsCompounded=false;
     m_IsConcentrated=false;
     m_Font=null;
     m_FontColor=Color.Black;
     m_Label=null;
     m_LabelJustification=LabelJustification.C;
     m_LabelLocation=LabelLocation.B;
     m_Layers=new GraphvizLayerCollection();
     m_McLimit=1.0;
     m_NodeSeparation=0.25;
     m_IsNormalized=false;
     m_NsLimit=-1;
     m_NsLimit1=-1;
     m_OutputOrder=OutputMode.BreadthFirst;
     m_PageSize=new Size(0,0);
     m_PageDirection=PageDirection.BL;
     m_Quantum=0;
     m_RankSeparation=0.5;
     m_Ratio = RatioMode.Auto;
     m_IsReMinCross=false;
     m_Resolution=0.96;
     m_Rotate=0;
     m_SamplePoints=8;
     m_SearchSize=30;
     m_Size=new Size(0,0);
     m_StyleSheet=null;
 }