Skip to content

Latest commit

 

History

History
87 lines (63 loc) · 1.71 KB

File metadata and controls

87 lines (63 loc) · 1.71 KB

Codeformatter Package

A Simple Text formatter that formats the contents of a file using the c# style. Watch Video

Installation

  Install-Package CodeFormatterModule

Imports

import the Codeformatter

  using CodeFormatterModule;

API Reference

Format a single file

Pass in the path of the file you want formatted

var formatter = new FormatCode();

try
{
	formatter.FormatCodeFile("File.cs");
}
catch (Exception ex) 
{
	Console.WriteLine(ex.Message);
}
Parameter Type Description
path string Should contain relative path to your file

Format multiple files

Pass in the paths of the file you want formatted in a string array

var formatter = new FormatCode();

try
{
	var files = new string[] { "File1.cs", "File2.cs" };
    	formatter.FormatCodeFile(files);
}
catch (Exception ex) 
{
	Console.WriteLine(ex.Message);
}
Parameter Type Description
paths string [] Should contain relative paths to your files

Format all files in directory and subdirectory

Pass in the path of the folder you want formatted

var formatter = new FormatCode();

try
{
	formatter.FormatCodeFile("Folder",children:true);
}
catch (Exception ex) 
{
	Console.WriteLine(ex.Message);
}
Parameter Type Description
fileDirectory string Should contain relative path to your folder
children boolean Should be used if you want the children of the folder