Skip to content

Commit

Permalink
Mass style guide application
Browse files Browse the repository at this point in the history
I went through and applied as many automatic rules as I could. Work for #140
  • Loading branch information
atruskie committed Feb 17, 2018
1 parent 19b246a commit 1af4644
Show file tree
Hide file tree
Showing 276 changed files with 10,090 additions and 5,570 deletions.
1 change: 1 addition & 0 deletions src/AcousticWorkbench/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static (bool, string) TryParse(string apiString, out Api api)
Host = uri.Host,
Protocol = uri.Scheme,
Version = version,

//Uri = uri
};

Expand Down
2 changes: 1 addition & 1 deletion src/AcousticWorkbench/Models/Models.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AcousticWorkbench.cs" company="QutEcoacoustics">
// <copyright file="Models.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>

Expand Down
39 changes: 20 additions & 19 deletions src/Acoustics.Shared/AppConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public static DirectoryInfo AssemblyDir
{
var assemblyDirString = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

if (!String.IsNullOrEmpty(assemblyDirString))
if (!string.IsNullOrEmpty(assemblyDirString))
{
var assemblyDir = new DirectoryInfo(assemblyDirString);

Expand Down Expand Up @@ -327,7 +327,7 @@ public static bool IsAspNet
}

// app virtual path should not be null and current context usually not null
if (!String.IsNullOrEmpty(appDomainPath) || currentContext != null)
if (!string.IsNullOrEmpty(appDomainPath) || currentContext != null)
{
return true;
}
Expand Down Expand Up @@ -379,12 +379,12 @@ public static string GetString(string key)
if (ConfigurationManager.AppSettings.AllKeys.All(k => k != key))
{
//throw new ConfigurationErrorsException("Could not find key: " + key);
return String.Empty;
return string.Empty;
}

var value = ConfigurationManager.AppSettings[key];

if (String.IsNullOrEmpty(value))
if (string.IsNullOrEmpty(value))
{
throw new ConfigurationErrorsException("Found key, but it did not have a value: " + key);
}
Expand All @@ -404,9 +404,9 @@ public static string[] GetStrings(string key, params char[] separators)
var values = value
.Split(separators, StringSplitOptions.RemoveEmptyEntries)
.Select(s => s.Trim())
.Where(v => !String.IsNullOrEmpty(v));
.Where(v => !string.IsNullOrEmpty(v));

if (!values.Any() || values.All(s => String.IsNullOrEmpty(s)))
if (!values.Any() || values.All(s => string.IsNullOrEmpty(s)))
{
throw new ConfigurationErrorsException("Key " + key + " exists but does not have a value");
}
Expand All @@ -419,7 +419,7 @@ public static bool GetBool(string key)
var value = GetString(key);

bool valueParsed;
if (Boolean.TryParse(value, out valueParsed))
if (bool.TryParse(value, out valueParsed))
{
return valueParsed;
}
Expand All @@ -433,7 +433,7 @@ public static int GetInt(string key)
var value = GetString(key);

int valueParsed;
if (Int32.TryParse(value, out valueParsed))
if (int.TryParse(value, out valueParsed))
{
return valueParsed;
}
Expand All @@ -447,7 +447,7 @@ public static double GetDouble(string key)
var value = GetString(key);

double valueParsed;
if (Double.TryParse(value, out valueParsed))
if (double.TryParse(value, out valueParsed))
{
return valueParsed;
}
Expand All @@ -462,7 +462,7 @@ public static DirectoryInfo GetDir(string key, bool checkExists)

if (checkExists && !Directory.Exists(value))
{
throw new DirectoryNotFoundException(String.Format("Could not find directory: {0} = {1}", key, value));
throw new DirectoryNotFoundException(string.Format("Could not find directory: {0} = {1}", key, value));
}

return new DirectoryInfo(value);
Expand All @@ -474,7 +474,7 @@ public static FileInfo GetFile(string key, bool checkExists)

if (checkExists && !File.Exists(value))
{
throw new FileNotFoundException(String.Format("Could not find file: {0} = {1}", key, value));
throw new FileNotFoundException(string.Format("Could not find file: {0} = {1}", key, value));
}

return new FileInfo(value);
Expand All @@ -501,11 +501,11 @@ public static IEnumerable<FileInfo> GetFiles(string key, bool checkAnyExist, par
var value = GetString(key);
var values = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);

var files = values.Where(v => !String.IsNullOrEmpty(v)).Select(v => new FileInfo(v)).ToList();
var files = values.Where(v => !string.IsNullOrEmpty(v)).Select(v => new FileInfo(v)).ToList();

if (checkAnyExist && files.All(f => !File.Exists(f.FullName)))
{
throw new FileNotFoundException("None of the given files exist: " + String.Join(", ", files.Select(f => f.FullName)));
throw new FileNotFoundException("None of the given files exist: " + string.Join(", ", files.Select(f => f.FullName)));
}

return files;
Expand All @@ -516,7 +516,7 @@ public static long GetLong(string key)
var value = GetString(key);

long valueParsed;
if (Int64.TryParse(value, out valueParsed))
if (long.TryParse(value, out valueParsed))
{
return valueParsed;
}
Expand Down Expand Up @@ -553,13 +553,13 @@ public static IEnumerable<DirectoryInfo> GetDirs(string webConfigRealDirectory,
var values = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);

var dirs =
values.Where(v => !String.IsNullOrEmpty(v)).Select(
values.Where(v => !string.IsNullOrEmpty(v)).Select(
v => v.StartsWith("..") ? new DirectoryInfo(webConfigRealDirectory + v) : new DirectoryInfo(v))
.ToList();

if (checkAnyExist && dirs.All(d => !Directory.Exists(d.FullName)))
{
throw new DirectoryNotFoundException("None of the given directories exist: " + String.Join(", ", dirs.Select(a => a.FullName)));
throw new DirectoryNotFoundException("None of the given directories exist: " + string.Join(", ", dirs.Select(a => a.FullName)));
}

return dirs;
Expand All @@ -572,11 +572,11 @@ public static IEnumerable<DirectoryInfo> GetDirs(string key, bool checkAnyExist,
var values = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);

var dirs =
values.Where(v => !String.IsNullOrEmpty(v)).Select(v => new DirectoryInfo(v)).ToList();
values.Where(v => !string.IsNullOrEmpty(v)).Select(v => new DirectoryInfo(v)).ToList();

if (checkAnyExist && dirs.All(d => !Directory.Exists(d.FullName)))
{
throw new DirectoryNotFoundException("None of the given directories exist: " + String.Join(", ", dirs.Select(a => a.FullName)));
throw new DirectoryNotFoundException("None of the given directories exist: " + string.Join(", ", dirs.Select(a => a.FullName)));
}

return dirs;
Expand All @@ -593,7 +593,8 @@ private static string GetExeFile(string appConfigKey)
// assume windows
DirectoryInfo assemblyDir = IsAspNet ? new DirectoryInfo(WebsiteBasePath) : AssemblyDir;

return Path.Combine(assemblyDir.FullName, GetString(appConfigKey)); ;
return Path.Combine(assemblyDir.FullName, GetString(appConfigKey));
;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Acoustics.Shared/Base58.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public static string Encode(long num)
while (num >= BaseCount)
{
div = num / BaseCount;
mod = (int)(num - (BaseCount * (long)div));
mod = (int)(num - (BaseCount * div));
result = Alphabet[mod] + result;
num = (long)div;
num = div;
}

if (num > 0)
Expand Down
Loading

0 comments on commit 1af4644

Please sign in to comment.