36 lines
1.2 KiB
C#

using System;
namespace Adaptation.Shared.Metrology
{
internal class OISiViewer
{
private static System.Net.WebClient _WebClient;
internal static string WebClientDownloadString(string baseAddress, ConfigDataBase configDataBase, string reportFullPath, bool isErrorFile, string target)
{
string result = string.Empty;
if (System.Diagnostics.Debugger.IsAttached)
result = DateTime.Now.ToString();
else
{
if (string.IsNullOrEmpty(baseAddress) || !baseAddress.Contains(":") || !baseAddress.Contains("."))
throw new Exception("Invalid URL");
try
{
if (_WebClient is null)
_WebClient = new System.Net.WebClient();
string address = string.Concat(baseAddress, "/Home/ExtractMove/?equipment_connection=", configDataBase.GetEquipmentType(), "&is_error_file=", isErrorFile);
_WebClient.OpenRead(address);
result = _WebClient.ResponseHeaders["Date"];
_WebClient.CancelAsync();
}
catch (Exception) { }
}
return result;
}
}
}