public override int Run(Terminal.Terminal config) { var defaultProfile = config.Settings["profiles"]["defaults"] as JObject; if (!string.IsNullOrEmpty(Image)) { if (!CheckURLValid(Image)) { defaultProfile["backgroundImage"] = Image; } else { Console.WriteLine($"Downloading Image: {Image}"); using var wc = new WebClient(); var fileName = System.IO.Path.GetFileName(Image); wc.DownloadFile(Image, System.IO.Path.Combine(wt_tool.Program.ApplicationCache, fileName)); defaultProfile["backgroundImage"] = System.IO.Path.Combine(wt_tool.Program.ApplicationCache, fileName); } } if (ImageAlignment != null) { defaultProfile["backgroundImageAlignment"] = ImageAlignment.ToString(); } if (ImageStrechMode != null) { defaultProfile["backgroundImageStretchMode"] = ImageStrechMode.ToString(); } if (ImageOpacity != null) { var op = ImageOpacity; if (op > 1.0) { op = 1.0f; } if (op < 0.0) { op = 0.0f; } defaultProfile["backgroundImageOpacity"] = op; } if (BackgroundColor != null && CheckValidFormatHtmlColor(BackgroundColor)) { defaultProfile["background"] = BackgroundColor; } config.Save(); return(1); }
public static string ToRQLString(this ImageAlignment align) { return(align == ImageAlignment.NotSet ? "" : align.ToString()); }