Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions TidyCSharp.Cli/CliOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using CommandLine;

namespace TidyCSharp.Cli;

public class CliOptions
{
[Option('p', "path", Required = true, HelpText = "Solution path.")]
public string SolutionPath { get; set; }

[Option('o', "output", Required = true, HelpText = "Output path.")]
public string OutputPath { get; set; }

[Option('m', "mode", Required = true, HelpText = "Readonly(r) or RunSafeRules(w) mode.")]
public string Mode { get; set; }
}
14 changes: 14 additions & 0 deletions TidyCSharp.Cli/CommandConstants/GuidList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Guids.cs
// MUST match guids.h

namespace TidyCSharp.Cli.CommandConstants;

internal static class GuidList
{
public const string GuidGeeksProductivityToolsPkgString = "c6176957-c61c-4beb-8dd8-e7c0170b0bf3";

private const string GuidCleanupCmdSetString = "53366ba1-1788-42c8-922a-034d6dc89b12";
//

public static readonly Guid GuidCleanupCmdSet = new(GuidCleanupCmdSetString);
};
9 changes: 9 additions & 0 deletions TidyCSharp.Cli/CommandConstants/PkgCmdIDList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// PkgCmdID.cs
// MUST match PkgCmdID.h

namespace TidyCSharp.Cli.CommandConstants;

internal static class PkgCmdIdList
{
public const uint CmdCustomUpAllActions = 0x0138;
};
16 changes: 16 additions & 0 deletions TidyCSharp.Cli/Definition/UsingsCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace TidyCSharp.Cli.Definition;

public static class UsingsCommands
{
public const string RemoveAndSortVs15 = "EditorContextMenus.CodeWindow.OrganizeUsings.RemoveAndSort";

public const string RemoveAndSortVs17 = "EditorContextMenus.CodeWindow.RemoveAndSort";

public const string RemoveAndSortCommandName = "Edit.RemoveAndSort";

public const string SystemNamespace = "using System;";

public const string LinqNamespace = "using System.Linq;";

public const string GenericNamespace = "using System.Collections.Generic;";
}
15 changes: 15 additions & 0 deletions TidyCSharp.Cli/Environment/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace TidyCSharp.Cli.Environment;

public static class App
{
public static void Initialize()
{
AppDomain.CurrentDomain.UnhandledException += GlobalExceptionHandlerEvent;
}

private static void GlobalExceptionHandlerEvent(object sender, UnhandledExceptionEventArgs args)
{
ErrorNotification.ErrorNotification.WriteErrorToFile((Exception)args.ExceptionObject);
ErrorNotification.ErrorNotification.WriteErrorToOutputWindow((Exception)args.ExceptionObject);
}
}
76 changes: 76 additions & 0 deletions TidyCSharp.Cli/Environment/ErrorList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
namespace TidyCSharp.Cli.Environment;

public static class ErrorList
{
//static ErrorListProvider _errorListProvider;
// static Dictionary<string, Microsoft.VisualStudio.Shell.Task> ListOfErrors = new Dictionary<string, Microsoft.VisualStudio.Shell.Task>();

// public static void AddOrOverrideError(string key, Microsoft.VisualStudio.Shell.Task task)
// {
// if (ListOfErrors.ContainsKey(key))
// {
// ListOfErrors[key] = task;
// }
// else
// {
// ListOfErrors.Add(key, task);
// }

// if (task is ErrorTask)
// {
// WriteVisualStudioErrorList(task as ErrorTask);
// }
// }

// public static void RemoveError(string key)
// {
// if (string.IsNullOrEmpty(key))
// return;

// if (ListOfErrors.ContainsKey(key))
// {
// var task = ListOfErrors[key];
// if (task == null)
// return;

// if (task is ErrorTask)
// {
// _errorListProvider.Tasks.Remove(task);
// }

// ListOfErrors.Remove(key);
// }
// }

/// <summary>
/// Write an entry to the Visual Studio Error List.
/// </summary>
// static void WriteVisualStudioErrorList(ErrorTask errorTask)
// {
// if (_errorListProvider == null)
// {
// _errorListProvider = new ErrorListProvider(TidyCSharpPackage.Instance);
// }

// // Check if this error is already in the error list, don't report more than once
// var alreadyReported = false;
// foreach (ErrorTask task in _errorListProvider.Tasks)
// {
// if (task.ErrorCategory == errorTask.ErrorCategory &&
// task.Document == errorTask.Document &&
// task.Line == errorTask.Line &&
// task.Column == errorTask.Column &&
// task.Text == errorTask.Text)
// {
// alreadyReported = true;
// break;
// }
// }

// if (!alreadyReported)
// {
// // Add error to task list
// _errorListProvider.Tasks.Add(errorTask);
// }
// }
}
23 changes: 23 additions & 0 deletions TidyCSharp.Cli/ErrorNotification/ErrorNotification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace TidyCSharp.Cli.ErrorNotification;
internal static class ErrorNotification
{
internal static void EmailError(string message)
{

}

internal static void WriteErrorToOutputWindow(Exception ex, string itemAddress = null)
{

}

internal static void WriteErrorToFile(Exception ex, string itemAddress = null)
{
File.AppendAllText(Path.GetDirectoryName(TidyCSharpPackage.Instance.Solution.FilePath) + "\\Tidy.Error.log",
Newtonsoft.Json.JsonConvert.SerializeObject(new
{
FileAddress = itemAddress,
Exception = ex,
}));
}
}
Loading