update sharpcifs

This commit is contained in:
Luke Pulverenti
2017-07-08 03:25:24 -04:00
parent a7187180bf
commit 71eb9f143f
220 changed files with 23703 additions and 25613 deletions

View File

@@ -4,63 +4,59 @@ using System.Globalization;
namespace SharpCifs.Util.Sharpen
{
public class SimpleDateFormat : DateFormat
{
string _format;
{
string _format;
CultureInfo Culture
{
get; set;
}
CultureInfo Culture {
get; set;
}
bool Lenient
{
get; set;
}
bool Lenient {
get; set;
}
public SimpleDateFormat (): this ("g")
{
}
public SimpleDateFormat() : this("g")
{
}
public SimpleDateFormat (string format): this (format, CultureInfo.CurrentCulture)
{
}
public SimpleDateFormat(string format) : this(format, CultureInfo.CurrentCulture)
{
}
public SimpleDateFormat (string format, CultureInfo c)
{
Culture = c;
this._format = format.Replace ("EEE", "ddd");
this._format = this._format.Replace ("Z", "zzz");
SetTimeZone (TimeZoneInfo.Local);
}
public SimpleDateFormat(string format, CultureInfo c)
{
Culture = c;
this._format = format.Replace("EEE", "ddd");
this._format = this._format.Replace("Z", "zzz");
SetTimeZone(TimeZoneInfo.Local);
}
public bool IsLenient ()
{
return Lenient;
}
public bool IsLenient()
{
return Lenient;
}
public void SetLenient (bool lenient)
{
Lenient = lenient;
}
public void SetLenient(bool lenient)
{
Lenient = lenient;
}
public override DateTime Parse (string value)
{
if (IsLenient ())
return DateTime.Parse (value);
return DateTime.ParseExact (value, _format, Culture);
}
public override DateTime Parse(string value)
{
if (IsLenient())
return DateTime.Parse(value);
return DateTime.ParseExact(value, _format, Culture);
}
public override string Format(DateTime date)
{
date += GetTimeZone().BaseUtcOffset;
return date.ToString(_format);
}
public string Format(long date)
{
return Extensions.MillisToDateTimeOffset(date, (int)GetTimeZone().BaseUtcOffset
.TotalMinutes)
.DateTime.ToString(_format);
}
}
public override string Format (DateTime date)
{
date += GetTimeZone().BaseUtcOffset;
return date.ToString (_format);
}
public string Format (long date)
{
return Extensions.MillisToDateTimeOffset (date, (int)GetTimeZone ().BaseUtcOffset.TotalMinutes).DateTime.ToString (_format);
}
}
}