public OutputLogViewModel(IOutput writer, OutputLog control) { // Store values. Writer = writer; Control = control; // Create objects. Strings = new StringLibrary(); Lines = new ObservableCollection<OutputLineViewModel>(); scrollDelay = new DelayedAction(0.1, ScrollToBottom); // Create brushes. dividerColor = new SolidColorBrush(Colors.Black) { Opacity = 0.1 }; lineBreakColor = new SolidColorBrush(Color.FromArgb(255, 255, 0, 228)) { Opacity = 0.4 }; // Create commands. ClearCommand = new DelegateCommand<Button>(m => Clear(), m => IsClearButtonEnabled); // Wire up events. writer.WrittenTo += HandleWrittenTo; writer.Cleared += delegate { Clear(); }; writer.BreakInserted += delegate { InsertBreak(); }; // Finish up. UpdateLineMargin(); }
public void Initialize(OutputLog control) { control.Width = 600; control.Height = 350; writer = new OutputWriter(); control.Writer = writer; // Output.Write(Colors.Green, "Written from initial ViewTest."); }
private void SaveState() { IsRunning = false; if (_backgroundWorker.IsBusy) { _backgroundWorker.CancelAsync(); } Messenger.Default.Send(new NotificationMessage <StateFileModel>(new StateFileModel { NumberOfCycles = NumberOfCycles, Listing = Listing, OutputLog = OutputLog.ToList(), Processor = Proc }, "SaveFileWindow")); }
private String GetSolutionDir() { EnvDTE.DTE dte = MainPanelPackage.getDTE(); if (dte == null) { OutputLog.ShowMessage("The plugin was not initialized yet. DTE is null"); return(""); } string solutionFullName = dte.Solution.FullName; if (String.IsNullOrWhiteSpace(solutionFullName)) { OutputLog.ShowMessage("There is no solution yet available. The path is: " + solutionFullName); return(""); } return(System.IO.Path.GetDirectoryName(solutionFullName)); }
public void Run() { Thread.Sleep(1000); while (true) { while (RealProgram.OutputQueue.TryDequeue(out var fromQueue)) { OutputLog.AddRow(fromQueue); WriteLine(fromQueue); } if (RealProgram.Running) { WriteLine("Input command (help to see available commands):"); RealProgram.InputCommand(ReadLine()); } } }
void Start() { if (GetComponentInChildren <SkinnedMeshRenderer> ()) { SkinnedMeshRenderer smr = GetComponentInChildren <SkinnedMeshRenderer> (); float[] newArray = new float[References.instance.totalBlendShapes]; for (int i = 0; i < References.instance.totalBlendShapes; i++) { newArray [i] = smr.GetBlendShapeWeight(i); } info.blendshapes = newArray; } else { OutputLog.Write("Spawned animal " + this.name + " does not have a SkinnedMeshRenderer attached to any of its parts."); Debug.LogError("Spawned animal " + this.name + " does not have a SkinnedMeshRenderer attached to any of its parts.", this); } }
public bool DoLogin(string email, string pass, ref Account acc) { try { if (email == "admin" && pass == "FDB8060958F8769E55720EA6E27029A6")//edenrose@123 { acc.Email = "admin"; acc.Password = ""; acc.FullName = "Admin"; return(true); } return(false); }catch (Exception ex) { OutputLog.WriteOutputLog(ex); return(false); } }
private void CheckNormals(string assetName) { if (this.dictNormal == null) { return; } using (Dictionary <GameObject, NormalData.Param> .Enumerator enumerator = this.dictNormal.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <GameObject, NormalData.Param> current = enumerator.Current; if (current.Value.NormalMin.Count != current.Value.NormalMax.Count) { OutputLog.Error("法線の数が違う:" + assetName + " " + current.Value.ObjectName, false, "CharaLoad"); } } } }
public bool Add(Topic entity) { try { _context.Topics.Add(entity); if (entity.ListPicture != null && entity.ListPicture.Count > 0) { _context.Pictures.AddRange(entity.ListPicture); } _context.SaveChanges(); return(true); } catch (Exception ex) { OutputLog.WriteOutputLog(ex); throw ex; } }
public void RecordOneRound(I_Network network, I_AgentSet agent_set, int current_round) { int green_count = 0; int red_count = 0; int undeter_count = 0; foreach (var agent in agent_set.AgentList) { switch (agent.Opinion) { case InfoEnum.Undeter: undeter_count++; break; case InfoEnum.Green: green_count++; break; case InfoEnum.Red: red_count++; break; default: break; } } double all_count = green_count + red_count + undeter_count; var list = new List <double>(); list.Add(green_count / all_count); list.Add(red_count / all_count); list.Add(undeter_count / all_count); this.RoundResults.Rows.Add(current_round, list[0], list[1], list[2]); Console.WriteLine($"round: {current_round,3} green: {list[0]:f3} red: {list[1]:f3} undeter: {list[2]:f3}"); if (!this.IsRecordingRounds) { return; } OutputLog.OutputLogCSV(this.RoundResults, this.OutputRoundFilePath); }
public bool Update(Config entity) { try { var objOld = GetbyId(entity.id); if (objOld.id > 0) { ObjectUtils.CopyObject(entity, ref objOld, true); _context.SaveChanges(); return(true); } return(false); } catch (Exception ex) { OutputLog.WriteOutputLog(ex); throw ex; } }
private async Task PerformTestConnectionAsync() { try { if (!txtBoxServer.Text.EndsWith("/")) { txtBoxServer.Text += "/"; } HttpUtils.InitClient(txtBoxServer.Text, txtBoxUser.Text, txtBoxPassword.Text); XrayStatus xrayStatus = await HttpUtils.GetPingAsync(); if (xrayStatus == null) { testConnectionField.Text = "Failed to perform ping."; return; } XrayVersion xrayVersion = await HttpUtils.GetVersionAsync(); if (!isCompatibleVersion(xrayVersion)) { testConnectionField.Text = XrayUtil.GetMinimumXrayVersionErrorMessage(xrayVersion.xray_version); return; } // Check components permissions. String message = await HttpUtils.PostComponentToXrayAsync(new Components("", Util.PREFIX + "testComponent")); if (String.IsNullOrEmpty(message)) { testConnectionField.Text = "Received Xray version: " + xrayVersion.xray_version; } else { testConnectionField.Text = message; } } catch (IOException ioe) { testConnectionField.Text = ioe.Message; await OutputLog.ShowMessageAsync("Caught exception when performing test connection: " + ioe); } }
public static async Task <Artifacts> GetCopmonentsFromXrayAsync(List <Components> collection) { HttpResponseMessage componentResponse = await getResponseFromXrayAsync(collection); string componentResult = await parseXrayResponseAsync(componentResponse); await OutputLog.ShowMessageAsync(componentResult); try { Artifacts artifacts = JsonConvert.DeserializeObject <Artifacts>(componentResult); return(artifacts); } catch (Exception e) { await OutputLog.ShowMessageAsync("Failed deserializing component result in Xray response."); throw new IOException(e.Message, e); } }
public bool Update(Article entity) { try { var objOld = GetById(entity.id); if (objOld.id > 0) { ObjectUtils.CopyObject(entity, ref objOld, true); //_context.Entry(entity).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return(true); } return(false); } catch (Exception ex) { OutputLog.WriteOutputLog(ex); throw ex; } }
public List <Article> GetData(int pageIndex, int pageSize, out int totalItem) { try { var lstData = _context.Articles.Where(p => p.TypeArticle == (int)TypeArticle.TinTuc && p.Deleted != true); totalItem = lstData.Count(); lstData = lstData.OrderBy(t => t.CreatedDate); if (totalItem > ((pageIndex - 1) * pageSize)) { lstData = lstData.Skip((pageIndex - 1) * pageSize).Take(pageSize); } return(lstData.OrderBy(m => m.DisplayOrder).ToList()); } catch (Exception ex) { OutputLog.WriteOutputLog(ex); throw ex; } }
public List <Config> GetData(int pageIndex, int pageSize, out int totalItem) { try { var lstData = _context.Configs.Where(x => x.id > 0); totalItem = lstData.Count(); lstData = lstData.OrderBy(x => x.Name); if (totalItem > ((pageIndex - 1) * pageSize)) { lstData = lstData.Skip((pageIndex - 1) * pageSize).Take(pageSize); } return(lstData.ToList()); } catch (Exception ex) { OutputLog.WriteOutputLog(ex); throw ex; } }
private void CurrentErrorsOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { foreach (Exception ex in e.NewItems) { if (ex.Message == "Dialogue Scene Completed!") { OutputLog.AddLogItem("Dialogue Scene Completed! :D"); OutputLog.AddErrorLogItem(0, ex.Message, "BlockNodeEditor", false); } else if (ex.Message.Contains("Updated Runtime Var")) { OutputLog.AddLogItem("Updated Global Runtime Var"); OutputLog.AddErrorLogItem(0, ex.Message, "BlockNodeEditor", true); } else { OutputLog.AddErrorLogItem(-1, ex.Message, "BlockNodeEditor", false); OutputLog.AddLogItem("Dialogue Error Found! Check Error Log for details."); } } }
private void performTestConnection(object sender, EventArgs e) { try { if (!txtBoxServer.Text.EndsWith("/")) { txtBoxServer.Text += "/"; } HttpUtils.InitClient(txtBoxServer.Text, txtBoxUser.Text, txtBoxPassword.Text); XrayStatus xrayStatus = HttpUtils.GetPing(); if (xrayStatus == null) { testConnectionField.Text = "Failed to perfom ping."; return; } XrayVersion xrayVersion = HttpUtils.GetVersion(); if (!isCompatibleVersion(xrayVersion)) { testConnectionField.Text = "ERROR: Unsupported Xray version: " + xrayVersion.xray_version + ", version " + XrayUtil.MIN_XRAY_VERSION + " or above required."; return; } // Check components permissions. String message = HttpUtils.PostComponentToXray(new Components("", Util.PREFIX + "testComponent")); if (String.IsNullOrEmpty(message)) { testConnectionField.Text = "Received Xray version: " + xrayVersion.xray_version; } else { testConnectionField.Text = message; } } catch (IOException ioe) { testConnectionField.Text = ioe.Message; OutputLog.ShowMessage("Caught exception when performing test connection: " + ioe); } }
protected void ReloadData() { if (!OutputHelper.DebugOutput) { this.lblInfo.Text = GetString("DebugOutput.NotConfigured"); } else { this.plcLogs.Controls.Clear(); for (int i = OutputHelper.LastLogs.Count - 1; i >= 0; i--) { try { // Get the log RequestLog log = (RequestLog)OutputHelper.LastLogs[i]; if (log != null) { // Load the control OutputLog logCtrl = (OutputLog)LoadControl("~/CMSAdminControls/Debug/OutputLog.ascx"); logCtrl.ID = "outputLog"; logCtrl.EnableViewState = false; logCtrl.Log = log; logCtrl.LogStyle = ""; // Add to the output this.plcLogs.Controls.Add(new LiteralControl("<div>‎<strong> " + GetRequestLink(log.RequestURL, log.RequestGUID) + "</strong> (" + log.RequestTime.ToString("hh:mm:ss") + ")‎<br /><br />")); this.plcLogs.Controls.Add(logCtrl); this.plcLogs.Controls.Add(new LiteralControl("</div><br /><br />")); logs.Add(logCtrl); } } catch //(Exception ex) { } } } }
private void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; var outputLogs = new List <OutputLog>(); while (true) { if (worker != null && worker.CancellationPending || IsBreakPointTriggered()) { e.Cancel = true; RaisePropertyChanged("Proc"); foreach (var log in outputLogs) { OutputLog.Insert(0, log); } UpdateMemoryPage(); return; } StepProcessor(); outputLogs.Add(GetOutputLog()); if (NumberOfCycles % GetLogModValue() == 0) { foreach (var log in outputLogs) { OutputLog.Insert(0, log); } outputLogs.Clear(); UpdateUi(); } Thread.Sleep(GetSleepValue()); } }
void MakeFileAndFolder() { var di = new DirectoryInfo(this.OutputFolderPath); this.OutputRoundFilePath = OutputLog.SafeCreateCSV(di, "RoundOpinion" + "_" + this.DataName); var round_dic = new Dictionary <string, string>(); round_dic.Add("round_seed", this.RoundSeed.ToString()); round_dic.Add("total_round", this.TotalRounds.ToString()); round_dic.Add("round_steps", this.RoundSteps.ToString()); var condition_string = ""; foreach (var dic in this.MyNetwork.GetInfoString()) { condition_string += dic.Key.ToString() + "." + dic.Value.ToString() + "_"; } foreach (var dic in MyAgentSet.GetInfoString()) { condition_string += dic.Key.ToString() + "." + dic.Value.ToString() + "_"; } foreach (var dic in MyAlgo.GetInfoString()) { condition_string += dic.Key.ToString() + "." + dic.Value.ToString() + "_"; } foreach (var dic in round_dic) { condition_string += dic.Key.ToString() + "." + dic.Value.ToString() + "_"; } var condition_path = OutputLog.SafeCreateTXT(di, condition_string); OutputLog.OutputLogCSV(new DataTable(), condition_path); }
private void OnWatchedFileChanged(object source, FileSystemEventArgs e) { DateTime lastWriteTime = File.GetLastWriteTime(WatcherFullPath); if ((lastWriteTime - WatcherLastRead).Milliseconds > 100) { var fileInfo = new FileInfo(WatcherFullPath); while (File.Exists(WatcherFullPath) && IsFileLocked(fileInfo)) { //File is still locked, meaning the writing stream is still writing to the file, // we need to wait until that process is done before trying to refresh it here. System.Threading.Thread.Sleep(500); } ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputLog.Log("File change detected."); FileWatchedChanged?.Invoke(); }); WatcherLastRead = lastWriteTime; } }
private void DataReceivedCore(object sender, TextEventArgs e) { if (e.Text.Contains("%") || e.Text.Contains("remote: Counting objects")) { ThreadHelper.JoinableTaskFactory.RunAsync(() => SetProgressAsync(e.Text)).FileAndForget(); } else { const string ansiSuffix = "\u001B[K"; string line = e.Text.Replace(ansiSuffix, ""); if (ConsoleOutput.IsDisplayingFullProcessOutput) { OutputLog.Append(line); // To the log only, display control displays it by itself } else { AppendOutput(line); // Both to log and display control } } DataReceived(sender, e); }
private void DataReceivedCore(object sender, TextEventArgs e) { if (e.Text.Contains("%") || e.Text.Contains("remote: Counting objects")) { SetProgress(e.Text); } else { const string ansiSuffix = "\u001B[K"; string line = e.Text.Replace(ansiSuffix, ""); if (ConsoleOutput.IsDisplayingFullProcessOutput) { OutputLog.AppendLine(line); // To the log only, display control displays it by itself } else { AppendOutputLine(line); // Both to log and display control } } DataReceived(sender, e); }
public virtual void SetUp() { this.Log = OutputLog.FromWriter(Console.Out, Console.Error); }
private void WriteToOutput(string outputString) { OutputLog.AppendText("\n" + outputString); OutputLog.ScrollToEnd(); }
public void Write__20(OutputLog control) { for (int i = 0; i < 20; i++) { writer.Write(RandomData.LoremIpsum(5)); } }
public async Task LoadAsync(RefreshType refreshType, HashSet <Severity> severities) { this.EnableRefreshButton = false; DataService dataService = DataService.Instance; RaisePropertyChanged("SelectedKey"); try { String solutionDir = await GetSolutionDirAsync(); if (String.IsNullOrWhiteSpace(solutionDir)) { return; } XrayVersion xrayVersion = await HttpUtils.GetVersionAsync(); if (!XrayUtil.IsXrayVersionCompatible(xrayVersion.xray_version)) { String errorMessage = XrayUtil.GetMinimumXrayVersionErrorMessage(xrayVersion.xray_version); await OutputLog.ShowMessageAsync(errorMessage); return; } // Steps to run: // 1. Trigger CLI to collect json info to a file. // 2. Read the info. // 3. Send dependencies to Xray. // 4. Get response and build the dependencies tree. // Running CLI - this is the returned output. String returnedText = await Task.Run(() => Util.GetCLIOutputAsync(solutionDir)); // Load projects from output. Projects projects = Util.LoadNugetProjects(returnedText); if (projects.projects == null || projects.projects.Length == 0) { await OutputLog.ShowMessageAsync("No projects were found."); return; } Artifacts artifacts = null; switch (refreshType) { case RefreshType.Hard: { // Get information for all dependencies. Ignore the cache. artifacts = await dataService.RefreshArtifactsAsync(true, projects); break; } case RefreshType.Soft: { // Get information only for the delta. Means only new dependencies will be added. artifacts = await dataService.RefreshArtifactsAsync(false, projects); break; } } dataService.Severities = severities; dataService.populateRootElements(projects); this.Artifacts = new ObservableCollection <ArtifactViewModel>(); foreach (string key in dataService.RootElements) { Artifacts.Add(new ArtifactViewModel(key)); } } catch (Exception e) { dataService.ClearAllComponents(); await OutputLog.ShowMessageAsync(e.Message); await OutputLog.ShowMessageAsync(e.StackTrace); } finally { this.EnableRefreshButton = true; } }
public void ResetLineCount(OutputLog control) { control.ResetLineCount(); }
private void CopyPluginStructure(string[] folders) { OutputLog.Show(); ClientSize = new System.Drawing.Size(461, 343); int missing = 0; String database; if (FLFolderTextBox.Text[FLFolderTextBox.Text.Length - 1].ToString() != "\\") { database = FLFolderTextBox.Text + "\\FL Studio\\Presets\\Plugin database\\"; } else { database = FLFolderTextBox.Text + "FL Studio\\Presets\\Plugin database\\"; } foreach (string folder in folders) { String directory = database + folder; if (!Directory.Exists(directory)) { missing++; continue; } foreach (string filename in Directory.GetFiles(directory)) { if (filename.Contains(".nfo")) { if (File.Exists(filename.Substring(0, filename.Length - 4) + ".fst")) { String text; try { StreamReader sr = new StreamReader(filename); text = sr.ReadToEnd(); Regex location = new Regex(@"ps_file_filename_0=.*?\.dll"); // Todo: Simplify this - don't need regex anymore Match match = location.Match(text); if (match.Success) { if (match.Value.Contains(VSTFolderTextBox.Text)) { text = match.Value; text = text.Replace("ps_file_filename_0=" + VSTFolderTextBox.Text, ""); // Todo: Worry about double slash for (int i = 1; i < text.Length; i++) { if (text[text.Length - i].ToString() == "\\") { text = text.Substring(0, text.Length - i); break; } } if (!Directory.Exists(database + text)) { Directory.CreateDirectory(database + text); } File.Copy(filename.Substring(0, filename.Length - 4) + ".fst", database + text + "\\" + Path.GetFileName(filename).Substring(0, Path.GetFileName(filename).Length - 4) + ".fst", true); OutputLog.Items.Add("Copied folder structure for '" + filename.Substring(0, filename.Length - 4) + "'"); } else { OutputLog.Items.Add("Error copying '" + filename.Substring(directory.Length, filename.Length - directory.Length - 4) + "': VST file located outside of specified folder. (Try re-scanning plugins in FL Studio)"); // Todo: Be more concise with this error as it's an issue with the FL plugin database, not the actual VST file } } else { OutputLog.Items.Add("Error copying '" + filename.Substring(directory.Length, filename.Length - directory.Length - 4) + "': No associated VST file could be found."); } sr.Close(); Console.ReadLine(); } catch (Exception e) { OutputLog.Items.Add("Error copying '" + filename.Substring(directory.Length, filename.Length - directory.Length) + "': Unhandled exception"); OutputLog.Items.Add(e); // Todo: Maybe move this try catch to just the file open, place rest of code after (*if* open file exists, match contents etc) } } else { OutputLog.Items.Add("Couldn't find .fst for " + filename.Substring(directory.Length, filename.Length - directory.Length) + " (It's probably part of another VST)"); } } } } if (missing == 4) { OutputLog.Items.Add("Couldn't find any plugins. Try running a plugin scan in FL Studio."); } }
public void Write__Long(OutputLog control) { writer.Write(RandomData.LoremIpsum(20, 50)); }
public void Write__Blank_Line(OutputLog control) { writer.Write(); }
public void Global_Output__WriteTitle(OutputLog control) { Output.WriteTitle(RandomData.LoremIpsum(3)); }
public void Write__Short(OutputLog control) { writer.Write(RandomData.LoremIpsum(5)); }
public void Global_Output__WriteException(OutputLog control, bool includeInner = true) { var error3 = new ArgumentException("param", "Parameter value not set."); var error2 = new Exception(null, error3); var error1 = new NotFoundException("My Sample Error", error2); Output.WriteException(error1, includeInner); }
public void Global_Output__WriteCollection_Custom(OutputLog control) { var items = CreateStubs(3); Output.WriteCollection(items, o => "Custom Output: " + o.Number); }
public void Global_Output__WriteCollection(OutputLog control, bool truncate) { IEnumerable<Stub> items = CreateStubs(12); if (truncate) { Output.WriteCollection(items, truncateAfter: 5); } else { Output.WriteCollection(items); } }
public void Global_Output__WriteProperties_Specific(OutputLog control) { var stub = new Stub { Text = RandomData.LoremIpsum(5) }; Output.WriteProperties("My Title", stub, m => m.ParentProperty, m => m.Text); }
public void Write__Null_Value(OutputLog control) { writer.Write(null); }
public void Toggle__IsToolbarVisible(OutputLog control) { control.IsToolbarVisible = !control.IsToolbarVisible; }
public void Write__From_Background_Thread(OutputLog control) { var thread = new Thread(() => writer.Write(RandomData.LoremIpsum(5))); thread.Start(); }
public void Clear(OutputLog control) { writer.Clear(); }
public void Global_Output__Write_Values(OutputLog control) { Output.Write("One", "Two", "Three"); }
public void Break(OutputLog control) { writer.Break(); }
public void Global_Output__Write_With_Color(OutputLog control) { Output.Write(Colors.Green, RandomData.LoremIpsum(5)); }
public async Task CloseAsync() { await OutputLog.ShowMessageAsync("Closing solution. Clearing..."); }
public void Global_Output__Write_Null_Value(OutputLog control) { Output.Write(null); }
public void Write__Orange(OutputLog control) { writer.Write(new OutputLine { Value = RandomData.LoremIpsum(5), Color = Colors.Orange }); }
protected override void OnException(ExceptionContext filterContext) { //Log Exception e OutputLog.WriteOutputLog(filterContext.Exception); }
public RESOClient(RESOClientSettings settings, OutputLog log) { this.clientsettings = settings; ClientLog = new StringBuilder(); outputlog = log; }
public void Global_Output__Write_Blank_Line(OutputLog control) { Output.Write(); }
private static void PrintInternal(OutputLog log) { outputQueue.Add(log); }
public void Toggle__IsActive(OutputLog control) { control.IsActive = !control.IsActive; }
public void Global_Output__Break(OutputLog control) { Output.Break(); }
public void Global_Output__WriteProperties_IncludeHierarchy(OutputLog control, bool withTitle = true) { var stub = new Stub { Text = RandomData.LoremIpsum(5) }; if (withTitle) { Output.WriteProperties("My Title", stub, includeHierarchy: true); } else { Output.WriteProperties(stub, includeHierarchy: true); } }