本文整理汇总了C#中RecordType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RecordType.ToString方法的具体用法?C# RecordType.ToString怎么用?C# RecordType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordType
的用法示例。
在下文中一共展示了RecordType.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lookup
/// <summary>
/// Retrieves whois information
/// </summary>
/// <param name="domainName">The registrar or domain or name server whose whois information to be retrieved</param>
/// <param name="recordType">The type of record i.e a domain, nameserver or a registrar</param>
/// <returns></returns>
public static string Lookup(string domainName, RecordType recordType)
{
string whoisServerName = WhoisServerResolver.GetWhoisServerName(domainName);
using (TcpClient whoisClient = new TcpClient())
{
whoisClient.Connect(whoisServerName, Whois_Server_Default_PortNumber);
string domainQuery = recordType.ToString() + " " + domainName + "\r\n";
byte[] domainQueryBytes = Encoding.ASCII.GetBytes(domainQuery.ToCharArray());
Stream whoisStream = whoisClient.GetStream();
whoisStream.Write(domainQueryBytes, 0, domainQueryBytes.Length);
StreamReader whoisStreamReader = new StreamReader(whoisClient.GetStream(), Encoding.ASCII);
string streamOutputContent = "";
List<string> whoisData = new List<string>();
while (null != (streamOutputContent = whoisStreamReader.ReadLine()))
{
whoisData.Add(streamOutputContent);
}
whoisClient.Close();
return String.Join(Environment.NewLine, whoisData);
}
}
示例2: Lookup
/// <summary>
/// retrieves whois information
/// </summary>
/// <param name="domainname">The registrar or domain or name server whose whois information to be retrieved</param>
/// <param name="recordType">The type of record i.e a domain, nameserver or a registrar</param>
/// <param name="returnlist">use "whois.internic.net" if you dont know whoisservers</param>
/// <returns>The string list containg the whois information</returns>
public static List<string> Lookup(string domainname, RecordType recordType, string whois_server_address = "whois.internic.net")
{
TcpClient tcp = new TcpClient();
tcp.Connect(whois_server_address, 43);
string strDomain = recordType.ToString() + " " + domainname + "\r\n";
byte[] bytDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
Stream s = tcp.GetStream();
s.Write(bytDomain, 0, strDomain.Length);
StreamReader sr = new StreamReader(tcp.GetStream(), Encoding.ASCII);
string strLine = "";
List<string> result = new List<string>();
while (null != (strLine = sr.ReadLine()))
{
result.Add(strLine);
}
tcp.Close();
return result;
}
示例3: Whois_lookup
public static string Whois_lookup(string domainname, RecordType recordType)
{
string whois_server_address = "whois.internic.net";
TcpClient tcp = new TcpClient();
tcp.Connect(whois_server_address, 43);
string strDomain = recordType.ToString() + " " + domainname + "\r\n";
byte[] bytDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
Stream s = tcp.GetStream();
s.Write(bytDomain, 0, strDomain.Length);
var sr = new StreamReader(tcp.GetStream(), Encoding.ASCII);
string final = "";
string strLine;
while (null != (strLine = sr.ReadLine()))
{
final = final + strLine + "\n";
}
tcp.Close();
return final;
}
示例4: WriteDataToLog
private static void WriteDataToLog(Device device, string content, RecordType recordType)
{
DateTime now = DateTime.Now;
FileStream stream = RecordManager.GetLogFileStream(device, now);
string time = string.Format("[{0:HH:mm:ss}] ", now);
StringBuilder sb = new StringBuilder(time);
sb.Append(string.Format(" <{0}> ", recordType.ToString()));
sb.Append(content);
sb.Append("\r\n");
string line = sb.ToString();
byte[] bytes = Encoding.ASCII.GetBytes(line);
stream.Write(bytes, 0, bytes.Length);
// Flush Control.
if (flushCtrlCount % 10 == 0)
{
stream.Flush();
}
flushCtrlCount = (flushCtrlCount + 1) % 5;
}
示例5: ImportOrganization
public TypeOrg ImportOrganization(RecordType recordType, string clientType, string mainSpec)
{
OrganizationModel organizationModel = new OrganizationModel { RecordType = recordType.ToString(), ClientType = clientType, MainSpec = mainSpec };
return new ReadFileOrganization().GetTypeOrg(organizationModel);
}
示例6: WriteDataToLog
private static void WriteDataToLog(Device device, string content, RecordType recordType, bool flush = false)
{
// To Log File
DateTime now = DateTime.Now;
StreamWriter fileWriter = RecordManager.GetLogFileStream(device, now);
string time = string.Format("[{0:HH:mm:ss}] ", now);
StringBuilder sb = new StringBuilder(time);
sb.Append(string.Format(" <{0}> ", recordType.ToString()));
sb.Append(content);
string line = sb.ToString();
fileWriter.WriteLine(line);
// Flush Control.
#if DEBUG
fileWriter.Flush();
#else
if (flush)
{
fileWriter.Flush();
}
#endif
if (flushCtrlCount % 10 == 0)
{
fileWriter.Flush();
}
flushCtrlCount = (flushCtrlCount + 1) % 5;
// To Log Console
if (ExistLoggerConsoleProc())
{
string deviceKey = device.Id.ToLower();
if (LoggerClient.Contains(deviceKey))
{
logger.Send(deviceKey, line);
}
}
}