public XT ToXT() { switch (Mode) { case MDBSubsetFilterMode.Whitelist: { return(XT.Format("SubsetFilter [{0}] <green>{1} <cyan>{2} <magenta>{3}", ID, Mode, Type, Text)); } default: { return(XT.Format("SubsetFilter [{0}] <red>{1} <cyan>{2} <magenta>{3}", ID, Mode, Type, Text)); } } }
public XT ToXT() { return(XT.Format("Genre [{0}] <cyan>{1}", ID, Name)); }
public XT ToXT() { return(XT.Format("Folder [{0}] <cyan>{1}", ID, Name)); }
void Run(Arguments args) { ILogReceiver console = null; if (args.IsOptionPresent("debug")) { if (console == null) { console = LogConsole.Create(); } console.Level = LogLevel.Debug; } if (args.IsOptionPresent("verbose")) { if (console == null) { console = LogConsole.Create(); } console.Level = LogLevel.Verbose; } LoadConfig(); List <XT> results = new List <XT>(); foreach (string dir in Directory.GetDirectories(Path.Combine(LetsEncryptPath, "live"))) { string domainName = Path.GetFileName(dir); var conf = Path.Combine(LetsEncryptPath, "renewal", domainName + ".conf"); if (!File.Exists(conf)) { continue; } if (domainName.Split('.').Length != 2) { continue; } if (!domains.TryGetStruct(nameof(Domain.Name), domainName, out Domain domain)) { var x = XT.Format("<red>Error: <default>Domain <red>{0}<default> removed from imscp!", domainName); results.Add(x); SystemConsole.WriteLine(x); File.Delete(conf); continue; } string certText = File.ReadAllText(Path.Combine(dir, "cert.pem")).GetValidChars(ASCII.Strings.Printable + '\n') + "\n"; string keyText = File.ReadAllText(Path.Combine(dir, "privkey.pem")).GetValidChars(ASCII.Strings.Printable + '\n') + "\n"; string chainText = File.ReadAllText(Path.Combine(dir, "chain.pem")).GetValidChars(ASCII.Strings.Printable + '\n') + "\n"; var sslCerts = ssl_certs.GetStructs(nameof(SslCerts.DomainID), domain.ID); if (sslCerts.Count > 1) { var x = XT.Format("<red>Error: <default>Multiple ssl certs for domain {0}!", domain); results.Add(x); SystemConsole.WriteLine(x); continue; } var newCert = PEM.ReadCert(certText.SplitNewLine()); if (sslCerts.Count == 1) { //already got one, check for update var sslCert = sslCerts[0]; var oldCert = PEM.ReadCert(sslCert.Certificate.SplitNewLine()); if (newCert.Equals(oldCert)) { this.LogInfo("Domain <green>{0}<default> valid till <green>{1}", domainName, oldCert.GetExpirationDateString()); //no change continue; } if (!oldCert.Issuer.Contains("O=Let's Encrypt")) { //do not override users own certs continue; } sslCert.Certificate = certText; sslCert.PrivateKey = keyText; sslCert.CaBundle = chainText; sslCert.Status = "tochange"; ssl_certs.Update(sslCert); } else { var sslCert = new SslCerts() { AllowHsts = "off", CaBundle = chainText, Certificate = certText, DomainID = (int)domain.ID, DomainType = "dmn", HstsIncludeSubdomains = "off", HstsMaxAge = 31536000, PrivateKey = keyText, Status = "tochange", }; ssl_certs.Insert(sslCert); } domain.Status = "tochange"; domains.Update(domain); { var x = XT.Format("<green>Certificate: <default>Domain {0} new certificate {1} valid till {2}!", domain, newCert.Subject, newCert.GetExpirationDateString()); results.Add(x); SystemConsole.WriteLine(x); } } this.LogInfo("Completed."); if (results.Count > 0) { MailMessage msg = new MailMessage(mailSender, "*****@*****.**") { Subject = "CaveSystems LetsEncrypt", IsBodyHtml = true, Body = results.ToHtml() }; smtpClient.Send(msg); } Logger.Flush(); Logger.CloseAll(); console?.Dispose(); }
/// <summary>Provides an eXtended Text string for this object.</summary> /// <returns>Returns a new XT instance with the description of this object.</returns> public XT ToXT() { return XT.Format("AudioFile [{0}] <cyan>{1}", FileID, Title); }
public XT ToXT() { return(XT.Format("Category [{0}] <cyan>{1}", ID, Name)); }
/// <summary>Provides an eXtended Text string for this object.</summary> /// <returns>Returns a new XT instance with the description of this object.</returns> public XT ToXT() { return(XT.Format("Subset [{0}] <cyan>{1}", ID, Name)); }
/// <summary>Provides an eXtended Text string for this object.</summary> /// <returns>Returns a new XT instance with the description of this object.</returns> public XT ToXT() { return(XT.Format("Artist [{0}] <cyan>{1} <default>{2}", ID, Name, MusicBrainzArtistGuid)); }
public XT ToXT() { string progress = Progress.ToString("p"); return(XT.Format("[{0}] <cyan>{1} <yellow>{2} <green>{3}", ID, Source, Type, progress)); }
/// <summary>Provides an eXtended Text string for this object.</summary> /// <returns>Returns a new XT instance with the description of this object.</returns> public XT ToXT() { return(XT.Format("NowPlaying [{0}]", Position.FormatTimeSpan(1))); }
/// <summary>Provides an eXtended Text string for this object.</summary> /// <returns>Returns a new XT instance with the description of this object.</returns> public XT ToXT() { return(XT.Format("Image [{0}] <cyan>{1} <magenta>{2}<default>x<magenta>{3}", FileID, Type, Width, Height)); }
public XT ToXT() { return(XT.Format("File [{0}] <cyan>{1}{2}", ID, Name, Extension)); }