Merge branch 'master' of github.com:ONLYOFFICE/CommunityServer-AspNetCore

This commit is contained in:
Ilya Oleshko 2019-08-15 16:42:57 +03:00
commit 3c8ceade5d
147 changed files with 504 additions and 566 deletions

View File

@ -68,7 +68,7 @@ namespace ASC.Collections
protected override object GetObjectFromCache(string fullKey)
{
return Common.HttpContext.Current != null ? Common.HttpContext.Current.Items[fullKey] : null;
return Common.HttpContext.Current?.Items[fullKey];
}
protected override bool FitsCondition(object cached)

View File

@ -38,12 +38,9 @@ namespace ASC.Common.Data.AdoProxy
public DbCommandProxy(DbCommand command, ProxyContext ctx)
{
if (command == null) throw new ArgumentNullException("command");
if (ctx == null) throw new ArgumentNullException("ctx");
this.command = command;
context = ctx;
{
this.command = command ?? throw new ArgumentNullException("command");
context = ctx ?? throw new ArgumentNullException("ctx");
}

View File

@ -38,12 +38,9 @@ namespace ASC.Common.Data.AdoProxy
public DbConnectionProxy(DbConnection connection, ProxyContext ctx)
{
if (connection == null) throw new ArgumentNullException("connection");
if (ctx == null) throw new ArgumentNullException("ctx");
this.connection = connection;
context = ctx;
{
this.connection = connection ?? throw new ArgumentNullException("connection");
context = ctx ?? throw new ArgumentNullException("ctx");
}
protected override System.Data.Common.DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)

View File

@ -37,12 +37,9 @@ namespace ASC.Common.Data.AdoProxy
public readonly System.Data.Common.DbTransaction Transaction;
public DbTransactionProxy(System.Data.Common.DbTransaction transaction, ProxyContext ctx)
{
if (transaction == null) throw new ArgumentNullException("transaction");
if (ctx == null) throw new ArgumentNullException("ctx");
Transaction = transaction;
context = ctx;
{
Transaction = transaction ?? throw new ArgumentNullException("transaction");
context = ctx ?? throw new ArgumentNullException("ctx");
}

View File

@ -36,10 +36,8 @@ namespace ASC.Common.Data.AdoProxy
private ExecuteHelper(Action<TimeSpan> onStop)
{
if (onStop == null) throw new ArgumentNullException("onStop");
this.onStop = onStop;
{
this.onStop = onStop ?? throw new ArgumentNullException("onStop");
stopwatch = Stopwatch.StartNew();
}

View File

@ -37,11 +37,7 @@ namespace ASC.Common.Data.AdoProxy
public ProxyContext(Action<ExecutedEventArgs> executedEvent)
{
if (executedEvent == null)
{
throw new ArgumentNullException("executedEvent");
}
this.executedEvent = executedEvent;
this.executedEvent = executedEvent ?? throw new ArgumentNullException("executedEvent");
}

View File

@ -92,8 +92,7 @@ namespace ASC.Common.Data
return DBNull.Value;
}
var @enum = value as Enum;
if (@enum != null)
if (value is Enum @enum)
{
return @enum.ToString("d");
}

View File

@ -91,8 +91,7 @@ namespace ASC.Common.Data
public DbManager(string databaseId, bool shared, int? commandTimeout = null)
{
if (databaseId == null) throw new ArgumentNullException("databaseId");
DatabaseId = databaseId;
DatabaseId = databaseId ?? throw new ArgumentNullException("databaseId");
this.shared = shared;
if (logger.IsDebugEnabled)
@ -129,8 +128,7 @@ namespace ASC.Common.Data
{
if (HttpContext.Current != null)
{
var dbManager = DisposableHttpContext.Current[databaseId] as DbManager;
if (dbManager == null || dbManager.disposed)
if (!(DisposableHttpContext.Current[databaseId] is DbManager dbManager) || dbManager.disposed)
{
var localDbManager = new DbManager(databaseId);
var dbManagerAdapter = new DbManagerProxy(localDbManager);

View File

@ -36,8 +36,7 @@ namespace ASC.Common.Data
public DbNestedTransaction(IDbTransaction transaction)
{
if (transaction == null) throw new ArgumentNullException("transaction");
this.transaction = transaction;
this.transaction = transaction ?? throw new ArgumentNullException("transaction");
}
public IDbConnection Connection

View File

@ -37,8 +37,7 @@ namespace ASC.Common.Data
{
public DbTransaction(IDbTransaction transaction)
{
if (transaction == null) throw new ArgumentNullException("transaction");
Transaction = transaction;
Transaction = transaction ?? throw new ArgumentNullException("transaction");
}
internal IDbTransaction Transaction { get; private set; }

View File

@ -66,7 +66,7 @@ namespace ASC.Common.Data.Sql.Dialects
case DbType.AnsiString:
case DbType.String:
if (size <= 8192) return string.Format("VARCHAR({0})", size);
else if (size <= UInt16.MaxValue) return "TEXT";
else if (size <= ushort.MaxValue) return "TEXT";
else if (size <= ((int)Math.Pow(2, 24) - 1)) return "MEDIUMTEXT";
else return "LONGTEXT";
@ -80,7 +80,7 @@ namespace ASC.Common.Data.Sql.Dialects
case DbType.Binary:
case DbType.Object:
if (size <= 8192) return string.Format("BINARY({0})", size);
else if (size <= UInt16.MaxValue) return "BLOB";
else if (size <= ushort.MaxValue) return "BLOB";
else if (size <= ((int)Math.Pow(2, 24) - 1)) return "MEDIUMBLOB";
else return "LONGBLOB";

View File

@ -46,8 +46,7 @@ namespace ASC.Common.DependencyInjection
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
{
var instantiableType = GetInstantiableType(destinationType);
var elementCollection = value as DictionaryElementCollection;
if (elementCollection == null || !(instantiableType != null))
if (!(value is DictionaryElementCollection elementCollection) || !(instantiableType != null))
return base.ConvertTo(context, culture, value, destinationType);
var dictionary = (IDictionary)Activator.CreateInstance(instantiableType);
var genericArguments = instantiableType.GetGenericArguments();

View File

@ -77,8 +77,7 @@ namespace ASC.Common.DependencyInjection
private static TypeConverter GetTypeConverterFromName(string converterTypeName)
{
var typeConverter = Activator.CreateInstance(Type.GetType(converterTypeName, true)) as TypeConverter;
if (typeConverter == null)
if (!(Activator.CreateInstance(Type.GetType(converterTypeName, true)) is TypeConverter typeConverter))
throw new ConfigurationErrorsException("");
return typeConverter;
}

View File

@ -120,7 +120,7 @@ namespace ASC.Geolocation
var index = ip.IndexOf("::");
if (0 <= index)
{
ip = ip.Insert(index + 2, new String(':', 8 - ip.Split(':').Length));
ip = ip.Insert(index + 2, new string(':', 8 - ip.Split(':').Length));
}
return string.Join(":", ip.Split(':').Select(s => ("0000" + s).Substring(s.Length)).ToArray());
}

View File

@ -108,7 +108,7 @@ namespace ASC.Common.Logging
{
Exception = err,
Level = LogLevel.Error,
Message = String.Format("file: {0}, dir: {1}, mess: {2}", filePath, dirPath, err.Message),
Message = string.Format("file: {0}, dir: {1}, mess: {2}", filePath, dirPath, err.Message),
LoggerName = "SelfCleaningTarget"
});
}

View File

@ -91,7 +91,7 @@ namespace ASC.Common.Security
for (var i = 0; i < buffer.Length; i++)
{
buffer[i] = (byte)(InternalSample() % (Byte.MaxValue + 1));
buffer[i] = (byte)(InternalSample() % (byte.MaxValue + 1));
}
}

View File

@ -65,8 +65,7 @@ namespace ASC.Common.Security.Authentication
public override bool Equals(object obj)
{
var a = obj as IAccount;
return a != null && ID.Equals(a.ID);
return obj is IAccount a && ID.Equals(a.ID);
}
public override int GetHashCode()

View File

@ -45,13 +45,12 @@ namespace ASC.Common.Security.Authorizing
public AuthorizingException(ISubject subject, IAction[] actions)
{
if (subject == null) throw new ArgumentNullException("subject");
if (actions == null || actions.Length == 0) throw new ArgumentNullException("actions");
Subject = subject;
Subject = subject ?? throw new ArgumentNullException("subject");
Actions = actions;
var sactions = "";
Array.ForEach(actions, action => { sactions += action.ToString() + ", "; });
_Message = String.Format(
_Message = string.Format(
"\"{0}\" access denied \"{1}\"",
subject,
sactions
@ -101,20 +100,20 @@ namespace ASC.Common.Security.Authorizing
{
var reason = "";
if (denySubjects[i] != null && denyActions[i] != null)
reason = String.Format("{0}:{1} access denied {2}.",
reason = string.Format("{0}:{1} access denied {2}.",
actions[i].Name,
(denySubjects[i] is IRole ? "role:" : "") + denySubjects[i].Name,
denyActions[i].Name
);
else
reason = String.Format("{0}: access denied.", actions[i].Name);
reason = string.Format("{0}: access denied.", actions[i].Name);
if (i != actions.Length - 1)
reason += ", ";
reasons += reason;
}
var sactions = "";
Array.ForEach(actions, action => { sactions += action.ToString() + ", "; });
var message = String.Format(
var message = string.Format(
"\"{0}\" access denied \"{1}\". Cause: {2}.",
(subject is IRole ? "role:" : "") + subject.Name,
sactions,

View File

@ -42,9 +42,8 @@ namespace ASC.Common.Security.Authorizing
public AzObjectSecurityProviderHelper(ISecurityObjectId objectId, ISecurityObjectProvider secObjProvider)
{
if (objectId == null) throw new ArgumentNullException("objectId");
currObjIdAsProvider = false;
currObjId = objectId;
currObjId = objectId ?? throw new ArgumentNullException("objectId");
currSecObjProvider = secObjProvider;
if (currSecObjProvider == null && currObjId is ISecurityObjectProvider)
{

View File

@ -62,8 +62,7 @@ namespace ASC.Common.Security.Authorizing
public override bool Equals(object obj)
{
var a = obj as Action;
return a != null && a.ID == ID;
return obj is Action a && a.ID == ID;
}
public override string ToString()

View File

@ -70,8 +70,7 @@ namespace ASC.Common.Security.Authorizing
public override bool Equals(object obj)
{
var r = obj as Role;
return r != null && r.ID == ID;
return obj is Role r && r.ID == ID;
}
public override string ToString()

View File

@ -77,7 +77,7 @@ namespace ASC.Security.Cryptography
public static bool EqualHash(byte[] dataToCompare, byte[] hash, HashAlg hashAlg)
{
return String.Equals(
return string.Equals(
ComputeHash64(dataToCompare, hashAlg),
B2S64(hash)
);

View File

@ -39,11 +39,9 @@ namespace ASC.Common.Security
public SecurityObjectId(object id, Type objType)
{
if (objType == null) throw new ArgumentNullException("objType");
{
SecurityId = id;
ObjectType = objType;
ObjectType = objType ?? throw new ArgumentNullException("objType");
}
public override int GetHashCode()
@ -53,8 +51,7 @@ namespace ASC.Common.Security
public override bool Equals(object obj)
{
var other = obj as SecurityObjectId;
return other != null &&
return obj is SecurityObjectId other &&
Equals(AzObjectIdHelper.GetFullObjectId(other), AzObjectIdHelper.GetFullObjectId(this));
}
}

View File

@ -64,8 +64,7 @@ namespace ASC.Common.Threading.Workers
{
if (disposing)
{
var disposable = Item as IDisposable;
if (disposable != null)
if (Item is IDisposable disposable)
{
disposable.Dispose();
}

View File

@ -40,8 +40,7 @@ namespace ASC.Common.Web
public DisposableHttpContext(Microsoft.AspNetCore.Http.HttpContext ctx)
{
if (ctx == null) throw new ArgumentNullException();
this.ctx = ctx;
this.ctx = ctx ?? throw new ArgumentNullException();
}
public static DisposableHttpContext Current

View File

@ -351,14 +351,14 @@ namespace ASC.Core.Billing
default;
}
private static Decimal GetValueDecimal(XElement xelement)
private static decimal GetValueDecimal(XElement xelement)
{
if (xelement == null || string.IsNullOrEmpty(xelement.Value))
{
return default;
}
var sep = CultureInfo.InvariantCulture.NumberFormat.CurrencyDecimalSeparator;
return Decimal.TryParse(xelement.Value.Replace(".", sep).Replace(",", sep), NumberStyles.Currency, CultureInfo.InvariantCulture, out var value) ? value : default;
return decimal.TryParse(xelement.Value.Replace(".", sep).Replace(",", sep), NumberStyles.Currency, CultureInfo.InvariantCulture, out var value) ? value : default;
}
void IDisposable.Dispose()

View File

@ -307,9 +307,9 @@ namespace ASC.Core.Billing
}
}
var year = Int32.Parse(versionDate.Substring(0, 4));
var month = Int32.Parse(versionDate.Substring(4, 2));
var day = Int32.Parse(versionDate.Substring(6, 2));
var year = int.Parse(versionDate.Substring(0, 4));
var month = int.Parse(versionDate.Substring(4, 2));
var day = int.Parse(versionDate.Substring(6, 2));
_date = new DateTime(year, month, day);
}
catch (Exception ex)

View File

@ -49,7 +49,7 @@ namespace ASC.Core.Billing
public DateTime Date { get; set; }
public Decimal Price { get; set; }
public decimal Price { get; set; }
public string Currency { get; set; }
@ -63,6 +63,6 @@ namespace ASC.Core.Billing
public string Country { get; set; }
public Decimal DiscountSum { get; set; }
public decimal DiscountSum { get; set; }
}
}

View File

@ -69,8 +69,7 @@ namespace ASC.Core.Billing
public override bool Equals(object obj)
{
var t = obj as Tariff;
return t != null && t.QuotaId == QuotaId;
return obj is Tariff t && t.QuotaId == QuotaId;
}
}
}

View File

@ -254,10 +254,9 @@ namespace ASC.Core.Billing
var key = tenant.HasValue
? GetBillingUrlCacheKey(tenant.Value)
: String.Format("notenant{0}", !string.IsNullOrEmpty(affiliateId) ? "_" + affiliateId : "");
: string.Format("notenant{0}", !string.IsNullOrEmpty(affiliateId) ? "_" + affiliateId : "");
key += quota.Visible ? "" : "0";
var urls = cache.Get<Dictionary<string, Tuple<Uri, Uri>>>(key) as IDictionary<string, Tuple<Uri, Uri>>;
if (urls == null)
if (!(cache.Get<Dictionary<string, Tuple<Uri, Uri>>>(key) is IDictionary<string, Tuple<Uri, Uri>> urls))
{
urls = new Dictionary<string, Tuple<Uri, Uri>>();
if (billingConfigured)

View File

@ -221,8 +221,7 @@ namespace ASC.Core.Caching
GetChangesFromDb();
var key = GetRefCacheKey(tenant);
var refs = cache.Get<UserGroupRefStore>(key) as IDictionary<string, UserGroupRef>;
if (refs == null)
if (!(cache.Get<UserGroupRefStore>(key) is IDictionary<string, UserGroupRef> refs))
{
refs = service.GetUserGroupRefs(tenant, default);
cache.Insert(key, new UserGroupRefStore(refs), CacheExpiration);

View File

@ -88,15 +88,12 @@ namespace ASC.Core.Configuration
if (string.IsNullOrEmpty(senderAddress))
{
throw new ArgumentException("Empty sender address.", "senderAddress");
}
if (senderDisplayName == null)
{
throw new ArgumentNullException("senderDisplayName");
}
}
Host = host;
Port = port;
SenderAddress = senderAddress;
SenderDisplayName = senderDisplayName;
SenderDisplayName = senderDisplayName ?? throw new ArgumentNullException("senderDisplayName");
}
public void SetCredentials(string userName, string password)
@ -135,7 +132,7 @@ namespace ASC.Core.Configuration
props = Array.ConvertAll(props, p => !string.IsNullOrEmpty(p) ? p : null);
var host = HttpUtility.UrlDecode(props[3]);
var port = !string.IsNullOrEmpty(props[4]) ? Int32.Parse(props[4]) : DefaultSmtpPort;
var port = !string.IsNullOrEmpty(props[4]) ? int.Parse(props[4]) : DefaultSmtpPort;
var senderAddress = HttpUtility.UrlDecode(props[5]);
var senderDisplayName = HttpUtility.UrlDecode(props[6]) ?? DefaultSenderDisplayName;

View File

@ -118,8 +118,7 @@ namespace ASC.Core
private IEnumerable<AzRecord> FilterAces(IEnumerable<AzRecord> aces, Guid subjectId, Guid actionId, ISecurityObjectId objectId)
{
var objId = AzObjectIdHelper.GetFullObjectId(objectId);
var store = aces as AzRecordStore;
return store != null ?
return aces is AzRecordStore store ?
store.Get(objId).Where(a => (a.SubjectId == subjectId || subjectId == Guid.Empty) && (a.ActionId == actionId || actionId == Guid.Empty)) :
aces.Where(a => (a.SubjectId == subjectId || subjectId == Guid.Empty) && (a.ActionId == actionId || actionId == Guid.Empty) && a.ObjectId == objId);
}

View File

@ -114,7 +114,7 @@ namespace ASC.Core
return settings;
}
}
set { SaveSetting("SmtpSettings", value != null ? value.Serialize() : null, CoreContext.TenantManager.GetCurrentTenant().TenantId); }
set { SaveSetting("SmtpSettings", value?.Serialize(), CoreContext.TenantManager.GetCurrentTenant().TenantId); }
}
public string BaseDomain

View File

@ -36,8 +36,7 @@ namespace ASC.Core
public SubscriptionManager(ISubscriptionService service)
{
if (service == null) throw new ArgumentNullException("subscriptionManager");
this.service = service;
this.service = service ?? throw new ArgumentNullException("subscriptionManager");
}

View File

@ -91,7 +91,7 @@ namespace ASC.Core
if (t == null)
{
var baseUrl = CoreContext.Configuration.BaseDomain;
if (!String.IsNullOrEmpty(baseUrl) && domain.EndsWith("." + baseUrl, StringComparison.InvariantCultureIgnoreCase))
if (!string.IsNullOrEmpty(baseUrl) && domain.EndsWith("." + baseUrl, StringComparison.InvariantCultureIgnoreCase))
{
isAlias = true;
t = tenantService.GetTenant(domain.Substring(0, domain.Length - baseUrl.Length - 1));
@ -127,8 +127,7 @@ namespace ASC.Core
{
var newTenant = tenantService.SaveTenant(tenant);
var oldTenant = CallContext.GetData(CURRENT_TENANT) as Tenant;
if (oldTenant != null) SetCurrentTenant(newTenant);
if (CallContext.GetData(CURRENT_TENANT) is Tenant oldTenant) SetCurrentTenant(newTenant);
return newTenant;
}

View File

@ -280,13 +280,12 @@ namespace ASC.Core
var refs = GetRefsInternal(tenant.TenantId);
IEnumerable<UserGroupRef> userRefs = null;
var store = refs as UserGroupRefStore;
if (store != null)
if (refs is UserGroupRefStore store)
{
userRefs = store.GetRefsByUser(userID);
}
var userRefsContainsNotRemoved = userRefs != null ? userRefs.Where(r => !r.Removed && r.RefType == UserGroupRefType.Contains).ToList() : null;
var userRefsContainsNotRemoved = userRefs?.Where(r => !r.Removed && r.RefType == UserGroupRefType.Contains).ToList();
foreach (var g in GetGroupsInternal(tenant.TenantId).Where(g => !categoryId.HasValue || g.CategoryID == categoryId))
{
@ -302,7 +301,7 @@ namespace ASC.Core
result.AddRange(distinctUserGroups);
}
result.Sort((group1, group2) => String.Compare(group1.Name, group2.Name, StringComparison.Ordinal));
result.Sort((group1, group2) => string.Compare(group1.Name, group2.Name, StringComparison.Ordinal));
return result.ToArray();
}
@ -313,8 +312,7 @@ namespace ASC.Core
var refs = GetRefsInternal(tenantId);
var store = refs as UserGroupRefStore;
if (store != null)
if (refs is UserGroupRefStore store)
{
var userRefs = store.GetRefsByUser(userID);

View File

@ -144,8 +144,7 @@ namespace ASC.Core
private static void NotifyEngine_AfterTransferRequest(NotifyEngine sender, NotifyRequest request)
{
var tenant = (request.Properties.Contains("Tenant") ? request.Properties["Tenant"] : null) as Tenant;
if (tenant != null)
if ((request.Properties.Contains("Tenant") ? request.Properties["Tenant"] : null) is Tenant tenant)
{
CoreContext.TenantManager.SetCurrentTenant(tenant);
}

View File

@ -106,8 +106,7 @@ namespace ASC.Core
public override bool Equals(object obj)
{
var r = obj as AzRecord;
return r != null &&
return obj is AzRecord r &&
r.Tenant == Tenant &&
r.SubjectId == SubjectId &&
r.ActionId == ActionId &&

View File

@ -234,8 +234,7 @@ namespace TMResourceData
private Dictionary<string, string> GetResources()
{
var key = string.Format("{0}/{1}", filename, culture);
var dic = cache.Get(key) as Dictionary<string, string>;
if (dic == null)
if (!(cache.Get(key) is Dictionary<string, string> dic))
{
lock (locker)
{

View File

@ -90,8 +90,7 @@ namespace ASC.Core
public override bool Equals(object obj)
{
var g = obj as Group;
return g != null && g.Id == Id;
return obj is Group g && g.Id == Id;
}
}
}

View File

@ -65,8 +65,7 @@ namespace ASC.Core.Users
public override bool Equals(object obj)
{
var g = obj as GroupInfo;
if (g == null) return false;
if (!(obj is GroupInfo g)) return false;
if (ID == Guid.Empty && g.ID == Guid.Empty) return ReferenceEquals(this, g);
return g.ID == ID;
}

View File

@ -169,8 +169,7 @@ namespace ASC.Core
public override bool Equals(object obj)
{
var p = obj as Partner;
return p != null && p.Id == Id;
return obj is Partner p && p.Id == Id;
}
public override int GetHashCode()

View File

@ -74,8 +74,7 @@ namespace ASC.Core
public override bool Equals(object obj)
{
var r = obj as UserGroupRef;
return r != null && r.Tenant == Tenant && r.UserId == UserId && r.GroupId == GroupId && r.RefType == RefType;
return obj is UserGroupRef r && r.Tenant == Tenant && r.UserId == UserId && r.GroupId == GroupId && r.RefType == RefType;
}
public static implicit operator UserGroupRef(UserGroupRefCacheItem cache)

View File

@ -106,7 +106,7 @@ namespace ASC.Core.Users
public override string ToString()
{
return String.Format("{0} {1}", FirstName, LastName).Trim();
return string.Format("{0} {1}", FirstName, LastName).Trim();
}
public override int GetHashCode()
@ -116,8 +116,7 @@ namespace ASC.Core.Users
public override bool Equals(object obj)
{
var ui = obj as UserInfo;
return ui != null && ID.Equals(ui.ID);
return obj is UserInfo ui && ID.Equals(ui.ID);
}
public CultureInfo GetCulture()

View File

@ -96,7 +96,7 @@ namespace ASC.Core
return tenantService.GetTenants(login, hash).Select(AddRegion).ToList();
}
public Tenant GetTenant(String domain)
public Tenant GetTenant(string domain)
{
return AddRegion(tenantService.GetTenant(domain));
}

View File

@ -41,7 +41,7 @@ namespace ASC.Core
{
private readonly object locker = new object();
private readonly Dictionary<string, HostedSolution> regions = new Dictionary<string, HostedSolution>();
private readonly String dbid;
private readonly string dbid;
private volatile bool initialized = false;
public MultiRegionHostedSolution(string dbid)
@ -183,7 +183,7 @@ namespace ASC.Core
{
Initialize();
return regions.Where(x => !String.IsNullOrEmpty(x.Key))
return regions.Where(x => !string.IsNullOrEmpty(x.Key))
.Select(x => x.Value);
}

View File

@ -46,14 +46,11 @@ namespace ASC.Notify.Channels
public SenderChannel(Context context, string senderName, ISink decorateSink, ISink senderSink)
{
if (senderName == null) throw new ArgumentNullException("senderName");
if (context == null) throw new ArgumentNullException("context");
if (senderSink == null) throw new ApplicationException(string.Format("channel with tag {0} not created sender sink", senderName));
this.context = context;
if (senderName == null) throw new ArgumentNullException("senderName");
this.context = context ?? throw new ArgumentNullException("context");
this.SenderName = senderName;
this.firstSink = decorateSink;
this.senderSink = senderSink;
this.senderSink = senderSink ?? throw new ApplicationException(string.Format("channel with tag {0} not created sender sink", senderName));
var dispatcherSink = new DispatchSink(SenderName, this.context.DispatchEngine);
this.firstSink = AddSink(firstSink, dispatcherSink);

View File

@ -150,8 +150,10 @@ namespace ASC.Notify.Cron
CronExpression copy;
try
{
copy = new CronExpression(CronExpressionString);
copy.TimeZone = TimeZone;
copy = new CronExpression(CronExpressionString)
{
TimeZone = TimeZone
};
}
catch (FormatException)
{

View File

@ -41,13 +41,10 @@ namespace ASC.Core.Notify
public DirectSubscriptionProvider(string sourceID, SubscriptionManager subscriptionManager, IRecipientProvider recipientProvider)
{
if (string.IsNullOrEmpty(sourceID)) throw new ArgumentNullException("sourceID");
if (subscriptionManager == null) throw new ArgumentNullException("subscriptionManager");
if (recipientProvider == null) throw new ArgumentNullException("recipientProvider");
if (string.IsNullOrEmpty(sourceID)) throw new ArgumentNullException("sourceID");
this.sourceID = sourceID;
this.subscriptionManager = subscriptionManager;
this.recipientProvider = recipientProvider;
this.subscriptionManager = subscriptionManager ?? throw new ArgumentNullException("subscriptionManager");
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException("recipientProvider");
}

View File

@ -43,10 +43,8 @@ namespace ASC.Core.Notify
public EmailSenderSink(INotifySender sender)
{
if (sender == null) throw new ArgumentNullException("sender");
this.sender = sender;
{
this.sender = sender ?? throw new ArgumentNullException("sender");
}

View File

@ -42,10 +42,8 @@ namespace ASC.Notify.Engine
public DispatchEngine(Context context)
{
if (context == null) throw new ArgumentNullException("context");
this.context = context;
{
this.context = context ?? throw new ArgumentNullException("context");
logOnly = "log".Equals(ConfigurationManager.AppSettings["core:notify:postman"], StringComparison.InvariantCultureIgnoreCase);
log.DebugFormat("LogOnly: {0}", logOnly);
}

View File

@ -41,8 +41,7 @@ namespace ASC.Notify.Engine
{
get
{
var storage = CallContext.GetData(CallContext_Prefix) as Dictionary<string, ISendInterceptor>;
if (storage == null)
if (!(CallContext.GetData(CallContext_Prefix) is Dictionary<string, ISendInterceptor> storage))
{
storage = new Dictionary<string, ISendInterceptor>(10);
CallContext.SetData(CallContext_Prefix, storage);
@ -55,7 +54,7 @@ namespace ASC.Notify.Engine
public void Add(ISendInterceptor interceptor)
{
if (interceptor == null) throw new ArgumentNullException("interceptor");
if (String.IsNullOrEmpty(interceptor.Name)) throw new ArgumentException("empty name property", "interceptor");
if (string.IsNullOrEmpty(interceptor.Name)) throw new ArgumentException("empty name property", "interceptor");
switch (interceptor.Lifetime)
{
@ -72,7 +71,7 @@ namespace ASC.Notify.Engine
public ISendInterceptor Get(string name)
{
if (String.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
if (string.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
ISendInterceptor result = null;
result = GetInternal(name, callInterceptors);
@ -82,7 +81,7 @@ namespace ASC.Notify.Engine
public void Remove(string name)
{
if (String.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
if (string.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
RemoveInternal(name, callInterceptors);
RemoveInternal(name, globalInterceptors);

View File

@ -73,10 +73,8 @@ namespace ASC.Notify.Engine
public NotifyEngine(Context context)
{
if (context == null) throw new ArgumentNullException("context");
this.context = context;
{
this.context = context ?? throw new ArgumentNullException("context");
notifyScheduler = new Thread(NotifyScheduler) { IsBackground = true, Name = "NotifyScheduler" };
notifySender = new Thread(NotifySender) { IsBackground = true, Name = "NotifySender" };
}
@ -179,9 +177,9 @@ namespace ASC.Notify.Engine
{
wait = defaultSleep;
}
else if (wait.Ticks > Int32.MaxValue)
else if (wait.Ticks > int.MaxValue)
{
wait = TimeSpan.FromTicks(Int32.MaxValue);
wait = TimeSpan.FromTicks(int.MaxValue);
}
methodsEvent.WaitOne(wait, false);
}
@ -388,7 +386,7 @@ namespace ASC.Notify.Engine
}
else
{
response = new SendResponse(request.NotifyAction, sendertag, request.Recipient, new NotifyException(String.Format("Not registered sender \"{0}\".", sendertag)));
response = new SendResponse(request.NotifyAction, sendertag, request.Recipient, new NotifyException(string.Format("Not registered sender \"{0}\".", sendertag)));
}
responses.Add(response);
}
@ -403,8 +401,7 @@ namespace ASC.Notify.Engine
private SendResponse SendDirectNotify(int tenantId, NotifyRequest request, ISenderChannel channel)
{
var recipient = request.Recipient as IDirectRecipient;
if (recipient == null) throw new ArgumentException("request.Recipient not IDirectRecipient", "request");
if (!(request.Recipient is IDirectRecipient recipient)) throw new ArgumentException("request.Recipient not IDirectRecipient", "request");
request.CurrentSender = channel.SenderName;
@ -447,7 +444,7 @@ namespace ASC.Notify.Engine
var pattern = request.GetSenderPattern(sender);
if (pattern == null)
{
return new SendResponse(request.NotifyAction, sender, recipient, new NotifyException(String.Format("For action \"{0}\" by sender \"{1}\" no one patterns getted.", request.NotifyAction, sender)));
return new SendResponse(request.NotifyAction, sender, recipient, new NotifyException(string.Format("For action \"{0}\" by sender \"{1}\" no one patterns getted.", request.NotifyAction, sender)));
}
noticeMessage.Pattern = pattern;
@ -490,8 +487,7 @@ namespace ASC.Notify.Engine
{
if (!stylers.ContainsKey(message.Pattern.Styler))
{
var styler = Activator.CreateInstance(Type.GetType(message.Pattern.Styler, true)) as IPatternStyler;
if (styler != null)
if (Activator.CreateInstance(Type.GetType(message.Pattern.Styler, true)) is IPatternStyler styler)
{
stylers.Add(message.Pattern.Styler, styler);
}
@ -537,12 +533,9 @@ namespace ASC.Notify.Engine
if (pattern == null)
{
pattern = apProvider.GetPattern(request.NotifyAction, senderName);
}
if (pattern == null)
{
throw new NotifyException(string.Format("For action \"{0}\" by sender \"{1}\" no one patterns getted.", request.NotifyAction.Name, senderName));
}
request.Patterns[i] = pattern;
}
request.Patterns[i] = pattern ?? throw new NotifyException(string.Format("For action \"{0}\" by sender \"{1}\" no one patterns getted.", request.NotifyAction.Name, senderName));
}
}
}

View File

@ -65,19 +65,15 @@ namespace ASC.Notify.Engine
public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
{
if (notifySource == null) throw new ArgumentNullException("notifySource");
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
{
Properties = new Hashtable();
Arguments = new List<ITagValue>();
RequaredTags = new List<string>();
Interceptors = new List<ISendInterceptor>();
NotifySource = notifySource;
Recipient = recipient;
NotifyAction = action;
NotifySource = notifySource ?? throw new ArgumentNullException("notifySource");
Recipient = recipient ?? throw new ArgumentNullException("recipient");
NotifyAction = action ?? throw new ArgumentNullException("action");
ObjectID = objectID;
IsNeedCheckSubscriptions = true;
@ -118,7 +114,7 @@ namespace ASC.Notify.Engine
var index = Array.IndexOf(SenderNames, senderName);
if (index < 0)
{
throw new ApplicationException(String.Format("Sender with tag {0} dnot found", senderName));
throw new ApplicationException(string.Format("Sender with tag {0} dnot found", senderName));
}
return Patterns[index];
}
@ -126,13 +122,15 @@ namespace ASC.Notify.Engine
internal NotifyRequest Split(IRecipient recipient)
{
if (recipient == null) throw new ArgumentNullException("recipient");
var newRequest = new NotifyRequest(NotifySource, NotifyAction, ObjectID, recipient);
newRequest.SenderNames = SenderNames;
newRequest.Patterns = Patterns;
newRequest.Arguments = new List<ITagValue>(Arguments);
newRequest.RequaredTags = RequaredTags;
newRequest.CurrentSender = CurrentSender;
newRequest.CurrentMessage = CurrentMessage;
var newRequest = new NotifyRequest(NotifySource, NotifyAction, ObjectID, recipient)
{
SenderNames = SenderNames,
Patterns = Patterns,
Arguments = new List<ITagValue>(Arguments),
RequaredTags = RequaredTags,
CurrentSender = CurrentSender,
CurrentMessage = CurrentMessage
};
newRequest.Interceptors.AddRange(Interceptors);
return newRequest;
}

View File

@ -42,8 +42,8 @@ namespace ASC.Notify.Engine
public SendInterceptorSkeleton(string name, InterceptorPlace preventPlace, InterceptorLifetime lifetime, Func<NotifyRequest, InterceptorPlace, bool> sendInterceptor)
{
if (String.IsNullOrEmpty("name")) throw new ArgumentNullException("name");
if (String.IsNullOrEmpty("sendInterceptor")) throw new ArgumentNullException("sendInterceptor");
if (string.IsNullOrEmpty("name")) throw new ArgumentNullException("name");
if (string.IsNullOrEmpty("sendInterceptor")) throw new ArgumentNullException("sendInterceptor");
method = sendInterceptor;
Name = name;

View File

@ -45,7 +45,7 @@ namespace ASC.Notify.Engine
internal SingleRecipientInterceptor(string name)
{
if (String.IsNullOrEmpty(name)) throw new ArgumentException("name");
if (string.IsNullOrEmpty(name)) throw new ArgumentException("name");
Name = name;
}

View File

@ -39,10 +39,8 @@ namespace ASC.Core.Notify
public JabberSenderSink(INotifySender sender)
{
if (sender == null) throw new ArgumentNullException("sender");
this.sender = sender;
{
this.sender = sender ?? throw new ArgumentNullException("sender");
}

View File

@ -47,30 +47,25 @@ namespace ASC.Notify.Messages
public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID)
{
if (recipient == null) throw new ArgumentNullException("recipient");
Recipient = recipient;
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Action = action;
ObjectID = objectID;
}
public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID, IPattern pattern)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (pattern == null) throw new ArgumentNullException("pattern");
Recipient = recipient;
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Action = action;
Pattern = pattern;
Pattern = pattern ?? throw new ArgumentNullException("pattern");
ObjectID = objectID;
ContentType = pattern.ContentType;
}
public NoticeMessage(IDirectRecipient recipient, string subject, string body, string contentType)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (body == null) throw new ArgumentNullException("body");
Recipient = recipient;
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Subject = subject;
Body = body;
Body = body ?? throw new ArgumentNullException("body");
ContentType = contentType;
}

View File

@ -42,10 +42,8 @@ namespace ASC.Notify.Model
}
public NotifyAction(string id, string name)
{
if (id == null) throw new ArgumentNullException("id");
ID = id;
{
ID = id ?? throw new ArgumentNullException("id");
Name = name;
}
@ -61,8 +59,7 @@ namespace ASC.Notify.Model
public override bool Equals(object obj)
{
var a = obj as INotifyAction;
return a != null && a.ID == ID;
return obj is INotifyAction a && a.ID == ID;
}
public override int GetHashCode()
@ -72,7 +69,7 @@ namespace ASC.Notify.Model
public override string ToString()
{
return String.Format("action: {0}", ID);
return string.Format("action: {0}", ID);
}
}
}

View File

@ -141,9 +141,11 @@ namespace ASC.Notify.Model
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
var request = new NotifyRequest(notifySource, action, objectID, recipient);
request.SenderNames = senders;
request.IsNeedCheckSubscriptions = checkSubsciption;
var request = new NotifyRequest(notifySource, action, objectID, recipient)
{
SenderNames = senders,
IsNeedCheckSubscriptions = checkSubsciption
};
if (args != null) request.Arguments.AddRange(args);
return request;
}

View File

@ -133,13 +133,13 @@ namespace ASC.Core.Notify
RecipientsProvider = CreateRecipientsProvider();
if (RecipientsProvider == null)
{
throw new NotifyException(String.Format("Provider {0} not instanced.", "IRecipientsProvider"));
throw new NotifyException(string.Format("Provider {0} not instanced.", "IRecipientsProvider"));
}
SubscriprionProvider = CreateSubscriptionProvider();
if (SubscriprionProvider == null)
{
throw new NotifyException(String.Format("Provider {0} not instanced.", "ISubscriprionProvider"));
throw new NotifyException(string.Format("Provider {0} not instanced.", "ISubscriprionProvider"));
}
initialized = true;

View File

@ -59,7 +59,7 @@ namespace ASC.Notify.Patterns
protected override string FormatText(string text, ITagValue[] tagsValues)
{
if (String.IsNullOrEmpty(text)) return text;
if (string.IsNullOrEmpty(text)) return text;
return VelocityFormatter.FormatText(text, _nvelocityContext);
}
@ -71,8 +71,7 @@ namespace ASC.Notify.Patterns
private static void EventCartridgeReferenceInsertion(object sender, ReferenceInsertionEventArgs e)
{
var originalString = e.OriginalValue as string;
if (originalString == null) return;
if (!(e.OriginalValue is string originalString)) return;
var lines = originalString.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 0) return;
e.NewValue = string.Empty;

View File

@ -50,20 +50,17 @@ namespace ASC.Notify.Patterns
public Pattern(string id, string subject, string body, string contentType)
{
if (String.IsNullOrEmpty(id)) throw new ArgumentException("id");
if (subject == null) throw new ArgumentNullException("subject");
if (body == null) throw new ArgumentNullException("body");
if (string.IsNullOrEmpty(id)) throw new ArgumentException("id");
ID = id;
Subject = subject;
Body = body;
Subject = subject ?? throw new ArgumentNullException("subject");
Body = body ?? throw new ArgumentNullException("body");
ContentType = string.IsNullOrEmpty(contentType) ? HTMLContentType : contentType;
}
public override bool Equals(object obj)
{
var p = obj as IPattern;
return p != null && p.ID == ID;
return obj is IPattern p && p.ID == ID;
}
public override int GetHashCode()

View File

@ -55,7 +55,7 @@ namespace ASC.Notify.Patterns
internal PatternFormatter(string tagSearchRegExp, bool formatMessage)
{
if (String.IsNullOrEmpty(tagSearchRegExp)) throw new ArgumentException("tagSearchRegExp");
if (string.IsNullOrEmpty(tagSearchRegExp)) throw new ArgumentException("tagSearchRegExp");
tagSearchPattern = tagSearchRegExp;
RegEx = new Regex(tagSearchPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
@ -97,7 +97,7 @@ namespace ASC.Notify.Patterns
protected virtual string[] SearchTags(string text)
{
if (String.IsNullOrEmpty(text) || String.IsNullOrEmpty(tagSearchPattern)) return new string[0];
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(tagSearchPattern)) return new string[0];
var maches = RegEx.Matches(text);
var findedTags = new List<string>(maches.Count);

View File

@ -44,7 +44,7 @@ namespace ASC.Notify.Patterns
protected override string FormatText(string text, ITagValue[] tagsValues)
{
if (String.IsNullOrEmpty(text)) return text;
if (string.IsNullOrEmpty(text)) return text;
var formattedText = RegEx.Replace(text,
match =>

View File

@ -59,8 +59,7 @@ namespace ASC.Notify.Patterns
var xdoc = new XmlDocument();
xdoc.LoadXml(xml);
var xformatter = xdoc.SelectSingleNode("/patterns/formatter") as XmlElement;
if (xformatter != null)
if (xdoc.SelectSingleNode("/patterns/formatter") is XmlElement xformatter)
{
var type = xformatter.GetAttribute("type");
if (!string.IsNullOrEmpty(type))

View File

@ -77,8 +77,7 @@ namespace ASC.Notify.Recipients
public override bool Equals(object obj)
{
var recD = obj as IDirectRecipient;
if (recD == null) return false;
if (!(obj is IDirectRecipient recD)) return false;
return Equals(recD.ID, ID);
}
@ -89,7 +88,7 @@ namespace ASC.Notify.Recipients
public override string ToString()
{
return String.Format("{0}({1})", Name, String.Join(";", _Addresses.ToArray()));
return string.Format("{0}({1})", Name, string.Join(";", _Addresses.ToArray()));
}
}
}

View File

@ -48,8 +48,7 @@ namespace ASC.Notify.Recipients
public override bool Equals(object obj)
{
var recGr = obj as IRecipientsGroup;
if (recGr == null) return false;
if (!(obj is IRecipientsGroup recGr)) return false;
return Equals(recGr.ID, ID);
}
@ -60,7 +59,7 @@ namespace ASC.Notify.Recipients
public override string ToString()
{
return String.Format("{0}", Name);
return string.Format("{0}", Name);
}
}
}

View File

@ -59,11 +59,11 @@ namespace ASC.Core.Common.Notify
/// <returns>New TeamLab tag</returns>
public static TagValue Comment(string entity, string entityId, string parentId)
{
if (String.IsNullOrEmpty(entity) || !EntityType.Match(entity).Success) throw new ArgumentException(@"Not supported entity type", entity);
if (String.IsNullOrEmpty(entityId)) throw new ArgumentException(@"Entity Id is null or empty", entityId);
if (string.IsNullOrEmpty(entity) || !EntityType.Match(entity).Success) throw new ArgumentException(@"Not supported entity type", entity);
if (string.IsNullOrEmpty(entityId)) throw new ArgumentException(@"Entity Id is null or empty", entityId);
var pId = parentId != Guid.Empty.ToString() && parentId != null ? parentId : String.Empty;
return new TagValue(TagName, String.Format("reply_{0}_{1}_{2}@{3}", entity, entityId, pId, AutoreplyDomain));
var pId = parentId != Guid.Empty.ToString() && parentId != null ? parentId : string.Empty;
return new TagValue(TagName, string.Format("reply_{0}_{1}_{2}@{3}", entity, entityId, pId, AutoreplyDomain));
}
/// <summary>
@ -73,7 +73,7 @@ namespace ASC.Core.Common.Notify
/// <returns>New TeamLab tag</returns>
public static TagValue Message(int projectId)
{
return new TagValue(TagName, String.Format("message_{0}@{1}", projectId, AutoreplyDomain));
return new TagValue(TagName, string.Format("message_{0}@{1}", projectId, AutoreplyDomain));
}
private static string AutoreplyDomain

View File

@ -143,8 +143,10 @@ namespace ASC.Core.Notify.Senders
Body body;
if (m.ContentType == Pattern.HTMLContentType)
{
body = new Body(new Content(HtmlUtil.GetText(m.Content)) { Charset = Encoding.UTF8.WebName });
body.Html = new Content(GetHtmlView(m.Content)) { Charset = Encoding.UTF8.WebName };
body = new Body(new Content(HtmlUtil.GetText(m.Content)) { Charset = Encoding.UTF8.WebName })
{
Html = new Content(GetHtmlView(m.Content)) { Charset = Encoding.UTF8.WebName }
};
}
else
{

View File

@ -36,10 +36,8 @@ namespace ASC.Notify.Sinks
private readonly DispatchEngine dispatcher;
public DispatchSink(string senderName, DispatchEngine dispatcher)
{
if (dispatcher == null) throw new ArgumentNullException("dispatcher");
this.dispatcher = dispatcher;
{
this.dispatcher = dispatcher ?? throw new ArgumentNullException("dispatcher");
this.senderName = senderName;
}

View File

@ -40,12 +40,9 @@ namespace ASC.Notify.Model
public TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscriptionProvider directSubscriptionProvider)
{
if (recipientProvider == null) throw new ArgumentNullException("recipientProvider");
if (directSubscriptionProvider == null) throw new ArgumentNullException("directSubscriptionProvider");
this.recipientProvider = recipientProvider;
subscriptionProvider = directSubscriptionProvider;
{
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException("recipientProvider");
subscriptionProvider = directSubscriptionProvider ?? throw new ArgumentNullException("directSubscriptionProvider");
}
public TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscriptionProvider directSubscriptionProvider, string[] defaultSenderMethods)

View File

@ -71,8 +71,7 @@ namespace ASC.Core.Security.Authentication
public override bool Equals(object obj)
{
var a = obj as IUserAccount;
return a != null && ID.Equals(a.ID);
return obj is IUserAccount a && ID.Equals(a.ID);
}
public override int GetHashCode()

View File

@ -42,12 +42,9 @@ namespace ASC.Common.Security.Authorizing
public AzManager(IRoleProvider roleProvider, IPermissionProvider permissionProvider)
: this()
{
if (roleProvider == null) throw new ArgumentNullException("roleProvider");
if (permissionProvider == null) throw new ArgumentNullException("permissionProvider");
this.roleProvider = roleProvider;
this.permissionProvider = permissionProvider;
{
this.roleProvider = roleProvider ?? throw new ArgumentNullException("roleProvider");
this.permissionProvider = permissionProvider ?? throw new ArgumentNullException("permissionProvider");
}

View File

@ -42,8 +42,7 @@ namespace ASC.Core.Security.Authorizing
public PermissionResolver(AzManager azManager)
{
if (azManager == null) throw new ArgumentNullException("azManager");
this.azManager = azManager;
this.azManager = azManager ?? throw new ArgumentNullException("azManager");
}

View File

@ -96,11 +96,11 @@ namespace ASC.Security.Cryptography
var parts = key.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length != 2) return ValidationResult.Invalid;
if (!Int64.TryParse(parts[0], out var ms)) return ValidationResult.Invalid;
if (!long.TryParse(parts[0], out var ms)) return ValidationResult.Invalid;
var hash = GetMashineHashedData(BitConverter.GetBytes(ms), Encoding.ASCII.GetBytes(email));
var key2 = DoStringFromBytes(hash);
var key2_good = String.Compare(parts[1], key2, StringComparison.InvariantCultureIgnoreCase) == 0;
var key2_good = string.Compare(parts[1], key2, StringComparison.InvariantCultureIgnoreCase) == 0;
if (!key2_good) return ValidationResult.Invalid;
var ms_current = (long)(DateTime.UtcNow - _from).TotalMilliseconds;
return validInterval >= TimeSpan.FromMilliseconds(ms_current - ms) ? ValidationResult.Ok : ValidationResult.Expired;

View File

@ -122,8 +122,7 @@ namespace ASC.Core.Tenants
public override bool Equals(object obj)
{
var t = obj as Tenant;
return t != null && t.TenantId == TenantId;
return obj is Tenant t && t.TenantId == TenantId;
}
public override int GetHashCode()
@ -156,9 +155,9 @@ namespace ASC.Core.Tenants
}
}
public String GetTenantDomain(bool allowMappedDomain = true)
public string GetTenantDomain(bool allowMappedDomain = true)
{
var result = String.Empty;
var result = string.Empty;
var baseHost = TenantUtil.GetBaseDomain(HostedRegion);

View File

@ -178,7 +178,7 @@ namespace ASC.Core.Tenants
{
var features = (Features ?? string.Empty).Split(' ', ',', ';').ToList();
var portals = features.FirstOrDefault(f => f.StartsWith("portals:"));
if (portals == null || !Int32.TryParse(portals.Replace("portals:", ""), out var countPortals) || countPortals <= 0)
if (portals == null || !int.TryParse(portals.Replace("portals:", ""), out var countPortals) || countPortals <= 0)
{
countPortals = 0;
}
@ -211,8 +211,7 @@ namespace ASC.Core.Tenants
public override bool Equals(object obj)
{
var q = obj as TenantQuota;
return q != null && q.Id == Id;
return obj is TenantQuota q && q.Id == Id;
}

View File

@ -30,7 +30,7 @@ namespace ASC.Core.Tenants
{
public class TenantUtil
{
public static String GetBaseDomain(string hostedRegion)
public static string GetBaseDomain(string hostedRegion)
{
var baseHost = CoreContext.Configuration.BaseDomain;

View File

@ -57,8 +57,7 @@ namespace ASC.Core
public override bool Equals(object obj)
{
var v = obj as TenantVersion;
return v != null && v.Id == Id;
return obj is TenantVersion v && v.Id == Id;
}
public override string ToString()

View File

@ -56,8 +56,7 @@ namespace ASC.Common.Tests.Security.Authorizing
public override bool Equals(object obj)
{
var class1 = obj as Class1;
return class1 != null && Equals(class1.Id, Id);
return obj is Class1 class1 && Equals(class1.Id, Id);
}
public override int GetHashCode()

View File

@ -334,8 +334,7 @@ namespace ASC.Common.Tests.Security.Authorizing
public override bool Equals(object obj)
{
var p = obj as PermissionRecord;
return p != null && Id == p.Id;
return obj is PermissionRecord p && Id == p.Id;
}
}
}

View File

@ -45,8 +45,8 @@ namespace ASC.Core.Common.Tests
private string objectId;
private string rndObj;
private string rndObj2;
private IRecipient everyone = new RecipientsGroup(String.Empty, String.Empty);
private IRecipient otdel = new RecipientsGroup(String.Empty, String.Empty);
private IRecipient everyone = new RecipientsGroup(string.Empty, string.Empty);
private IRecipient otdel = new RecipientsGroup(string.Empty, string.Empty);
private IRecipient testRec;
private IRecipient testRec2;
private NotifyAction nAction;
@ -94,7 +94,7 @@ namespace ASC.Core.Common.Tests
res = subProvider.GetRecipients(tenant.TenantId, nAction, objectId);
Assert.AreEqual(cnt, res.Count());
String[] objs;
string[] objs;
//GetSubscribtions
@ -114,7 +114,7 @@ namespace ASC.Core.Common.Tests
CollectionAssert.AllItemsAreUnique(objsGroup);
//Подписываем весь отдел на объект
rndObj = String.Concat("TestObject#", new Random().Next().ToString());
rndObj = string.Concat("TestObject#", new Random().Next().ToString());
subProvider.Subscribe(nAction, rndObj, otdel);
//Проверяем подписался ли юзер вместе со всем отделом двумя способами.
Assert.AreEqual(objsGroup.Count() + 1, subProvider.GetSubscriptions(tenant, nAction, otdel).Count());
@ -122,7 +122,7 @@ namespace ASC.Core.Common.Tests
Assert.AreEqual(true, subProvider.IsSubscribed(tenant, nAction, testRec2, rndObj));
//Подписываем Everybody
rndObj2 = String.Concat("TestObject#", new Random().Next().ToString());
rndObj2 = string.Concat("TestObject#", new Random().Next().ToString());
objs = subProvider.GetSubscriptions(tenant, nAction, testRec2);
subProvider.Subscribe(nAction, rndObj2, everyone);
//Проверяем подписался ли user двумя способами.

View File

@ -104,7 +104,7 @@ namespace ASC.Core.Users
{
ID = new Guid("{17097D73-2D1E-4B36-AA07-AEB34AF993CD}"),
FirstName = ConfigurationManager.AppSettings["core:system:poster:name"] ?? "ONLYOFFICE Poster",
LastName = String.Empty,
LastName = string.Empty,
ActivationStatus = EmployeeActivationStatus.Activated
};

View File

@ -57,10 +57,10 @@ namespace ASC.Core.Users
return string.Format(GetUserDisplayFormat(format), userInfo.FirstName, userInfo.LastName);
}
public static string GetUserName(String firstName, String lastName)
public static string GetUserName(string firstName, string lastName)
{
if (String.IsNullOrEmpty(firstName) || String.IsNullOrEmpty("lastName")) throw new ArgumentException();
if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty("lastName")) throw new ArgumentException();
return string.Format(GetUserDisplayFormat(DisplayUserNameFormat.Default), firstName, lastName);
}
@ -90,13 +90,13 @@ namespace ASC.Core.Users
if (format == DisplayUserNameFormat.Default) format = GetUserDisplayDefaultOrder();
if (format == DisplayUserNameFormat.FirstLast)
{
result = String.Compare(x.FirstName, y.FirstName, true);
if (result == 0) result = String.Compare(x.LastName, y.LastName, true);
result = string.Compare(x.FirstName, y.FirstName, true);
if (result == 0) result = string.Compare(x.LastName, y.LastName, true);
}
else
{
result = String.Compare(x.LastName, y.LastName, true);
if (result == 0) result = String.Compare(x.FirstName, y.FirstName, true);
result = string.Compare(x.LastName, y.LastName, true);
if (result == 0) result = string.Compare(x.FirstName, y.FirstName, true);
}
return result;
}
@ -118,7 +118,7 @@ namespace ASC.Core.Users
if (!forceFormatChecked)
{
forceFormat = ConfigurationManager.AppSettings["core:user-display-format"];
if (String.IsNullOrEmpty(forceFormat)) forceFormat = null;
if (string.IsNullOrEmpty(forceFormat)) forceFormat = null;
forceFormatChecked = true;
}
if (forceFormat != null) return forceFormat;

View File

@ -40,12 +40,9 @@ namespace ASC.Data.Storage
private readonly int chunksize;
public CrossModuleTransferUtility(IDataStore source, IDataStore destination)
{
if (source == null) throw new ArgumentNullException("source");
if (destination == null) throw new ArgumentNullException("destination");
this.source = source;
this.destination = destination;
{
this.source = source ?? throw new ArgumentNullException("source");
this.destination = destination ?? throw new ArgumentNullException("destination");
maxChunkUploadSize = 10 * 1024 * 1024;
chunksize = 5 * 1024 * 1024;
}

View File

@ -62,7 +62,7 @@ namespace ASC.Data.Storage.DiscStorage
_domainsExpires.Add(string.Empty, moduleConfig.Expires);
}
public String GetPhysicalPath(string domain, string path)
public string GetPhysicalPath(string domain, string path)
{
if (path == null)
{
@ -145,9 +145,8 @@ namespace ASC.Data.Storage.DiscStorage
//Copy stream
//optimaze disk file copy
var fileStream = buffered as FileStream;
long fslen;
if (fileStream != null && WorkContext.IsMono)
if (buffered is FileStream fileStream && WorkContext.IsMono)
{
File.Copy(fileStream.Name, target, true);
fslen = fileStream.Length;

View File

@ -45,7 +45,7 @@ namespace ASC.Data.Storage.GoogleCloud
{
public class GoogleCloudStorage : BaseStorage
{
private String _subDir = String.Empty;
private string _subDir = string.Empty;
private readonly Dictionary<string, PredefinedObjectAcl> _domainsAcl;
private readonly PredefinedObjectAcl _moduleAcl;
@ -137,12 +137,12 @@ namespace ASC.Data.Storage.GoogleCloud
path = path.TrimStart('\\', '/').TrimEnd('/').Replace('\\', '/');
if (!String.IsNullOrEmpty(_subDir))
if (!string.IsNullOrEmpty(_subDir))
{
if (_subDir.Length == 1 && (_subDir[0] == '/' || _subDir[0] == '\\'))
result = path;
else
result = String.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
result = string.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
}
else//Key combined from module+domain+filename
result = string.Format("{0}/{1}/{2}/{3}",
@ -280,10 +280,10 @@ namespace ASC.Data.Storage.GoogleCloud
var uploaded = storage.UploadObject(_bucket, MakePath(domain, path), mime, buffered, uploadObjectOptions, null);
uploaded.ContentEncoding = contentEncoding;
uploaded.CacheControl = String.Format("public, maxage={0}", (int)TimeSpan.FromDays(cacheDays).TotalSeconds);
uploaded.CacheControl = string.Format("public, maxage={0}", (int)TimeSpan.FromDays(cacheDays).TotalSeconds);
if (uploaded.Metadata == null)
uploaded.Metadata = new Dictionary<String, String>();
uploaded.Metadata = new Dictionary<string, string>();
uploaded.Metadata["Expires"] = DateTime.UtcNow.Add(TimeSpan.FromDays(cacheDays)).ToString("R");
@ -559,7 +559,7 @@ namespace ASC.Data.Storage.GoogleCloud
var storage = GetStorage();
var objects = storage
.ListObjects(_bucket, MakePath(domain, String.Empty));
.ListObjects(_bucket, MakePath(domain, string.Empty));
if (QuotaController != null)
{
@ -584,7 +584,7 @@ namespace ASC.Data.Storage.GoogleCloud
var storage = GetStorage();
var objects = storage
.ListObjects(_bucket, MakePath(domain, String.Empty));
.ListObjects(_bucket, MakePath(domain, string.Empty));
long result = 0;
@ -606,9 +606,10 @@ namespace ASC.Data.Storage.GoogleCloud
var size = GetFileSize(srcdomain, srcpath);
var options = new CopyObjectOptions();
options.DestinationPredefinedAcl = GetDomainACL(newdomain);
var options = new CopyObjectOptions
{
DestinationPredefinedAcl = GetDomainACL(newdomain)
};
storage.CopyObject(_bucket, MakePath(srcdomain, srcpath), _bucket, MakePath(newdomain, newpath), options);
@ -658,11 +659,11 @@ namespace ASC.Data.Storage.GoogleCloud
var uploaded = storage.UploadObject(_bucket, MakePath(domain, path), "application/octet-stream", buffered, uploadObjectOptions, null);
uploaded.CacheControl = String.Format("public, maxage={0}", (int)TimeSpan.FromDays(5).TotalSeconds);
uploaded.CacheControl = string.Format("public, maxage={0}", (int)TimeSpan.FromDays(5).TotalSeconds);
uploaded.ContentDisposition = "attachment";
if (uploaded.Metadata == null)
uploaded.Metadata = new Dictionary<String, String>();
uploaded.Metadata = new Dictionary<string, string>();
uploaded.Metadata["Expires"] = DateTime.UtcNow.Add(TimeSpan.FromDays(5)).ToString("R");
uploaded.Metadata.Add("private-expire", expires.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture));
@ -701,7 +702,7 @@ namespace ASC.Data.Storage.GoogleCloud
#region chunking
public override String InitiateChunkedUpload(string domain, string path)
public override string InitiateChunkedUpload(string domain, string path)
{
var storage = GetStorage();
@ -712,9 +713,9 @@ namespace ASC.Data.Storage.GoogleCloud
return sessionUri.ToString();
}
public override string UploadChunk(String domain,
String path,
String uploadUri,
public override string UploadChunk(string domain,
string path,
string uploadUri,
Stream stream,
long defaultChunkSize,
int chunkNumber,
@ -731,7 +732,7 @@ namespace ASC.Data.Storage.GoogleCloud
if (chunkLength != defaultChunkSize)
totalBytes = Convert.ToString((chunkNumber - 1) * defaultChunkSize + chunkLength);
var contentRangeHeader = String.Format("bytes {0}-{1}/{2}", bytesRangeStart, bytesRangeEnd, totalBytes);
var contentRangeHeader = string.Format("bytes {0}-{1}/{2}", bytesRangeStart, bytesRangeEnd, totalBytes);
var request = HttpWebRequest.CreateHttp(uploadUri);
@ -793,7 +794,7 @@ namespace ASC.Data.Storage.GoogleCloud
}
}
return String.Empty;
return string.Empty;
}
public override Uri FinalizeChunkedUpload(string domain, string path, string uploadUri, Dictionary<int, string> eTags)

View File

@ -36,9 +36,7 @@ namespace ASC.Data.Storage
public ProgressStream(Stream stream)
{
if (stream == null) throw new ArgumentNullException("stream");
this.stream = stream;
this.stream = stream ?? throw new ArgumentNullException("stream");
try
{
length = stream.Length;

View File

@ -41,11 +41,11 @@ namespace ASC.Data.Storage.RackspaceCloud
{
private string _region;
private string _private_container;
private String _public_container;
private string _public_container;
private readonly List<string> _domains = new List<string>();
private readonly Dictionary<String, ACL> _domainsAcl;
private readonly Dictionary<string, ACL> _domainsAcl;
private readonly ACL _moduleAcl;
private String _subDir;
private string _subDir;
private string _username;
private string _apiKey;
private bool _lowerCasing = true;
@ -95,12 +95,12 @@ namespace ASC.Data.Storage.RackspaceCloud
path = path.TrimStart('\\', '/').TrimEnd('/').Replace('\\', '/');
if (!String.IsNullOrEmpty(_subDir))
if (!string.IsNullOrEmpty(_subDir))
{
if (_subDir.Length == 1 && (_subDir[0] == '/' || _subDir[0] == '\\'))
result = path;
else
result = String.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
result = string.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
}
else//Key combined from module+domain+filename
result = string.Format("{0}/{1}/{2}/{3}",
@ -148,7 +148,7 @@ namespace ASC.Data.Storage.RackspaceCloud
_public_container = props["public_container"];
if (String.IsNullOrEmpty(_public_container))
if (string.IsNullOrEmpty(_public_container))
throw new ArgumentException("_public_container");
var client = GetClient();
@ -182,7 +182,7 @@ namespace ASC.Data.Storage.RackspaceCloud
var client = GetClient();
var accounMetaData = client.GetAccountMetaData(_region);
var secretKey = String.Empty;
var secretKey = string.Empty;
if (accounMetaData.ContainsKey("Temp-Url-Key"))
{
@ -206,7 +206,7 @@ namespace ASC.Data.Storage.RackspaceCloud
private Uri GetUriShared(string domain, string path)
{
return new Uri(String.Format("{0}{1}", SecureHelper.IsSecure() ? _cnameSSL : _cname, MakePath(domain, path)));
return new Uri(string.Format("{0}{1}", SecureHelper.IsSecure() ? _cnameSSL : _cname, MakePath(domain, path)));
}
public override Stream GetReadStream(string domain, string path)
@ -284,11 +284,11 @@ namespace ASC.Data.Storage.RackspaceCloud
contentDisposition = "attachment";
}
var customHeaders = new Dictionary<String, String>();
var customHeaders = new Dictionary<string, string>();
if (cacheDays > 0)
{
customHeaders.Add("Cache-Control", String.Format("public, maxage={0}", (int)TimeSpan.FromDays(cacheDays).TotalSeconds));
customHeaders.Add("Cache-Control", string.Format("public, maxage={0}", (int)TimeSpan.FromDays(cacheDays).TotalSeconds));
customHeaders.Add("Expires", DateTime.UtcNow.Add(TimeSpan.FromDays(cacheDays)).ToString());
}
@ -306,7 +306,7 @@ namespace ASC.Data.Storage.RackspaceCloud
}
if (!String.IsNullOrEmpty(contentEncoding))
if (!string.IsNullOrEmpty(contentEncoding))
customHeaders.Add("Content-Encoding", contentEncoding);
var cannedACL = acl == ACL.Auto ? GetDomainACL(domain) : ACL.Read;
@ -319,9 +319,9 @@ namespace ASC.Data.Storage.RackspaceCloud
using (var emptyStream = TempStream.Create())
{
var headers = new Dictionary<String, String>();
var headers = new Dictionary<string, string>();
headers.Add("X-Object-Manifest", String.Format("{0}/{1}", _private_container, MakePath(domain, path)));
headers.Add("X-Object-Manifest", string.Format("{0}/{1}", _private_container, MakePath(domain, path)));
// create symlink
client.CreateObject(_public_container,
emptyStream,
@ -408,7 +408,7 @@ namespace ASC.Data.Storage.RackspaceCloud
{
if (!paths.Any()) return;
var keysToDel = new List<String>();
var keysToDel = new List<string>();
long quotaUsed = 0;
@ -510,7 +510,7 @@ namespace ASC.Data.Storage.RackspaceCloud
public override string[] ListFilesRelative(string domain, string path, string pattern, bool recursive)
{
var paths = new List<String>();
var paths = new List<string>();
var client = GetClient();
@ -582,7 +582,7 @@ namespace ASC.Data.Storage.RackspaceCloud
var client = GetClient();
var objects = client
.ListObjects(_private_container, null, null, null, MakePath(domain, String.Empty), _region);
.ListObjects(_private_container, null, null, null, MakePath(domain, string.Empty), _region);
if (QuotaController != null)
{
@ -606,7 +606,7 @@ namespace ASC.Data.Storage.RackspaceCloud
var client = GetClient();
var objects = client
.ListObjects(_private_container, null, null, null, MakePath(domain, String.Empty), _region);
.ListObjects(_private_container, null, null, null, MakePath(domain, string.Empty), _region);
long result = 0;

View File

@ -61,7 +61,7 @@ namespace ASC.Data.Storage.S3
private bool _lowerCasing = true;
private bool _revalidateCloudFront;
private string _distributionId = string.Empty;
private String _subDir = String.Empty;
private string _subDir = string.Empty;
public S3Storage(string tenant)
{
@ -1045,11 +1045,11 @@ namespace ASC.Data.Storage.S3
_bucketRoot = props.ContainsKey("cname") && Uri.IsWellFormedUriString(props["cname"], UriKind.Absolute)
? new Uri(props["cname"], UriKind.Absolute)
: new Uri(String.Format("http://s3.{1}.amazonaws.com/{0}/", _bucket, _region), UriKind.Absolute);
: new Uri(string.Format("http://s3.{1}.amazonaws.com/{0}/", _bucket, _region), UriKind.Absolute);
_bucketSSlRoot = props.ContainsKey("cnamessl") &&
Uri.IsWellFormedUriString(props["cnamessl"], UriKind.Absolute)
? new Uri(props["cnamessl"], UriKind.Absolute)
: new Uri(String.Format("https://s3.{1}.amazonaws.com/{0}/", _bucket, _region), UriKind.Absolute);
: new Uri(string.Format("https://s3.{1}.amazonaws.com/{0}/", _bucket, _region), UriKind.Absolute);
if (props.ContainsKey("lower"))
{
@ -1078,12 +1078,12 @@ namespace ASC.Data.Storage.S3
path = path.TrimStart('\\', '/').TrimEnd('/').Replace('\\', '/');
if (!String.IsNullOrEmpty(_subDir))
if (!string.IsNullOrEmpty(_subDir))
{
if (_subDir.Length == 1 && (_subDir[0] == '/' || _subDir[0] == '\\'))
result = path;
else
result = String.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
result = string.Format("{0}/{1}", _subDir, path); // Ignory all, if _subDir is not null
}
else//Key combined from module+domain+filename
result = string.Format("{0}/{1}/{2}/{3}",
@ -1150,9 +1150,7 @@ namespace ASC.Data.Storage.S3
public ResponseStreamWrapper(GetObjectResponse response)
{
if (response == null) throw new ArgumentNullException("response");
_response = response;
_response = response ?? throw new ArgumentNullException("response");
}

View File

@ -95,7 +95,7 @@ namespace ASC.Data.Storage
if (Appenders.Any())
{
var avaliableAppenders = Appenders.Where(x => x.Extensions != null && x.Extensions.Split('|').Contains(ext) || String.IsNullOrEmpty(ext)).ToList();
var avaliableAppenders = Appenders.Where(x => x.Extensions != null && x.Extensions.Split('|').Contains(ext) || string.IsNullOrEmpty(ext)).ToList();
var avaliableAppendersCount = avaliableAppenders.LongCount();
Appender appender;

View File

@ -75,16 +75,16 @@ namespace ASC.FederatedLogin.Helpers
var clientSecret = loginProvider.ClientSecret;
var redirectUri = loginProvider.RedirectUri;
if (String.IsNullOrEmpty(authCode)) throw new ArgumentNullException("authCode");
if (String.IsNullOrEmpty(clientID)) throw new ArgumentNullException("clientID");
if (String.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException("clientSecret");
if (string.IsNullOrEmpty(authCode)) throw new ArgumentNullException("authCode");
if (string.IsNullOrEmpty(clientID)) throw new ArgumentNullException("clientID");
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException("clientSecret");
var data = string.Format("code={0}&client_id={1}&client_secret={2}",
HttpUtility.UrlEncode(authCode),
HttpUtility.UrlEncode(clientID),
HttpUtility.UrlEncode(clientSecret));
if (!String.IsNullOrEmpty(redirectUri))
if (!string.IsNullOrEmpty(redirectUri))
data += "&redirect_uri=" + HttpUtility.UrlEncode(redirectUri);
data += "&grant_type=authorization_code";
@ -119,7 +119,7 @@ namespace ASC.FederatedLogin.Helpers
{
if (token == null || !CanRefresh(token)) throw new ArgumentException("Can not refresh given token", "token");
var data = String.Format("client_id={0}&client_secret={1}&refresh_token={2}&grant_type=refresh_token",
var data = string.Format("client_id={0}&client_secret={1}&refresh_token={2}&grant_type=refresh_token",
HttpUtility.UrlEncode(token.ClientID),
HttpUtility.UrlEncode(token.ClientSecret),
HttpUtility.UrlEncode(token.RefreshToken));
@ -140,7 +140,7 @@ namespace ASC.FederatedLogin.Helpers
private static bool CanRefresh(OAuth20Token token)
{
return !String.IsNullOrEmpty(token.ClientID) && !String.IsNullOrEmpty(token.ClientSecret);
return !string.IsNullOrEmpty(token.ClientID) && !string.IsNullOrEmpty(token.ClientSecret);
}
}
}

View File

@ -34,9 +34,9 @@ namespace ASC.FederatedLogin.Helpers
{
public class RequestHelper
{
public static String PerformRequest(String uri, String contentType = "", String method = "GET", String body = "", Dictionary<string, string> headers = null, int timeout = 30000)
public static string PerformRequest(string uri, string contentType = "", string method = "GET", string body = "", Dictionary<string, string> headers = null, int timeout = 30000)
{
if (String.IsNullOrEmpty(uri)) throw new ArgumentNullException("uri");
if (string.IsNullOrEmpty(uri)) throw new ArgumentNullException("uri");
var request = WebRequest.Create(uri);
request.Method = method;

View File

@ -77,7 +77,7 @@ namespace ASC.FederatedLogin.LoginProviders
{
var token = Auth(context, Scopes);
return GetLoginProfile(token == null ? null : token.AccessToken);
return GetLoginProfile(token?.AccessToken);
}
catch (ThreadAbortException)
{

View File

@ -79,13 +79,13 @@ namespace ASC.FederatedLogin.LoginProviders
{
get
{
return !String.IsNullOrEmpty(BitlyClientId) &&
!String.IsNullOrEmpty(BitlyClientSecret) &&
!String.IsNullOrEmpty(BitlyUrl);
return !string.IsNullOrEmpty(BitlyClientId) &&
!string.IsNullOrEmpty(BitlyClientSecret) &&
!string.IsNullOrEmpty(BitlyUrl);
}
}
public static String GetShortenLink(String shareLink)
public static string GetShortenLink(string shareLink)
{
var uri = new Uri(shareLink);

View File

@ -167,9 +167,7 @@ namespace ASC.FederatedLogin.LoginProviders
var parser = JObject.Parse(token.OriginJson);
return
parser == null
? null
: parser.Value<string>("x_mailru_vid");
parser?.Value<string>("x_mailru_vid");
}
}
}

View File

@ -52,12 +52,12 @@ namespace ASC.FederatedLogin.LoginProviders
{
IAuthenticationRequest request;
var realmUrlString = String.Empty;
var realmUrlString = string.Empty;
if (@params.ContainsKey("realmUrl"))
realmUrlString = @params["realmUrl"];
if (!String.IsNullOrEmpty(realmUrlString))
if (!string.IsNullOrEmpty(realmUrlString))
request = Openid.CreateRequest(id, new Realm(realmUrlString));
else
request = Openid.CreateRequest(id);
@ -110,7 +110,7 @@ namespace ASC.FederatedLogin.LoginProviders
var spprofile = response.GetExtension<ClaimsResponse>();
var fetchprofile = response.GetExtension<FetchResponse>();
var realmUrlString = String.Empty;
var realmUrlString = string.Empty;
if (@params.ContainsKey("realmUrl"))
realmUrlString = @params["realmUrl"];

View File

@ -164,9 +164,7 @@ namespace ASC.FederatedLogin.LoginProviders
var parser = JObject.Parse(token.OriginJson);
return
parser == null
? null
: parser.Value<string>("email");
parser?.Value<string>("email");
}
}
}

Some files were not shown because too many files have changed in this diff Show More