This project is read-only.

File encoding information

Dec 16, 2013 at 10:14 PM
I have created rule to check if file is in specific encoding (e.g. UTF-8).

I get the file path from CodeDocument.SourceCode.Path and the method Utils.GetFileEncoding() gives me encoding of this file.

But this method open the file and read from it... it's unnecessary because if we open file to analyze StyleCop it's self use this method (CodeFile.cs).

I was wandering can you make public property with Encoding in SoruceCode, and in the method Read() store this information in this property.

My rule will work much faster without opening and reading the file again...
Dec 16, 2013 at 11:05 PM

Makes sense.

Add it as a work item please and I'll do it.


Marked as answer by Carnifex on 12/16/2013 at 11:52 PM
Dec 17, 2013 at 7:52 AM
Ok, I created some... but don't know if this is proper way :)

I couldn't select any "type" for it...