analizators/ca1507

This commit is contained in:
Anton Suhorukov 2022-01-24 13:49:00 +03:00
parent 0fcac47686
commit fce8d26cef
110 changed files with 315 additions and 315 deletions

View File

@ -88,7 +88,7 @@ namespace ASC.Api.Core
public static ApiDateTime Parse(string data, TimeZoneInfo tz, TenantManager tenantManager, TimeZoneConverter timeZoneConverter)
{
if (string.IsNullOrEmpty(data)) throw new ArgumentNullException("data");
if (string.IsNullOrEmpty(data)) throw new ArgumentNullException(nameof(data));
if (data.Length < 7) throw new ArgumentException("invalid date time format");

View File

@ -36,8 +36,8 @@ namespace ASC.Common.Data
public static void StreamCopyTo(this Stream srcStream, Stream dstStream, int length)
{
if (srcStream == null) throw new ArgumentNullException("srcStream");
if (dstStream == null) throw new ArgumentNullException("dstStream");
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));
var buffer = new byte[BufferSize];
int totalRead = 0;

View File

@ -32,7 +32,7 @@ namespace ASC.Common
public Stream GetBuffered(Stream srcStream)
{
if (srcStream == null) throw new ArgumentNullException("srcStream");
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
if (!srcStream.CanSeek || srcStream.CanTimeout)
{
//Buffer it

View File

@ -186,7 +186,7 @@ namespace ASC.Core.Billing
{
if (productIds == null)
{
throw new ArgumentNullException("productIds");
throw new ArgumentNullException(nameof(productIds));
}
var parameters = productIds.Select(pid => Tuple.Create("ProductId", pid)).ToList();

View File

@ -153,7 +153,7 @@ namespace ASC.Core.Billing
private static void SaveLicense(Stream licenseStream, string path)
{
if (licenseStream == null) throw new ArgumentNullException("licenseStream");
if (licenseStream == null) throw new ArgumentNullException(nameof(licenseStream));
if (licenseStream.CanSeek)
{

View File

@ -279,7 +279,7 @@ namespace ASC.Core.Billing
{
if (tariff == null)
{
throw new ArgumentNullException("tariff");
throw new ArgumentNullException(nameof(tariff));
}
var q = QuotaService.GetTenantQuota(tariff.QuotaId);
@ -432,7 +432,7 @@ namespace ASC.Core.Billing
{
if (productIds == null)
{
throw new ArgumentNullException("productIds");
throw new ArgumentNullException(nameof(productIds));
}
try
{

View File

@ -87,7 +87,7 @@ namespace ASC.Core.Caching
public CachedAzService(DbAzService service, AzServiceCache azServiceCache)
{
this.service = service ?? throw new ArgumentNullException("service");
this.service = service ?? throw new ArgumentNullException(nameof(service));
Cache = azServiceCache.Cache;
cacheNotify = azServiceCache.CacheNotify;
CacheExpiration = TimeSpan.FromMinutes(10);

View File

@ -127,7 +127,7 @@ namespace ASC.Core.Caching
public CachedQuotaService(DbQuotaService service, QuotaServiceCache quotaServiceCache) : this()
{
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
QuotaServiceCache = quotaServiceCache;
Cache = quotaServiceCache.Cache;
CacheNotify = quotaServiceCache.CacheNotify;

View File

@ -114,7 +114,7 @@ namespace ASC.Core.Caching
public CachedSubscriptionService(DbSubscriptionService service, SubscriptionServiceCache subscriptionServiceCache)
{
this.service = service ?? throw new ArgumentNullException("service");
this.service = service ?? throw new ArgumentNullException(nameof(service));
cache = subscriptionServiceCache.Cache;
notifyRecord = subscriptionServiceCache.NotifyRecord;
notifyMethod = subscriptionServiceCache.NotifyMethod;

View File

@ -205,7 +205,7 @@ namespace ASC.Core.Caching
public CachedTenantService(DbTenantService service, TenantServiceCache tenantServiceCache, ICache cache) : this()
{
this.cache = cache;
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
TenantServiceCache = tenantServiceCache;
CacheNotifyItem = tenantServiceCache.CacheNotifyItem;
CacheNotifySettings = tenantServiceCache.CacheNotifySettings;

View File

@ -207,7 +207,7 @@ namespace ASC.Core.Caching
UserServiceCache userServiceCache
) : this()
{
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
CoreBaseSettings = coreBaseSettings;
UserServiceCache = userServiceCache;
Cache = userServiceCache.Cache;

View File

@ -83,17 +83,17 @@ namespace ASC.Core.Configuration
{
if (string.IsNullOrEmpty(host))
{
throw new ArgumentException("Empty smtp host.", "host");
throw new ArgumentException("Empty smtp host.", nameof(host));
}
if (string.IsNullOrEmpty(senderAddress))
{
throw new ArgumentException("Empty sender address.", "senderAddress");
throw new ArgumentException("Empty sender address.", nameof(senderAddress));
}
Host = host;
Port = port;
SenderAddress = senderAddress;
SenderDisplayName = senderDisplayName ?? throw new ArgumentNullException("senderDisplayName");
SenderDisplayName = senderDisplayName ?? throw new ArgumentNullException(nameof(senderDisplayName));
}
public void SetCredentials(string userName, string password)
@ -105,11 +105,11 @@ namespace ASC.Core.Configuration
{
if (string.IsNullOrEmpty(userName))
{
throw new ArgumentException("Empty user name.", "userName");
throw new ArgumentException("Empty user name.", nameof(userName));
}
if (string.IsNullOrEmpty(password))
{
throw new ArgumentException("Empty password.", "password");
throw new ArgumentException("Empty password.", nameof(password));
}
CredentialsUserName = userName;
CredentialsUserPassword = password;

View File

@ -179,7 +179,7 @@ namespace ASC.Core
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}
byte[] bytes = null;
if (value != null)
@ -193,7 +193,7 @@ namespace ASC.Core
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}
var bytes = TenantService.GetTenantSettings(tenant, key);

View File

@ -104,7 +104,7 @@ namespace ASC.Core
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}
var now = DateTime.UtcNow;

View File

@ -194,7 +194,7 @@ namespace ASC.Core
public Tenant SetTenantVersion(Tenant tenant, int version)
{
if (tenant == null) throw new ArgumentNullException("tenant");
if (tenant == null) throw new ArgumentNullException(nameof(tenant));
if (tenant.Version != version)
{
tenant.Version = version;

View File

@ -113,8 +113,8 @@ namespace ASC.Core
public string AuthenticateMe(string login, string passwordHash)
{
if (login == null) throw new ArgumentNullException("login");
if (passwordHash == null) throw new ArgumentNullException("passwordHash");
if (login == null) throw new ArgumentNullException(nameof(login));
if (passwordHash == null) throw new ArgumentNullException(nameof(passwordHash));
var tenantid = TenantManager.GetCurrentTenant().TenantId;
var u = UserManager.GetUsersByPasswordHash(tenantid, login, passwordHash);

View File

@ -174,11 +174,11 @@ namespace TMResourceData
{
if (culture == null)
{
throw new ArgumentNullException("culture");
throw new ArgumentNullException(nameof(culture));
}
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("filename");
throw new ArgumentNullException(nameof(filename));
}
DbContext = dbContext;

View File

@ -115,7 +115,7 @@ namespace ASC.Core.Data
public TenantQuota SaveTenantQuota(TenantQuota quota)
{
if (quota == null) throw new ArgumentNullException("quota");
if (quota == null) throw new ArgumentNullException(nameof(quota));
var dbQuota = new DbQuota
{
@ -155,7 +155,7 @@ namespace ASC.Core.Data
public void SetTenantQuotaRow(TenantQuotaRow row, bool exchange)
{
if (row == null) throw new ArgumentNullException("row");
if (row == null) throw new ArgumentNullException(nameof(row));
using var tx = CoreDbContext.Database.BeginTransaction();

View File

@ -185,7 +185,7 @@ namespace ASC.Core.Data
public bool SaveSettingsFor<T>(T settings, int tenantId, Guid userId) where T : ISettings
{
if (settings == null) throw new ArgumentNullException("settings");
if (settings == null) throw new ArgumentNullException(nameof(settings));
try
{
var key = settings.ID.ToString() + tenantId + userId;

View File

@ -69,8 +69,8 @@ namespace ASC.Core.Data
public string[] GetRecipients(int tenant, string sourceId, string actionId, string objectId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
var q = GetQuery(tenant, sourceId, actionId)
.Where(r => r.Object == (objectId ?? string.Empty))
@ -83,8 +83,8 @@ namespace ASC.Core.Data
public IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourceId, string actionId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
var q = GetQuery(tenant, sourceId, actionId);
return GetSubscriptions(q, tenant);
@ -108,7 +108,7 @@ namespace ASC.Core.Data
public SubscriptionRecord GetSubscription(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));
var q = GetQuery(tenant, sourceId, actionId)
.Where(r => r.Recipient == recipientId)
@ -119,9 +119,9 @@ namespace ASC.Core.Data
public bool IsUnsubscribe(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
var q = UserDbContext.Subscriptions
.Where(r => r.Source == sourceId &&
@ -144,9 +144,9 @@ namespace ASC.Core.Data
public string[] GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, bool checkSubscribe)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
var q = GetQuery(tenant, sourceId, actionId)
.Where(r=> r.Recipient == recipientId)
@ -163,7 +163,7 @@ namespace ASC.Core.Data
public void SaveSubscription(SubscriptionRecord s)
{
if (s == null) throw new ArgumentNullException("s");
if (s == null) throw new ArgumentNullException(nameof(s));
var subs = new Subscription
{
@ -186,8 +186,8 @@ namespace ASC.Core.Data
public void RemoveSubscriptions(int tenant, string sourceId, string actionId, string objectId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
using var tr = UserDbContext.Database.BeginTransaction();
var q = UserDbContext.Subscriptions
@ -213,8 +213,8 @@ namespace ASC.Core.Data
public IEnumerable<SubscriptionMethod> GetSubscriptionMethods(int tenant, string sourceId, string actionId, string recipientId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
var q = UserDbContext.SubscriptionMethods
.Where(r => r.Tenant == -1 || r.Tenant == tenant)
@ -258,7 +258,7 @@ namespace ASC.Core.Data
public void SetSubscriptionMethod(SubscriptionMethod m)
{
if (m == null) throw new ArgumentNullException("m");
if (m == null) throw new ArgumentNullException(nameof(m));
using var tr = UserDbContext.Database.BeginTransaction();
@ -297,8 +297,8 @@ namespace ASC.Core.Data
private IQueryable<Subscription> GetQuery(int tenant, string sourceId, string actionId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));
return
UserDbContext.Subscriptions

View File

@ -158,7 +158,7 @@ namespace ASC.Core.Data
public IEnumerable<Tenant> GetTenants(string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException(nameof(login));
IQueryable<TenantUserSecurity> query() => TenantsQuery()
.Where(r => r.Status == TenantStatus.Active)
@ -245,7 +245,7 @@ namespace ASC.Core.Data
public Tenant GetTenant(string domain)
{
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException("domain");
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException(nameof(domain));
domain = domain.ToLowerInvariant();

View File

@ -239,7 +239,7 @@ namespace ASC.Core.Data
public UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException(nameof(login));
if (Guid.TryParse(login, out var userId))
{
@ -548,7 +548,7 @@ namespace ASC.Core.Data
public UserInfo SaveUser(int tenant, UserInfo user)
{
if (user == null) throw new ArgumentNullException("user");
if (user == null) throw new ArgumentNullException(nameof(user));
if (string.IsNullOrEmpty(user.UserName)) throw new ArgumentOutOfRangeException("Empty username.");
if (user.ID == default) user.ID = Guid.NewGuid();

View File

@ -131,12 +131,12 @@ namespace ASC.Core.Encryption
if (length < 1 || length > 128)
{
throw new ArgumentException("password_length_incorrect", "length");
throw new ArgumentException("password_length_incorrect", nameof(length));
}
if (numberOfNonAlphanumericCharacters > length || numberOfNonAlphanumericCharacters < 0)
{
throw new ArgumentException("min_required_non_alphanumeric_characters_incorrect", "numberOfNonAlphanumericCharacters");
throw new ArgumentException("min_required_non_alphanumeric_characters_incorrect", nameof(numberOfNonAlphanumericCharacters));
}
var array2 = new char[length];

View File

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

View File

@ -41,32 +41,32 @@ namespace ASC.Core.Notify
public DirectSubscriptionProvider(string sourceID, SubscriptionManager subscriptionManager, IRecipientProvider recipientProvider)
{
if (string.IsNullOrEmpty(sourceID)) throw new ArgumentNullException("sourceID");
if (string.IsNullOrEmpty(sourceID)) throw new ArgumentNullException(nameof(sourceID));
this.sourceID = sourceID;
this.subscriptionManager = subscriptionManager ?? throw new ArgumentNullException("subscriptionManager");
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException("recipientProvider");
this.subscriptionManager = subscriptionManager ?? throw new ArgumentNullException(nameof(subscriptionManager));
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException(nameof(recipientProvider));
}
public object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
return subscriptionManager.GetSubscriptionRecord(sourceID, action.ID, recipient.ID, objectID);
}
public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscribe = true)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
return subscriptionManager.GetSubscriptions(sourceID, action.ID, recipient.ID, checkSubscribe);
}
public IRecipient[] GetRecipients(INotifyAction action, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
return subscriptionManager.GetRecipients(sourceID, action.ID, objectID)
.Select(r => recipientProvider.GetRecipient(r))
@ -76,53 +76,53 @@ namespace ASC.Core.Notify
public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
return subscriptionManager.GetSubscriptionMethod(sourceID, action.ID, recipient.ID);
}
public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
subscriptionManager.UpdateSubscriptionMethod(sourceID, action.ID, recipient.ID, senderNames);
}
public bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
if (action == null) throw new ArgumentNullException(nameof(action));
return subscriptionManager.IsUnsubscribe(sourceID, recipient.ID, action.ID, objectID);
}
public void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
subscriptionManager.Subscribe(sourceID, action.ID, objectID, recipient.ID);
}
public void UnSubscribe(INotifyAction action, string objectID, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
subscriptionManager.Unsubscribe(sourceID, action.ID, objectID, recipient.ID);
}
public void UnSubscribe(INotifyAction action)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
subscriptionManager.UnsubscribeAll(sourceID, action.ID);
}
public void UnSubscribe(INotifyAction action, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
subscriptionManager.UnsubscribeAll(sourceID, action.ID, objectID);
}

View File

@ -49,7 +49,7 @@ namespace ASC.Core.Notify
public EmailSenderSink(INotifySender sender, IServiceProvider serviceProvider, IOptionsMonitor<ILog> options)
{
this.sender = sender ?? throw new ArgumentNullException("sender");
this.sender = sender ?? throw new ArgumentNullException(nameof(sender));
ServiceProvider = serviceProvider;
Log = options.Get("ASC.Notify");
}

View File

@ -47,7 +47,7 @@ namespace ASC.Notify.Engine
{
log = options.Get("ASC.Notify");
logMessages = options.Get("ASC.Notify.Messages");
this.context = context ?? throw new ArgumentNullException("context");
this.context = context ?? throw new ArgumentNullException(nameof(context));
logOnly = "log".Equals(configuration["core:notify:postman"], StringComparison.InvariantCultureIgnoreCase);
log.DebugFormat("LogOnly: {0}", logOnly);
}

View File

@ -54,8 +54,8 @@ 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 (interceptor == null) throw new ArgumentNullException(nameof(interceptor));
if (string.IsNullOrEmpty(interceptor.Name)) throw new ArgumentException("empty name property", nameof(interceptor));
switch (interceptor.Lifetime)
{
@ -72,7 +72,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", nameof(name));
var result = GetInternal(name, CallInterceptors);
if (result == null) result = GetInternal(name, globalInterceptors);
return result;
@ -80,7 +80,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", nameof(name));
RemoveInternal(name, CallInterceptors);
RemoveInternal(name, globalInterceptors);

View File

@ -76,7 +76,7 @@ namespace ASC.Notify.Engine
public NotifyEngine(Context context, IServiceProvider serviceProvider)
{
this.context = context ?? throw new ArgumentNullException("context");
this.context = context ?? throw new ArgumentNullException(nameof(context));
log = serviceProvider.GetService<IOptionsMonitor<ILog>>().Get("ASC.Notify");
ServiceProvider = serviceProvider;
notifyScheduler = new Thread(NotifyScheduler) { IsBackground = true, Name = "NotifyScheduler" };
@ -102,8 +102,8 @@ namespace ASC.Notify.Engine
internal void RegisterSendMethod(Action<DateTime> method, string cron)
{
if (method == null) throw new ArgumentNullException("method");
if (string.IsNullOrEmpty(cron)) throw new ArgumentNullException("cron");
if (method == null) throw new ArgumentNullException(nameof(method));
if (string.IsNullOrEmpty(cron)) throw new ArgumentNullException(nameof(cron));
var w = new SendMethodWrapper(method, cron, log);
lock (sendMethods)
@ -121,7 +121,7 @@ namespace ASC.Notify.Engine
internal void UnregisterSendMethod(Action<DateTime> method)
{
if (method == null) throw new ArgumentNullException("method");
if (method == null) throw new ArgumentNullException(nameof(method));
lock (sendMethods)
{
@ -346,7 +346,7 @@ namespace ASC.Notify.Engine
private List<SendResponse> SendDirectNotify(NotifyRequest request, IServiceScope serviceScope)
{
if (!(request.Recipient is IDirectRecipient)) throw new ArgumentException("request.Recipient not IDirectRecipient", "request");
if (!(request.Recipient is IDirectRecipient)) throw new ArgumentException("request.Recipient not IDirectRecipient", nameof(request));
var responses = new List<SendResponse>();
var response = CheckPreventInterceptors(request, InterceptorPlace.DirectSend, serviceScope, null);
@ -401,7 +401,7 @@ namespace ASC.Notify.Engine
private SendResponse SendDirectNotify(NotifyRequest request, ISenderChannel channel, IServiceScope serviceScope)
{
if (!(request.Recipient is IDirectRecipient)) throw new ArgumentException("request.Recipient not IDirectRecipient", "request");
if (!(request.Recipient is IDirectRecipient)) throw new ArgumentException("request.Recipient not IDirectRecipient", nameof(request));
request.CurrentSender = channel.SenderName;
@ -419,7 +419,7 @@ namespace ASC.Notify.Engine
private SendResponse CreateNoticeMessageFromNotifyRequest(NotifyRequest request, string sender, IServiceScope serviceScope, out NoticeMessage noticeMessage)
{
if (request == null) throw new ArgumentNullException("request");
if (request == null) throw new ArgumentNullException(nameof(request));
var recipientProvider = request.GetRecipientsProvider(serviceScope);
var recipient = request.Recipient as IDirectRecipient;

View File

@ -75,9 +75,9 @@ namespace ASC.Notify.Engine
RequaredTags = new List<string>();
Interceptors = new List<ISendInterceptor>();
NotifySource = notifySource ?? throw new ArgumentNullException("notifySource");
Recipient = recipient ?? throw new ArgumentNullException("recipient");
NotifyAction = action ?? throw new ArgumentNullException("action");
NotifySource = notifySource ?? throw new ArgumentNullException(nameof(notifySource));
Recipient = recipient ?? throw new ArgumentNullException(nameof(recipient));
NotifyAction = action ?? throw new ArgumentNullException(nameof(action));
ObjectID = objectID;
IsNeedCheckSubscriptions = true;
@ -125,7 +125,7 @@ namespace ASC.Notify.Engine
internal NotifyRequest Split(IRecipient recipient)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
var newRequest = new NotifyRequest(NotifySource, NotifyAction, ObjectID, recipient)
{
SenderNames = SenderNames,

View File

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

View File

@ -44,7 +44,7 @@ namespace ASC.Core.Notify
public JabberSenderSink(INotifySender sender, IServiceProvider serviceProvider)
{
this.sender = sender ?? throw new ArgumentNullException("sender");
this.sender = sender ?? throw new ArgumentNullException(nameof(sender));
ServiceProvider = serviceProvider;
}

View File

@ -48,25 +48,25 @@ namespace ASC.Notify.Messages
public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID)
{
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Recipient = recipient ?? throw new ArgumentNullException(nameof(recipient));
Action = action;
ObjectID = objectID;
}
public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID, IPattern pattern)
{
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Recipient = recipient ?? throw new ArgumentNullException(nameof(recipient));
Action = action;
Pattern = pattern ?? throw new ArgumentNullException("pattern");
Pattern = pattern ?? throw new ArgumentNullException(nameof(pattern));
ObjectID = objectID;
ContentType = pattern.ContentType;
}
public NoticeMessage(IDirectRecipient recipient, string subject, string body, string contentType)
{
Recipient = recipient ?? throw new ArgumentNullException("recipient");
Recipient = recipient ?? throw new ArgumentNullException(nameof(recipient));
Subject = subject;
Body = body ?? throw new ArgumentNullException("body");
Body = body ?? throw new ArgumentNullException(nameof(body));
ContentType = contentType;
}
@ -89,7 +89,7 @@ namespace ASC.Notify.Messages
public void AddArgument(params ITagValue[] tagValues)
{
if (tagValues == null) throw new ArgumentNullException("tagValues");
if (tagValues == null) throw new ArgumentNullException(nameof(tagValues));
Array.ForEach(tagValues,
tagValue =>
{

View File

@ -43,7 +43,7 @@ namespace ASC.Notify.Model
public NotifyAction(string id, string name)
{
ID = id ?? throw new ArgumentNullException("id");
ID = id ?? throw new ArgumentNullException(nameof(id));
Name = name;
}

View File

@ -43,9 +43,9 @@ namespace ASC.Notify.Model
public NotifyClientImpl(Context context, INotifySource notifySource, IServiceScope serviceScope)
{
this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource");
this.notifySource = notifySource ?? throw new ArgumentNullException(nameof(notifySource));
ServiceScope = serviceScope;
ctx = context ?? throw new ArgumentNullException("context");
ctx = context ?? throw new ArgumentNullException(nameof(context));
}
public void SendNoticeToAsync(INotifyAction action, IRecipient[] recipients, string[] senderNames, params ITagValue[] args)
@ -108,7 +108,7 @@ namespace ASC.Notify.Model
public void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, bool checkSubsciption, params ITagValue[] args)
{
if (recipients == null) throw new ArgumentNullException("recipients");
if (recipients == null) throw new ArgumentNullException(nameof(recipients));
BeginSingleRecipientEvent("__syspreventduplicateinterceptor");
@ -127,8 +127,8 @@ namespace ASC.Notify.Model
private NotifyRequest CreateRequest(INotifyAction action, string objectID, IRecipient recipient, ITagValue[] args, string[] senders, bool checkSubsciption)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
var request = new NotifyRequest(notifySource, action, objectID, recipient)
{

View File

@ -69,7 +69,7 @@ namespace ASC.Core.Notify
protected NotifySource(string id, UserManager userManager, IRecipientProvider recipientsProvider, SubscriptionManager subscriptionManager)
{
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(nameof(id));
ID = id;
UserManager = userManager;

View File

@ -52,8 +52,8 @@ namespace ASC.Notify.Patterns
{
if (string.IsNullOrEmpty(id)) throw new ArgumentException("id");
ID = id;
Subject = subject ?? throw new ArgumentNullException("subject");
Body = body ?? throw new ArgumentNullException("body");
Subject = subject ?? throw new ArgumentNullException(nameof(subject));
Body = body ?? throw new ArgumentNullException(nameof(body));
ContentType = string.IsNullOrEmpty(contentType) ? HTMLContentType : contentType;
}

View File

@ -65,7 +65,7 @@ namespace ASC.Notify.Patterns
public string[] GetTags(IPattern pattern)
{
if (pattern == null) throw new ArgumentNullException("pattern");
if (pattern == null) throw new ArgumentNullException(nameof(pattern));
var findedTags = new List<string>(SearchTags(pattern.Body));
Array.ForEach(SearchTags(pattern.Subject), tag => { if (!findedTags.Contains(tag)) findedTags.Add(tag); });
@ -74,9 +74,9 @@ namespace ASC.Notify.Patterns
public void FormatMessage(INoticeMessage message, ITagValue[] tagsValues)
{
if (message == null) throw new ArgumentNullException("message");
if (message == null) throw new ArgumentNullException(nameof(message));
if (message.Pattern == null) throw new ArgumentException("message");
if (tagsValues == null) throw new ArgumentNullException("tagsValues");
if (tagsValues == null) throw new ArgumentNullException(nameof(tagsValues));
BeforeFormat(message, tagsValues);

View File

@ -46,7 +46,7 @@ namespace ASC.Notify.Patterns
public TagValue(string tag, object value)
{
if (string.IsNullOrEmpty(tag)) throw new ArgumentNullException("tag");
if (string.IsNullOrEmpty(tag)) throw new ArgumentNullException(nameof(tag));
Tag = tag;
Value = value;

View File

@ -54,7 +54,7 @@ namespace ASC.Core.Notify
public virtual IRecipient[] GetGroupEntries(IRecipientsGroup group)
{
if (group == null) throw new ArgumentNullException("group");
if (group == null) throw new ArgumentNullException(nameof(group));
var result = new List<IRecipient>();
if (TryParseGuid(group.ID, out var groupID))
@ -71,7 +71,7 @@ namespace ASC.Core.Notify
public virtual IRecipientsGroup[] GetGroups(IRecipient recipient)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
var result = new List<IRecipientsGroup>();
if (TryParseGuid(recipient.ID, out var recID))
@ -98,7 +98,7 @@ namespace ASC.Core.Notify
public virtual string[] GetRecipientAddresses(IDirectRecipient recipient, string senderName)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
if (TryParseGuid(recipient.ID, out var userID))
{

View File

@ -38,7 +38,7 @@ namespace ASC.Notify.Sinks
public DispatchSink(string senderName, DispatchEngine dispatcher)
{
this.dispatcher = dispatcher ?? throw new ArgumentNullException("dispatcher");
this.dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
this.senderName = senderName;
}

View File

@ -43,7 +43,7 @@ namespace ASC.Core.Notify
public TelegramSenderSink(INotifySender sender, IServiceProvider serviceProvider)
{
this.sender = sender ?? throw new ArgumentNullException("sender");
this.sender = sender ?? throw new ArgumentNullException(nameof(sender));
this.serviceProvider = serviceProvider;
}

View File

@ -41,8 +41,8 @@ namespace ASC.Notify.Model
public TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscriptionProvider directSubscriptionProvider)
{
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException("recipientProvider");
subscriptionProvider = directSubscriptionProvider ?? throw new ArgumentNullException("directSubscriptionProvider");
this.recipientProvider = recipientProvider ?? throw new ArgumentNullException(nameof(recipientProvider));
subscriptionProvider = directSubscriptionProvider ?? throw new ArgumentNullException(nameof(directSubscriptionProvider));
}
public TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscriptionProvider directSubscriptionProvider, string[] defaultSenderMethods)
@ -54,8 +54,8 @@ namespace ASC.Notify.Model
public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
var senders = subscriptionProvider.GetSubscriptionMethod(action, recipient);
if (senders == null || senders.Length == 0)
@ -73,7 +73,7 @@ namespace ASC.Notify.Model
public virtual IRecipient[] GetRecipients(INotifyAction action, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
var recipents = new List<IRecipient>(5);
var directRecipients = subscriptionProvider.GetRecipients(action, objectID) ?? new IRecipient[0];
@ -83,8 +83,8 @@ namespace ASC.Notify.Model
public virtual bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
return subscriptionProvider.IsUnsubscribe(recipient, action, objectID);
}
@ -92,30 +92,30 @@ namespace ASC.Notify.Model
public virtual void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
subscriptionProvider.Subscribe(action, objectID, recipient);
}
public virtual void UnSubscribe(INotifyAction action, string objectID, IRecipient recipient)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
subscriptionProvider.UnSubscribe(action, objectID, recipient);
}
public void UnSubscribe(INotifyAction action, string objectID)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
subscriptionProvider.UnSubscribe(action, objectID);
}
public void UnSubscribe(INotifyAction action)
{
if (action == null) throw new ArgumentNullException("action");
if (action == null) throw new ArgumentNullException(nameof(action));
subscriptionProvider.UnSubscribe(action);
}
@ -131,17 +131,17 @@ namespace ASC.Notify.Model
public virtual void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
{
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException("recipient");
if (senderNames == null) throw new ArgumentNullException("senderNames");
if (action == null) throw new ArgumentNullException(nameof(action));
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
if (senderNames == null) throw new ArgumentNullException(nameof(senderNames));
subscriptionProvider.UpdateSubscriptionMethod(action, recipient, senderNames);
}
public virtual object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
if (action == null) throw new ArgumentNullException(nameof(action));
var subscriptionRecord = subscriptionProvider.GetSubscriptionRecord(action, recipient, objectID);
@ -161,8 +161,8 @@ namespace ASC.Notify.Model
public virtual string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscription = true)
{
if (recipient == null) throw new ArgumentNullException("recipient");
if (action == null) throw new ArgumentNullException("action");
if (recipient == null) throw new ArgumentNullException(nameof(recipient));
if (action == null) throw new ArgumentNullException(nameof(action));
var objects = new List<string>();
var direct = subscriptionProvider.GetSubscriptions(action, recipient, checkSubscription) ?? Array.Empty<string>();

View File

@ -43,8 +43,8 @@ namespace ASC.Common.Security.Authorizing
public AzManager(IRoleProvider roleProvider, IPermissionProvider permissionProvider)
: this()
{
this.roleProvider = roleProvider ?? throw new ArgumentNullException("roleProvider");
this.permissionProvider = permissionProvider ?? throw new ArgumentNullException("permissionProvider");
this.roleProvider = roleProvider ?? throw new ArgumentNullException(nameof(roleProvider));
this.permissionProvider = permissionProvider ?? throw new ArgumentNullException(nameof(permissionProvider));
}
@ -52,8 +52,8 @@ namespace ASC.Common.Security.Authorizing
ISecurityObjectProvider securityObjProvider, out ISubject denySubject,
out IAction denyAction)
{
if (subject == null) throw new ArgumentNullException("subject");
if (action == null) throw new ArgumentNullException("action");
if (subject == null) throw new ArgumentNullException(nameof(subject));
if (action == null) throw new ArgumentNullException(nameof(action));
var acl = GetAzManagerAcl(subject, action, objectId, securityObjProvider);
denySubject = acl.DenySubject;

View File

@ -44,8 +44,8 @@ namespace ASC.Core.Security.Authorizing
public IEnumerable<Ace> GetAcl(ISubject subject, IAction action, ISecurityObjectId objectId, ISecurityObjectProvider secObjProvider)
{
if (subject == null) throw new ArgumentNullException("subject");
if (action == null) throw new ArgumentNullException("action");
if (subject == null) throw new ArgumentNullException(nameof(subject));
if (action == null) throw new ArgumentNullException(nameof(action));
return AuthorizationManager
.GetAcesWithInherits(subject.ID, action.ID, objectId, secObjProvider)

View File

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

View File

@ -85,7 +85,7 @@ namespace ASC.Security.Cryptography
public string GetEmailKey(int tenantId, string email)
{
if (string.IsNullOrEmpty(email)) throw new ArgumentNullException("email");
if (string.IsNullOrEmpty(email)) throw new ArgumentNullException(nameof(email));
email = FormatEmail(tenantId, email);
@ -96,7 +96,7 @@ namespace ASC.Security.Cryptography
private string FormatEmail(int tenantId, string email)
{
if (email == null) throw new ArgumentNullException("email");
if (email == null) throw new ArgumentNullException(nameof(email));
try
{
return string.Format("{0}|{1}|{2}", email.ToLowerInvariant(), tenantId, Encoding.UTF8.GetString(MachinePseudoKeys.GetMachineConstant()));
@ -123,8 +123,8 @@ namespace ASC.Security.Cryptography
private ValidationResult ValidateEmailKeyInternal(string email, string key, TimeSpan validInterval)
{
if (string.IsNullOrEmpty(email)) throw new ArgumentNullException("email");
if (key == null) throw new ArgumentNullException("key");
if (string.IsNullOrEmpty(email)) throw new ArgumentNullException(nameof(email));
if (key == null) throw new ArgumentNullException(nameof(key));
email = FormatEmail(TenantManager.GetCurrentTenant().TenantId, email);
var parts = key.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

View File

@ -51,7 +51,7 @@ namespace ASC.Core.Users
public string GetUserName(UserInfo userInfo, DisplayUserNameFormat format)
{
if (userInfo == null) throw new ArgumentNullException("userInfo");
if (userInfo == null) throw new ArgumentNullException(nameof(userInfo));
return string.Format(GetUserDisplayFormat(format), userInfo.FirstName, userInfo.LastName);
}

View File

@ -52,7 +52,7 @@ namespace ASC.Data.Backup
bool isSleepExponential = true)
{
if (action == null)
throw new ArgumentNullException("action");
throw new ArgumentNullException(nameof(action));
var countAttempts = 0;
while (countAttempts++ < maxAttempts)

View File

@ -56,13 +56,13 @@ namespace ASC.Data.Backup.Extensions
Func<TEntry, TKey> parentKeySelector)
{
if (elements == null)
throw new ArgumentNullException("elements");
throw new ArgumentNullException(nameof(elements));
if (keySelector == null)
throw new ArgumentNullException("keySelector");
throw new ArgumentNullException(nameof(keySelector));
if (parentKeySelector == null)
throw new ArgumentNullException("parentKeySelector");
throw new ArgumentNullException(nameof(parentKeySelector));
var dic = elements.ToDictionary(keySelector, x => new TreeNode<TEntry>(x));
foreach (var keyValue in dic)
@ -81,10 +81,10 @@ namespace ASC.Data.Backup.Extensions
public static IEnumerable<IEnumerable<TEntry>> MakeParts<TEntry>(this IEnumerable<TEntry> collection, int partLength)
{
if (collection == null)
throw new ArgumentNullException("collection");
throw new ArgumentNullException(nameof(collection));
if (partLength <= 0)
throw new ArgumentOutOfRangeException("partLength", partLength, "Length must be positive integer");
throw new ArgumentOutOfRangeException(nameof(partLength), partLength, "Length must be positive integer");
return MakePartsIterator(collection, partLength);
}

View File

@ -78,7 +78,7 @@ namespace ASC.Data.Backup.Tasks
public void Init(int tenantId, string fromConfigPath, string toFilePath, int limit)
{
if (string.IsNullOrEmpty(toFilePath))
throw new ArgumentNullException("toFilePath");
throw new ArgumentNullException(nameof(toFilePath));
BackupFilePath = toFilePath;
Limit = limit;
Init(tenantId, fromConfigPath);

View File

@ -167,7 +167,7 @@ namespace ASC.Data.Backup.Tasks
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
stepsCount = value;
Logger.Debug("Steps: " + stepsCount);
@ -191,7 +191,7 @@ namespace ASC.Data.Backup.Tasks
{
if (value < 0 || value > 100)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
if (value == 100)
{
@ -207,7 +207,7 @@ namespace ASC.Data.Backup.Tasks
{
if (value < 0 || value > 100)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
if (Progress != value)
{

View File

@ -54,9 +54,9 @@ namespace ASC.Data.Backup.Tasks
public RestoreDbModuleTask(IOptionsMonitor<ILog> options, IModuleSpecifics module, IDataReadOperator reader, ColumnMapper columnMapper, DbFactory factory, bool replaceDate, bool dump, StorageFactory storageFactory, StorageFactoryConfig storageFactoryConfig, ModuleProvider moduleProvider)
: base(factory, options, storageFactory, storageFactoryConfig, moduleProvider)
{
Reader = reader ?? throw new ArgumentNullException("reader");
ColumnMapper = columnMapper ?? throw new ArgumentNullException("columnMapper");
DbFactory = factory ?? throw new ArgumentNullException("factory");
Reader = reader ?? throw new ArgumentNullException(nameof(reader));
ColumnMapper = columnMapper ?? throw new ArgumentNullException(nameof(columnMapper));
DbFactory = factory ?? throw new ArgumentNullException(nameof(factory));
Module = module;
ReplaceDate = replaceDate;
Dump = dump;

View File

@ -84,7 +84,7 @@ namespace ASC.Data.Backup.Tasks
public void Init(string toConfigPath, string fromFilePath, int tenantId = -1, ColumnMapper columnMapper = null, string upgradesPath = null)
{
if (fromFilePath == null)
throw new ArgumentNullException("fromFilePath");
throw new ArgumentNullException(nameof(fromFilePath));
if (!File.Exists(fromFilePath))
throw new FileNotFoundException("file not found at given path");

View File

@ -83,7 +83,7 @@ namespace ASC.Data.Backup.Tasks
public void Init(int tenantId, string fromConfigPath, string toConfigPath, int limit, string backupDirectory)
{
Limit = limit;
ToConfigPath = toConfigPath ?? throw new ArgumentNullException("toConfigPath");
ToConfigPath = toConfigPath ?? throw new ArgumentNullException(nameof(toConfigPath));
Init(tenantId, fromConfigPath);
BackupDirectory = backupDirectory;

View File

@ -104,7 +104,7 @@ namespace ASC.Data.Storage
{
if (path == null)
{
throw new ArgumentNullException("path");
throw new ArgumentNullException(nameof(path));
}
if (string.IsNullOrEmpty(_tenant) && IsSupportInternalUri)

View File

@ -57,18 +57,18 @@ namespace ASC.Data.Storage
Option = option;
TempStream = tempStream;
TempPath = tempPath;
this.source = source ?? throw new ArgumentNullException("source");
this.destination = destination ?? throw new ArgumentNullException("destination");
this.source = source ?? throw new ArgumentNullException(nameof(source));
this.destination = destination ?? throw new ArgumentNullException(nameof(destination));
maxChunkUploadSize = 10 * 1024 * 1024;
chunksize = 5 * 1024 * 1024;
}
public void CopyFile(string srcDomain, string srcPath, string destDomain, string destPath)
{
if (srcDomain == null) throw new ArgumentNullException("srcDomain");
if (srcPath == null) throw new ArgumentNullException("srcPath");
if (destDomain == null) throw new ArgumentNullException("destDomain");
if (destPath == null) throw new ArgumentNullException("destPath");
if (srcDomain == null) throw new ArgumentNullException(nameof(srcDomain));
if (srcPath == null) throw new ArgumentNullException(nameof(srcPath));
if (destDomain == null) throw new ArgumentNullException(nameof(destDomain));
if (destPath == null) throw new ArgumentNullException(nameof(destPath));
using var stream = source.GetReadStream(srcDomain, srcPath);
if (stream.Length < maxChunkUploadSize)

View File

@ -98,7 +98,7 @@ namespace ASC.Data.Storage.DiscStorage
{
if (path == null)
{
throw new ArgumentNullException("path");
throw new ArgumentNullException(nameof(path));
}
var pathMap = GetPath(domain);
@ -118,7 +118,7 @@ namespace ASC.Data.Storage.DiscStorage
public Stream GetReadStream(string domain, string path, bool withDecription)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);
if (File.Exists(target))
@ -135,7 +135,7 @@ namespace ASC.Data.Storage.DiscStorage
public override Stream GetReadStream(string domain, string path, int offset)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);
if (File.Exists(target))
@ -172,8 +172,8 @@ namespace ASC.Data.Storage.DiscStorage
QuotaController.QuotaUsedCheck(buffered.Length);
}
if (path == null) throw new ArgumentNullException("path");
if (buffered == null) throw new ArgumentNullException("stream");
if (path == null) throw new ArgumentNullException(nameof(path));
if (buffered == null) throw new ArgumentNullException(nameof(stream));
//Try seek to start
if (buffered.CanSeek)
@ -277,7 +277,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void Delete(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);
if (File.Exists(target))
@ -295,7 +295,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void DeleteFiles(string domain, List<string> paths)
{
if (paths == null) throw new ArgumentNullException("paths");
if (paths == null) throw new ArgumentNullException(nameof(paths));
foreach (var path in paths)
{
@ -313,7 +313,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void DeleteFiles(string domain, string folderPath, string pattern, bool recursive)
{
if (folderPath == null) throw new ArgumentNullException("folderPath");
if (folderPath == null) throw new ArgumentNullException(nameof(folderPath));
//Return dirs
var targetDir = GetTarget(domain, folderPath);
@ -335,7 +335,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void DeleteFiles(string domain, string folderPath, DateTime fromDate, DateTime toDate)
{
if (folderPath == null) throw new ArgumentNullException("folderPath");
if (folderPath == null) throw new ArgumentNullException(nameof(folderPath));
//Return dirs
var targetDir = GetTarget(domain, folderPath);
@ -374,8 +374,8 @@ namespace ASC.Data.Storage.DiscStorage
public override Uri Move(string srcdomain, string srcpath, string newdomain, string newpath, bool quotaCheckFileSize = true)
{
if (srcpath == null) throw new ArgumentNullException("srcpath");
if (newpath == null) throw new ArgumentNullException("srcpath");
if (srcpath == null) throw new ArgumentNullException(nameof(srcpath));
if (newpath == null) throw new ArgumentNullException(nameof(srcpath));
var target = GetTarget(srcdomain, srcpath);
var newtarget = GetTarget(newdomain, newpath);
@ -407,7 +407,7 @@ namespace ASC.Data.Storage.DiscStorage
public override bool IsDirectory(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
//Return dirs
var targetDir = GetTarget(domain, path);
@ -420,7 +420,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void DeleteDirectory(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
//Return dirs
var targetDir = GetTarget(domain, path);
@ -485,7 +485,7 @@ namespace ASC.Data.Storage.DiscStorage
public override void DeleteExpired(string domain, string folderPath, TimeSpan oldThreshold)
{
if (folderPath == null) throw new ArgumentNullException("folderPath");
if (folderPath == null) throw new ArgumentNullException(nameof(folderPath));
//Return dirs
var targetDir = GetTarget(domain, folderPath);
@ -531,7 +531,7 @@ namespace ASC.Data.Storage.DiscStorage
public override string[] ListDirectoriesRelative(string domain, string path, bool recursive)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
//Return dirs
var targetDir = GetTarget(domain, path);
@ -548,7 +548,7 @@ namespace ASC.Data.Storage.DiscStorage
public override string[] ListFilesRelative(string domain, string path, string pattern, bool recursive)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
//Return dirs
var targetDir = GetTarget(domain, path);
@ -565,7 +565,7 @@ namespace ASC.Data.Storage.DiscStorage
public override bool IsFile(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
//Return dirs
var target = GetTarget(domain, path);
@ -602,8 +602,8 @@ namespace ASC.Data.Storage.DiscStorage
public override Uri Copy(string srcdomain, string srcpath, string newdomain, string newpath)
{
if (srcpath == null) throw new ArgumentNullException("srcpath");
if (newpath == null) throw new ArgumentNullException("srcpath");
if (srcpath == null) throw new ArgumentNullException(nameof(srcpath));
if (newpath == null) throw new ArgumentNullException(nameof(srcpath));
var target = GetTarget(srcdomain, srcpath);
var newtarget = GetTarget(newdomain, newpath);
@ -680,7 +680,7 @@ namespace ASC.Data.Storage.DiscStorage
public Stream GetWriteStream(string domain, string path, FileMode fileMode)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);
CreateDirectory(target);
return File.Open(target, fileMode);
@ -716,7 +716,7 @@ namespace ASC.Data.Storage.DiscStorage
public void Encrypt(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);
@ -732,7 +732,7 @@ namespace ASC.Data.Storage.DiscStorage
public void Decrypt(string domain, string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));
var target = GetTarget(domain, path);

View File

@ -46,8 +46,8 @@ namespace ASC.Data.Storage
public static void IronReadToStream(this IDataStore store, string domain, string path, int tryCount, Stream readTo)
{
if (tryCount < 1) throw new ArgumentOutOfRangeException("tryCount", "Must be greater or equal 1.");
if (!readTo.CanWrite) throw new ArgumentException("stream cannot be written", "readTo");
if (tryCount < 1) throw new ArgumentOutOfRangeException(nameof(tryCount), "Must be greater or equal 1.");
if (!readTo.CanWrite) throw new ArgumentException("stream cannot be written", nameof(readTo));
var tryCurrent = 0;
var offset = 0;

View File

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

View File

@ -1262,7 +1262,7 @@ namespace ASC.Data.Storage.S3
public ResponseStreamWrapper(GetObjectResponse response)
{
_response = response ?? throw new ArgumentNullException("response");
_response = response ?? throw new ArgumentNullException(nameof(response));
}

View File

@ -35,7 +35,7 @@ namespace ASC.Data.Storage
{
if (tenant == null)
{
throw new ArgumentNullException("tenant");
throw new ArgumentNullException(nameof(tenant));
}
if (long.TryParse(tenant, NumberStyles.Integer, CultureInfo.InvariantCulture, out var tenantId))

View File

@ -82,7 +82,7 @@ namespace ASC.Data.Storage
{
if (!string.IsNullOrEmpty(relativePath) && relativePath.IndexOf('~') == 0)
{
throw new ArgumentException($"bad path format {relativePath} remove '~'", "relativePath");
throw new ArgumentException($"bad path format {relativePath} remove '~'", nameof(relativePath));
}
var result = relativePath;
@ -200,7 +200,7 @@ namespace ASC.Data.Storage
{
if (!string.IsNullOrEmpty(relativePath) && relativePath.IndexOf('~') == 0)
{
throw new ArgumentException($"bad path format {relativePath} remove '~'", "relativePath");
throw new ArgumentException($"bad path format {relativePath} remove '~'", nameof(relativePath));
}
if (CoreBaseSettings.Standalone && ServiceProvider.GetService<StaticUploader>().CanUpload()) //hack for skip resolve DistributedTaskQueueOptionsManager

View File

@ -103,7 +103,7 @@ namespace ASC.FederatedLogin.Helpers
var clientSecret = loginProvider.ClientSecret;
var redirectUri = loginProvider.RedirectUri;
if (string.IsNullOrEmpty(authCode)) throw new ArgumentNullException("authCode");
if (string.IsNullOrEmpty(authCode)) throw new ArgumentNullException(nameof(authCode));
if (string.IsNullOrEmpty(clientID)) throw new ArgumentNullException("clientID");
if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException("clientSecret");
@ -142,7 +142,7 @@ namespace ASC.FederatedLogin.Helpers
public static OAuth20Token RefreshToken(string requestUrl, OAuth20Token token)
{
if (token == null || !CanRefresh(token)) throw new ArgumentException("Can not refresh given token", "token");
if (token == null || !CanRefresh(token)) throw new ArgumentException("Can not refresh given token", nameof(token));
var data = $"client_id={HttpUtility.UrlEncode(token.ClientID)}&client_secret={HttpUtility.UrlEncode(token.ClientSecret)}&refresh_token={HttpUtility.UrlEncode(token.RefreshToken)}&grant_type=refresh_token";

View File

@ -38,7 +38,7 @@ namespace ASC.FederatedLogin.Helpers
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(nameof(uri));
var request = new HttpRequestMessage();
request.RequestUri = new Uri(uri);

View File

@ -88,7 +88,7 @@ namespace ASC.FederatedLogin.LoginProviders
public OAuth20Token GetAccessToken(string authCode)
{
if (string.IsNullOrEmpty(authCode)) throw new ArgumentNullException("authCode");
if (string.IsNullOrEmpty(authCode)) throw new ArgumentNullException(nameof(authCode));
if (string.IsNullOrEmpty(ClientID)) throw new ArgumentException("clientID");
if (string.IsNullOrEmpty(ClientSecret)) throw new ArgumentException("clientSecret");

View File

@ -79,7 +79,7 @@ namespace ASC.FederatedLogin.LoginProviders
public LoginProfile GetLoginProfile(string providerType, string accessToken)
{
var consumer = GetLoginProvider(providerType);
if (consumer == null) throw new ArgumentException("Unknown provider type", "providerType");
if (consumer == null) throw new ArgumentException("Unknown provider type", nameof(providerType));
try
{

View File

@ -48,7 +48,7 @@ namespace ASC.FederatedLogin
databaseId = string.Join(".", new[] { _baseDatabaseId, hostedRegion.Trim() });
if (!_accountLinkers.ContainsKey(databaseId))
throw new ArgumentException($"Region {databaseId} is not defined", "hostedRegion");
throw new ArgumentException($"Region {databaseId} is not defined", nameof(hostedRegion));
return databaseId;
}

View File

@ -233,7 +233,7 @@ namespace ASC.FederatedLogin.Profile
internal void SetField(string name, string value)
{
if (name == null) throw new ArgumentNullException("name");
if (name == null) throw new ArgumentNullException(nameof(name));
if (!string.IsNullOrEmpty(value))
{
if (_fields.ContainsKey(name))
@ -276,7 +276,7 @@ namespace ASC.FederatedLogin.Profile
public static bool HasProfile(HttpRequest request)
{
if (request == null) throw new ArgumentNullException("request");
if (request == null) throw new ArgumentNullException(nameof(request));
return new Uri(request.GetDisplayUrl()).HasProfile();
}
@ -361,7 +361,7 @@ namespace ASC.FederatedLogin.Profile
internal void FromSerializedString(string serialized)
{
if (serialized == null) throw new ArgumentNullException("serialized");
if (serialized == null) throw new ArgumentNullException(nameof(serialized));
_fields = serialized.Split(PairSeparator).ToDictionary(x => x.Split(KeyValueSeparator)[0], y => y.Split(KeyValueSeparator)[1]);
}
@ -386,7 +386,7 @@ namespace ASC.FederatedLogin.Profile
protected LoginProfile(Signature signature, InstanceCrypto instanceCrypto, SerializationInfo info) : this(signature, instanceCrypto)
{
if (info == null)
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));
var transformed = (string)info.GetValue(QueryParamName, typeof(string));
FromTransport(transformed);
}

View File

@ -60,8 +60,8 @@ namespace ASC.VoipService.Twilio
public TwilioProvider(string accountSid, string authToken, AuthContext authContext, TenantUtil tenantUtil, SecurityContext securityContext, BaseCommonLinkUtility baseCommonLinkUtility)
{
if (string.IsNullOrEmpty(accountSid)) throw new ArgumentNullException("accountSid");
if (string.IsNullOrEmpty(authToken)) throw new ArgumentNullException("authToken");
if (string.IsNullOrEmpty(accountSid)) throw new ArgumentNullException(nameof(accountSid));
if (string.IsNullOrEmpty(authToken)) throw new ArgumentNullException(nameof(authToken));
this.authToken = authToken;
AuthContext = authContext;

View File

@ -611,7 +611,7 @@ namespace ASC.ElasticSearch
}
break;
default:
throw new ArgumentOutOfRangeException("action", action, null);
throw new ArgumentOutOfRangeException(nameof(action), action, null);
}
}

View File

@ -368,7 +368,7 @@ namespace ASC.Files.Core.Data
{
if (file == null)
{
throw new ArgumentNullException("file");
throw new ArgumentNullException(nameof(file));
}
var maxChunkedUploadSize = SetupInfo.MaxChunkedUploadSize(TenantExtra, TenantStatisticProvider);
@ -514,7 +514,7 @@ namespace ASC.Files.Core.Data
public File<int> ReplaceFileVersion(File<int> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.ID == default) throw new ArgumentException("No file id or folder id toFolderId determine provider");
var maxChunkedUploadSize = SetupInfo.MaxChunkedUploadSize(TenantExtra, TenantStatisticProvider);
@ -1171,9 +1171,9 @@ namespace ASC.Files.Core.Data
public void SaveEditHistory(File<int> file, string changes, Stream differenceStream)
{
if (file == null) throw new ArgumentNullException("file");
if (string.IsNullOrEmpty(changes)) throw new ArgumentNullException("changes");
if (differenceStream == null) throw new ArgumentNullException("differenceStream");
if (file == null) throw new ArgumentNullException(nameof(file));
if (string.IsNullOrEmpty(changes)) throw new ArgumentNullException(nameof(changes));
if (differenceStream == null) throw new ArgumentNullException(nameof(differenceStream));
changes = changes.Trim();
@ -1285,7 +1285,7 @@ namespace ASC.Files.Core.Data
public void SaveThumbnail(File<int> file, Stream thumbnail)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var toUpdate = FilesDbContext.Files
.FirstOrDefault(r => r.Id == file.ID && r.Version == file.Version && r.TenantId == TenantID);

View File

@ -297,7 +297,7 @@ namespace ASC.Files.Core.Data
public int SaveFolder(Folder<int> folder, IDbContextTransaction transaction)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
folder.Title = Global.ReplaceInvalidCharsAndTruncate(folder.Title);
@ -486,7 +486,7 @@ namespace ASC.Files.Core.Data
var folder = GetFolder(folderId);
if (folder.FolderType != FolderType.DEFAULT)
throw new ArgumentException("It is forbidden to move the System folder.", "folderId");
throw new ArgumentException("It is forbidden to move the System folder.", nameof(folderId));
var recalcFolders = new List<int> { toFolderId };
var parent = FilesDbContext.Folders
@ -824,8 +824,8 @@ namespace ASC.Files.Core.Data
public IEnumerable<int> GetFolderIDs(string module, string bunch, IEnumerable<string> data, bool createIfNotExists)
{
if (string.IsNullOrEmpty(module)) throw new ArgumentNullException("module");
if (string.IsNullOrEmpty(bunch)) throw new ArgumentNullException("bunch");
if (string.IsNullOrEmpty(module)) throw new ArgumentNullException(nameof(module));
if (string.IsNullOrEmpty(bunch)) throw new ArgumentNullException(nameof(bunch));
var keys = data.Select(id => $"{module}/{bunch}/{id}").ToArray();
@ -908,8 +908,8 @@ namespace ASC.Files.Core.Data
public int GetFolderID(string module, string bunch, string data, bool createIfNotExists)
{
if (string.IsNullOrEmpty(module)) throw new ArgumentNullException("module");
if (string.IsNullOrEmpty(bunch)) throw new ArgumentNullException("bunch");
if (string.IsNullOrEmpty(module)) throw new ArgumentNullException(nameof(module));
if (string.IsNullOrEmpty(bunch)) throw new ArgumentNullException(nameof(bunch));
var key = $"{module}/{bunch}/{data}";
var folderId = Query(FilesDbContext.BunchObjects)

View File

@ -177,7 +177,7 @@ namespace ASC.Files.Core.Data
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
if (names == null) throw new ArgumentNullException("names");
if (names == null) throw new ArgumentNullException(nameof(names));
var q = Query(FilesDbContext.Tag)
.Join(FilesDbContext.TagLink, r => r.Id, l => l.TagId, (tag, link) => new TagLinkData { Tag = tag, Link = link })
@ -191,7 +191,7 @@ namespace ASC.Files.Core.Data
public IEnumerable<Tag> GetTags(string name, TagType tagType)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
return GetTags(new[] { name }, tagType);
}

View File

@ -72,8 +72,8 @@ namespace ASC.Web.Files.Core.Entries
public void SetKeyPair(string publicKey, string privateKeyEnc)
{
if (string.IsNullOrEmpty(publicKey)) throw new ArgumentNullException("publicKey");
if (string.IsNullOrEmpty(privateKeyEnc)) throw new ArgumentNullException("privateKeyEnc");
if (string.IsNullOrEmpty(publicKey)) throw new ArgumentNullException(nameof(publicKey));
if (string.IsNullOrEmpty(privateKeyEnc)) throw new ArgumentNullException(nameof(privateKeyEnc));
var user = UserManager.GetUsers(AuthContext.CurrentAccount.ID);
if (!AuthContext.IsAuthenticated || user.IsVisitor(UserManager)) throw new System.Security.SecurityException();

View File

@ -55,7 +55,7 @@ namespace ASC.Web.Files.Api
public IEnumerable<T> RegisterBunchFolders<T>(string module, string bunch, IEnumerable<string> data)
{
if (data == null)
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
data = data.ToList();
if (!data.Any())

View File

@ -246,7 +246,7 @@ namespace ASC.Files.Thirdparty.Box
ProviderInfo.CacheReset(boxFileId, true);
var boxFile = GetBoxFile(file.ID);
if (boxFile == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (boxFile == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
if (boxFile is ErrorFile errorFile) throw new Exception(errorFile.Error);
var fileStream = ProviderInfo.Storage.DownloadStream(boxFile, (int)offset);
@ -266,8 +266,8 @@ namespace ASC.Files.Thirdparty.Box
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (file == null) throw new ArgumentNullException(nameof(file));
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
BoxFile newBoxFile = null;

View File

@ -180,7 +180,7 @@ namespace ASC.Files.Thirdparty.Box
public string SaveFolder(Folder<string> folder)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
if (folder.ID != null)
{
return RenameFolder(folder, folder.Title);

View File

@ -121,7 +121,7 @@ namespace ASC.Files.Thirdparty.Box
public Stream DownloadStream(BoxFile file, int offset = 0)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
if (offset > 0 && file.Size.HasValue)
{

View File

@ -250,7 +250,7 @@ namespace ASC.Files.Thirdparty.Dropbox
ProviderInfo.CacheReset(dropboxFilePath, true);
var dropboxFile = GetDropboxFile(file.ID);
if (dropboxFile == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (dropboxFile == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
if (dropboxFile is ErrorFile errorFile) throw new Exception(errorFile.Error);
var fileStream = ProviderInfo.Storage.DownloadStream(MakeDropboxPath(dropboxFile), (int)offset);
@ -270,8 +270,8 @@ namespace ASC.Files.Thirdparty.Dropbox
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (file == null) throw new ArgumentNullException(nameof(file));
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
FileMetadata newDropboxFile = null;

View File

@ -181,7 +181,7 @@ namespace ASC.Files.Thirdparty.Dropbox
public string SaveFolder(Folder<string> folder)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
if (folder.ID != null)
{
return RenameFolder(folder, folder.Title);

View File

@ -246,7 +246,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
var driveId = MakeDriveId(file.ID);
ProviderInfo.CacheReset(driveId, true);
var driveFile = GetDriveEntry(file.ID);
if (driveFile == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (driveFile == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
if (driveFile is ErrorDriveEntry errorDriveEntry) throw new Exception(errorDriveEntry.Error);
var fileStream = ProviderInfo.Storage.DownloadStream(driveFile, (int)offset);
@ -271,8 +271,8 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (file == null) throw new ArgumentNullException(nameof(file));
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
DriveFile newDriveFile = null;

View File

@ -177,7 +177,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public string SaveFolder(Folder<string> folder)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
if (folder.ID != null)
{
return RenameFolder(folder, folder.Title);

View File

@ -205,7 +205,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public Stream DownloadStream(DriveFile file, int offset = 0)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var downloadArg = $"{file.Id}?alt=media";
@ -347,7 +347,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public ResumableUploadSession CreateResumableSession(DriveFile driveFile, long contentLength)
{
if (driveFile == null) throw new ArgumentNullException("driveFile");
if (driveFile == null) throw new ArgumentNullException(nameof(driveFile));
var fileId = string.Empty;
var method = "POST";
@ -389,7 +389,7 @@ namespace ASC.Files.Thirdparty.GoogleDrive
public void Transfer(ResumableUploadSession googleDriveSession, Stream stream, long chunkLength)
{
if (stream == null)
throw new ArgumentNullException("stream");
throw new ArgumentNullException(nameof(stream));
if (googleDriveSession.Status != ResumableUploadSessionStatus.Started)
throw new InvalidOperationException("Can't upload chunk for given upload session.");

View File

@ -246,7 +246,7 @@ namespace ASC.Files.Thirdparty.OneDrive
ProviderInfo.CacheReset(onedriveFileId);
var onedriveFile = GetOneDriveItem(file.ID);
if (onedriveFile == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (onedriveFile == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
if (onedriveFile is ErrorItem errorItem) throw new Exception(errorItem.Error);
var fileStream = ProviderInfo.Storage.DownloadStream(onedriveFile, (int)offset);
@ -266,8 +266,8 @@ namespace ASC.Files.Thirdparty.OneDrive
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (file == null) throw new ArgumentNullException(nameof(file));
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
Item newOneDriveFile = null;

View File

@ -177,7 +177,7 @@ namespace ASC.Files.Thirdparty.OneDrive
public string SaveFolder(Folder<string> folder)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
if (folder.ID != null)
{
return RenameFolder(folder, folder.Title);

View File

@ -141,7 +141,7 @@ namespace ASC.Files.Thirdparty.OneDrive
public Stream DownloadStream(Item file, int offset = 0)
{
if (file == null || file.File == null) throw new ArgumentNullException("file");
if (file == null || file.File == null) throw new ArgumentNullException(nameof(file));
var fileStream = OnedriveClient
.Drive
@ -250,7 +250,7 @@ namespace ASC.Files.Thirdparty.OneDrive
public ResumableUploadSession CreateResumableSession(Item onedriveFile, long contentLength)
{
if (onedriveFile == null) throw new ArgumentNullException("onedriveFile");
if (onedriveFile == null) throw new ArgumentNullException(nameof(onedriveFile));
var folderId = onedriveFile.ParentReference.Id;
var fileName = onedriveFile.Name;
@ -289,7 +289,7 @@ namespace ASC.Files.Thirdparty.OneDrive
public void Transfer(ResumableUploadSession oneDriveSession, Stream stream, long chunkLength)
{
if (stream == null)
throw new ArgumentNullException("stream");
throw new ArgumentNullException(nameof(stream));
if (oneDriveSession.Status != ResumableUploadSessionStatus.Started)
throw new InvalidOperationException("Can't upload chunk for given upload session.");

View File

@ -208,7 +208,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
/// <returns>Stream</returns>
public Stream GetFileStream(File<string> file, long offset)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var fileId = file.ID;
var selector = GetSelector(fileId);
file.ID = selector.ConvertId(fileId);
@ -221,7 +221,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
public bool IsSupportedPreSignedUri(File<string> file)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var fileId = file.ID;
var selector = GetSelector(fileId);
file.ID = selector.ConvertId(fileId);
@ -234,7 +234,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
public Uri GetPreSignedUri(File<string> file, TimeSpan expires)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var fileId = file.ID;
var selector = GetSelector(fileId);
file.ID = selector.ConvertId(fileId);
@ -247,7 +247,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
var fileId = file.ID;
var folderId = file.FolderID;
@ -281,7 +281,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
public File<string> ReplaceFileVersion(File<string> file, Stream fileStream)
{
if (file == null) throw new ArgumentNullException("file");
if (file == null) throw new ArgumentNullException(nameof(file));
if (file.ID == null) throw new ArgumentException("No file id or folder id toFolderId determine provider");
var fileId = file.ID;
@ -446,7 +446,7 @@ namespace ASC.Files.Thirdparty.ProviderDao
if (file.FolderID != null)
return GetSelector(file.FolderID).GetFileDao(file.FolderID);
throw new ArgumentException("Can't create instance of dao for given file.", "file");
throw new ArgumentException("Can't create instance of dao for given file.", nameof(file));
}
private string ConvertId(string id)

View File

@ -144,7 +144,7 @@ filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare);
public string SaveFolder(Folder<string> folder)
{
if (folder == null) throw new ArgumentNullException("folder");
if (folder == null) throw new ArgumentNullException(nameof(folder));
if (folder.ID != null)
{

View File

@ -130,7 +130,7 @@ namespace ASC.Files.Thirdparty
internal BaseProviderInfo<T> GetInfo(string objectId)
{
if (objectId == null) throw new ArgumentNullException("objectId");
if (objectId == null) throw new ArgumentNullException(nameof(objectId));
var id = objectId;
var match = Selector.Match(id);
if (match.Success)

View File

@ -236,7 +236,7 @@ namespace ASC.Files.Thirdparty.SharePoint
{
var fileToDownload = ProviderInfo.GetFileById(file.ID);
if (fileToDownload == null)
throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
var fileStream = ProviderInfo.GetFileStream(fileToDownload.ServerRelativeUrl, (int)offset);
@ -255,7 +255,7 @@ namespace ASC.Files.Thirdparty.SharePoint
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
if (file.ID != null)
{

View File

@ -244,7 +244,7 @@ namespace ASC.Files.Thirdparty.Sharpbox
var fileToDownload = GetFileById(file.ID);
if (fileToDownload == null)
throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
if (fileToDownload is ErrorEntry errorEntry)
throw new Exception(errorEntry.Error);
@ -287,7 +287,7 @@ namespace ASC.Files.Thirdparty.Sharpbox
public File<string> SaveFile(File<string> file, Stream fileStream)
{
if (fileStream == null) throw new ArgumentNullException("fileStream");
if (fileStream == null) throw new ArgumentNullException(nameof(fileStream));
ICloudFileSystemEntry entry = null;
if (file.ID != null)
{
@ -486,7 +486,7 @@ namespace ASC.Files.Thirdparty.Sharpbox
var entry = GetFileById(file.ID);
if (entry == null)
throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
var oldFileId = MakeId(entry);
var newFileId = oldFileId;

View File

@ -99,7 +99,7 @@ namespace ASC.Web.Files.Helpers
public void SaveToken(OAuth20Token token)
{
if (token == null) throw new ArgumentNullException("token");
if (token == null) throw new ArgumentNullException(nameof(token));
TokenHelper.SaveToken(new Token(token, AppAttr));
}
@ -207,7 +207,7 @@ namespace ASC.Web.Files.Helpers
public string SendDocuSign<T>(T fileId, DocuSignData docuSignData, IDictionary<string, StringValues> requestHeaders)
{
if (docuSignData == null) throw new ArgumentNullException("docuSignData");
if (docuSignData == null) throw new ArgumentNullException(nameof(docuSignData));
var token = DocuSignToken.GetToken();
var account = GetDocuSignAccount(token);
@ -223,7 +223,7 @@ namespace ASC.Web.Files.Helpers
private DocuSignAccount GetDocuSignAccount(OAuth20Token token)
{
if (token == null) throw new ArgumentNullException("token");
if (token == null) throw new ArgumentNullException(nameof(token));
var userInfoString = RequestHelper.PerformRequest(ConsumerFactory.Get<DocuSignLoginProvider>().DocuSignHost + "/oauth/userinfo",
headers: new Dictionary<string, string> { { "Authorization", "Bearer " + DocuSignToken.GetRefreshedToken(token) } });
@ -240,8 +240,8 @@ namespace ASC.Web.Files.Helpers
private DocuSign.eSign.Client.Configuration GetConfiguration(DocuSignAccount account, OAuth20Token token)
{
if (account == null) throw new ArgumentNullException("account");
if (token == null) throw new ArgumentNullException("token");
if (account == null) throw new ArgumentNullException(nameof(account));
if (token == null) throw new ArgumentNullException(nameof(token));
var apiClient = new ApiClient(account.BaseUri + "/restapi");
@ -377,8 +377,8 @@ namespace ASC.Web.Files.Helpers
public File<T> SaveDocument<T>(string envelopeId, string documentId, string documentName, T folderId)
{
if (string.IsNullOrEmpty(envelopeId)) throw new ArgumentNullException("envelopeId");
if (string.IsNullOrEmpty(documentId)) throw new ArgumentNullException("documentId");
if (string.IsNullOrEmpty(envelopeId)) throw new ArgumentNullException(nameof(envelopeId));
if (string.IsNullOrEmpty(documentId)) throw new ArgumentNullException(nameof(documentId));
var token = DocuSignToken.GetToken();
var account = GetDocuSignAccount(token);

View File

@ -107,7 +107,7 @@ namespace ASC.Web.Files.Classes
public string GetFolderUrl<T>(Folder<T> folder, int projectID = 0)
{
if (folder == null) throw new ArgumentNullException("folder", FilesCommonResource.ErrorMassage_FolderNotFound);
if (folder == null) throw new ArgumentNullException(nameof(folder), FilesCommonResource.ErrorMassage_FolderNotFound);
var folderDao = DaoFactory.GetFolderDao<T>();
@ -139,7 +139,7 @@ namespace ASC.Web.Files.Classes
public string GetFileStreamUrl<T>(File<T> file, string doc = null, bool lastVersion = false)
{
if (file == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (file == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
//NOTE: Always build path to handler!
var uriBuilder = new UriBuilder(CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.FileHandlerPath));
@ -163,7 +163,7 @@ namespace ASC.Web.Files.Classes
public string GetFileChangesUrl<T>(File<T> file, string doc = null)
{
if (file == null) throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
if (file == null) throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
var uriBuilder = new UriBuilder(CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.FileHandlerPath));
var query = uriBuilder.Query;
@ -181,7 +181,7 @@ namespace ASC.Web.Files.Classes
public string GetTempUrl(Stream stream, string ext)
{
if (stream == null) throw new ArgumentNullException("stream");
if (stream == null) throw new ArgumentNullException(nameof(stream));
var store = GlobalStore.GetStore();
var fileName = string.Format("{0}{1}", Guid.NewGuid(), ext);

View File

@ -61,7 +61,7 @@ namespace ASC.Web.Files.Helpers
public void SaveToken(OAuth20Token token)
{
if (token == null) throw new ArgumentNullException("token");
if (token == null) throw new ArgumentNullException(nameof(token));
TokenHelper.SaveToken(new Token(token, AppAttr));
}
@ -75,7 +75,7 @@ namespace ASC.Web.Files.Helpers
public void DeleteToken(OAuth20Token token)
{
if (token == null) throw new ArgumentNullException("token");
if (token == null) throw new ArgumentNullException(nameof(token));
TokenHelper.DeleteToken(AppAttr);
}

View File

@ -385,7 +385,7 @@ namespace ASC.Web.Files.HttpHandlers
public ChunkedRequestHelper(HttpRequest request)
{
_request = request ?? throw new ArgumentNullException("request");
_request = request ?? throw new ArgumentNullException(nameof(request));
}
private bool IsAuthDataSet(InstanceCrypto instanceCrypto)

View File

@ -123,8 +123,8 @@ namespace ASC.Web.Files.Services.FFmpegService
private static Task<int> StreamCopyToAsync(Stream srcStream, Stream dstStream, bool closeSrc = false, bool closeDst = false)
{
if (srcStream == null) throw new ArgumentNullException("srcStream");
if (dstStream == null) throw new ArgumentNullException("dstStream");
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));
return StreamCopyToAsyncInternal(srcStream, dstStream, closeSrc, closeDst);
}

View File

@ -332,7 +332,7 @@ namespace ASC.Web.Files.Utils
{
total = 0;
if (parent == null) throw new ArgumentNullException("parent", FilesCommonResource.ErrorMassage_FolderNotFound);
if (parent == null) throw new ArgumentNullException(nameof(parent), FilesCommonResource.ErrorMassage_FolderNotFound);
if (parent.ProviderEntry && !FilesSettingsHelper.EnableThirdParty) throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException_ReadFolder);
if (parent.RootFolderType == FolderType.Privacy && (!PrivacyRoomSettings.IsAvailable(TenantManager) || !PrivacyRoomSettings.GetEnabled(SettingsManager))) throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException_ReadFolder);
@ -1071,7 +1071,7 @@ namespace ASC.Web.Files.Utils
public File<T> UpdateToVersionFile<T>(T fileId, int version, string doc = null, bool checkRight = true)
{
var fileDao = DaoFactory.GetFileDao<T>();
if (version < 1) throw new ArgumentNullException("version");
if (version < 1) throw new ArgumentNullException(nameof(version));
var editLink = FileShareLink.Check(doc, false, fileDao, out var fromFile);

View File

@ -697,7 +697,7 @@ namespace ASC.Web.Files.Utils
var readLink = FileShareLink.Check(doc, true, fileDao, out file);
if (file == null)
{
throw new ArgumentNullException("file", FilesCommonResource.ErrorMassage_FileNotFound);
throw new ArgumentNullException(nameof(file), FilesCommonResource.ErrorMassage_FileNotFound);
}
if (!readLink)
{

View File

@ -513,7 +513,7 @@ namespace ASC.Web.Files.Utils
public List<FileEntry> MarkedItems<T>(Folder<T> folder)
{
if (folder == null) throw new ArgumentNullException("folder", FilesCommonResource.ErrorMassage_FolderNotFound);
if (folder == null) throw new ArgumentNullException(nameof(folder), FilesCommonResource.ErrorMassage_FolderNotFound);
if (!FileSecurity.CanRead(folder)) throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException_ViewFolder);
if (folder.RootFolderType == FolderType.TRASH && !Equals(folder.ID, GlobalFolder.GetFolderTrash<T>(DaoFactory))) throw new SecurityException(FilesCommonResource.ErrorMassage_ViewTrashItem);

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