Skip to content

Commit

Permalink
Code cleanup (usings)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jump committed Oct 5, 2020
1 parent fc4922e commit 30366a7
Show file tree
Hide file tree
Showing 119 changed files with 277 additions and 427 deletions.
8 changes: 5 additions & 3 deletions uSync.Commands/Commands/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
using System.Threading.Tasks;
using System.Web.Security;
using System.Xml.Linq;

using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Migrations.Install;
using Umbraco.Core.Services;

using uSync8.BackOffice.Commands;

namespace uSync.BaseCommands
Expand Down Expand Up @@ -76,7 +78,7 @@ public async Task<SyncCommandResult> Run(string[] args)
await writer.WriteLineAsync(" you can use the -sqlce switch to have this value automatically populated");
return SyncCommandResult.Error;
}

}

var result = SyncCommandResult.Success;
Expand Down Expand Up @@ -133,7 +135,7 @@ private SyncCommandResult CreateSqlCEDb(string connectionString)
return SyncCommandResult.Success;
}

private SyncCommandResult CreateDatabase()
private SyncCommandResult CreateDatabase()
{
writer.WriteLine(" Creating Database Schema");

Expand Down Expand Up @@ -179,7 +181,7 @@ private SyncCommandResult SetupAdmin(string username, string password)
var success = membershipUser.ChangePassword("default", password);
if (success == false)
{
throw new FormatException(" Password must be at least " + GetCurrentProvider().MinRequiredPasswordLength + " characters long and contain at least " + GetCurrentProvider().MinRequiredNonAlphanumericCharacters + " symbols");
throw new FormatException(" Password must be at least " + GetCurrentProvider().MinRequiredPasswordLength + " characters long and contain at least " + GetCurrentProvider().MinRequiredNonAlphanumericCharacters + " symbols");
}
}
catch (Exception ex)
Expand Down
11 changes: 6 additions & 5 deletions uSync.Commands/Commands/LangCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ public async Task<SyncCommandResult> Run(string[] args)
return await List();
}

if (args.Length > 1) {
if (args.Length > 1)
{

switch (args[0].ToLower())
switch (args[0].ToLower())
{
case "add":
return await AddLanguage(args[1]);
Expand All @@ -45,14 +46,14 @@ public async Task<SyncCommandResult> Run(string[] args)
case "default":
return await SetDefault(args[1]);
}

}

return SyncCommandResult.NoResult;
}

private async Task<SyncCommandResult> AddLanguage(string isoCode)
{
{
var existing = localizationService.GetLanguageByIsoCode(isoCode);
if (existing == null || existing.IsoCode != isoCode)
{
Expand Down Expand Up @@ -116,7 +117,7 @@ private async Task<SyncCommandResult> List()

await writer.WriteLineAsync("Language\tDefault");
await writer.WriteLineAsync("----------------------------");
foreach(var lang in languages)
foreach (var lang in languages)
{
await writer.WriteLineAsync(
string.Format("- {0}\t\t{1}", lang.IsoCode,
Expand Down
7 changes: 2 additions & 5 deletions uSync.Commands/Commands/QuitCommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

using uSync8.BackOffice.Commands;

namespace uSync.BaseCommands
Expand Down
1 change: 0 additions & 1 deletion uSync.Commands/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
6 changes: 2 additions & 4 deletions uSync.Commands/uSyncCommandComposer.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Umbraco.Core;
using Umbraco.Core.Composing;

using uSync8.BackOffice.Commands;

namespace uSync.BaseCommands
Expand Down
5 changes: 3 additions & 2 deletions uSync.Console/BootCommands.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;

using uSync.BaseCommands;

using uSync8.BackOffice.Commands;

namespace uSync.ConsoleApp
Expand Down
8 changes: 5 additions & 3 deletions uSync.Console/ConsoleHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;

using uSync8.BackOffice;
using uSync8.BackOffice.Commands;
using uSync8.BackOffice.Models;
Expand Down Expand Up @@ -55,7 +56,7 @@ public async Task<SyncCommandResult> Run(string[] args)
}
}

while( result < SyncCommandResult.Complete)
while (result < SyncCommandResult.Complete)
{
await writer.WriteAsync("uSync>");
var command = await reader.ReadLineAsync();
Expand All @@ -76,7 +77,8 @@ public async Task<SyncCommandResult> ProcessCommand(string[] args)
{
var alias = args[0];
var commandFactory = factory.GetInstance<SyncCommandFactory>();
if (commandFactory == null) {
if (commandFactory == null)
{
writer.WriteLine("Cannot load the commands :(");
return SyncCommandResult.Error;
}
Expand Down
5 changes: 1 addition & 4 deletions uSync.Console/ConsoleRuntime.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Runtime;
Expand Down
9 changes: 3 additions & 6 deletions uSync.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using uSync8.BackOffice.Commands;
using System.Threading;

using uSync8.BackOffice.Commands;

namespace uSync.ConsoleApp
{
/// <summary>
Expand Down Expand Up @@ -74,7 +71,7 @@ static void InitApplication(string[] args)
var domain = AppDomain.CreateDomain(uSyncAppDomain,
AppDomain.CurrentDomain.Evidence, setup);

foreach(var assembly in AppDomain.CurrentDomain.GetAssemblies())
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (File.Exists(assembly.FullName))
domain.Load(assembly.FullName);
Expand Down
1 change: 0 additions & 1 deletion uSync.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
1 change: 0 additions & 1 deletion uSync.TemplateTracker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
8 changes: 3 additions & 5 deletions uSync.TemplateTracker/TemplateTracker.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
Expand All @@ -30,7 +28,7 @@ public TemplateTracker(IFileService fileService)
public void WatchViewFolder()
{
var watcher = new FileSystemWatcher();
watcher.Path = viewFolderPath;
watcher.Path = viewFolderPath;

watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName;
watcher.Filter = "*.cshtml";
Expand Down
9 changes: 2 additions & 7 deletions uSync.TemplateTracker/TemplateTrackerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core;
using Umbraco.Core.Composing;

namespace uSync.TemplateTracker
{
public class TemplateTrackerCompose
public class TemplateTrackerCompose
: IUserComposer
{
public void Compose(Composition composition)
Expand Down
3 changes: 2 additions & 1 deletion uSync8.BackOffice/Commands/Command/ExportCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;

using uSync8.BackOffice.SyncHandlers;

namespace uSync8.BackOffice.Commands.Command
Expand All @@ -9,7 +10,7 @@ namespace uSync8.BackOffice.Commands.Command
[SyncCommand("Export", "export", "Exports setting from Umbraco")]
public class ExportCommand : SyncCommandServiceBase, ISyncCommand
{
public ExportCommand(TextReader reader, TextWriter writer,
public ExportCommand(TextReader reader, TextWriter writer,
uSyncService uSyncService) : base(reader, writer, uSyncService)
{ }

Expand Down
10 changes: 4 additions & 6 deletions uSync8.BackOffice/Commands/Command/ImportCommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using uSync8.BackOffice.SyncHandlers;
using uSync8.Core;

Expand All @@ -12,7 +10,7 @@ namespace uSync8.BackOffice.Commands.Command
[SyncCommand("Import", "import", "Imports uSync settings into Umbraco")]
public class ImportCommand : SyncCommandServiceBase, ISyncCommand
{
public ImportCommand(TextReader reader, TextWriter writer,
public ImportCommand(TextReader reader, TextWriter writer,
uSyncService uSyncService) : base(reader, writer, uSyncService)
{ }

Expand All @@ -24,7 +22,7 @@ public async Task<SyncCommandResult> Run(string[] args)
var force = options.GetSwitchValue<bool>("force", false);
var handlerSet = options.GetSwitchValue<string>("set", uSync.Handlers.DefaultSet);

if (force) await writer.WriteAsync("(With Force) ");
if (force) await writer.WriteAsync("(With Force) ");

var result = uSyncService.Import(options.Folder, force,
new SyncHandlerOptions(handlerSet, HandlerActions.Import),
Expand Down
6 changes: 2 additions & 4 deletions uSync8.BackOffice/Commands/Command/ReportCommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using uSync8.BackOffice.SyncHandlers;
using uSync8.Core;

Expand Down
6 changes: 1 addition & 5 deletions uSync8.BackOffice/Commands/ISyncCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace uSync8.BackOffice.Commands
{
Expand Down
8 changes: 5 additions & 3 deletions uSync8.BackOffice/Commands/SyncCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

using Umbraco.Core.Composing;

using uSync8.BackOffice.Configuration;
Expand All @@ -16,7 +17,7 @@ public class SyncCommandBase

public string AdvancedHelp { get; protected set; }

public bool Interactive { get;set; }
public bool Interactive { get; set; }

protected readonly TextReader reader;
protected readonly TextWriter writer;
Expand Down Expand Up @@ -66,14 +67,15 @@ protected SyncCommandOptions ParseArguments(string[] args)
foreach (var argument in args)
{
var cmd = argument.Trim().ToLower();

if (cmd.StartsWith("-"))
{
var fragments = cmd.Split('=');

var flag = fragments[0].Substring(1);

if (fragments.Length > 1) {
if (fragments.Length > 1)
{
options.Switches[flag] = fragments[1];
}
else
Expand Down
4 changes: 2 additions & 2 deletions uSync8.BackOffice/Commands/SyncCommandCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace uSync8.BackOffice.Commands
public class SyncCommandCollection
: BuilderCollectionBase<ISyncCommand>
{
public SyncCommandCollection(IEnumerable<ISyncCommand> items)
public SyncCommandCollection(IEnumerable<ISyncCommand> items)
: base(items)
{ }
{ }

public ISyncCommand GetCommand(string alias)
=> this.FirstOrDefault(x => x.Alias.Equals(alias, StringComparison.InvariantCultureIgnoreCase));
Expand Down
6 changes: 1 addition & 5 deletions uSync8.BackOffice/Commands/SyncCommandFactory.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace uSync8.BackOffice.Commands
{
Expand Down
3 changes: 2 additions & 1 deletion uSync8.BackOffice/Commands/SyncCommandOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;

using Umbraco.Core;

namespace uSync8.BackOffice.Commands
Expand Down Expand Up @@ -26,7 +27,7 @@ public class SyncCommandOptions
public SyncCommandOptions(string folder)
{
this.Folder = folder;

}

/// <summary>
Expand Down
Loading

0 comments on commit 30366a7

Please sign in to comment.