static void Main(string[] args) { Console console = new Console(); console.Level = Levels.Debug; console.Add(Levels.Debug, "Debug Message"); console.Add(Levels.Information, "Information Message"); console.Add(Levels.Warning, "Warning Message"); console.Add(Levels.Error, "Error Message"); Thread.Sleep(1000); }
protected override void start() { base.start(); string path = basicGameControl.name; Debug.Log(path); questions = QuestionContainer.loadQuestion(path); basicGameControl.addEvent("Reset", reset); Console.Add("Success"); Parent.SetActive(false); reset(); }
private void Start() { //string path = gameName; Debug.Log(gameName); questions = QuestionContainer.loadQuestion(gameName); Console.Add("Load Question Container"); Parent.SetActive(false); reset(); // menginstansisai game Object soal question = Parent.transform.GetChild(1).gameObject.GetComponent <Text>(); answer[0] = Parent.transform.GetChild(2).gameObject.GetComponent <Button>(); answer[0].onClick.AddListener(delegate() { this.questionAnswered(0); }); answer[1] = Parent.transform.GetChild(3).gameObject.GetComponent <Button>(); answer[1].onClick.AddListener(delegate() { this.questionAnswered(1); }); answer[2] = Parent.transform.GetChild(4).gameObject.GetComponent <Button>(); answer[2].onClick.AddListener(delegate() { this.questionAnswered(2); }); }
IEnumerable <Task> ExportData(SaveFileDialog saveFile, bool indexesOnly) { Console.Add("Exporting to {0}", saveFile.SafeFileName); var stream = saveFile.OpenFile(); var jsonRequestFactory = new HttpJsonRequestFactory(); var baseUrl = server.CurrentDatabaseAddress; var credentials = new NetworkCredential(); var convention = new DocumentConvention(); var streamWriter = new StreamWriter(new GZipStream(stream, CompressionMode.Compress)); var jsonWriter = new JsonTextWriter(streamWriter) { Formatting = Formatting.Indented }; Console.Add("Begin reading indexes"); jsonWriter.WriteStartObject(); jsonWriter.WritePropertyName("Indexes"); jsonWriter.WriteStartArray(); int totalCount = 0; const int batchSize = 128; var completed = false; while (!completed) { var url = (baseUrl + "/indexes/?start=" + totalCount + "&pageSize=" + batchSize).NoCache(); var request = jsonRequestFactory.CreateHttpJsonRequest(this, url, "GET", credentials, convention); var response = request.ReadResponseStringAsync(); yield return(response); var documents = response.Result; var array = JArray.Parse(documents); if (array.Count == 0) { Console.Add("Done with reading indexes, total: {0}", totalCount); completed = true; } else { totalCount += array.Count; Console.Add("Reading batch of {0,3} indexes, read so far: {1,10:#,#}", array.Count, totalCount); foreach (JToken item in array) { item.WriteTo(jsonWriter); } } } jsonWriter.WriteEndArray(); jsonWriter.WritePropertyName("Docs"); jsonWriter.WriteStartArray(); if (indexesOnly) { Console.Add("Documents will not be exported."); } else { Console.Add("Begin reading documents."); var lastEtag = Guid.Empty; totalCount = 0; completed = false; while (!completed) { var url = (baseUrl + "/docs/?pageSize=" + batchSize + "&etag=" + lastEtag).NoCache(); var request = jsonRequestFactory.CreateHttpJsonRequest(this, url, "GET", credentials, convention); var response = request.ReadResponseStringAsync(); yield return(response); var array = JArray.Parse(response.Result); if (array.Count == 0) { Console.Add("Done with reading documents, total: {0}", totalCount); completed = true; } else { totalCount += array.Count; Console.Add("Reading batch of {0,3} documents, read so far: {1,10:#,#}", array.Count, totalCount); foreach (JToken item in array) { item.WriteTo(jsonWriter); } lastEtag = new Guid(array.Last.Value <JObject>("@metadata").Value <string>("@etag")); } } } Execute.OnUIThread(() => { jsonWriter.WriteEndArray(); jsonWriter.WriteEndObject(); streamWriter.Flush(); streamWriter.Dispose(); stream.Dispose(); }); }
protected void Output(string format, params object[] args) { Console.Add(format, args); }
private void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { _dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { while (_serialPort.BytesToRead > 0) { var data = _serialPort.ReadLine(); Console.Add($"{DateTime.Now} - {data.Trim()}"); var setting = Settings.OrderByDescending(set => set.Label.Length).Where(st => data.StartsWith(st.Label)).FirstOrDefault(); if (setting != null) { setting.Value = data.Split(':')[1].Trim(); switch (setting.Key) { case "set-min-left": _leftServoMin = Convert.ToInt32(setting.Value); _leftServoRaw = LeftServoMin; RaisePropertyChanged(nameof(LeftServoMin)); RaisePropertyChanged(nameof(LeftServoRaw)); break; case "set-max-left": _leftServoMax = Convert.ToInt32(setting.Value); RaisePropertyChanged(nameof(LeftServoMax)); break; case "set-minvalue-left": _leftServoMinValue = Convert.ToDouble(setting.Value); _leftServoValue = LeftServoMinValue; RaisePropertyChanged(nameof(LeftServoMinValue)); RaisePropertyChanged(nameof(LeftServoValue)); break; case "set-maxvalue-left": _leftServoMaxValue = Convert.ToDouble(setting.Value); RaisePropertyChanged(nameof(LeftServoMaxValue)); break; case "set-min-right": _rightServoMin = Convert.ToInt32(setting.Value); _rightServoRaw = RightServoMin; RaisePropertyChanged(nameof(RightServoMin)); RaisePropertyChanged(nameof(RightServoRaw)); break; case "set-max-right": _rightServoMax = Convert.ToInt32(setting.Value); RaisePropertyChanged(nameof(RightServoMax)); break; case "set-minvalue-right": _rightServoMinValue = Convert.ToDouble(setting.Value); RightServoValue = RightServoMinValue; RaisePropertyChanged(nameof(RightServoMinValue)); RaisePropertyChanged(nameof(RightServoValue)); break; case "set-maxvalue-right": _rightServoMaxValue = Convert.ToDouble(setting.Value); RaisePropertyChanged(nameof(RightServoMaxValue)); break; case "set-minvalue-stepper": _stepperValueMin = Convert.ToDouble(setting.Value); RaisePropertyChanged(nameof(StepperValueMin)); break; case "set-maxvalue-stepper": _stepperValueMax = Convert.ToDouble(setting.Value); RaisePropertyChanged(nameof(StepperValueMax)); break; } } } })); }