public void deserializes_the_json_and_uses_the_property_binders() { var recorder = new Recorder(); var now = DateTime.Today; var time = MockRepository.GenerateStub<ISystemTime>(); time.Stub(x => x.UtcNow()).Return(now); using (var server = new IntegratedJsonBindingApplication(recorder, time).BuildApplication().RunEmbedded()) { var url = server.Urls.UrlFor(typeof (IntegratedJsonBindingTarget)); var response = post(url.ToAbsoluteUrl(server.BaseAddress), "{Name:'Josh',Child:{ChildName:'Joel'},DynamicData:{test:{name:'nested'}}}"); if (response.StatusCode != HttpStatusCode.OK) { Debug.WriteLine(response.ReadAsText()); } response.StatusCode.ShouldEqual(HttpStatusCode.OK); recorder.Target.Name.ShouldEqual("Josh"); recorder.Target.Child.ChildName.ShouldEqual("Joel"); recorder.Target.Child.CurrentTime.ShouldEqual(now); var child = recorder.Target.DynamicData.Value<JObject>("test"); child["name"].ToString().ShouldEqual("nested"); } }
public RecorderControlViewModel(RecordersViewModel parent, Recorder recorder) { _parent = parent; _recorder = recorder; ViewModelHelper.BindNotifyChanged(_recorder.RecordDescription, this, (sender, e) => RaisePropertyChanged(e.PropertyName)); ViewModelHelper.BindNotifyChanged(_recorder, this, (sender, e) => RaisePropertyChanged(e.PropertyName)); // IsPlayingの状態が変わったら、PlayCommand/StopCommandの有効無効を切り替える Observable.FromEventPattern<PropertyChangedEventArgs>(_recorder, "PropertyChanged") .Where(e => e.EventArgs.PropertyName == "IsRecording" || e.EventArgs.PropertyName == "IsPausing") .Subscribe(_ => { _PlayCommand.RaiseCanExecuteChanged(); _PauseCommand.RaiseCanExecuteChanged(); _StopCommand.RaiseCanExecuteChanged(); }); Observable.FromEventPattern<PropertyChangedEventArgs>(_recorder, "PropertyChanged") .Where(e => e.EventArgs.PropertyName == "IsAlive") .Subscribe(_ => _ReinitializeCommand.RaiseCanExecuteChanged()); Observable.FromEventPattern<ErrorInfoEventArgs>(_recorder, "ErrorRaised") .Subscribe(e => Messenger.Raise(new InformationMessage(e.EventArgs.Message, "エラー", "ShowError"))); }
public void deserializes_the_json_and_uses_the_property_binders() { var recorder = new Recorder(); var now = DateTime.Today; var time = MockRepository.GenerateStub<ISystemTime>(); time.Stub(x => x.UtcNow()).Return(now); using (var server = new IntegrationJsonBindingRegistry(recorder, time).ToRuntime()) { server.Scenario(_ => { _.Post.Input<IntegratedJsonBindingTarget>().ContentType("application/json"); _.Request.Body.JsonInputIs( "{Name:'Josh',Child:{ChildName:'Joel'},DynamicData:{test:{name:'nested'}}}"); _.StatusCodeShouldBeOk(); }); Recorder.Target.Name.ShouldBe("Josh"); Recorder.Target.Child.ChildName.ShouldBe("Joel"); Recorder.Target.Child.CurrentTime.ShouldBe(now); var child = Recorder.Target.DynamicData.Value<JObject>("test"); child["name"].ToString().ShouldBe("nested"); } }
private void Recorder_Executed(object sender, ExecutedRoutedEventArgs e) { var recorder = new Recorder(); Hide(); var result = recorder.ShowDialog(); if (result.HasValue && result.Value) { // If Close Environment.Exit(0); } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (recorder.ExitArg == ExitAction.Recorded) { var editor = new Editor { ListFrames = recorder.ListFrames }; GenericShowDialog(editor); return; } Show(); #endregion } }
private void WriteToDisk(Recorder recorder) { //Sample every second until flagged as completed. var accumulatingHistogram = new LongHistogram(TimeStamp.Hours(1), 3); while (_isCompleted == 0) { Thread.Sleep(1000); var histogram = recorder.GetIntervalHistogram(); accumulatingHistogram.Add(histogram); _logWriter.Append(histogram); Console.WriteLine($"{DateTime.Now:o} Interval.TotalCount = {histogram.TotalCount,10:G}. Accumulated.TotalCount = {accumulatingHistogram.TotalCount,10:G}."); } _logWriter.Dispose(); _outputStream.Dispose(); Console.WriteLine("Log contents"); Console.WriteLine(File.ReadAllText(LogPath)); Console.WriteLine(); Console.WriteLine("Percentile distribution (values reported in milliseconds)"); accumulatingHistogram.OutputPercentileDistribution(Console.Out, outputValueUnitScalingRatio: OutputScalingFactor.TimeStampToMilliseconds); Console.WriteLine("Output thread finishing."); }
public BetamaxRecordingBuilderStrategy(BetamaxSettings settings) { _settings = settings; var tape = new FileTape(); settings.RegisterObserver(tape); _recorder = new Recorder(tape); }
public AddCameraWin(Recorder host) { this.InitializeComponent(); this.Loaded += new RoutedEventHandler(AddCameraWin_Loaded); _host = host; // 在此点之下插入创建对象所需的代码。 }
/// <summary> /// Initializes a new instance of the <see cref="RapTimer" /> class. /// </summary> /// <param name="text">The text.</param> /// <param name="audioLength">Length of the audio.</param> /// <param name="r">The r.</param> /// <param name="b">The b.</param> public RapTimer(TextBlock text, TimeSpan audioLength, Recorder r, RapBeats b) { this._textBlock = text; this._maxAudioLength = audioLength; this._timer.Interval = new TimeSpan(0, 0, 0, 1); this._timer.Tick += this._timer_Tick; this._currentAudioLength = 0; this._recorderInstance = r; this._beats = b; }
public void TestRecorder() { var client = new ClientBase(new Serializer()); var recorder = new Recorder(client); recorder.Start(); var gate = new AutoResetEvent(false); Exception exception = null; FooClass result = null; Guid id = client.BeginRequest(RequestMethod.GET, "http://api.geonames.org", "/citiesJSON?north={north}&south={south}&east{east}&west={west}&lang={lang}&username={username}", new Dictionary<string, string>(), new Dictionary<string, object> { {"north",44.1}, {"south",-9.9}, {"east",-22.4}, {"west",55.2}, {"lang","de"}, {"username","demo"} }, ContentType.TEXT, ContentType.JSON, TimeSpan.FromSeconds(1), 3000, 0, ar => { try { result = client.EndRequest<FooClass>(ar); var responsetext = ar.ResponseText; } catch (Exception ex) { exception = ex; } gate.Set(); }, null); if (!gate.WaitOne(10000)) { throw new Exception("timed out"); } // verify cache has purged gate.WaitOne(3000); if (exception != null) { Assert.Fail(exception.Message); } recorder.Stop(); List<RequestInfoBase> recorded = recorder.GetRequests(); recorder.Dispose(); Assert.IsTrue(recorded.Count == 1); var recordedJson = client.Serializer.SerializeObject(recorded); List<RequestInfoBase> deserializedRecording = client.Serializer.DeserializeObject<List<RequestInfoBase>>(recordedJson); Assert.IsTrue(deserializedRecording.Count == 1); }
public void GetIntervalHistogram_returns_current_histogram_values() { var recorder = new Recorder(1, HighestTrackableValue, NumberOfSignificantValueDigits, (id, lowest, highest, sf) => new LongHistogram(id, lowest, highest, sf)); recorder.RecordValue(1); recorder.RecordValue(10); recorder.RecordValue(100); var histogram = recorder.GetIntervalHistogram(); Assert.AreEqual(1, histogram.GetCountAtValue(1)); Assert.AreEqual(1, histogram.GetCountAtValue(10)); Assert.AreEqual(1, histogram.GetCountAtValue(100)); }
// Use this for initialization void Start () { this.outputFile = Application.dataPath + "/Datas/weights.txt"; this.numWeights = (input * hidden) + (hidden * output) + (hidden + output); this.weights = NeuralNetworkHelpers.getRandomWeights (numWeights); this.nn = new NeuralNetwork (input, output, hidden); this.nn.setWeights (weights); this.error = double.MaxValue; this.trained = false; this.rec = new Recorder(); this.trainingSets = this.rec.read(input, output); }
// Use this for initialization public void Start() { Stopper s = new Stopper(); Console.WriteLine("How many hidden nodes?"); hidden = int.Parse(Console.ReadLine()); Console.WriteLine("Epoch counter?"); int epochCtr = int.Parse(Console.ReadLine()); Console.WriteLine("Error threshold?"); s.errorThresh = float.Parse(Console.ReadLine()); Thread oThread = new Thread(new ThreadStart(s.run)); oThread.Start(); String outPath = "C:/Users/SwoodGrommet/Desktop/game-ai/Assets/Scripts/Datas/"; outputFile = "weights.txt"; sets = new ArrayList(); rec = new Recorder(); nn = new NeuralNetwork (input, output, hidden); numWeights = (input * hidden) + (hidden * output) + (hidden + output); weights = getRandomWeights (numWeights); nn = new NeuralNetwork (input, output, hidden); nn.setWeights (weights); Console.WriteLine("chutzpah"); rec.read (this.sets); read = true; double changeDel = 0; while (/*!trained &&*/ read) { double errors = 0; //do { foreach (TrainingSet set in this.sets) { setInputs(set.getInputs()); setTargets(set.getTargets()); errors += train(); } //Debug.Log("Current error : " + errors); //} while (error > 0.0001); error = errors / sets.Count; if (s.output) { Console.WriteLine("Outputting weights to file"); this.weights = nn.getWeights(); nn.outputWeights(weights); s.output = false; } if (s.errorThresh > error || s.stop) { Console.WriteLine("All trainings are done!!!"); break; } //Console.WriteLine(ctr + ": " + errors); if (ctr % epochCtr == 0) { Console.WriteLine("epoch: " + ctr / epochCtr + "; error: " + error + "; Delta: " + (changeDel - error)); changeDel = error; } ctr++; } }
public RecordForm(String path) : base() { InitializeComponent(); base.adjustControlSizes(); rc = new Recorder(); if(path != null) voicePath = path+@"\Temporary.wav"; else voicePath = @"\Temporary.wav"; }
public void GetIntervalHistogram_returns_alternating_instances_from_factory() { var recorder = new Recorder(1, HighestTrackableValue, NumberOfSignificantValueDigits, (id, lowest, highest, sf) => new LongHistogram(id, lowest, highest, sf)); var a = recorder.GetIntervalHistogram(); var b = recorder.GetIntervalHistogram(a); var c = recorder.GetIntervalHistogram(b); var d = recorder.GetIntervalHistogram(c); Assert.AreNotSame(a, b); Assert.AreSame(a, c); Assert.AreNotSame(a, d); Assert.AreSame(b, d); }
// Use this for initialization void Start () { tower = GameObject.FindGameObjectWithTag ("tower"); <<<<<<< HEAD Debug.Log(tower); ======= >>>>>>> cd3c54cdc1382c9281f8215a0e5df8fe489c3d23 pie = tower.GetComponent<PieSliceSensor> (); cont = tower.GetComponent<TowerController> (); rec = new Recorder (); time = Time.time; <<<<<<< HEAD if (File.Exists(@rec.outputFile)) File.Delete(@rec.outputFile); }
public void GetIntervalHistogram_causes_recording_to_happen_on_new_histogram() { var recorder = new Recorder(1, HighestTrackableValue, NumberOfSignificantValueDigits, (id, lowest, highest, sf) => new LongHistogram(id, lowest, highest, sf)); recorder.RecordValue(1); var histogramPrimary = recorder.GetIntervalHistogram(); Assert.AreEqual(1, histogramPrimary.GetCountAtValue(1)); recorder.RecordValue(10); recorder.RecordValue(100); var histogramSecondary = recorder.GetIntervalHistogram(histogramPrimary); Assert.AreEqual(0, histogramSecondary.GetCountAtValue(1)); Assert.AreEqual(1, histogramSecondary.GetCountAtValue(10)); Assert.AreEqual(1, histogramSecondary.GetCountAtValue(100)); }
void Start() { // Get our Recorder instance (there can be only one per camera). m_Recorder = GetComponent<Recorder>(); // If you want to change Recorder settings at runtime, use : //m_Recorder.Setup(autoAspect, width, height, fps, bufferSize, repeat, quality); // The Recorder starts paused for performance reasons, call Record() to start // saving frames to memory. You can pause it at any time by calling Pause(). m_Recorder.Record(); // Optional callbacks (see each function for more info). m_Recorder.OnPreProcessingDone = OnProcessingDone; m_Recorder.OnFileSaveProgress = OnFileSaveProgress; m_Recorder.OnFileSaved = OnFileSaved; }
public WorkShop() { InitializeComponent(); var network = new Network(); var solver = new ODESolver(); var recorder = new Recorder(Simulator, RecordType.None, "Soul"); Simulator = new Simulator(0.01, 50, network, solver, recorder); IsReportProgress = true; CellNet = new CellNet(network); IsImaging = true; var transformGroup = new Transform3DGroup(); TranslateTransform = new TranslateTransform3D(); RotateTransform = new RotateTransform3D(new QuaternionRotation3D()); ScaleTransform = new ScaleTransform3D(); transformGroup.Children.Add(TranslateTransform); transformGroup.Children.Add(RotateTransform); transformGroup.Children.Add(ScaleTransform); ModelVisual.Transform = transformGroup; ActionType = ActionType.None; MouseLeftButtonDown += WorkShop_MouseLeftButtonDown; MouseLeftButtonUp += WorkShop_MouseLeftButtonUp; MouseRightButtonDown += WorkShop_MouseRightButtonDown; MouseRightButtonUp += WorkShop_MouseRightButtonUp; MouseMove += WorkShop_MouseMove; MouseWheel += WorkShop_MouseWheel; var n = new LI(-50, -48, 5, 2, -55); var net0 = Proliferation.Division(n, new Point3D(1, 10, 10), "InitPotential", new Randomizer(new RNG(), dimyend: 9, dimzend: 9, mean: -50.0, std: 5)); net0.ReSet(); //net0.ReShape(new Point3D(2, 10, 5)); var net1 = Proliferation.Division(n, new Point3D(1, 10, 10), "InitPotential", new Randomizer(new RNG(), dimyend: 9, dimzend: 9, mean: -50.0, std: 10)); net1.ReSet(); Projection.From_To(net0, net1, new WeightSynapse(null, 1), ProjectionType.OneToOne, 1.0); Projection.From_To(net0, net0, new WeightSynapse(null, -0.4), ProjectionType.AllToAll, 0.3); Projection.From_To(net1, net0, new WeightSynapse(null, -0.1), ProjectionType.AllToAll, 0.5); Projection.From_To(net1, net1, new WeightSynapse(null, 0.1), ProjectionType.OneToOne, 0.8); var net = new Network(); net.ChildNetworks.Add(net0.ID, net0); net.ChildNetworks.Add(net1.ID, net1); LoadNetwork(net); CellNet.ChildCellNet[net0.ID].Position = new Point3D(-15, 0, 15); }
public Recording(MainWindow mainWindow, Recorder recorder) : base(mainWindow) { mainWindow.RecordButton.Content = Resources.StopRecording; mainWindow.RecordButton.IsEnabled = true; mainWindow.RecordButton.Click += RecordButton_Click; bodyCamera = new BodyCamera(mainWindow.BodyCamera, recorder.Metadata.DepthFrameWidth, recorder.Metadata.DepthFrameHeight); colorCamera = new ColorCamera(mainWindow.ColorCamera, recorder.Metadata.ColorFrameWidth, recorder.Metadata.ColorFrameHeight); depthCamera = new DepthCamera(mainWindow.DepthCamera, recorder.Metadata.DepthFrameWidth, recorder.Metadata.DepthFrameHeight); this.recorder = recorder; recorder.Start(); recorder.BodyFrameUpdated += Recorder_BodyFrameUpdated; recorder.ColorFrameUpdated += Recorder_ColorFrameUpdated; recorder.DepthFrameUpdated += Recorder_DepthFrameUpdated; }
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i <= 20; i++) { try { String s = i + tempVoicePath; st = new FileStream(s, FileMode.Create, FileAccess.ReadWrite); rc = new Recorder(i); rc.RecordFor(st, 10); st.Flush(); } catch(Exception f) { String s=f.Message; } } }
public void データを書き込んでみる() { var recorder = new Recorder("127.0.0.1:2809/SampleOut0.rtc", "SampleOut0.out"); recorder.IsAlive.Is(true); recorder.Play(); recorder.IsAlive.Is(true); var comp = NamingServiceManager.Default.GetComponent("127.0.0.1:2809/SampleOut0.rtc"); var port = comp.GetPort("SampleOut0.out") as OutPortServiceMock; port.IsNotNull(); var inportcdr = port.GetInPortCdr(); inportcdr.IsNotNull(); var factory = new CdrSerializerFactory(); var serializer = factory.GetSerializer<TimedLong>(); for (int i = 0; i < 100; i++) { var stream = new MemoryStream(); var data = new TimedLong(new Time(0x12, 0x34), i); serializer.Serialize(data, stream); inportcdr.put(stream.ToArray()); } recorder.IsAlive.Is(true); recorder.Stop(); recorder.IsAlive.Is(true); recorder.RecordDescription.Count.Is(100); recorder.RecordDescription.SumSize.Is(1200); Directory.EnumerateFiles(TestDataDirectory).Count().Is(2); }
private void RecordButton_Click(object sender, RoutedEventArgs e) { var dialog = new SaveFileDialog() { FileName = string.Format("Mokap_{0}.mkp", DateTime.Now.ToString("yyyyMMdd_HHmmss")), Filter = "Mokap Record Files|*.mkp", }; if (dialog.ShowDialog() == true) { var recorder = new Recorder(dialog.FileName, MainWindow.Dispatcher); // TODO Check if recorder can start Become(new Recording(MainWindow, recorder)); } else { logger.Trace("User cancelled saving mkp file"); } }
public Recording32BitBenchmark() { const int lowestTrackableValue = 1; var highestTrackableValue = TimeStamp.Minutes(10); const int numberOfSignificantValueDigits = 3; _testValues = TestValues(highestTrackableValue); _longHistogram = new LongHistogram(highestTrackableValue, numberOfSignificantValueDigits); _intHistogram = new IntHistogram(highestTrackableValue, numberOfSignificantValueDigits); _shortHistogram = new ShortHistogram(highestTrackableValue, numberOfSignificantValueDigits); _longConcurrentHistogram = new LongConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits); _intConcurrentHistogram = new IntConcurrentHistogram(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits); _longRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongHistogram(id, low, hi, sf)); _longConcurrentRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new LongConcurrentHistogram(id, low, hi, sf)); _intRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntHistogram(id, low, hi, sf)); _intConcurrentRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new IntConcurrentHistogram(id, low, hi, sf)); _shortRecorder = new Recorder(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits, (id, low, hi, sf) => new ShortHistogram(id, low, hi, sf)); }
public void ShouldRecordMethodCallsTransparently() { var service = new WcfWidgetService(); var recordingImplementation = new Recorder().Record<WidgetService, WcfWidgetService>(service); var request = new WidgetNameForRequest { VersionNumber = "1" }; var response = recordingImplementation.GetWidgetNameFor(request); Assert.That(response.WidgetName, Is.EqualTo("Wcf Widget versioned 1")); var dir = new DirectoryInfo(@"RecordedCalls\SampleInterface.WcfStyle.WidgetService\GetWidgetNameFor"); var requestFiles = dir.GetFiles("*-request.xml"); var responseFiles = dir.GetFiles("*-response.xml"); Assert.That(requestFiles.Length, Is.EqualTo(1)); Assert.That(responseFiles.Length, Is.EqualTo(1)); //Directory.Delete("RecordedCalls", true); }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) { if (sender == _ok) { if (this.selectedRecorder == null) { newRecorder = new Recorder(); newRecorder.Name = _name.Text; newRecorder.ChannelNum = Int32.Parse(_channelNumber.Text); newRecorder.User = _user.Text; newRecorder.Password = _psd.Password; newRecorder.Capacity = Int32.Parse(_capacity.Text); newRecorder.Ip = _ip.Text; newRecorder.Productor = (_productCombo.SelectedItem as ComboBoxItem).Content.ToString(); newRecorder.Type = (_typeCombo.SelectedItem as ComboBoxItem).Content.ToString(); newRecorder.Port = _port.Text; newRecorder.Remark = _remark.Text; wsAdapter.addRecorder(newRecorder); } else { selectedRecorder.Name = _name.Text; selectedRecorder.ChannelNum = Int32.Parse(_channelNumber.Text); selectedRecorder.User = _user.Text; selectedRecorder.Password = _psd.Password; selectedRecorder.Capacity = Int32.Parse(_capacity.Text); selectedRecorder.Ip = _ip.Text; selectedRecorder.Productor = (_productCombo.SelectedItem as ComboBoxItem).Content.ToString(); selectedRecorder.Type = (_typeCombo.SelectedItem as ComboBoxItem).Content.ToString(); selectedRecorder.Port = _port.Text; selectedRecorder.Remark = _remark.Text; wsAdapter.editRecorder(selectedRecorder); } } // 在此处添加事件处理程序实现。 this.Close(); }
/// <summary> /// Helper method that creates a new recorder and sets its event handlers /// </summary> private void prepareRecorder() { recorder = null; try { recorder = phone.AllocateRecorder(); recorder.Completed += new VoiceEventHandler(recorder_Completed); } catch (Exception e) { display("Exception in creating recorder. Message: " + e.Message + "\r\n" + e.StackTrace, MessageType.WARNING); recorder = null; } }
/// <summary> /// Toggle Recording /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonToggle_Click(object sender, EventArgs e) { // Start Recording if (buttonToggle.Text == "Record") { // Set Text buttonToggle.Text = "Stop"; buttonPause.Visible = true; // Update Settings Properties.Settings.Default.Framerate = numericUpDownFramerate.Value; Properties.Settings.Default.Save(); // Create recorder and set options recorder = new Recorder(formOptions.getImageFormat()); recorder.fps = (float)numericUpDownFramerate.Value; recorder.drawCursor = checkBoxDrawCursor.Checked; // Trigger FormMain_Resize to get region of displayBox FormMain_Resize(sender, e); // Start recorder.Start(checkBoxCaptureAudio.Checked); timerRecord.Start(); // Set Alt Window Tracking if the option is set if (Properties.Settings.Default.AltWindowTracking) timerTracker.Start(); FormBorderStyle = FormBorderStyle.FixedDialog; return; } // Stop Recording { // Stop recorder.Stop(); timerRecord.Stop(); timerTracker.Stop(); // Set Text buttonToggle.Text = "Record"; buttonPause.Visible = false; FormMain_Resize(sender, e); TopMost = false; // Edit checkBoxFollow.Checked = false; var showFramesResult = showFrames(!checkBoxCaptureAudio.Checked); // Process if showFrames was successful if (showFramesResult.Item1) processFrames(showFramesResult.Item2); // Delete leftovers recorder.Flush(); recorder = null; FormBorderStyle = FormBorderStyle.Sizable; TopMost = checkBoxTopMost.Checked; } }
/// <summary> /// 全部直播间禁用自动录制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DisableAllAutoRec(object sender, RoutedEventArgs e) { Recorder.ToList().ForEach(rr => Task.Run(() => rr.Stop())); }
static void Main(string[] args) { //This is how you can select audio devices. If you want the system default device, //just leave the AudioInputDevice or AudioOutputDevice properties unset or pass null or empty string. var audioInputDevices = Recorder.GetSystemAudioDevices(AudioDeviceSource.InputDevices); var audioOutputDevices = Recorder.GetSystemAudioDevices(AudioDeviceSource.OutputDevices); string selectedAudioInputDevice = audioInputDevices.Count > 0 ? audioInputDevices.First().Key : null; string selectedAudioOutputDevice = audioOutputDevices.Count > 0 ? audioOutputDevices.First().Key : null; var opts = new RecorderOptions { AudioOptions = new AudioOptions { AudioInputDevice = selectedAudioInputDevice, AudioOutputDevice = selectedAudioOutputDevice, IsAudioEnabled = true, IsInputDeviceEnabled = true, IsOutputDeviceEnabled = true, } }; Recorder rec = Recorder.CreateRecorder(opts); rec.OnRecordingFailed += Rec_OnRecordingFailed; rec.OnRecordingComplete += Rec_OnRecordingComplete; rec.OnStatusChanged += Rec_OnStatusChanged; Console.WriteLine("Press ENTER to start recording or ESC to exit"); while (true) { ConsoleKeyInfo info = Console.ReadKey(true); if (info.Key == ConsoleKey.Enter) { break; } else if (info.Key == ConsoleKey.Escape) { return; } } rec.Record(Path.ChangeExtension(Path.GetTempFileName(), ".mp4")); CancellationTokenSource cts = new CancellationTokenSource(); var token = cts.Token; Task.Run(async() => { while (true) { if (token.IsCancellationRequested) { return; } if (_isRecording) { Console.Write(String.Format("\rElapsed: {0}s:{1}ms", _stopWatch.Elapsed.Seconds, _stopWatch.Elapsed.Milliseconds)); } await Task.Delay(10); } }, token); while (true) { ConsoleKeyInfo info = Console.ReadKey(true); if (info.Key == ConsoleKey.Escape) { break; } } cts.Cancel(); rec.Stop(); Console.WriteLine(); Console.ReadKey(); }
/// <summary> /// Toggle Recording /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonToggle_Click(object sender, EventArgs e) { // Start Recording if (buttonToggle.Text == "Record") { // Set Text buttonToggle.Text = "Stop"; buttonPause.Visible = true; // Update Settings Properties.Settings.Default.Framerate = numericUpDownFramerate.Value; Properties.Settings.Default.Save(); // Create recorder and set options recorder = new Recorder(formOptions.getImageFormat()); recorder.fps = (float)numericUpDownFramerate.Value; recorder.drawCursor = checkBoxDrawCursor.Checked; // Trigger FormMain_Resize to get region of displayBox FormMain_Resize(sender, e); // Start recorder.Start(checkBoxCaptureAudio.Checked); timerRecord.Start(); // Set Alt Window Tracking if the option is set if (Properties.Settings.Default.AltWindowTracking) { timerTracker.Start(); } FormBorderStyle = FormBorderStyle.FixedDialog; } // Stop Recording else { // Stop recorder.Stop(); timerRecord.Stop(); timerTracker.Stop(); // Set Text buttonToggle.Text = "Record"; buttonPause.Visible = false; FormMain_Resize(sender, e); TopMost = false; // Edit checkBoxFollow.Checked = false; var showFramesResult = showFrames(!checkBoxCaptureAudio.Checked); // Process if showFrames was successful if (showFramesResult.Item1) { processFrames(showFramesResult.Item2); } // Delete leftovers recorder.Flush(); recorder = null; FormBorderStyle = FormBorderStyle.Sizable; TopMost = checkBoxTopMost.Checked; } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as AdverseEvent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (CategoryElement != null) { dest.CategoryElement = (Code <Hl7.Fhir.Model.AdverseEvent.AdverseEventCategory>)CategoryElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Reaction != null) { dest.Reaction = new List <Hl7.Fhir.Model.ResourceReference>(Reaction.DeepCopy()); } if (Location != null) { dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopy(); } if (Seriousness != null) { dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)Seriousness.DeepCopy(); } if (Outcome != null) { dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopy(); } if (Recorder != null) { dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopy(); } if (EventParticipant != null) { dest.EventParticipant = (Hl7.Fhir.Model.ResourceReference)EventParticipant.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (SuspectEntity != null) { dest.SuspectEntity = new List <Hl7.Fhir.Model.AdverseEvent.SuspectEntityComponent>(SuspectEntity.DeepCopy()); } if (SubjectMedicalHistory != null) { dest.SubjectMedicalHistory = new List <Hl7.Fhir.Model.ResourceReference>(SubjectMedicalHistory.DeepCopy()); } if (ReferenceDocument != null) { dest.ReferenceDocument = new List <Hl7.Fhir.Model.ResourceReference>(ReferenceDocument.DeepCopy()); } if (Study != null) { dest.Study = new List <Hl7.Fhir.Model.ResourceReference>(Study.DeepCopy()); } return(dest); }
private async void RecordButton_Click(object sender, RoutedEventArgs e) { if (IsRecording) { _rec.Stop(); _progressTimer?.Stop(); _progressTimer = null; _secondsElapsed = 0; RecordButton.IsEnabled = false; return; } OutputResultTextBlock.Text = ""; UpdateProgress(); string videoPath = ""; if (CurrentRecordingMode == RecorderMode.Video) { string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp, timestamp + ".mp4"); } else if (CurrentRecordingMode == RecorderMode.Slideshow) { //For slideshow just give a folder path as input. string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp) + "\\"; } else if (CurrentRecordingMode == RecorderMode.Snapshot) { string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss-ff"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp, timestamp + GetImageExtension()); } _progressTimer = new DispatcherTimer(); _progressTimer.Tick += _progressTimer_Tick; _progressTimer.Interval = TimeSpan.FromSeconds(1); _progressTimer.Start(); int right = 0; Int32.TryParse(this.RecordingAreaRightTextBox.Text, out right); int bottom = 0; Int32.TryParse(this.RecordingAreaBottomTextBox.Text, out bottom); int left = 0; Int32.TryParse(this.RecordingAreaLeftTextBox.Text, out left); int top = 0; Int32.TryParse(this.RecordingAreaTopTextBox.Text, out top); int maxWidth = 0; Int32.TryParse(this.RecordingAreaMaxWidthTextBox.Text, out maxWidth); int maxHeight = 0; Int32.TryParse(this.RecordingAreaMaxHeightTextBox.Text, out maxHeight); Display selectedDisplay = (Display)this.ScreenComboBox.SelectedItem; string audioOutputDevice = AudioOutputsComboBox.SelectedValue as string; string audioInputDevice = AudioInputsComboBox.SelectedValue as string; RecorderOptions options = new RecorderOptions { RecorderMode = CurrentRecordingMode, IsThrottlingDisabled = this.IsThrottlingDisabled, IsHardwareEncodingEnabled = this.IsHardwareEncodingEnabled, IsLowLatencyEnabled = this.IsLowLatencyEnabled, IsMp4FastStartEnabled = this.IsMp4FastStartEnabled, IsFragmentedMp4Enabled = this.IsFragmentedMp4Enabled, IsLogEnabled = this.IsLogEnabled, LogSeverityLevel = this.LogSeverityLevel, LogFilePath = IsLogToFileEnabled ? this.LogFilePath : "", AudioOptions = new AudioOptions { Bitrate = AudioBitrate.bitrate_96kbps, Channels = AudioChannels.Stereo, IsAudioEnabled = this.IsAudioEnabled, IsOutputDeviceEnabled = IsAudioOutEnabled, IsInputDeviceEnabled = IsAudioInEnabled, AudioOutputDevice = audioOutputDevice, AudioInputDevice = audioInputDevice }, VideoOptions = new VideoOptions { BitrateMode = this.CurrentVideoBitrateMode, Bitrate = VideoBitrate * 1000, Framerate = this.VideoFramerate, Quality = this.VideoQuality, IsFixedFramerate = this.IsFixedFramerate, EncoderProfile = this.CurrentH264Profile, SnapshotFormat = CurrentImageFormat, MaxWidth = maxWidth, MaxHeight = maxHeight, }, DisplayOptions = new DisplayOptions(selectedDisplay.DisplayName, left, top, right, bottom), MouseOptions = new MouseOptions { IsMouseClicksDetected = this.IsMouseClicksDetected, IsMousePointerEnabled = this.IsMousePointerEnabled, MouseClickDetectionColor = this.MouseLeftClickColor, MouseRightClickDetectionColor = this.MouseRightClickColor, MouseClickDetectionRadius = this.MouseClickRadius, MouseClickDetectionDuration = this.MouseClickDuration, MouseClickDetectionMode = this.CurrentMouseDetectionMode } }; if (_rec == null) { _rec = Recorder.CreateRecorder(options); _rec.OnRecordingComplete += Rec_OnRecordingComplete; _rec.OnRecordingFailed += Rec_OnRecordingFailed; _rec.OnStatusChanged += _rec_OnStatusChanged; } else { _rec.SetOptions(options); } if (RecordToStream) { Directory.CreateDirectory(Path.GetDirectoryName(videoPath)); _outputStream = new FileStream(videoPath, FileMode.Create); _rec.Record(_outputStream); } else { _rec.Record(videoPath); } _secondsElapsed = 0; IsRecording = true; }
public override void WriteStr() { Recorder.Append("overrided"); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if (Identifier != null) { writer.WritePropertyName("identifier"); Identifier.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Actuality)) { writer.WriteString("actuality", (string)Actuality !); } if (_Actuality != null) { writer.WritePropertyName("_actuality"); _Actuality.SerializeJson(writer, options); } if ((Category != null) && (Category.Count != 0)) { writer.WritePropertyName("category"); writer.WriteStartArray(); foreach (CodeableConcept valCategory in Category) { valCategory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Event != null) { writer.WritePropertyName("event"); Event.SerializeJson(writer, options); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (Encounter != null) { writer.WritePropertyName("encounter"); Encounter.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Date)) { writer.WriteString("date", (string)Date !); } if (_Date != null) { writer.WritePropertyName("_date"); _Date.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Detected)) { writer.WriteString("detected", (string)Detected !); } if (_Detected != null) { writer.WritePropertyName("_detected"); _Detected.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(RecordedDate)) { writer.WriteString("recordedDate", (string)RecordedDate !); } if (_RecordedDate != null) { writer.WritePropertyName("_recordedDate"); _RecordedDate.SerializeJson(writer, options); } if ((ResultingCondition != null) && (ResultingCondition.Count != 0)) { writer.WritePropertyName("resultingCondition"); writer.WriteStartArray(); foreach (Reference valResultingCondition in ResultingCondition) { valResultingCondition.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Location != null) { writer.WritePropertyName("location"); Location.SerializeJson(writer, options); } if (Seriousness != null) { writer.WritePropertyName("seriousness"); Seriousness.SerializeJson(writer, options); } if (Severity != null) { writer.WritePropertyName("severity"); Severity.SerializeJson(writer, options); } if (Outcome != null) { writer.WritePropertyName("outcome"); Outcome.SerializeJson(writer, options); } if (Recorder != null) { writer.WritePropertyName("recorder"); Recorder.SerializeJson(writer, options); } if ((Contributor != null) && (Contributor.Count != 0)) { writer.WritePropertyName("contributor"); writer.WriteStartArray(); foreach (Reference valContributor in Contributor) { valContributor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((SuspectEntity != null) && (SuspectEntity.Count != 0)) { writer.WritePropertyName("suspectEntity"); writer.WriteStartArray(); foreach (AdverseEventSuspectEntity valSuspectEntity in SuspectEntity) { valSuspectEntity.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((SubjectMedicalHistory != null) && (SubjectMedicalHistory.Count != 0)) { writer.WritePropertyName("subjectMedicalHistory"); writer.WriteStartArray(); foreach (Reference valSubjectMedicalHistory in SubjectMedicalHistory) { valSubjectMedicalHistory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((ReferenceDocument != null) && (ReferenceDocument.Count != 0)) { writer.WritePropertyName("referenceDocument"); writer.WriteStartArray(); foreach (Reference valReferenceDocument in ReferenceDocument) { valReferenceDocument.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Study != null) && (Study.Count != 0)) { writer.WritePropertyName("study"); writer.WriteStartArray(); foreach (Reference valStudy in Study) { valStudy.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
public new void WriteNum() { Recorder.Append(99999); }
private void Awake() { instance = this; }
public Form_EventFileReader(string Game_Name, string Game_Path) { this.Game_Path = Game_Path; InitializeComponent(); //load presets checkBox_ShowWarnings.Checked = Properties.Settings.Default.Show_warnings; checkBox_ShowErrors.Checked = Properties.Settings.Default.Show_errors; checkBox_ShowNotifications.Checked = Properties.Settings.Default.Show_notifications; checkBox_ShowDebug.Checked = Properties.Settings.Default.Show_debug_info; vibrationEvents = new VibrationEvents(Game_Path); memory_scanner = new Memory_Scanner(Game_Name); eventFileScanner = new EventFileScanner(Game_Path, memory_scanner, vibrationEvents); RecorderOptions options = new RecorderOptions { RecorderMode = RecorderMode.Video, RecorderApi = RecorderApi.WindowsGraphicsCapture, IsThrottlingDisabled = false, IsHardwareEncodingEnabled = true, IsLowLatencyEnabled = false, IsMp4FastStartEnabled = false, IsFragmentedMp4Enabled = false, IsLogEnabled = true, LogSeverityLevel = LogLevel.Debug, LogFilePath = @"C:\Users\jpriv\Desktop\Nieuwe map\", AudioOptions = new AudioOptions { IsAudioEnabled = false, }, VideoOptions = new VideoOptions { BitrateMode = BitrateControlMode.Quality, Bitrate = 7000 * 1000, Framerate = 60, Quality = 70, IsFixedFramerate = true, EncoderProfile = H264Profile.Main } }; _rec1 = Recorder.CreateRecorder(options); _rec2 = Recorder.CreateRecorder(options); m_GlobalHook = Hook.GlobalEvents(); m_GlobalHook.OnCombination(new Dictionary <Combination, Action> { { Combination.TriggeredBy(Keys.PageUp), WaitForRecording }, }); m_GlobalHook.OnCombination(new Dictionary <Combination, Action> { { Combination.TriggeredBy(Keys.Home), WaitForContinuesRecording }, }); m_GlobalHook.OnCombination(new Dictionary <Combination, Action> { { Combination.TriggeredBy(Keys.End), StopRecording }, }); }
private void Application_Startup(object sender, StartupEventArgs e) { Global.StartupDateTime = DateTime.Now; #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { Argument.Prepare(e.Args); } } catch (Exception ex) { LogWriter.Log(ex, "Generic Exception - Arguments"); ErrorDialog.Ok("ScreenToGif", "Generic error - arguments", ex.Message, ex); } #endregion #region Language try { LocalizationHelper.SelectCulture(UserSettings.All.LanguageCode); } catch (Exception ex) { LogWriter.Log(ex, "Language Settings Exception."); ErrorDialog.Ok("ScreenToGif", "Generic error - language", ex.Message, ex); } #endregion #region Net Framework var array = Type.GetType("System.Array"); var method = array?.GetMethod("Empty"); if (array == null || method == null) { var ask = Dialog.Ask("Missing Dependency", "Net Framework 4.6.1 is not present", "In order to properly use this app, you need to download the correct version of the .Net Framework. Open the web page to download?"); if (ask) { Process.Start("https://www.microsoft.com/en-us/download/details.aspx?id=49981"); return; } } //try //{ // //If there's no Array.Empty, means that there's no .Net Framework 4.6.1 // //This is not the best way... // Array.Empty<int>(); //} //catch (MissingMethodException ex) //{ // var ask = Dialog.Ask("Missing Dependency", "Net Framework 4.6.1 is not present", "In order to properly use this app, you need to download the correct version of the .Net Framework. Open the web page to download?"); // if (ask) // { // Process.Start("https://www.microsoft.com/en-us/download/details.aspx?id=49981"); // return; // } // LogWriter.Log(ex, "Missing .Net Framework 4.6.1"); //} //if (Environment.Version.Build < 30319 && Environment.Version.Revision < 42000) //{ // var ask = Dialog.Ask("Missing Dependency", "Net Framework 4.6.1 is not present", "In order to properly use this app, you need to download the correct version of the .Net Framework. Open the page to download?"); // if (ask) // { // Process.Start("https://www.microsoft.com/en-us/download/details.aspx?id=49981"); // return; // } //} #endregion ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue)); //var select = new SelectFolderDialog(); //var select = new TestField(); //var select = new Encoder(); //select.ShowDialog(); return; try { #region Startup if (UserSettings.All.StartUp == 0 && !Argument.FileNames.Any()) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (UserSettings.All.StartUp == 4 || Argument.FileNames.Any()) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); ProjectInfo project = null; var exitArg = ExitAction.Exit; bool? result = null; #region Recorder, Webcam or Border switch (UserSettings.All.StartUp) { case 1: if (UserSettings.All.NewRecorder) { var recNew = new RecorderNew(true); Current.MainWindow = recNew; result = recNew.ShowDialog(); exitArg = recNew.ExitArg; project = recNew.Project; break; } var rec = new Recorder(true); Current.MainWindow = rec; result = rec.ShowDialog(); exitArg = rec.ExitArg; project = rec.Project; break; case 2: var web = new Windows.Webcam(true); Current.MainWindow = web; result = web.ShowDialog(); exitArg = web.ExitArg; project = web.Project; break; case 3: var board = new Board(); Current.MainWindow = board; result = board.ShowDialog(); exitArg = board.ExitArg; project = board.Project; break; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.Project = project; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { LogWriter.Log(ex, "Generic Exception - Root"); ErrorDialog.Ok("ScreenToGif", "Generic error", ex.Message, ex); } }
public void MyMethod(Computer computer, Recorder recoder) { // Do something here }
public IEnumerable <SearchSource> Convert(ISearchPolicy policy, IEnumerable <SearchSource> sources) { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert Sources:", sources); IConfigurationSession configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, policy.RecipientSession.SessionSettings, 46, "Convert", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\MailboxSearch\\WebService\\External\\PublicFolderSourceConverter.cs"); using (PublicFolderDataProvider provider = new PublicFolderDataProvider(configurationSession, "Get-PublicFolder", Guid.Empty)) { foreach (SearchSource source in sources) { if (source.SourceType == SourceType.PublicFolder) { Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "PublicFolderSourceConverter.Convert Source:", source.ReferenceId, "PublicFolderSourceConverter.Type:", source.SourceType }); PublicFolder publicFolder = null; try { PublicFolderId publicFolderId2; if (this.IsPath(source.ReferenceId)) { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert From Path:", source.ReferenceId); publicFolderId2 = new PublicFolderId(new MapiFolderPath(source.ReferenceId)); } else { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert From StoreId:", source.ReferenceId); StoreObjectId storeObjectId = StoreObjectId.FromHexEntryId(source.ReferenceId); publicFolderId2 = new PublicFolderId(storeObjectId); } if (publicFolderId2 != null) { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert PublicFolderId:", publicFolderId2); publicFolder = (PublicFolder)provider.Read <PublicFolder>(publicFolderId2); } } catch (FormatException) { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert FormatException, Source:", source); } if (publicFolder != null) { yield return(this.GetSource(source, publicFolder)); } else { Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert Failed, Source:", source); yield return(source); } } else if (source.SourceType == SourceType.AllPublicFolders) { Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "PublicFolderSourceConverter.Convert Source:", source.ReferenceId, "Type:", source.SourceType }); PublicFolderId publicFolderId = new PublicFolderId(MapiFolderPath.IpmSubtreeRoot); IEnumerable <PublicFolder> folders = provider.FindPaged <PublicFolder>(null, publicFolderId, true, null, 50); foreach (PublicFolder publicFolder2 in folders) { if (publicFolder2.FolderPath != MapiFolderPath.IpmSubtreeRoot) { yield return(this.GetSource(source, publicFolder2)); } } } } } yield break; }
public void QualitySettingTest() { long fullQualitySize; long lowestQualitySize; using (var outStream = new MemoryStream()) { using (var rec = Recorder.CreateRecorder(new RecorderOptions { VideoOptions = new VideoOptions { BitrateMode = BitrateControlMode.Quality, Quality = 100 } })) { bool isError = false; bool isComplete = false; ManualResetEvent finalizeResetEvent = new ManualResetEvent(false); ManualResetEvent recordingResetEvent = new ManualResetEvent(false); rec.OnRecordingComplete += (s, args) => { isComplete = true; finalizeResetEvent.Set(); }; rec.OnRecordingFailed += (s, args) => { isError = true; finalizeResetEvent.Set(); recordingResetEvent.Set(); }; rec.Record(outStream); recordingResetEvent.WaitOne(3000); rec.Stop(); finalizeResetEvent.WaitOne(5000); Assert.IsFalse(isError); Assert.IsTrue(isComplete); Assert.AreNotEqual(outStream.Length, 0); fullQualitySize = outStream.Length; } } using (var outStream = new MemoryStream()) { using (var rec = Recorder.CreateRecorder(new RecorderOptions { VideoOptions = new VideoOptions { BitrateMode = BitrateControlMode.Quality, Quality = 0 } })) { bool isError = false; bool isComplete = false; ManualResetEvent finalizeResetEvent = new ManualResetEvent(false); ManualResetEvent recordingResetEvent = new ManualResetEvent(false); rec.OnRecordingComplete += (s, args) => { isComplete = true; finalizeResetEvent.Set(); }; rec.OnRecordingFailed += (s, args) => { isError = true; finalizeResetEvent.Set(); recordingResetEvent.Set(); }; rec.Record(outStream); recordingResetEvent.WaitOne(3000); rec.Stop(); finalizeResetEvent.WaitOne(5000); Assert.IsFalse(isError); Assert.IsTrue(isComplete); Assert.AreNotEqual(outStream.Length, 0); lowestQualitySize = outStream.Length; } } Assert.IsTrue(fullQualitySize > lowestQualitySize * 2); }
public void Run() { // Altseedを初期化する。 asd.Engine.Initialize("Joystick_Basic", 640, 480, new asd.EngineOption()); // ジョイスティックの状態を表示するテキストを生成する。 var font = asd.Engine.Graphics.CreateDynamicFont("", 25, new asd.Color(255, 255, 255, 255), 1, new asd.Color(0, 0, 0, 255)); // ボタンの入力状態を表示する文字描画オブジェクトを設定して、エンジンに追加する。 var stateText = new asd.TextObject2D(); stateText.Position = new asd.Vector2DF(10, 5); stateText.Font = font; asd.Engine.AddObject2D(stateText); //ボタンをたくさん認識する可能性があるため表示の行間を詰める。 stateText.LineSpacing = -15; // Altseedのウインドウが閉じられていないか確認する。 while (asd.Engine.DoEvents()) { string displayStr = ""; // ジョイスティックが接続されているかどうかを確認する。 if (!asd.Engine.JoystickContainer.GetIsPresentAt(0)) { displayStr += "ジョイスティックが接続されていません。"; } else { // 1つ目のジョイスティックの全てのボタンの入力状態を表示する。 var joystick = asd.Engine.JoystickContainer.GetJoystickAt(0); for (int buttonIndex = 0; buttonIndex < joystick.ButtonsCount; buttonIndex++) { var state = joystick.GetButtonState(buttonIndex); if (state == asd.JoystickButtonState.Free) //前フレームと本フレームで非押下 { displayStr += ("ボタン " + buttonIndex + "を離しています。"); } else if (state == asd.JoystickButtonState.Hold) //前フレームと本フレームで押下 { displayStr += ("ボタン " + buttonIndex + "を押しています。"); } else if (state == asd.JoystickButtonState.Release) //前フレームで押下、本フレームで非押下 { displayStr += ("ボタン " + buttonIndex + "を離しました!"); } else if (state == asd.JoystickButtonState.Push) //前フレームで非押下、本フレームで押下 { displayStr += ("ボタン " + buttonIndex + "を押しました!"); } displayStr += "\n"; } } stateText.Text = displayStr; // Altseedを更新する。 asd.Engine.Update(); Recorder.CaptureScreen("Joystick_Basic", 30, 30, 0.2f, 0.7f); Recorder.TakeScreenShot("Joystick_Basic", 30); } //Altseedの終了処理をする。 asd.Engine.Terminate(); }
private void Recorder_Executed(object sender, ExecutedRoutedEventArgs e) { if (UserSettings.All.NewRecorder) { var recorderNew = new RecorderNew(false) { Owner = this }; Application.Current.MainWindow = recorderNew; Hide(); var result2 = recorderNew.ShowDialog(); if (result2.HasValue && result2.Value) { //If to close. Environment.Exit(0); } else if (result2.HasValue) { #region If Backbutton or Stop Clicked if (recorderNew.ExitArg == ExitAction.Recorded) { var editor = new Editor { Project = recorderNew.Project }; GenericShowDialog(editor); return; } Show(); #endregion } return; } var recorder = new Recorder { Owner = this }; Application.Current.MainWindow = recorder; Hide(); var result = recorder.ShowDialog(); if (result.HasValue && result.Value) { //If to close. Environment.Exit(0); } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (recorder.ExitArg == ExitAction.Recorded) { var editor = new Editor { Project = recorder.Project }; GenericShowDialog(editor); return; } Show(); #endregion } }
public override void Process(IList <SearchSource> item) { Recorder.Trace(4L, TraceType.InfoTrace, "CompleteSourceLookup.Process Item:", item); Guid guid = new Guid("aca47e7e-5bb8-43ed-976a-f3158f6d4df7"); List <PreviewItem> list = new List <PreviewItem>(); List <MailboxStatistics> list2 = new List <MailboxStatistics>(); SearchMailboxesInputs searchMailboxesInputs = base.Context.TaskContext as SearchMailboxesInputs; Uri baseUri = new Uri("http://local/"); StoreId value = new VersionedId(new byte[] { 3, 1, 2, 3, 3, 1, 2, 3, byte.MaxValue }); UniqueItemHash itemHash = new UniqueItemHash(string.Empty, string.Empty, null, false); PagingInfo pagingInfo = ((SearchMailboxesInputs)base.Executor.Context.Input).PagingInfo; ReferenceItem sortValue = new ReferenceItem(pagingInfo.SortBy, ExDateTime.Now, 0L); Dictionary <PropertyDefinition, object> properties = new Dictionary <PropertyDefinition, object> { { ItemSchema.Id, value } }; foreach (SearchSource searchSource in item) { if (searchSource.MailboxInfo != null && (searchSource.MailboxInfo.MailboxGuid != Guid.Empty || searchSource.MailboxInfo.IsRemoteMailbox)) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); if (searchSource.MailboxInfo != null && searchSource.MailboxInfo.MailboxGuid != Guid.Empty) { Dictionary <string, string> dictionary2 = dictionary; string key = "Name"; string value2; if ((value2 = searchSource.OriginalReferenceId) == null) { value2 = (searchSource.MailboxInfo.DisplayName ?? string.Empty); } dictionary2[key] = value2; dictionary["Smtp"] = (searchSource.MailboxInfo.PrimarySmtpAddress.ToString() ?? string.Empty); dictionary["DN"] = (searchSource.MailboxInfo.LegacyExchangeDN ?? string.Empty); } if (searchMailboxesInputs != null) { dictionary["Lang"] = (searchMailboxesInputs.Language ?? string.Empty); dictionary["Config"] = (searchMailboxesInputs.SearchConfigurationId ?? string.Empty); } Uri owaLink = LinkUtils.AppendQueryString(baseUri, dictionary); Recorder.Trace(4L, TraceType.InfoTrace, new object[] { "CompleteSourceLookup.Process Found:", searchSource.ReferenceId, "MailboxInfo:", searchSource.MailboxInfo }); list.Add(new PreviewItem(properties, (searchSource.MailboxInfo.MailboxGuid != Guid.Empty) ? searchSource.MailboxInfo.MailboxGuid : guid, owaLink, sortValue, itemHash) { MailboxInfo = searchSource.MailboxInfo }); list2.Add(new MailboxStatistics(searchSource.MailboxInfo, 0UL, new ByteQuantifiedSize(0UL))); } } SortedResultPage resultPage = new SortedResultPage(list.ToArray(), pagingInfo); ISearchResult searchResult = new ResultAggregator(resultPage, null, 0UL, new ByteQuantifiedSize(0UL), null, null, list2); base.Executor.EnqueueNext(new SearchMailboxesResults(item) { SearchResult = searchResult }); }
private void RecordingStopped(long sessionId) { Debug.Log("Recording " + sessionId + " was stopped."); Recorder.ExportRecordingSession(sessionId); }
public void Init() { RandomGenerator.initializeWithSeed(0); game = new Game(4, 5, 50); recorder = new Recorder(0, 4, 5, 50); }
private void RecordButton_Click(object sender, RoutedEventArgs e) { if (IsRecording) { _rec.Stop(); _progressTimer?.Stop(); _progressTimer = null; _secondsElapsed = 0; IsRecording = false; return; } OutputResultTextBlock.Text = ""; string videoPath = ""; if (CurrentRecordingMode == RecorderMode.Video) { string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp, timestamp + ".mp4"); } else if (CurrentRecordingMode == RecorderMode.Slideshow) { //For slideshow just give a folder path as input. string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp) + "\\"; } else if (CurrentRecordingMode == RecorderMode.Snapshot) { string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss-ff"); videoPath = Path.Combine(Path.GetTempPath(), "ScreenRecorder", timestamp, timestamp + ".png"); } _progressTimer = new DispatcherTimer(); _progressTimer.Tick += _progressTimer_Tick; _progressTimer.Interval = TimeSpan.FromSeconds(1); _progressTimer.Start(); int right = 0; Int32.TryParse(this.RecordingAreaRightTextBox.Text, out right); int bottom = 0; Int32.TryParse(this.RecordingAreaBottomTextBox.Text, out bottom); int left = 0; Int32.TryParse(this.RecordingAreaLeftTextBox.Text, out left); int top = 0; Int32.TryParse(this.RecordingAreaTopTextBox.Text, out top); RecorderOptions options = new RecorderOptions { RecorderMode = CurrentRecordingMode, IsThrottlingDisabled = this.IsThrottlingDisabled, IsHardwareEncodingEnabled = this.IsHardwareEncodingEnabled, IsLowLatencyEnabled = this.IsLowLatencyEnabled, IsMp4FastStartEnabled = this.IsMp4FastStartEnabled, AudioOptions = new AudioOptions { Bitrate = AudioBitrate.bitrate_96kbps, Channels = AudioChannels.Stereo, IsAudioEnabled = this.IsAudioEnabled }, VideoOptions = new VideoOptions { Bitrate = VideoBitrate * 1000, Framerate = this.VideoFramerate, IsMousePointerEnabled = this.IsMousePointerEnabled, IsFixedFramerate = this.IsFixedFramerate, EncoderProfile = this.CurrentH264Profile }, DisplayOptions = new DisplayOptions(this.ScreenComboBox.SelectedIndex, left, top, right, bottom) }; _rec = Recorder.CreateRecorder(options); _rec.OnRecordingComplete += Rec_OnRecordingComplete; _rec.OnRecordingFailed += Rec_OnRecordingFailed; _rec.OnStatusChanged += _rec_OnStatusChanged; if (RecordToStream) { Directory.CreateDirectory(Path.GetDirectoryName(videoPath)); _outputStream = new FileStream(videoPath, FileMode.Create); _rec.Record(_outputStream); } else { _rec.Record(videoPath); } _secondsElapsed = 0; IsRecording = true; }
static void Run(Options cmd_opts) { Recorder rec = Recorder.CreateRecorder(GetRecorderOptions(cmd_opts)); rec.OnRecordingFailed += Rec_OnRecordingFailed; rec.OnRecordingComplete += Rec_OnRecordingComplete; rec.OnStatusChanged += Rec_OnStatusChanged; Console.Write("Initialized"); while (true) { string line = Console.ReadLine(); string[] cmd = line.Split(':'); Console.Write(line); if (cmd[0] == "set_options") { rec.SetOptions(GetRecorderOptions(new Options { Top = Int32.Parse(cmd[1]), Bottom = Int32.Parse(cmd[2]), Left = Int32.Parse(cmd[3]), Right = Int32.Parse(cmd[4]), Audio_disabled = Boolean.Parse(cmd[5]), Display_name = cmd[6] ?? "", Audio_input_device = cmd[7] ?? "" })); rec.Record(cmd_opts.Path); break; } else if (cmd[0] == "start") { Console.Write(cmd); Console.Write(cmd.Length); rec.SetOptions(GetRecorderOptions(new Options { Audio_disabled = Boolean.Parse(cmd[1]), Display_name = cmd[2] ?? "", Audio_input_device = cmd[3] ?? "" })); rec.Record(cmd_opts.Path); break; } else if (cmd[0] == "list_audio_devices") { Rec_ListAudioInputDevices(); } } while (true) { string info = Console.ReadLine(); if (info == "stop") { rec.Stop(); break; } else if (info == "pause") { rec.Pause(); } else if (info == "resume") { rec.Resume(); } Task.Delay(100); } Console.ReadLine(); }
public IntegratedJsonBindingEndpoint(Recorder recorder) { _recorder = recorder; }
public AverageRecorder(Recorder recorder) { this.recorder = recorder; }
private void OnEnable() { processor = target as WebRtcAudioDsp; recorder = processor.GetComponent <Recorder>(); }
private void Application_Startup(object sender, StartupEventArgs e) { #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { Argument.Prepare(e.Args); } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Arguments"); } #endregion #region Upgrade Application Settings //See http://stackoverflow.com/questions/534261/how-do-you-keep-user-config-settings-across-different-assembly-versions-in-net if (Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save(); } #endregion #region Language try { LocalizationHelper.SelectCulture(Settings.Default.Language); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Language Settings Exception."); } #endregion //var select = new SelectFolderDialog(); //select.ShowDialog(); //var select = new TestField(); //select.ShowDialog(); //return; try { #region Startup if (Settings.Default.StartUp == 0) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (Settings.Default.StartUp == 4 || Argument.FileNames.Any()) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); List <FrameInfo> frames = null; var exitArg = ExitAction.Exit; bool?result = null; #region Recorder, Webcam or Border switch (Settings.Default.StartUp) { case 1: var rec = new Recorder(true); Current.MainWindow = rec; result = rec.ShowDialog(); exitArg = rec.ExitArg; frames = rec.ListFrames; break; case 2: var web = new Windows.Webcam(true); Current.MainWindow = web; result = web.ShowDialog(); exitArg = web.ExitArg; frames = web.ListFrames; break; case 3: var board = new Board(); Current.MainWindow = board; result = board.ShowDialog(); exitArg = board.ExitArg; frames = board.ListFrames; break; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.ListFrames = frames; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Root"); } }
/// <summary> /// Private helper method for the constructors /// </summary> private void initializeCallee() { conn = null; phone = null; pm = null; ll = null; recorder = null; calleeData = null; isRegistered = false; /** * Read the configuration params file and populate suitable parameters */ readConfigParams(); display("Configration file = " + inputParam.configFile); // this.numIterations = totalIter * totalSets; display("Extension = " + inputParam.myExtension); /** * Create an instance of prompt wait timer */ promptTimer = new System.Windows.Forms.Timer(); promptTimer.Enabled = false; promptTimer.Interval = promptWaitDuration * 1000; promptTimer.Tick += new System.EventHandler(promptTimer_Tick); missingHangupDetectionTimer = new System.Windows.Forms.Timer(); missingHangupDetectionTimer.Enabled = false; // Missing hangup detection timer is set to 5 times maximum call duration and wait time between calls missingHangupDetectionTimer.Interval = 5 * (maxCallDuration + waitTimeBetweenCalls) * 1000; missingHangupDetectionTimer.Enabled = false; missingHangupDetectionTimer.Tick += new System.EventHandler(missingHangupDetectionTimer_Tick); initializeVoiceDevice(); }
public void RecordTo(string fileName, RecordingBehaviour recordingBehaviour) { recorder = new Recorder(File.Create(fileName), this, recordingBehaviour); }
/// <summary> /// A tool for recording, playing back, saving, and loading user input /// into a replayable format. /// </summary> public RecordTool() { this.recorder = new Recorder(); }
public void SaveSequence(Recorder recorder, string filename, string foldername) { var str = JsonUtility.ToJson(recorder.clip, true); DataIO.Save(str, filename, foldername); }
void Start() { Physics.gravity = new Vector3(0, -jumpFactor, 0); joystick = GameObject.Find ("CNJoystick").GetComponent<CNJoystick> (); timeController = GameObject.Find("TimeController").GetComponent<TimeController>(); //subscribe to the recorder for recording movement recorder = GameObject.Find ("TimeController").GetComponent<Recorder> (); recorder.Subscribe (this); }
public void CreateSequence(Recorder recorder, float amplitude, float frequency, float stepSize) { recorder.Record(amplitude, frequency, stepSize); }
public AudioRecordService() { _state = AudioRecordState.Init; numbering = 0; // Create an audio recorder if (_recorder == null) { // find out the available audio codec and file format RecorderAudioCodec AudioCodec = RecorderAudioCodec.Amr; foreach (RecorderAudioCodec codec in Recorder.GetSupportedAudioCodecs()) { //Console.WriteLine("RecorderAudioCodec : " + codec); foreach (RecorderFileFormat format in codec.GetSupportedFileFormats()) { //Console.WriteLine(" RecorderFileFormat : " + format); if (format == AudioFileFormat) { AudioCodec = codec; break; } } } // Console.WriteLine("+++ Selected AudioCodec : " + AudioCodec + " Format : " + AudioFileFormat); // 2017-12-08: Todo need to roll back.. //_recorder = new AudioRecorder(AudioCodec, AudioFileFormat); //RecorderAudioCodec audioCodec, RecorderFileFormat fileFormat _recorder = new AudioRecorder(AudioCodec, AudioFileFormat); _recorder.StateChanged += AudioRecorder_StateChanged; _recorder.RecordingStatusChanged += AudioRecorder_RecordingStatusChanged; _recorder.RecordingLimitReached += AudioRecorder_RecordingLimitReached; _recorder.ErrorOccurred += AudioRecorder_ErrorOccurred; AudioRecorder.DeviceStateChanged += AudioRecorder_DeviceStateChanged; _recorder.Interrupting += AudioRecorder_Interrupting; //audioRecorder.ApplyAudioStreamPolicy(new AudioStreamPolicy(AudioStreamType.Media)); //audioRecorder.AudioChannels = 2; _recorder.AudioDevice = RecorderAudioDevice.Mic; _recorder.AudioBitRate = 128000; _recorder.AudioSampleRate = AMC_CODEC_AUDIO_SAMPLE_RATE; if (_recorder.State != RecorderState.Idle) { Console.WriteLine("AudioRecordService() : Invalid State (" + _recorder.State + ")" + "...may retry?"); } _recorder.Prepare(); if (_recorder.State != RecorderState.Ready) { Console.WriteLine("AudioRecordService() : Invalid State (" + _recorder.State + ")" + "...may retry?"); } try { SystemStorage internalStorage = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault(); var SoundsDir = internalStorage.GetAbsolutePath(DirectoryType.Sounds); audioStoragePath = Path.Combine(SoundsDir, "DotnetVoiceMemo"); // Create directory to save audio files Directory.CreateDirectory(audioStoragePath); } catch (Exception e) { Toast.DisplayText(e.Message + " - DotnetVoiceMemo directory creation failed."); } } }
public void Run() { // Altseedを初期化する。 asd.Engine.Initialize("CameraObject2D_Magnify", 640, 480, new asd.EngineOption()); // 画像を読み込み、画像描画オブジェクトを設定する。 { var tex0 = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png"); var obj0 = new asd.TextureObject2D(); obj0.Texture = tex0; obj0.CenterPosition = new asd.Vector2DF(256, 256); obj0.Position = new asd.Vector2DF(320, 240); obj0.Scale = new asd.Vector2DF(0.5f, 0.5f); asd.Engine.AddObject2D(obj0); } //一つ目の画面全体を写すカメラ。(オブジェクトをそのまま描画する。) { var camera1 = new asd.CameraObject2D(); camera1.Src = new asd.RectI(0, 0, 640, 480); camera1.Dst = new asd.RectI(0, 0, 640, 480); asd.Engine.AddObject2D(camera1); } //二つ目のマウスポインタの周辺を拡大して表示するカメラ。 var camera2 = new asd.CameraObject2D(); asd.Engine.AddObject2D(camera2); //フレーム用画像を読み込む。 var frame = new asd.TextureObject2D(); { var tex = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Frame.png"); frame.Texture = tex; frame.CenterPosition = new asd.Vector2DF(55.0f, 55.0f); asd.Engine.AddObject2D(frame); } // Altseedのウインドウが閉じられていないか確認する。 while (asd.Engine.DoEvents()) { //マウスポインタの位置を取得する。 var pos = asd.Engine.Mouse.Position; //拡大用カメラの描画元を指定する。 camera2.Src = new asd.RectI((int)(pos.X) - 25, (int)(pos.Y) - 25, 50, 50); //ポインタを中心に100x100の拡大画像を表示する。 camera2.Dst = new asd.RectI((int)(pos.X) - 50, (int)(pos.Y) - 50, 100, 100); //フレーム画像の描画中心をマウスポインタの位置に合わせる。 frame.Position = pos; // Altseedを更新する。 asd.Engine.Update(); Recorder.CaptureScreen("CameraObject2D_Magnify", 30, 60, 0.2f, 0.5f); Recorder.TakeScreenShot("CameraObject2D_Magnify", 30); } // Altseedの終了処理をする。 asd.Engine.Terminate(); }