typo + timeout x email

This commit is contained in:
Samuele E. Locatelli
2018-10-03 09:54:56 +02:00
parent e90ea0984c
commit 2cb29d13d9
+85 -13
View File
@@ -395,15 +395,27 @@ namespace SteamWare
{
DateTime answ = DateTime.Now;
CultureInfo cInfo = new CultureInfo(culture);
if (doLog) logger.lg.scriviLog(string.Format("Valore txt:{1}", Environment.NewLine, dataOra), tipoLog.INFO);
if (doLog)
{
logger.lg.scriviLog(string.Format("Valore txt:{1}", Environment.NewLine, dataOra), tipoLog.INFO);
}
bool fatto = false;
fatto = DateTime.TryParseExact(dataOra, formato, cInfo, DateTimeStyles.None, out answ);
if (doLog) logger.lg.scriviLog(string.Format("{0}Valore txt:{1}{0}Valore conv:{2}", Environment.NewLine, dataOra, answ), tipoLog.INFO);
if (doLog)
{
logger.lg.scriviLog(string.Format("{0}Valore txt:{1}{0}Valore conv:{2}", Environment.NewLine, dataOra, answ), tipoLog.INFO);
}
if (!fatto)
{
answ = Convert.ToDateTime(dataOra);
}
if (doLog) logger.lg.scriviLog(string.Format("{0}Valore txt:{1}{0}Valore conv BIS:{2}", Environment.NewLine, dataOra, answ), tipoLog.INFO);
if (doLog)
{
logger.lg.scriviLog(string.Format("{0}Valore txt:{1}{0}Valore conv BIS:{2}", Environment.NewLine, dataOra, answ), tipoLog.INFO);
}
return answ;
}
/// <summary>
@@ -456,9 +468,15 @@ namespace SteamWare
public static T convert(DataSet dataSet)
{
if (dataSet == null)
{
return null;
}
if (dataSet.Tables.Count == 0)
{
return null;
}
DataTable dataTable = dataSet.Tables[0];
return convert(dataTable);
}
@@ -469,7 +487,10 @@ namespace SteamWare
public static T convert(DataTable dataTable)
{
if (dataTable == null)
{
return null;
}
T stronglyTyped = new T();
// add data from the regular DataTable to the
// strongly typed DataTable.
@@ -608,6 +629,7 @@ namespace SteamWare
//_smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
_smtpClient.Credentials = new NetworkCredential(_username, _password);
_smtpClient.EnableSsl = memLayer.ML.CRB("_enableSSL");
_smtpClient.Timeout = 5000;
// verifico se sia porta non standard...
if (memLayer.ML.CRS("_PortSSL") != "")
{
@@ -733,17 +755,28 @@ namespace SteamWare
/// <returns></returns>
private static bool isValidDelimiterBinary(int StringIndex, int DelimiterIndex)
{
if (DelimiterIndex == m_Delimiter.Length) return true;
if (StringIndex == m_Expression.Length) return false;
if (DelimiterIndex == m_Delimiter.Length)
{
return true;
}
if (StringIndex == m_Expression.Length)
{
return false;
}
//If the current character of the expression matches
//the current character of the Delimiter,
//then go to next character
if (m_Expression[StringIndex] ==
m_Delimiter[DelimiterIndex])
{
return isValidDelimiterBinary(StringIndex + 1,
DelimiterIndex + 1);
}
else
{
return false;
}
}
/// <summary>
/// comparatore case insensitive
@@ -753,17 +786,28 @@ namespace SteamWare
/// <returns></returns>
private static bool isValidDelimiterText(int StringIndex, int DelimiterIndex)
{
if (DelimiterIndex == m_Delimiter.Length) return true;
if (StringIndex == m_Expression.Length) return false;
if (DelimiterIndex == m_Delimiter.Length)
{
return true;
}
if (StringIndex == m_Expression.Length)
{
return false;
}
//If the current character of the expression
//matches the current character of the Delimiter,
//then go to next character
if (Char.ToLower(m_Expression[StringIndex])
== Char.ToLower(m_Delimiter[DelimiterIndex]))
{
return isValidDelimiterText(StringIndex + 1,
DelimiterIndex + 1);
}
else
{
return false;
}
}
/// <summary>
@@ -787,20 +831,32 @@ namespace SteamWare
//If not using single separator,
//then use the regular split function
if (!SingleSeparator)
{
if (Count >= 0)
{
return Expression.Split(Delimiter.ToCharArray(), Count);
}
else
{
return Expression.Split(Delimiter.ToCharArray());
}
}
//Check if count = 0 then return an empty array
if (Count == 0)
{
return new string[0];
}
else
//Check if Count = 1 then return the whole expression
if (Count == 1)
{
return new string[] { Expression };
}
else
{
Count--;
}
// Indexer to loop over the string with
int i;
@@ -822,7 +878,10 @@ namespace SteamWare
//Update Current Token Start index
iStart = i + 1;
//If we reached the tokens limit , then exit For
if (Tokens.Count == Count && Count >= 0) break;
if (Tokens.Count == Count && Count >= 0)
{
break;
}
}
}
}
@@ -840,7 +899,10 @@ namespace SteamWare
//Update Current Token Start index
iStart = i + 1;
//If we reached the tokens limit , then exit For
if (Tokens.Count == Count && Count >= 0) break;
if (Tokens.Count == Count && Count >= 0)
{
break;
}
}
}
}
@@ -851,14 +913,21 @@ namespace SteamWare
LastToken = Expression.Substring(iStart,
Expression.Length - iStart);
if (LastToken == Delimiter)
{
Tokens.Add(null);
}
else
{
Tokens.Add(LastToken);
}
}
else
//If there is no elements in the tokens array,
//then pass the whole string as the one element
if (Tokens.Count == 0) Tokens.Add(Expression);
if (Tokens.Count == 0)
{
Tokens.Add(Expression);
}
//Return Splitted Tokens
return (string[])
Tokens.ToArray(Type.GetType("System.String"));
@@ -1087,7 +1156,10 @@ namespace SteamWare
/// <returns></returns>
public static string ReverseLookup(string ip)
{
if (string.IsNullOrEmpty(ip)) return ip;
if (string.IsNullOrEmpty(ip))
{
return ip;
}
try
{
@@ -1137,7 +1209,7 @@ namespace SteamWare
{
string s = string.Empty;
System.Net.IPHostEntry Tempaddr = null;
Tempaddr = (System.Net.IPHostEntry)Dns.GetHostEntry(sName);
Tempaddr = Dns.GetHostEntry(sName);
System.Net.IPAddress[] TempAd = Tempaddr.AddressList;
string[] Ipaddr = new string[3];
foreach (IPAddress TempA in TempAd)
@@ -1145,7 +1217,7 @@ namespace SteamWare
Ipaddr[1] = TempA.ToString();
byte[] ab = new byte[6];
int len = ab.Length;
int r = SendARP((int)BitConverter.ToInt32(TempA.GetAddressBytes(), 0), 0, ab, ref len);
int r = SendARP(BitConverter.ToInt32(TempA.GetAddressBytes(), 0), 0, ab, ref len);
string sMAC = BitConverter.ToString(ab, 0, 6);
Ipaddr[2] = sMAC;
s = sMAC;