/// <summary> /// Construct the line counter user interface and /// the countable file type mappings (to icons and /// counting algorithms). /// </summary> public LineCounterBrowser() { InitializeComponent(); #if IMPR1 projectImageListHelper = new ImageListHelper(imgProjectTypes); fileImageListHelper = new ImageListHelper(imgFileTypes); #endif // Map project types to icons for use in the projects list m_projIconMappings = new Dictionary <string, int>(); m_projIconMappings.Add("{00000000-0000-0000-0000-000000000000}", 0); m_projIconMappings.Add("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", 1); // C# m_projIconMappings.Add("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", 2); // VB m_projIconMappings.Add("{00000001-0000-0000-0000-000000000000}", 5); // List all the countable file types (so we don't try to count .dll's, // images, executables, etc. m_countableTypes = new System.Collections.Specialized.StringCollection(); #if IMPR2 countingAlgorithms = AddInTree.BuildItems <CountingAlgorithmDescriptor> ("/AddIns/LineCounter/CountingAlgorithms", this); // Iterate through algorithms to fill list of known countable types foreach (CountingAlgorithmDescriptor desc in countingAlgorithms) { m_countableTypes.AddRange(desc.extensions); } #else m_countableTypes.Add("*"); m_countableTypes.Add(".cs"); m_countableTypes.Add(".vb"); m_countableTypes.Add(".vj"); m_countableTypes.Add(".cpp"); m_countableTypes.Add(".cc"); m_countableTypes.Add(".cxx"); m_countableTypes.Add(".c"); m_countableTypes.Add(".hpp"); m_countableTypes.Add(".hh"); m_countableTypes.Add(".hxx"); m_countableTypes.Add(".h"); m_countableTypes.Add(".js"); m_countableTypes.Add(".cd"); m_countableTypes.Add(".resx"); m_countableTypes.Add(".res"); m_countableTypes.Add(".css"); m_countableTypes.Add(".htm"); m_countableTypes.Add(".html"); m_countableTypes.Add(".xml"); m_countableTypes.Add(".xsl"); m_countableTypes.Add(".xslt"); m_countableTypes.Add(".xsd"); m_countableTypes.Add(".config"); m_countableTypes.Add(".asax"); m_countableTypes.Add(".ascx"); m_countableTypes.Add(".asmx"); m_countableTypes.Add(".aspx"); m_countableTypes.Add(".ashx"); m_countableTypes.Add(".idl"); m_countableTypes.Add(".odl"); m_countableTypes.Add(".txt"); m_countableTypes.Add(".sql"); #endif // Map file extensions to icons for use in the file list m_fileIconMappings = new Dictionary <string, int>(33); m_fileIconMappings.Add("*", 0); m_fileIconMappings.Add(".cs", 1); m_fileIconMappings.Add(".vb", 2); m_fileIconMappings.Add(".vj", 3); m_fileIconMappings.Add(".cpp", 4); m_fileIconMappings.Add(".cc", 4); m_fileIconMappings.Add(".cxx", 4); m_fileIconMappings.Add(".c", 5); m_fileIconMappings.Add(".hpp", 6); m_fileIconMappings.Add(".hh", 6); m_fileIconMappings.Add(".hxx", 6); m_fileIconMappings.Add(".h", 6); m_fileIconMappings.Add(".js", 7); m_fileIconMappings.Add(".cd", 8); m_fileIconMappings.Add(".resx", 9); m_fileIconMappings.Add(".res", 9); m_fileIconMappings.Add(".css", 10); m_fileIconMappings.Add(".htm", 11); m_fileIconMappings.Add(".html", 11); m_fileIconMappings.Add(".xml", 12); m_fileIconMappings.Add(".xsl", 13); m_fileIconMappings.Add(".xslt", 13); m_fileIconMappings.Add(".xsd", 14); m_fileIconMappings.Add(".config", 15); m_fileIconMappings.Add(".asax", 16); m_fileIconMappings.Add(".ascx", 17); m_fileIconMappings.Add(".asmx", 18); m_fileIconMappings.Add(".aspx", 19); m_fileIconMappings.Add(".ashx", 0); m_fileIconMappings.Add(".idl", 0); m_fileIconMappings.Add(".odl", 0); m_fileIconMappings.Add(".txt", 0); m_fileIconMappings.Add(".sql", 0); // Prepare counting algorithm mappings CountLines countLinesGeneric = new CountLines(CountLinesGeneric); CountLines countLinesCStyle = new CountLines(CountLinesCStyle); CountLines countLinesVBStyle = new CountLines(CountLinesVBStyle); CountLines countLinesXMLStyle = new CountLines(CountLinesXMLStyle); m_countAlgorithms = new Dictionary <string, CountLines>(33); m_countAlgorithms.Add("*", countLinesGeneric); m_countAlgorithms.Add(".cs", countLinesCStyle); m_countAlgorithms.Add(".vb", countLinesVBStyle); m_countAlgorithms.Add(".vj", countLinesCStyle); m_countAlgorithms.Add(".js", countLinesCStyle); m_countAlgorithms.Add(".cpp", countLinesCStyle); m_countAlgorithms.Add(".cc", countLinesCStyle); m_countAlgorithms.Add(".cxx", countLinesCStyle); m_countAlgorithms.Add(".c", countLinesCStyle); m_countAlgorithms.Add(".hpp", countLinesCStyle); m_countAlgorithms.Add(".hh", countLinesCStyle); m_countAlgorithms.Add(".hxx", countLinesCStyle); m_countAlgorithms.Add(".h", countLinesCStyle); m_countAlgorithms.Add(".idl", countLinesCStyle); m_countAlgorithms.Add(".odl", countLinesCStyle); m_countAlgorithms.Add(".txt", countLinesGeneric); m_countAlgorithms.Add(".xml", countLinesXMLStyle); m_countAlgorithms.Add(".xsl", countLinesXMLStyle); m_countAlgorithms.Add(".xslt", countLinesXMLStyle); m_countAlgorithms.Add(".xsd", countLinesXMLStyle); m_countAlgorithms.Add(".config", countLinesXMLStyle); m_countAlgorithms.Add(".res", countLinesGeneric); m_countAlgorithms.Add(".resx", countLinesXMLStyle); m_countAlgorithms.Add(".aspx", countLinesXMLStyle); m_countAlgorithms.Add(".ascx", countLinesXMLStyle); m_countAlgorithms.Add(".ashx", countLinesXMLStyle); m_countAlgorithms.Add(".asmx", countLinesXMLStyle); m_countAlgorithms.Add(".asax", countLinesXMLStyle); m_countAlgorithms.Add(".htm", countLinesXMLStyle); m_countAlgorithms.Add(".html", countLinesXMLStyle); m_countAlgorithms.Add(".css", countLinesCStyle); m_countAlgorithms.Add(".sql", countLinesGeneric); m_countAlgorithms.Add(".cd", countLinesGeneric); }
/// <summary> /// Construct the line counter user interface and /// the countable file type mappings (to icons and /// counting algorithms). /// </summary> public LineCounterBrowser() { InitializeComponent(); #if IMPR1 projectImageListHelper = new ImageListHelper(imgProjectTypes); fileImageListHelper = new ImageListHelper(imgFileTypes); #endif // Map project types to icons for use in the projects list m_projIconMappings = new Dictionary<string, int>(); m_projIconMappings.Add("{00000000-0000-0000-0000-000000000000}", 0); m_projIconMappings.Add("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", 1); // C# m_projIconMappings.Add("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", 2); // VB m_projIconMappings.Add("{00000001-0000-0000-0000-000000000000}", 5); // List all the countable file types (so we don't try to count .dll's, // images, executables, etc. m_countableTypes = new System.Collections.Specialized.StringCollection(); #if IMPR2 countingAlgorithms = AddInTree.BuildItems<CountingAlgorithmDescriptor> ("/AddIns/LineCounter/CountingAlgorithms", this); // Iterate through algorithms to fill list of known countable types foreach (CountingAlgorithmDescriptor desc in countingAlgorithms) { m_countableTypes.AddRange(desc.extensions); } #else m_countableTypes.Add("*"); m_countableTypes.Add(".cs"); m_countableTypes.Add(".vb"); m_countableTypes.Add(".vj"); m_countableTypes.Add(".cpp"); m_countableTypes.Add(".cc"); m_countableTypes.Add(".cxx"); m_countableTypes.Add(".c"); m_countableTypes.Add(".hpp"); m_countableTypes.Add(".hh"); m_countableTypes.Add(".hxx"); m_countableTypes.Add(".h"); m_countableTypes.Add(".js"); m_countableTypes.Add(".cd"); m_countableTypes.Add(".resx"); m_countableTypes.Add(".res"); m_countableTypes.Add(".css"); m_countableTypes.Add(".htm"); m_countableTypes.Add(".html"); m_countableTypes.Add(".xml"); m_countableTypes.Add(".xsl"); m_countableTypes.Add(".xslt"); m_countableTypes.Add(".xsd"); m_countableTypes.Add(".config"); m_countableTypes.Add(".asax"); m_countableTypes.Add(".ascx"); m_countableTypes.Add(".asmx"); m_countableTypes.Add(".aspx"); m_countableTypes.Add(".ashx"); m_countableTypes.Add(".idl"); m_countableTypes.Add(".odl"); m_countableTypes.Add(".txt"); m_countableTypes.Add(".sql"); #endif // Map file extensions to icons for use in the file list m_fileIconMappings = new Dictionary<string, int>(33); m_fileIconMappings.Add("*", 0); m_fileIconMappings.Add(".cs", 1); m_fileIconMappings.Add(".vb", 2); m_fileIconMappings.Add(".vj", 3); m_fileIconMappings.Add(".cpp", 4); m_fileIconMappings.Add(".cc", 4); m_fileIconMappings.Add(".cxx", 4); m_fileIconMappings.Add(".c", 5); m_fileIconMappings.Add(".hpp", 6); m_fileIconMappings.Add(".hh", 6); m_fileIconMappings.Add(".hxx", 6); m_fileIconMappings.Add(".h", 6); m_fileIconMappings.Add(".js", 7); m_fileIconMappings.Add(".cd", 8); m_fileIconMappings.Add(".resx", 9); m_fileIconMappings.Add(".res", 9); m_fileIconMappings.Add(".css", 10); m_fileIconMappings.Add(".htm", 11); m_fileIconMappings.Add(".html", 11); m_fileIconMappings.Add(".xml", 12); m_fileIconMappings.Add(".xsl", 13); m_fileIconMappings.Add(".xslt", 13); m_fileIconMappings.Add(".xsd", 14); m_fileIconMappings.Add(".config", 15); m_fileIconMappings.Add(".asax", 16); m_fileIconMappings.Add(".ascx", 17); m_fileIconMappings.Add(".asmx", 18); m_fileIconMappings.Add(".aspx", 19); m_fileIconMappings.Add(".ashx", 0); m_fileIconMappings.Add(".idl", 0); m_fileIconMappings.Add(".odl", 0); m_fileIconMappings.Add(".txt", 0); m_fileIconMappings.Add(".sql", 0); // Prepare counting algorithm mappings CountLines countLinesGeneric = new CountLines(CountLinesGeneric); CountLines countLinesCStyle = new CountLines(CountLinesCStyle); CountLines countLinesVBStyle = new CountLines(CountLinesVBStyle); CountLines countLinesXMLStyle = new CountLines(CountLinesXMLStyle); m_countAlgorithms = new Dictionary<string, CountLines>(33); m_countAlgorithms.Add("*", countLinesGeneric); m_countAlgorithms.Add(".cs", countLinesCStyle); m_countAlgorithms.Add(".vb", countLinesVBStyle); m_countAlgorithms.Add(".vj", countLinesCStyle); m_countAlgorithms.Add(".js", countLinesCStyle); m_countAlgorithms.Add(".cpp", countLinesCStyle); m_countAlgorithms.Add(".cc", countLinesCStyle); m_countAlgorithms.Add(".cxx", countLinesCStyle); m_countAlgorithms.Add(".c", countLinesCStyle); m_countAlgorithms.Add(".hpp", countLinesCStyle); m_countAlgorithms.Add(".hh", countLinesCStyle); m_countAlgorithms.Add(".hxx", countLinesCStyle); m_countAlgorithms.Add(".h", countLinesCStyle); m_countAlgorithms.Add(".idl", countLinesCStyle); m_countAlgorithms.Add(".odl", countLinesCStyle); m_countAlgorithms.Add(".txt", countLinesGeneric); m_countAlgorithms.Add(".xml", countLinesXMLStyle); m_countAlgorithms.Add(".xsl", countLinesXMLStyle); m_countAlgorithms.Add(".xslt", countLinesXMLStyle); m_countAlgorithms.Add(".xsd", countLinesXMLStyle); m_countAlgorithms.Add(".config", countLinesXMLStyle); m_countAlgorithms.Add(".res", countLinesGeneric); m_countAlgorithms.Add(".resx", countLinesXMLStyle); m_countAlgorithms.Add(".aspx", countLinesXMLStyle); m_countAlgorithms.Add(".ascx", countLinesXMLStyle); m_countAlgorithms.Add(".ashx", countLinesXMLStyle); m_countAlgorithms.Add(".asmx", countLinesXMLStyle); m_countAlgorithms.Add(".asax", countLinesXMLStyle); m_countAlgorithms.Add(".htm", countLinesXMLStyle); m_countAlgorithms.Add(".html", countLinesXMLStyle); m_countAlgorithms.Add(".css", countLinesCStyle); m_countAlgorithms.Add(".sql", countLinesGeneric); m_countAlgorithms.Add(".cd", countLinesGeneric); }