diff options
author | Rustan Leino <unknown> | 2013-03-05 16:58:16 -0800 |
---|---|---|
committer | Rustan Leino <unknown> | 2013-03-05 16:58:16 -0800 |
commit | c819fabbb8da669952cb7e2e5937c73ff6dcfabe (patch) | |
tree | fdfa5ecd7ef81709608d5dcb5ba232611c1b073f /BCT/Samples/CodeCounter | |
parent | f82dab21f1240fb3f8d67a880f4f93017d85c345 (diff) |
Removed Dafny, Jennisys, Chalice, and BCT, which now live in different Codeplex repositories.
Diffstat (limited to 'BCT/Samples/CodeCounter')
25 files changed, 0 insertions, 2507 deletions
diff --git a/BCT/Samples/CodeCounter/codecounter.sln b/BCT/Samples/CodeCounter/codecounter.sln deleted file mode 100644 index 8869bd4f..00000000 --- a/BCT/Samples/CodeCounter/codecounter.sln +++ /dev/null @@ -1,51 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCounter", "console\CodeCounter.csproj", "{7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "codecounterlibrary", "library\codecounterlibrary.csproj", "{A055DCC3-3C6A-123C-82F8-AD10A8B313F7}"
-EndProject
-Global
- GlobalSection(TeamFoundationVersionControl) = preSolution
- SccNumberOfProjects = 4
- SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs09
- SccLocalPath0 = .
- SccProjectUniqueName1 = console\\CodeCounter.csproj
- SccProjectName1 = console
- SccLocalPath1 = console
- SccProjectUniqueName2 = library\\codecounterlibrary.csproj
- SccProjectName2 = library
- SccLocalPath2 = library
- SccProjectUniqueName3 = Extensions\\vbcounter\\VBCodeCountingLogic\\VBCodeCountingLogic.vbproj
- SccProjectName3 = Extensions/vbcounter/VBCodeCountingLogic
- SccLocalPath3 = Extensions\\vbcounter\\VBCodeCountingLogic
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- DEBUG ALL|Any CPU = DEBUG ALL|Any CPU
- Debug|Any CPU = Debug|Any CPU
- RELEASE ALL|Any CPU = RELEASE ALL|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.DEBUG ALL|Any CPU.ActiveCfg = Debug|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.DEBUG ALL|Any CPU.Build.0 = Debug|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.RELEASE ALL|Any CPU.ActiveCfg = Release|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.RELEASE ALL|Any CPU.Build.0 = Release|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}.Release|Any CPU.Build.0 = Release|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.DEBUG ALL|Any CPU.ActiveCfg = DEBUG ALL|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.DEBUG ALL|Any CPU.Build.0 = DEBUG ALL|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.RELEASE ALL|Any CPU.ActiveCfg = RELEASE ALL|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.RELEASE ALL|Any CPU.Build.0 = RELEASE ALL|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A055DCC3-3C6A-123C-82F8-AD10A8B313F7}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/BCT/Samples/CodeCounter/codecounter.suo b/BCT/Samples/CodeCounter/codecounter.suo Binary files differdeleted file mode 100644 index 84ae5e2a..00000000 --- a/BCT/Samples/CodeCounter/codecounter.suo +++ /dev/null diff --git a/BCT/Samples/CodeCounter/codecounter.vssscc b/BCT/Samples/CodeCounter/codecounter.vssscc deleted file mode 100644 index 794f014c..00000000 --- a/BCT/Samples/CodeCounter/codecounter.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/BCT/Samples/CodeCounter/console/App.config b/BCT/Samples/CodeCounter/console/App.config deleted file mode 100644 index 5f8ec848..00000000 --- a/BCT/Samples/CodeCounter/console/App.config +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <configSections>
- <section
- name="codeCounters"
- type="CodeCounter.Library.CodeCounterTypesConfigurationSection, CodeCounter.Library"
- requirePermission="false"
- />
- </configSections>
- <codeCounters>
- <counterImplementations>
- <logic key="CS"
- assemblyInformation="CSharpCodeCounterLogic, CodeCounter.Library.CSharpCodeCounterLogic, CodeCounter.Library.dll"/>
- <logic key="MSSQL" assemblyInformation="SqlCodeCounterLogic, CodeCounter.Library.SqlCodeCounterLogic, CodeCounter.Library.dll"/>
- <logic key="XAML" assemblyInformation="XamlCodeCounterLogic, CodeCounter.Library.XamlCodeCounterLogic, CodeCounter.Library.dll"/>
- </counterImplementations>
- </codeCounters>
-</configuration>
\ No newline at end of file diff --git a/BCT/Samples/CodeCounter/console/CodeCounter.csproj b/BCT/Samples/CodeCounter/console/CodeCounter.csproj deleted file mode 100644 index d8accbbd..00000000 --- a/BCT/Samples/CodeCounter/console/CodeCounter.csproj +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{7A901DC8-19B3-4F4C-9C2D-2088A30CB5D4}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>CodeCounter</RootNamespace>
- <AssemblyName>CodeCounter</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <SccProjectName>SAK</SccProjectName>
- <SccLocalPath>SAK</SccLocalPath>
- <SccAuxPath>SAK</SccAuxPath>
- <SccProvider>SAK</SccProvider>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <OldToolsVersion>3.5</OldToolsVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Big Woo.NET, Version=3.0.3287.30089, Culture=neutral, PublicKeyToken=b8a13bcc86eb719e, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\Big Woo.NET.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CodeCounterEngine.cs" />
- <Compile Include="CountCounterEvents.cs" />
- <Compile Include="FileTypes.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\library\codecounterlibrary.csproj">
- <Project>{A055DCC3-3C6A-123C-82F8-AD10A8B313F7}</Project>
- <Name>codecounterlibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file diff --git a/BCT/Samples/CodeCounter/console/CodeCounter.csproj.user b/BCT/Samples/CodeCounter/console/CodeCounter.csproj.user deleted file mode 100644 index f83e497d..00000000 --- a/BCT/Samples/CodeCounter/console/CodeCounter.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <StartArguments>-about</StartArguments>
- <StartWorkingDirectory>C:\src\toolkit\CodeCounter\library\</StartWorkingDirectory>
- </PropertyGroup>
-</Project>
\ No newline at end of file diff --git a/BCT/Samples/CodeCounter/console/CodeCounter.csproj.vspscc b/BCT/Samples/CodeCounter/console/CodeCounter.csproj.vspscc deleted file mode 100644 index bfa5cf9c..00000000 --- a/BCT/Samples/CodeCounter/console/CodeCounter.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = "relative:toolkit\\CodeCounter"
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
-}
diff --git a/BCT/Samples/CodeCounter/console/CodeCounterEngine.cs b/BCT/Samples/CodeCounter/console/CodeCounterEngine.cs deleted file mode 100644 index 2cf1748f..00000000 --- a/BCT/Samples/CodeCounter/console/CodeCounterEngine.cs +++ /dev/null @@ -1,270 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-using System.Security.AccessControl;
-using CodeCounter.Library;
-#endregion
-
-namespace CodeCounter
-{
- /// <summary>
- /// This is the class that processes a file. If manages the "conversation" with the
- /// ICodeCounterLogic implementation occuring during reading through the file.
- /// </summary>
- public class CodeCounterEngine
- {
- #region private data
- private FileInfo _fileInfo = null;
- private long _statementLines = 0L;
- private long _totalLines = 0L;
- private long _codeLines = 0L;
- private long _commentLines = 0L;
- private long _errors = 0L;
- private CodeCounterLogicImplementerList _implementerList = null;
- #endregion
-
- #region properties
- /// <summary>
- /// FileInfo instance of the file we want to count code.
- /// </summary>
- public FileInfo File
- {
- get { return _fileInfo; }
- set { _fileInfo = value; }
- }
- #endregion
-
- #region event firing helpers
- /// <summary>
- /// Fires the OnStartEvent if there are listeners. This
- /// event is fired once per file.
- /// </summary>
- /// <param name="startArgs">CodeCounterUpdateEventArgs</param>
- private void FireOnStartEvent(CodeCounterUpdateEventArgs startArgs)
- {
- if (null != OnStart)
- {
- OnStart(this, startArgs);
- }
- }
-
- /// <summary>
- /// Fires OnUpdate event if there are listeners. This event
- /// is fired approx every 250 lines read in the file.
- /// </summary>
- /// <param name="updateArgs">CodeCounterUpdateEventArgs</param>
- private void FireOnUpdateEvent(CodeCounterUpdateEventArgs updateArgs)
- {
- if (null != OnUpdate)
- OnUpdate(this, updateArgs);
- }
-
- /// <summary>
- /// Fires OnFinish event if there are listeners. This event
- /// is fired once per file
- /// </summary>
- /// <param name="finishedArgs">CodeCounterFinishedEventArgs</param>
- private void FireOnFinishedEvent(CodeCounterFinishedEventArgs finishedArgs)
- {
- if (null != OnFinish)
- OnFinish(this, finishedArgs);
- }
- #endregion
-
- #region private methods
- /// <summary>
- /// Find the ICodeCounterLogic implementation that can work with the file type we
- /// have found.
- /// </summary>
- /// <exception cref="FileTypeNotSupportedException">Thrown if no logic is found for the given file type</exception>
- /// <exception cref="ConfigurationFileException">Thrown if no logic is defined in the config file</exception>
- /// <returns>ICodeCounterLogic</returns>
- private ICodeCounterLogic GetFileProcessor(FileInfo info)
- {
- if (null == _implementerList)
- {
- _implementerList = CodeCounterLogicImplementerList.LoadFromConfigFile();
- if (0 == _implementerList.Count)
- throw new ConfigurationFileException("No code counter logic found.");
- }
-
- ICodeCounterLogic handler = null;
-
- foreach (CodeCounterLogicImplementer implementer in _implementerList)
- {
- ICodeCounterLogic potentialHandler = implementer.Implementer;
-
- if (true == potentialHandler.CanProcessFile(info.Name))
- {
- handler = potentialHandler;
- break;
- }
- }
-
- if (null == handler)
- throw FileTypeNotSupportedException.CreateException(info);
-
- return handler;
- }
-
- /// <summary>
- /// Each count is file specific. It is up to the consumer to process
- /// those values
- /// </summary>
- private void InitializeCounters()
- {
- _statementLines = 0L;
- _totalLines = 0L;
- _codeLines = 0L;
- _commentLines = 0L;
- _errors = 0L;
- }
- #endregion
-
- #region public methods
- /// <summary>
- /// The heart of the counting of lines
- /// </summary>
- public void Count()
- {
- // nothing to process if we have no file name
- if (null == _fileInfo)
- return;
-
- // ensures member data is reset to default
- InitializeCounters();
- long linesRead = 0L;
-
- // event arg initialization
- CodeCounterFinishedEventArgs finishedArgs = new CodeCounterFinishedEventArgs(_fileInfo, CodeCounterFunctionTypes.Error);
- CodeCounterUpdateEventArgs startArgs = new CodeCounterUpdateEventArgs(_fileInfo, CodeCounterFunctionTypes.ProcessingFiles);
- CodeCounterUpdateEventArgs updateEventArg = new CodeCounterUpdateEventArgs(_fileInfo, CodeCounterFunctionTypes.ProcessingFiles);
-
- try
- {
- // let console know we found a file
- FireOnStartEvent(startArgs);
-
- // find the appropriate handler for the type
- ICodeCounterLogic processor = GetFileProcessor(_fileInfo);
- bool _processorDeterminesEmpty = processor.EngineCanDetermineBlankLines();
-
- // allow the ICodeCounterLogic implementation a chance to
- // do something with the file
- processor.PrefileProcessing(_fileInfo.FullName);
-
- // now we can read through each line and count what it contains
- using (TextReader fileReader = _fileInfo.OpenText())
- {
- string line = "";
-
- while (null != (line = fileReader.ReadLine()))
- {
- linesRead++;
-
- long mod = (linesRead % 250L);
-
- if (0L == mod)
- {
- updateEventArg.Lines = linesRead;
- FireOnUpdateEvent(updateEventArg);
- }
-
- string trimmed = line.Trim();
-
- // when the processor does not know or care how empty lines are determined
- // we will do it by testing for null or empty line.
- if ((true == _processorDeterminesEmpty) && (true == string.IsNullOrEmpty(trimmed)))
- continue;
-
- // now we are ready to let the implemention decide what the line is
- CodeCounterLineType lineType = processor.LineType(trimmed);
-
- switch (lineType)
- {
- case CodeCounterLineType.Statement:
- case CodeCounterLineType.Code:
- _codeLines++;
- break;
- case CodeCounterLineType.StatementAndComment:
- case CodeCounterLineType.CodeAndComment:
- _codeLines++;
- _commentLines++;
- break;
- case CodeCounterLineType.CommentOnly:
- _commentLines++;
- break;
- default:
- break;
- }
-
- if (CodeCounterLineType.EmptyLine != lineType)
- _totalLines++;
- }
-
- // yay we are done
- fileReader.Close();
-
- // allow the counter implemenation any final moments
- processor.PostfileProcessing(_fileInfo.FullName);
-
- finishedArgs.Function = CodeCounterFunctionTypes.Summarizing;
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- finishedArgs.Function = CodeCounterFunctionTypes.Error;
- finishedArgs.AdditionalData = ex;
- }
- finally
- {
- finishedArgs.FileInfo = _fileInfo;
- finishedArgs.CodeLines = _codeLines;
- finishedArgs.CommentLines = _commentLines;
- finishedArgs.StatementLines = _statementLines;
- finishedArgs.Lines = _totalLines;
- _fileInfo = null;
-
- FireOnFinishedEvent(finishedArgs);
- }
- }
- #endregion
-
- #region event member delcaration
- public event CodeCounterUpdateEvent OnStart;
- public event CodeCounterUpdateEvent OnUpdate;
- public event CodeCounterFinishedEvent OnFinish;
- #endregion
- }
-}
diff --git a/BCT/Samples/CodeCounter/console/CountCounterEvents.cs b/BCT/Samples/CodeCounter/console/CountCounterEvents.cs deleted file mode 100644 index 5bc24136..00000000 --- a/BCT/Samples/CodeCounter/console/CountCounterEvents.cs +++ /dev/null @@ -1,169 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-#endregion
-
-namespace CodeCounter
-{
- #region CodeCounterFunctionTypes enumeration
- /// <summary>
- ///
- /// </summary>
- public enum CodeCounterFunctionTypes
- {
- NA,
- ListingFiles,
- ProcessingFiles,
- Summarizing,
- Error
- }
- #endregion
-
- #region base Event Arg class
- /// <summary>
- ///
- /// </summary>
- public class BaseCodeCounterEventArgs : EventArgs
- {
- private FileInfo _fileInfo = null;
-
- public FileInfo FileInfo
- {
- get { return _fileInfo; }
- set { _fileInfo = value; }
- }
-
- protected BaseCodeCounterEventArgs() { }
-
- protected BaseCodeCounterEventArgs(FileInfo fileInfo)
- {
- _fileInfo = fileInfo;
- }
- }
- #endregion
-
- #region CodeCounterUpdateEventArgs implementation
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterUpdateEventArgs : BaseCodeCounterEventArgs
- {
- private CodeCounterFunctionTypes _function = CodeCounterFunctionTypes.NA;
- private long _lines = 0;
-
- public long Lines
- {
- get { return _lines; }
- set { _lines = value; }
- }
-
- public CodeCounterFunctionTypes Function
- {
- get { return _function; }
- set { _function = value; }
- }
-
- protected CodeCounterUpdateEventArgs() { }
-
- public CodeCounterUpdateEventArgs(FileInfo fileInfo, CodeCounterFunctionTypes function)
- : base(fileInfo)
- {
- _function = function;
- }
- }
- #endregion
-
- #region CodeCounterFinishedEventArgs declaration
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterFinishedEventArgs : BaseCodeCounterEventArgs
- {
- private CodeCounterFunctionTypes _function = CodeCounterFunctionTypes.NA;
- private long _totalLines = 0L;
- private long _codeLines = 0L;
- private long _commentLines = 0L;
- private long _statementLines = 0L;
- private object _additionalData = null;
-
- public object AdditionalData
- {
- get { return _additionalData; }
- set { _additionalData = value; }
- }
-
- public CodeCounterFunctionTypes Function
- {
- get { return _function; }
- set { _function = value; }
- }
-
- public long StatementLines
- {
- get { return _statementLines; }
- set { _statementLines = value; }
- }
-
- public long Lines
- {
- get { return _totalLines; }
- set { _totalLines = value; }
- }
-
- public long CodeLines
- {
- get { return _codeLines; }
- set { _codeLines = value; }
- }
-
- public long CommentLines
- {
- get { return _commentLines; }
- set { _commentLines = value; }
- }
-
- public CodeCounterFinishedEventArgs(FileInfo fileInfo, CodeCounterFunctionTypes function)
- : base(fileInfo)
- {
- _function = function;
- }
-
- }
- #endregion
-
- #region event declarations
- public delegate void CodeCounterUpdateEvent(object sender, CodeCounterUpdateEventArgs args);
- public delegate void CodeCounterFinishedEvent(object sender, CodeCounterFinishedEventArgs args);
- #endregion
-
-}
diff --git a/BCT/Samples/CodeCounter/console/FileTypes.cs b/BCT/Samples/CodeCounter/console/FileTypes.cs deleted file mode 100644 index 3b614eb0..00000000 --- a/BCT/Samples/CodeCounter/console/FileTypes.cs +++ /dev/null @@ -1,47 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-#endregion
-
-namespace CodeCounter
-{
- /// <summary>
- ///
- /// </summary>
- public interface IFileType
- {
- string Extension { get; }
- bool HandlesFile(File file);
- string[] Comments { get; }
- }
-}
diff --git a/BCT/Samples/CodeCounter/console/MSSCCPRJ.SCC b/BCT/Samples/CodeCounter/console/MSSCCPRJ.SCC deleted file mode 100644 index ec58105e..00000000 --- a/BCT/Samples/CodeCounter/console/MSSCCPRJ.SCC +++ /dev/null @@ -1,5 +0,0 @@ -SCC = This is a source code control file
-
-[CodeCounter.csproj]
-SCC_Aux_Path = "P4SCC#bigwoo:1666##matt##MediumWoo"
-SCC_Project_Name = Perforce Project
diff --git a/BCT/Samples/CodeCounter/console/Program.cs b/BCT/Samples/CodeCounter/console/Program.cs deleted file mode 100644 index 1815170c..00000000 --- a/BCT/Samples/CodeCounter/console/Program.cs +++ /dev/null @@ -1,642 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using BigWoo.NET.ApplicationSupport;
-using BigWoo.NET.Utility;
-using System.IO;
-using BigWoo.Utility;
-using CodeCounter.Library;
-#endregion
-
-namespace CodeCounter
-{
- /// <summary>
- /// The main control loop for the code counter program. Evaulates command line arguments
- /// spins up file searches and code counting implmentations to count the code in the file
- /// </summary>
- class Program
- {
- private class PrintHelpException : Exception { }
-
- private class ShowAboutWebPageException : Exception { }
-
- #region private data
-
- private const string COMMAND_VERBOSE = "-verbose";
- private const string COMMAND_RECURSE = "-recurse";
- private const string COMMAND_SUPPORTED = "-supportedTypes";
- private const string COMMAND_SHOWABOUTWEBPAGE = "-about";
-
- private const string WEBSITE = "www.mattraffel.com/aboutme.aspx";
-
- private char[] _spinner = new char[] { '|', '/', '-', '\\', '|', '/', '-', '\\' };
- private char[] _osWildCards = new char[] { '*', '?' };
- private object _lockObject = new object();
-
- private List<string> _fileArgs = new List<string>();
- private ScanResultsList _listOfFiles = new ScanResultsList();
- private ScanForFiles _fileScanner = new ScanForFiles();
-
- private bool _quiet = true;
- private bool _recursive = false;
- private bool _detailedHelp = false;
-
- private AutoResetEvent _eventReset = null;
- private int _erasableTextLengh = 0;
- private int _spinnerPosition = 0;
- private string _lastDirectoryProcessed = string.Empty;
-
- private long _filesCounted = 0L;
- private long _totalLines = 0L;
- private long _codeLines = 0L;
- private long _commentLines = 0L;
- private long _statementLines = 0L;
- private long _errors = 0L;
- #endregion
-
- #region private methods
- /// <summary>
- /// Draws what might appear to some as a spinner in the console window to
- /// show that the program is functioning and not hung
- /// </summary>
- private void DrawSpinner()
- {
- // move cursor back to starting position, ignoring if we muck up
- ConsoleBackspace(_erasableTextLengh);
-
- if (_spinnerPosition >= _spinner.Length)
- _spinnerPosition = 0;
-
- string outputText = string.Format("{0}", _spinner[_spinnerPosition]);
- Console.Write(outputText);
-
- _erasableTextLengh = outputText.Length;
-
- _spinnerPosition++;
-
- }
-
- /// <summary>
- /// Erases "spaces" by moving the cursor left by "spaces"
- /// Exceptions are ignored
- /// </summary>
- /// <param name="spaces">int, the number of spaces to backspace</param>
- private void ConsoleBackspace(int spaces)
- {
- try
- {
- if (0 < spaces)
- {
- int move = spaces;
-
- if (spaces > Console.CursorLeft)
- move = Console.CursorLeft;
-
- Console.CursorLeft -= move;
- }
- }
- catch(Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- }
- }
-
- /// <summary>
- /// processes the command line arguments. We expect no more than
- /// -quiet
- /// -recurse
- /// -help
- /// -supportedTypes
- /// {filename}
- ///
- /// FileName can be full filename or partial with wild card
- /// </summary>
- /// <param name="args">string[]</param>
- private void ProcessCommandLineArgs(string[] args)
- {
- foreach (string arg in args)
- {
- if (('-' == arg[0]) || (('/' == arg[0])))
- {
- if (0 == arg.CompareTo(COMMAND_VERBOSE))
- _quiet = false;
- else if (0 == arg.CompareTo(COMMAND_RECURSE))
- _recursive = true;
- else if (0 == arg.CompareTo(COMMAND_SUPPORTED))
- {
- _detailedHelp = true;
- throw new PrintHelpException();
- }
- else if (0 == arg.CompareTo(COMMAND_SHOWABOUTWEBPAGE))
- throw new ShowAboutWebPageException();
- else
- throw new PrintHelpException();
- }
- else
- _fileArgs.Add(arg);
- }
-
- if (0 == _fileArgs.Count)
- throw new PrintHelpException();
- }
-
- /// <summary>
- /// Using a mask, look for files matching the mask, digging recursively
- /// into sub-directories if recursive is true. While this code can work
- /// for files without a wildcard, for performance reasons the expectation
- /// is this method is only called when fileMask has a wildcard in it,
- /// or recursive is true.
- /// </summary>
- /// <param name="fileMask">string</param>
- private void BuildFileListForMask(string fileMask)
- {
- Console.Write(string.Format("scanning for {0}.", fileMask));
-
- _fileScanner.FilesList = new ScanResultsList();
- _fileScanner.IsRecursive = _recursive;
- _fileScanner.RootDir = Environment.CurrentDirectory;
- _fileScanner.FileMask = fileMask;
- _fileScanner.Scan();
-
- _listOfFiles.AddRange(_fileScanner.FilesList.ToArray());
-
- ConsoleBackspace(_erasableTextLengh);
- _erasableTextLengh = 0;
-
- if (false == _quiet)
- Console.WriteLine("..done");
- else
- Console.WriteLine("");
-
- }
-
- /// <summary>
- /// Called when recursive is true, scan for all matches in fileMask
- /// input received from the commandline
- /// </summary>
- private void BuildFileListViaScanner()
- {
- // for each input that "appears" to be a file mask (either a file name or a file wildcard)
- // gather the file names)
- foreach (string fileMask in _fileArgs)
- {
- BuildFileListForMask(fileMask);
- }
- }
-
- /// <summary>
- /// Called when recursive is false, evaluates the input to see if search is really
- /// required or not, only using the file scanner when a wildcard is present in the
- /// input
- /// </summary>
- private void BuildFileListIntelligently()
- {
- // for each input that "appears" to be a file mask (either a file name or a file wildcard)
- // gather the file names)
- foreach (string fileMask in _fileArgs)
- {
- if (-1 < fileMask.IndexOfAny(_osWildCards))
- {
- BuildFileListForMask(fileMask);
- }
- else
- {
- DefaultScanForFilesData nextFile = new DefaultScanForFilesData();
- nextFile.FileInfo = new FileInfo(fileMask);
- _listOfFiles.Add(nextFile);
- }
- }
- }
-
- /// <summary>
- /// optimized building of the file list....if recursive is not true
- /// additional code checks the input and determines how to add files
- /// to the list
- /// </summary>
- private void BuildFileList()
- {
- _listOfFiles.Clear();
-
- // go ahead and hook up the event handler for file found
- // in case we do end up using the scanner
- _fileScanner.OnFileFound += new FileFoundEvent(OnFileFound);
- _fileScanner.OnDirectoryFound += new ScanningDirectoryEvent(OnDirectoryFound);
-
- // since recursive is true, it really doesnt matter if
- // a wild card is in the input, just start scanning
- if (true == _recursive)
- {
- BuildFileListViaScanner();
- }
- else
- {
- BuildFileListIntelligently();
- }
- }
-
- /// <summary>
- /// File list has been built, now its time to crack open each file
- /// and count the code
- /// </summary>
- private void ProcessFileList()
- {
- // now we are ready to count the files
- CodeCounterEngine codeCounterEngine = new CodeCounterEngine();
- _eventReset = new AutoResetEvent(false);
- object lockObject = new object();
-
- // hook up finished even handler (required)
- codeCounterEngine.OnFinish += new CodeCounterFinishedEvent(OnCodeCountingFinished);
-
- if (0 < _listOfFiles.Count)
- Console.WriteLine(string.Format("counting {0} possible files", _listOfFiles.Count));
-
- // only add these event handlers if the user wanted output
- if (false == _quiet)
- {
- codeCounterEngine.OnStart += new CodeCounterUpdateEvent(OnCodeCountingStart);
- codeCounterEngine.OnUpdate += new CodeCounterUpdateEvent(OnCodeCountingUpdate);
- }
-
- // for each file in the array
- foreach (IScanForFilesData file in _listOfFiles)
- {
- try
- {
- codeCounterEngine.File = file.FileInfo;
-
- // clean everything up
- while (true == Console.KeyAvailable)
- Console.Read();
-
- _spinnerPosition = 0;
- _erasableTextLengh = 0;
- _eventReset.Reset();
-
- // make erasure execute on a separate thread
- ThreadStart codeCountThreadStart = new ThreadStart(codeCounterEngine.Count);
- Thread codeCountThread = new Thread(codeCountThreadStart);
- codeCountThread.Name = "codeCountingThread worker";
- codeCountThread.Start();
-
- _eventReset.WaitOne();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- Console.WriteLine(ex.Message);
- }
- }
- }
-
- /// <summary>
- /// Prints help to console
- /// </summary>
- private void PrintHelp()
- {
- Console.WriteLine("");
- Console.WriteLine("\t-verbose");
- Console.WriteLine("\t-recurse");
- Console.WriteLine("\t-supportedTypes");
- Console.WriteLine("\t-help");
- Console.WriteLine("\t-about (opens www.mattraffel.com)");
- Console.WriteLine("\t{filename}");
- Console.WriteLine("");
- Console.WriteLine("FileName can be full filename or partial with wild card");
-
- // _detailedHelp is set to true when -supportedTypes is found in the command line
- // this means we show information from each of the code counter implmentations
- if (true == _detailedHelp)
- {
- Console.WriteLine("");
- CodeCounterLogicImplementerList list = CodeCounterLogicImplementerList.LoadFromConfigFile();
- if (0 == list.Count)
- {
- Console.WriteLine("No code types supported. Check the config file.");
- return;
- }
-
- Console.WriteLine("File formats supported:");
-
- foreach (CodeCounterLogicImplementer implementor in list)
- {
- string[] fileTypeList = implementor.Implementer.FileTypesHandled();
- foreach (string fileType in fileTypeList)
- {
- // most file types are short so we will make a fair assumption
- // that it is ok to right justify fileType by 10 chars....
- string details = string.Format("{0,10} by {1}", fileType, implementor.ImplementerType.Name);
- Console.WriteLine(details);
- }
- }
-
- }
- }
-
- /// <summary>
- /// Prints the results of counting code lines
- /// </summary>
- private void PrintSummaryReport()
- {
- if (false == _quiet)
- Console.WriteLine("");
-
- Console.WriteLine(string.Format("Files {0,10:#,##0}", _filesCounted));
- if (0 < _codeLines)
- Console.WriteLine(string.Format("Code Lines {0,10:#,##0}", _codeLines));
-
- if (0 < _statementLines)
- Console.WriteLine(string.Format("Statment Lines {0,10:#,##0}", _statementLines));
-
- Console.WriteLine(string.Format("Comment Lines {0,10:#,##0}", _commentLines));
-
- if (0 < _filesCounted)
- Console.WriteLine(string.Format("Avg Lines/File {0,10:#,##0}", _totalLines / _filesCounted));
-
- if (0 < _errors)
- {
- Console.WriteLine(string.Format("Error Files {0,10:#,##0}", _errors));
- if (true == _quiet)
- Console.WriteLine(" ==> to see details about the errors run with -verbose");
- }
-
- Console.WriteLine("");
- }
-
- /// <summary>
- /// A little extra self boasting.....
- /// </summary>
- private void ShowAboutWebPage()
- {
- try
- {
- Console.WriteLine("");
- Console.WriteLine(string.Format("ok to open {0} in your browser (Y/n)?", WEBSITE));
- ConsoleKeyInfo keyInfo = Console.ReadKey();
- char input = keyInfo.KeyChar;
-
- if (('y' == input) || ('Y' == input) || ('\r' == input))
- System.Diagnostics.Process.Start(string.Format("http://{0}", WEBSITE));
-
- //if ('y' != input)
- // System.Diagnostics.Process.Start(string.Format("http://{0}", WEBSITE));
- }
- catch
- {
- Console.WriteLine(string.Format("Error trying to open url. Please visit http://{0} when you have a moment.", WEBSITE));
- }
- }
-
- /// <summary>
- /// Prints a standard bit of header information every time
- /// </summary>
- private void PrintHeader()
- {
- Console.WriteLine("CodeCounter by matt raffel");
- Console.WriteLine("(c) 2009 - matt.raffel@mindspring.com");
- }
-
- /// <summary>
- /// This is the main function of this class
- /// it runs through the command line parameters
- /// sets up the FileErasure object and lets it do
- /// its business
- /// </summary>
- /// <param name="args">string[], command line arguments</param>
- private void Run(string[] args)
- {
- PrintHeader();
-
- try
- {
- // process input
- ProcessCommandLineArgs(args);
-
- // now we should know what files to count or what mask to use
- // to get the files to count so build a definitive list
- // of files
- BuildFileList();
-
- // now count the code
- ProcessFileList();
-
- // and print out the results
- PrintSummaryReport();
- }
- catch (PrintHelpException)
- {
- PrintHelp();
- }
- catch (ShowAboutWebPageException)
- {
- ShowAboutWebPage();
- }
- catch (Exception error)
- {
- Console.WriteLine("");
- Console.WriteLine("Application Exception:");
- Console.WriteLine(error.Message);
- Console.WriteLine(error.StackTrace);
- }
- finally
- {
- }
- }
- #endregion
-
- #region event methods
- /// <summary>
- /// Provide simple UI updates on scanning
- /// </summary>
- /// <param name="directoryName">string</param>
- private void OnDirectoryFound(string directoryName)
- {
- if (false == _quiet)
- DrawSpinner();
- }
-
- /// <summary>
- /// Provide simple UI updates on scanning
- /// </summary>
- /// <param name="fileData">string</param>
- private void OnFileFound(IScanForFilesData fileData)
- {
- if (false == _quiet)
- DrawSpinner();
- }
-
- /// <summary>
- /// Finished counting lines in a file, now its time to note it
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="counterFinishedArgs">CodeCounterFinishedEventArgs</param>
- private void OnCodeCountingFinished(object sender, CodeCounterFinishedEventArgs counterFinishedArgs)
- {
- lock (_lockObject)
- {
- try
- {
-
- if (CodeCounterFunctionTypes.Summarizing == counterFinishedArgs.Function)
- {
- if (false == _quiet)
- {
- // move cursor back to starting position, ignoring if we muck up
- ConsoleBackspace(_erasableTextLengh);
- string spaces = new string(' ', _erasableTextLengh);
- Console.Write(spaces);
- Console.WriteLine("");
- }
-
- // only files we succeeding in counting are part of the file count
- // error files are not included in the value
- _filesCounted++;
-
- _codeLines += counterFinishedArgs.CodeLines;
- _totalLines += counterFinishedArgs.Lines;
- _commentLines += counterFinishedArgs.CommentLines;
- _statementLines += counterFinishedArgs.StatementLines;
-
- }
- else
- {
- _errors++;
-
- if ((counterFinishedArgs.AdditionalData is ConfigurationFileException) ||
- (counterFinishedArgs.AdditionalData is FileTypeNotSupportedException))
- {
- if (false == _quiet)
- {
- // move cursor back to starting position, ignoring if we muck up
- ConsoleBackspace(_erasableTextLengh);
- Console.Write("...file type not supported");
- Console.WriteLine("");
- }
- }
- }
-
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- }
- finally
- {
- _spinnerPosition = 0;
- _erasableTextLengh = 0;
- _eventReset.Set();
-
- }
- }
- }
-
- /// <summary>
- /// Updates from the code counter as it evaluates a file
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="erasureArgs">CodeCounterUpdateEventArgs</param>
- private void OnCodeCountingUpdate(object sender, CodeCounterUpdateEventArgs erasureArgs)
- {
- lock (_lockObject)
- {
- try
- {
- // move cursor back to starting position, ignoring if we muck up
- DrawSpinner();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- }
- }
- }
-
- /// <summary>
- /// Indicates a file has been found that matches our criteria for counting the lines
- /// of code in the file
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="startArgs">CodeCounterUpdateEventArgs</param>
- private void OnCodeCountingStart(object sender, CodeCounterUpdateEventArgs startArgs)
- {
- try
- {
- System.Diagnostics.Debug.Assert(0 == _erasableTextLengh);
-
- if (0 != _lastDirectoryProcessed.CompareTo(startArgs.FileInfo.DirectoryName))
- {
- _lastDirectoryProcessed = startArgs.FileInfo.DirectoryName;
- string directory = string.Format("{0}:", _lastDirectoryProcessed);
- Console.WriteLine(directory);
- }
-
- _spinnerPosition = 0;
- _erasableTextLengh = 0;
- string fileName = string.Format("\t{0}: ", startArgs.FileInfo.Name);
- Console.Write(fileName);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.Message);
- }
- }
- #endregion
-
- #region ctor
- /// <summary>
- ///
- /// </summary>
- internal Program()
- {
- }
- #endregion
-
- #region startup entry method
- /// <summary>
- ///
- /// </summary>
- /// <param name="args">string[]</param>
- static void Main(string[] args)
- {
- Program go = new Program();
- go.Run(args);
-
- if (true == System.Diagnostics.Debugger.IsAttached)
- {
- Console.WriteLine("press a key....");
- Console.Read();
- }
- }
- #endregion
- }
-}
diff --git a/BCT/Samples/CodeCounter/console/Properties/AssemblyInfo.cs b/BCT/Samples/CodeCounter/console/Properties/AssemblyInfo.cs deleted file mode 100644 index 10081080..00000000 --- a/BCT/Samples/CodeCounter/console/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("CodeCounter")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("CodeCounter")]
-[assembly: AssemblyCopyright("Copyright © 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("d6e0a218-ddd1-436c-8405-4be8d7616bfb")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BCT/Samples/CodeCounter/dependencies/Big Woo.NET.dll b/BCT/Samples/CodeCounter/dependencies/Big Woo.NET.dll Binary files differdeleted file mode 100644 index 9110f2cb..00000000 --- a/BCT/Samples/CodeCounter/dependencies/Big Woo.NET.dll +++ /dev/null diff --git a/BCT/Samples/CodeCounter/library/CSharpCodeCounterLogic.cs b/BCT/Samples/CodeCounter/library/CSharpCodeCounterLogic.cs deleted file mode 100644 index 83f90d9a..00000000 --- a/BCT/Samples/CodeCounter/library/CSharpCodeCounterLogic.cs +++ /dev/null @@ -1,177 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-using System.IO;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- /// Provides the logic for counting lines of code and comments
- /// </summary>
- public class CSharpCodeCounterLogic : ICodeCounterLogic
- {
- private bool _isInComment = false;
-
- /// <summary>
- /// Performs all the evaluations while are stepping through
- /// a multi line comment
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType EvaluateWhileInComment(string line)
- {
- if (false == string.IsNullOrEmpty(line))
- {
- if (true == line.Contains("*/"))
- {
- _isInComment = false;
-
- int endOfCommentIndex = line.IndexOf("*/");
-
- endOfCommentIndex += 2;
-
- if (endOfCommentIndex < line.Length)
- return CodeCounterLineType.CodeAndComment;
- }
- }
-
- return CodeCounterLineType.CommentOnly;
- }
-
- /// <summary>
- /// Evaluates a line
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType Evaluate(string line)
- {
- // this one is real simple a line starts with // so
- // know there is no code after and we know the next line
- // could be anything
- if (true == line.StartsWith("//"))
- return CodeCounterLineType.CommentOnly;
-
- if (true == line.StartsWith("/*"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // return value
- return EvaluateWhileInComment(line);
- }
-
- if (true == line.Contains("//"))
- return CodeCounterLineType.CodeAndComment;
-
- if (true == line.Contains("/*"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // if the comment has finished. we will ignore its return
- // value as the only possible legal value for this case is
- // CodeCounterLineType.CodeAndComment
- EvaluateWhileInComment(line);
-
- return CodeCounterLineType.CodeAndComment;
- }
-
- return CodeCounterLineType.Code;
- }
-
- #region ICodeCounterLogic Members
- /// <summary>
- ///
- /// </summary>
- /// <param name="line"></param>
- /// <returns></returns>
- public CodeCounterLineType LineType(string line)
- {
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- string trimmed = line.Trim();
-
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- if (true == _isInComment)
- return EvaluateWhileInComment(trimmed);
- else
- return Evaluate(trimmed);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public bool EngineCanDetermineBlankLines()
- {
- return true;
- }
-
- /// <summary>
- /// should return something like cs or vb or sql etc
- /// </summary>
- /// <returns>string[]</returns>
- public string[] FileTypesHandled()
- {
- return new string[] {"cs"};
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="fileName"></param>
- /// <returns></returns>
- public bool CanProcessFile(string file)
- {
- FileInfo info = new FileInfo(file);
- string fileExtension = info.Extension.ToLower();
- if (".cs" == fileExtension)
- return true;
-
- return false;
- }
-
- public void PrefileProcessing(string fileName) {}
-
- public void PostfileProcessing(string fileName) {}
-
- #endregion
- }
-}
diff --git a/BCT/Samples/CodeCounter/library/CodeCounterLogicImplementers.cs b/BCT/Samples/CodeCounter/library/CodeCounterLogicImplementers.cs deleted file mode 100644 index 245571d3..00000000 --- a/BCT/Samples/CodeCounter/library/CodeCounterLogicImplementers.cs +++ /dev/null @@ -1,136 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-using System.IO;
-using BigWoo.Utility;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterLogicImplementer
- {
- private string _className = string.Empty;
- private string _fullClassName = string.Empty;
- private string _assemblyName = "CodeCounter.Library.dll";
- private Type _implementer = null;
- private ICodeCounterLogic _logic = null;
-
- private Type GetImplementerTypeInstance()
- {
- if (null == _implementer)
- {
- if (true == string.IsNullOrEmpty(_assemblyName))
- throw new ConfigurationFileException("codeCounters not configured correctly");
-
- if (true == string.IsNullOrEmpty(_fullClassName))
- throw new ConfigurationFileException("codeCounters not configured correctly");
-
- _implementer = AssemblyUtility.GetTypeFromFile(_assemblyName, _fullClassName);
-
- if (false == AssemblyUtility.HasInterface(typeof(ICodeCounterLogic), _implementer))
- throw new ConfigurationFileException("codeCounters not implemented correctly");
- }
-
- return _implementer;
- }
-
- private ICodeCounterLogic GetImplementerInstance()
- {
- if (null == _logic)
- {
- _logic = AssemblyUtility.InvokeDefaultCtor(ImplementerType) as ICodeCounterLogic;
- }
-
- return _logic;
- }
-
- public Type ImplementerType
- {
- get { return GetImplementerTypeInstance(); }
- }
-
- public ICodeCounterLogic Implementer
- {
- get { return GetImplementerInstance(); }
- }
-
- protected CodeCounterLogicImplementer() { }
-
- public static CodeCounterLogicImplementer FromConfigElement(CodeCounterLogicElement element)
- {
- CodeCounterLogicImplementer implementer = new CodeCounterLogicImplementer();
- string[] typeParts = element.AssemblyInformation.Split(new char[] { ',' });
-
- if (null != typeParts)
- {
- if (1 <= typeParts.Length)
- implementer._className = typeParts[0].Trim();
-
- if (2 <= typeParts.Length)
- implementer._fullClassName = typeParts[1].Trim();
-
- if (3 <= typeParts.Length)
- implementer._assemblyName = typeParts[2].Trim();
- }
- return implementer;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterLogicImplementerList : List<CodeCounterLogicImplementer>
- {
- protected CodeCounterLogicImplementerList() { }
-
- public static CodeCounterLogicImplementerList LoadFromConfigFile()
- {
- CodeCounterLogicImplementerList list = new CodeCounterLogicImplementerList();
-
- CodeCounterTypesConfigurationSection section = ConfigurationManager.GetSection("codeCounters") as CodeCounterTypesConfigurationSection;
-
- if (null == section)
- throw new ConfigurationFileException("codeCounters section is missing");
-
- foreach (CodeCounterLogicElement element in section.CounterImplementations)
- {
- CodeCounterLogicImplementer implementer = CodeCounterLogicImplementer.FromConfigElement(element);
- list.Add(implementer);
- }
-
- return list;
- }
- }
-}
diff --git a/BCT/Samples/CodeCounter/library/ConfigFileSections.cs b/BCT/Samples/CodeCounter/library/ConfigFileSections.cs deleted file mode 100644 index 70bc5917..00000000 --- a/BCT/Samples/CodeCounter/library/ConfigFileSections.cs +++ /dev/null @@ -1,122 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterTypesConfigurationSection : ConfigurationSection
- {
- [ConfigurationProperty("counterImplementations")]
- public CodeCounterLogicCollection CounterImplementations
- {
- get { return ((CodeCounterLogicCollection)(base["counterImplementations"])); }
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [ConfigurationCollection(typeof(CodeCounterLogicElement), AddItemName = "logic")]
- public class CodeCounterLogicCollection : ConfigurationElementCollection
- {
- /// <summary>
- /// for creating new elements
- /// </summary>
- /// <returns>AssemblyElement</returns>
- protected override ConfigurationElement CreateNewElement()
- {
- return new CodeCounterLogicElement();
- }
-
- /// <summary>
- /// searchs the collection for a given AssemblyElement based on its key
- /// </summary>
- /// <param name="element">AssemblyElement</param>
- /// <returns>CodeCounterType</returns>
- protected override object GetElementKey(ConfigurationElement element)
- {
- return (element as CodeCounterLogicElement).AssemblyInformation;
- }
-
- /// <summary>
- /// Indexor into the array
- /// </summary>
- /// <param name="idx">int</param>
- /// <returns>CodeCounterType</returns>
- public CodeCounterLogicElement this[int idx]
- {
- get
- {
- return BaseGet(idx) as CodeCounterLogicElement;
- }
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class CodeCounterLogicElement : ConfigurationElement
- {
- [ConfigurationProperty("assemblyInformation", IsKey = false, IsRequired = true)]
- public string AssemblyInformation
- {
- get
- {
- // assemblyInformation="CSharpCodeCounterLogic, CodeCounter.Library.CSharpCodeCounterLogic, CodeCounter.Library.dll"
- string assemblyInformation = (string) base["assemblyInformation"];
- return assemblyInformation;
- }
-
- set
- {
- base["assemblyInformation"] = value;
- }
- }
-
- [ConfigurationProperty("key", IsKey = true, IsRequired = true)]
- public string Key
- {
- get
- {
- string key = (string) base["key"];
- return key;
- }
- set { base["key"] = value; }
- }
- }
-
-
-}
diff --git a/BCT/Samples/CodeCounter/library/CustomExceptions.cs b/BCT/Samples/CodeCounter/library/CustomExceptions.cs deleted file mode 100644 index b4ee7100..00000000 --- a/BCT/Samples/CodeCounter/library/CustomExceptions.cs +++ /dev/null @@ -1,60 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-using System.IO;
-#endregion
-
-
-namespace CodeCounter.Library
-{
- /// <summary>
- ///
- /// </summary>
- public class ConfigurationFileException : Exception
- {
- public ConfigurationFileException(string msg) : base(msg) { }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class FileTypeNotSupportedException : Exception
- {
- public FileTypeNotSupportedException(string msg) : base(msg) { }
-
- public static FileTypeNotSupportedException CreateException(FileInfo info)
- {
- string msg = string.Format("{0} was not counted as no implemention for type {1} was found", info.Name, info.Extension);
- return new FileTypeNotSupportedException(msg);
- }
- }
-}
diff --git a/BCT/Samples/CodeCounter/library/ICodeCounterLogic.cs b/BCT/Samples/CodeCounter/library/ICodeCounterLogic.cs deleted file mode 100644 index 9e37ed59..00000000 --- a/BCT/Samples/CodeCounter/library/ICodeCounterLogic.cs +++ /dev/null @@ -1,120 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- /// Used by ICodeCounterLogic implementations to inform the the code counting engine
- /// the type of line read.
- /// </summary>
- public enum CodeCounterLineType
- {
- /// <summary>
- /// a blank line
- /// </summary>
- EmptyLine,
- /// <summary>
- /// this line contains code only
- /// </summary>
- Code,
- /// <summary>
- /// this line contains code and comments
- /// </summary>
- CodeAndComment,
- /// <summary>
- /// line line is part of a comment and no code
- /// </summary>
- CommentOnly,
- /// <summary>
- /// a complete code statement (like in cs a statement ends with ;)
- /// </summary>
- Statement,
- /// <summary>
- /// this line contains a completed code statement and comments
- /// </summary>
- StatementAndComment,
- }
-
- /// <summary>
- /// Interface that defines the methods required by implementtions that provide
- /// the code counting functions
- /// </summary>
- public interface ICodeCounterLogic
- {
- /// <summary>
- /// Evaluates input and determines what the line contains: nothing,
- /// code, code and comments or comment only, statement etc...
- /// </summary>
- /// <param name="line">string, typically one line a source file</param>
- /// <returns>CodeCounterLineType</returns>
- CodeCounterLineType LineType(string line);
-
- /// <summary>
- /// should return something like cs or vb or sql etc. No need to return .cs just cs
- /// Typically used to display the supported types during command line help command
- /// </summary>
- /// <returns>string[]</returns>
- string[] FileTypesHandled();
-
- /// <summary>
- /// Called by the engine to ask the implementation if it can count the lines in the file
- /// </summary>
- /// <param name="fileName"></param>
- /// <returns>bool, true if the file can be processed</returns>
- bool CanProcessFile(string file);
-
- /// <summary>
- /// Determines who is responsible for identifying an empty line. An empty line
- /// being a line that contains no comments and no code. (Currently unused)
- /// </summary>
- /// <returns>true, the engine will determine what constitues a blank line
- /// other wise the ICodeCounterLogic Implmentation makes that decision</returns>
- bool EngineCanDetermineBlankLines();
-
- /// <summary>
- /// opportunity to do some processing prior to counting. If your code
- /// grabs a system handle to this file, make sure you release it before
- /// the function terminates or counting fails.
- /// </summary>
- /// <param name="fileName">string, full path to the file</param>
- void PrefileProcessing(string fileName);
-
- /// <summary>
- /// opportunity to do some processing after counting
- /// </summary>
- /// <param name="fileName">string, full path to the file</param>
- void PostfileProcessing(string fileName);
-
- }
-}
diff --git a/BCT/Samples/CodeCounter/library/MSSCCPRJ.SCC b/BCT/Samples/CodeCounter/library/MSSCCPRJ.SCC deleted file mode 100644 index 76e63471..00000000 --- a/BCT/Samples/CodeCounter/library/MSSCCPRJ.SCC +++ /dev/null @@ -1,5 +0,0 @@ -SCC = This is a source code control file
-
-[codecounterlibrary.csproj]
-SCC_Aux_Path = "P4SCC#bigwoo:1666##matt##MediumWoo"
-SCC_Project_Name = Perforce Project
diff --git a/BCT/Samples/CodeCounter/library/Properties/AssemblyInfo.cs b/BCT/Samples/CodeCounter/library/Properties/AssemblyInfo.cs deleted file mode 100644 index 6df524f7..00000000 --- a/BCT/Samples/CodeCounter/library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("CodeCounterLib")]
-[assembly: AssemblyDescription("Assortment of Mananged utilities")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("mattraffel.com")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("See GNU license included")]
-[assembly: AssemblyTrademark("See GNU license included")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-
diff --git a/BCT/Samples/CodeCounter/library/SqlCodeCounterLogic.cs b/BCT/Samples/CodeCounter/library/SqlCodeCounterLogic.cs deleted file mode 100644 index e8581fee..00000000 --- a/BCT/Samples/CodeCounter/library/SqlCodeCounterLogic.cs +++ /dev/null @@ -1,169 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-using System.IO;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- ///
- /// </summary>
- public class SqlCodeCounterLogic : ICodeCounterLogic
- {
- private bool _isInComment = false;
-
- /// <summary>
- /// Performs all the evaluations while are stepping through
- /// a multi line comment
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType EvaluateWhileInComment(string line)
- {
- if (false == string.IsNullOrEmpty(line))
- {
- if (true == line.Contains("*/"))
- {
- _isInComment = false;
-
- int endOfCommentIndex = line.IndexOf("*/");
-
- endOfCommentIndex += 2;
-
- if (endOfCommentIndex < line.Length)
- return CodeCounterLineType.CodeAndComment;
- }
- }
-
- return CodeCounterLineType.CommentOnly;
- }
-
- /// <summary>
- /// Evaluates a line
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType Evaluate(string line)
- {
- // this one is real simple a line starts with // so
- // know there is no code after and we know the next line
- // could be anything
- if (true == line.StartsWith("--"))
- return CodeCounterLineType.CommentOnly;
-
- if (true == line.StartsWith("/*"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // return value
- return EvaluateWhileInComment(line);
- }
-
- if (true == line.Contains("--"))
- return CodeCounterLineType.CodeAndComment;
-
- if (true == line.Contains("/*"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // if the comment has finished. we will ignore its return
- // value as the only possible legal value for this case is
- // CodeCounterLineType.CodeAndComment
- EvaluateWhileInComment(line);
-
- return CodeCounterLineType.CodeAndComment;
- }
-
- return CodeCounterLineType.Code;
- }
-
- #region ICodeCounterLogic Members
- /// <summary>
- ///
- /// </summary>
- /// <param name="line"></param>
- /// <returns></returns>
- public CodeCounterLineType LineType(string line)
- {
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- string trimmed = line.Trim();
-
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- if (true == _isInComment)
- return EvaluateWhileInComment(trimmed);
- else
- return Evaluate(trimmed);
- }
-
- /// <summary>
- /// should return something like cs or vb or sql etc
- /// </summary>
- /// <returns>string[]</returns>
- public string[] FileTypesHandled()
- {
- return new string[] { "sql" };
- }
-
-
- public bool CanProcessFile(string file)
- {
- FileInfo info = new FileInfo(file);
- string fileExtension = info.Extension.ToLower();
- if (".sql" == fileExtension)
- return true;
-
- return false;
- }
-
- public bool EngineCanDetermineBlankLines()
- {
- return true;
- }
-
- public void PrefileProcessing(string fileName) { }
-
- public void PostfileProcessing(string fileName) {}
-
- #endregion
- }
-}
diff --git a/BCT/Samples/CodeCounter/library/XamlCodeCounterLogic.cs b/BCT/Samples/CodeCounter/library/XamlCodeCounterLogic.cs deleted file mode 100644 index 60ece6fb..00000000 --- a/BCT/Samples/CodeCounter/library/XamlCodeCounterLogic.cs +++ /dev/null @@ -1,161 +0,0 @@ -/*
- ******************************************************************************
- This file is part of BigWoo.NET.
-
- BigWoo.NET is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- BigWoo.NET is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BigWoo.NET; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- architected and written by
- matt raffel
- matt.raffel@mindspring.com
-
- copyright (c) 2008 by matt raffel unless noted otherwise
-
- ******************************************************************************
-*/
-#region using statements
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Configuration;
-using System.IO;
-#endregion
-
-namespace CodeCounter.Library
-{
- /// <summary>
- /// XamlCodeCounterLogic
- /// </summary>
- public class XamlCodeCounterLogic : ICodeCounterLogic
- {
- private bool _isInComment = false;
-
- /// <summary>
- /// Performs all the evaluations while are stepping through
- /// a multi line comment
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType EvaluateWhileInComment(string line)
- {
- if (false == string.IsNullOrEmpty(line))
- {
- if (true == line.Contains("-->"))
- {
- _isInComment = false;
-
- int endOfCommentIndex = line.IndexOf("-->");
-
- endOfCommentIndex += 3;
-
- if (endOfCommentIndex < line.Length)
- return CodeCounterLineType.CodeAndComment;
- }
- }
-
- return CodeCounterLineType.CommentOnly;
- }
-
- /// <summary>
- /// Evaluates a line
- /// </summary>
- /// <param name="line">string</param>
- /// <returns>CodeCounterLineType</returns>
- private CodeCounterLineType Evaluate(string line)
- {
- if (true == line.StartsWith("<!--"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // return value
- return EvaluateWhileInComment(line);
- }
-
- if (true == line.Contains("<!--"))
- {
- _isInComment = true;
-
- // because it is possible the comment terminates
- // in this same line and to ensure that we count code after the comment
- // terminates, use our EvaluateWhileInComment to determine
- // if the comment has finished. we will ignore its return
- // value as the only possible legal value for this case is
- // CodeCounterLineType.CodeAndComment
- EvaluateWhileInComment(line);
-
- return CodeCounterLineType.CodeAndComment;
- }
-
- return CodeCounterLineType.Code;
- }
-
- #region ICodeCounterLogic Members
- /// <summary>
- ///
- /// </summary>
- /// <param name="line"></param>
- /// <returns></returns>
- public CodeCounterLineType LineType(string line)
- {
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- string trimmed = line.Trim();
-
- if (true == string.IsNullOrEmpty(line))
- return CodeCounterLineType.EmptyLine;
-
- if (true == _isInComment)
- return EvaluateWhileInComment(trimmed);
- else
- return Evaluate(trimmed);
- }
-
- /// <summary>
- /// should return something like cs or vb or sql etc
- /// </summary>
- /// <returns>string[]</returns>
- public string[] FileTypesHandled()
- {
- return new string[] { "xaml" };
- }
-
-
- public bool CanProcessFile(string file)
- {
- FileInfo info = new FileInfo(file);
- string fileExtension = info.Extension.ToLower();
- if (".xaml" == fileExtension)
- return true;
-
- return false;
- }
-
- public bool EngineCanDetermineBlankLines()
- {
- return true;
- }
-
- public void PrefileProcessing(string fileName) { }
-
- public void PostfileProcessing(string fileName) { }
-
- #endregion
- }
-
-}
diff --git a/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj b/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj deleted file mode 100644 index 53193b57..00000000 --- a/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{A055DCC3-3C6A-123C-82F8-AD10A8B313F7}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CodeCounter.Library</AssemblyName>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Library</OutputType>
- <RootNamespace>CodeCounter.Library</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <OldToolsVersion>3.5</OldToolsVersion>
- <SccProjectName>SAK</SccProjectName>
- <SccLocalPath>SAK</SccLocalPath>
- <SccAuxPath>SAK</SccAuxPath>
- <SccProvider>SAK</SccProvider>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>bin\dll\Debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>bin\dll\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <DefineConstants>TRACE</DefineConstants>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DEBUG ALL|AnyCPU' ">
- <OutputPath>bin\DEBUG ALL\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>1</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RELEASE ALL|AnyCPU' ">
- <OutputPath>bin\dll\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <DefineConstants>TRACE</DefineConstants>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Big Woo.NET, Version=3.0.3287.30089, Culture=neutral, PublicKeyToken=b8a13bcc86eb719e, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\Big Woo.NET.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.configuration" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Drawing">
- <Name>System.Drawing</Name>
- </Reference>
- <Reference Include="System.Security">
- <Name>System.Security</Name>
- </Reference>
- <Reference Include="System.Windows.Forms">
- <Name>System.Windows.Forms</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CodeCounterLogicImplementers.cs" />
- <Compile Include="ConfigFileSections.cs" />
- <Compile Include="CSharpCodeCounterLogic.cs" />
- <Compile Include="CustomExceptions.cs" />
- <Compile Include="ICodeCounterLogic.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SqlCodeCounterLogic.cs" />
- <Compile Include="XamlCodeCounterLogic.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project>
\ No newline at end of file diff --git a/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj.vspscc b/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj.vspscc deleted file mode 100644 index feffdeca..00000000 --- a/BCT/Samples/CodeCounter/library/codecounterlibrary.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
-}
|