/// Set fileMode and call the AStyleMain function in Artistic Style. public String FormatSource(String textIn, FormatFileMode fileModeArg) { // set file mode before formatting source fileMode = fileModeArg; String textOut = FormatSource(textIn); return(textOut); }
/// Set the fileMode variable from the input file extension. public void SetFileMode(String fileName) { fileMode = FormatFileMode.CPP; if (fileName.EndsWith(".java")) { fileMode = FormatFileMode.JAVA; } else if (fileName.EndsWith(".cs")) { fileMode = FormatFileMode.SHARP; } }
public void SetDefaultChameleonStyleOptions() { predefinedStyle = PredefinedStyle.ALLMAN; // tabs / spaces options indentLength = 4; indentType = Indent.TABS; // brackets option bracketFormatMode = Brackets.NONE; // fileMode option - FILEMODE_JAVA is required for Java files fileMode = FormatFileMode.CPP; // indentation options classIndent = true; switchIndent = true; caseIndent = false; bracketIndent = false; blockIndent = false; namespaceIndent = true; labelIndent = false; preprocessorIndent = false; col1CommentIndent = false; maxInStatementIndent = 50; minConditionalIndent = 10; // padding options breakHeaderBlocks = false; breakClosingBlocks = false; padOperators = true; padParensOutside = false; padParensInside = false; padHeaders = false; unpadParens = true; deleteEmptyLines = false; fillEmptyLines = false; // formatting options breakCloseBrackets = true; breakElseIfs = false; addBrackets = true; addOneLineBrackets = false; breakOneLineStmts = true; breakOneLineBlocks = true; convertTabs = true; alignPointers = Align.TYPE; }