Commit 37df47b5 authored by Rob Nelson's avatar Rob Nelson

Initial commit, 0.12

parents
File added
<?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)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1D28A217-9425-49BB-8708-3F5C178FE0AF}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MurrayGrant.ReadablePassphrase.Generator</RootNamespace>
<AssemblyName>PassphraseGenerator</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>MurrayGrant.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="MurrayGrant.snk" />
<None Include="NotMurrayGrant.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReadablePassphrase.Interfaces\ReadablePassphrase.Words.csproj">
<Project>{CE0EEC1C-F997-4B6B-97C8-909474ED6970}</Project>
<Name>ReadablePassphrase.Words</Name>
</ProjectReference>
<ProjectReference Include="..\ReadablePassphrase\ReadablePassphrase.csproj">
<Project>{60C9ECF7-95D4-48E4-8E8C-F7A2029F443D}</Project>
<Name>ReadablePassphrase</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>copy /y "$(SolutionDir)MergePartsOfSpeech\bin\$(ConfigurationName)\dictionary.xml" "$(TargetDir)"
del "$(TargetDir)dictionary.xml.gz"
"$(SolutionDir)gzip.exe" -9 "$(TargetDir)dictionary.xml"</PostBuildEvent>
</PropertyGroup>
<!-- 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
This diff is collapsed.
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("Readable Passphrase Generator")]
[assembly: AssemblyDescription("Generates gramatically correct passphrases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Murray Grant")]
[assembly: AssemblyProduct("Readable Passphrase Generator")]
[assembly: AssemblyCopyright("Copyright © Murray Grant 2011-2013")]
[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("44e10711-2fe1-4688-94a2-87850701cdfe")]
// 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("0.13.0.0")]
[assembly: AssemblyFileVersion("0.13.0.0")]
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727" sku="Client"/></startup></configuration>
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("Readable Passphrase Plugin")]
[assembly: AssemblyDescription("Generates gramatically correct passphrases as KeePass passphrases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Murray Grant")]
[assembly: AssemblyProduct("KeePass Plugin")]
[assembly: AssemblyCopyright("Copyright © Murray Grant 2011-2014")]
[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("cb2e4de5-64ef-4922-a07e-b53e8b782fb8")]
// 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("0.13.0.0")]
[assembly: AssemblyFileVersion("0.13.0.0")]
// Copyright 2011 Murray Grant
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MurrayGrant.ReadablePassphrase;
using MurrayGrant.ReadablePassphrase.PhraseDescription;
using MurrayGrant.ReadablePassphrase.Mutators;
using System.Xml;
namespace KeePassReadablePassphrase
{
public class Config
{
public bool SpacesBetweenWords { get; set; }
private PhraseStrength _PhraseSelection;
public PhraseStrength PhraseStrength { get { return this._PhraseSelection; } set { this._PhraseSelection = value; this.UpdatePhraseDescription(); } }
public IEnumerable<Clause> PhraseDescription { get; set; }
public bool UseCustomDictionary { get; set; }
public string PathOfCustomDictionary { get; set; }
public int MinLength { get; set; }
public int MaxLength { get; set; }
public MutatorOption Mutator { get; set; }
public UppercaseStyles UpperStyle { get; set; }
public int UpperCount { get; set; }
public NumericStyles NumericStyle { get; set; }
public int NumericCount { get; set; }
public Config()
{
this.LoadDefaults();
}
public Config(string configFromKeePass)
{
this.LoadDefaults();
if (!String.IsNullOrEmpty(configFromKeePass))
this.ParseConfig(configFromKeePass);
}
private void LoadDefaults()
{
// Defaults.
SpacesBetweenWords = true;
PhraseStrength = PhraseStrength.Random;
MinLength = 1;
MaxLength = 999;
this.UpdatePhraseDescription();
this.Mutator = MutatorOption.None;
this.UpperStyle = UppercaseMutator.Basic.When;
this.UpperCount = UppercaseMutator.Basic.NumberOfCharactersToCapitalise;
this.NumericStyle = NumericMutator.Basic.When;
this.NumericCount = NumericMutator.Basic.NumberOfNumbersToAdd;
}
private void ParseConfig(string configFromKeePass)
{
// Load the config up from ToConfigString().
var reader = XmlReader.Create(new System.IO.StringReader(configFromKeePass));
bool inPhraseDescription = false;
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "readablepassphraseconfig")
{ }// NoOp
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "spacesbetweenwords")
this.SpacesBetweenWords = Boolean.Parse(reader.GetAttribute("value"));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "phrasestrength")
this.PhraseStrength = (PhraseStrength)Enum.Parse(typeof(PhraseStrength), reader.GetAttribute("value").Replace("Speach", "Speech"));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "usecustomdictionary")
this.UseCustomDictionary = Boolean.Parse(reader.GetAttribute("value"));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "pathofcustomdictionary")
this.PathOfCustomDictionary = reader.GetAttribute("value");
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "phrasedescription")
inPhraseDescription = true;
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "maxlength")
this.MaxLength = Int32.Parse(reader.GetAttribute("value"));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "minlength")
this.MinLength = Int32.Parse(reader.GetAttribute("value"));
else if (reader.NodeType == XmlNodeType.CDATA && inPhraseDescription)
{
this.PhraseDescription = Clause.CreateCollectionFromTextString(reader.Value);
inPhraseDescription = false;
}
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "mutator")
this.Mutator = (MutatorOption)Enum.Parse(typeof(MutatorOption), reader.GetAttribute("value").Replace(" ", ""));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "upperstyle")
this.UpperStyle = (UppercaseStyles)Enum.Parse(typeof(UppercaseStyles), reader.GetAttribute("value").Replace(" ", ""));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "uppercount")
this.UpperCount = Int32.Parse(reader.GetAttribute("value"));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "numericstyle")
this.NumericStyle = (NumericStyles)Enum.Parse(typeof(NumericStyles), reader.GetAttribute("value").Replace(" ", ""));
else if (reader.NodeType == XmlNodeType.Element && reader.Name.ToLower() == "numericcount")
this.NumericCount = Int32.Parse(reader.GetAttribute("value"));
}
if (this.PhraseStrength != PhraseStrength.Custom)
this.UpdatePhraseDescription();
if (MinLength < 1)
MinLength = 1;
if (MinLength > 999)
MinLength = 999;
if (MaxLength < 1)
MaxLength = 1;
if (MaxLength > 999)
MaxLength = 999;
if (UpperCount < 0)
UpperCount = 0;
if (UpperCount > 999)
UpperCount = 999;
if (NumericCount < 0)
NumericCount = 0;
if (NumericCount > 999)
NumericCount = 999;
}
public string ToConfigString()
{
// This gets saved / parsed from KeePass's config file.
var sb = new StringBuilder();
sb.AppendLine();
sb.AppendLine("<ReadablePassphraseConfig>");
sb.AppendFormat("<SpacesBetweenWords value=\"{0}\"/>\n", this.SpacesBetweenWords);
sb.AppendFormat("<PhraseStrength value=\"{0}\"/>\n", this.PhraseStrength);
sb.AppendLine("<PhraseDescription>");
if (!Clause.RandomMappings.ContainsKey(this.PhraseStrength))
{
sb.Append("<![CDATA[");
foreach (var c in this.PhraseDescription)
c.ToStringBuilder(sb);
sb.Append("]]>");
}
sb.AppendLine("</PhraseDescription>");
sb.AppendFormat("<UseCustomDictionary value=\"{0}\"/>\n", this.UseCustomDictionary);
sb.AppendFormat("<PathOfCustomDictionary value=\"{0}\"/>\n", this.PathOfCustomDictionary);
sb.AppendFormat("<MinLength value=\"{0}\"/>\n", this.MinLength);
sb.AppendFormat("<MaxLength value=\"{0}\"/>\n", this.MaxLength);
sb.AppendFormat("<Mutator value=\"{0}\"/>\n", this.Mutator);
sb.AppendFormat("<UpperStyle value=\"{0}\"/>\n", this.UpperStyle);
sb.AppendFormat("<UpperCount value=\"{0}\"/>\n", this.UpperCount);
sb.AppendFormat("<NumericStyle value=\"{0}\"/>\n", this.NumericStyle);
sb.AppendFormat("<NumericCount value=\"{0}\"/>\n", this.NumericCount);
sb.AppendLine("</ReadablePassphraseConfig>");
return sb.ToString();
}
private void UpdatePhraseDescription()
{
if (this.PhraseStrength != PhraseStrength.Custom && !Clause.RandomMappings.ContainsKey(this.PhraseStrength))
this.PhraseDescription = MurrayGrant.ReadablePassphrase.PhraseDescription.Clause.CreatePhraseDescription(this.PhraseStrength, null);
}
}
public enum MutatorOption
{
None,
Standard,
Custom,
}
}
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="txtPhraseDescription.ToolTip" xml:space="preserve">
<value>Shows all the options for how the phrase will be generated.
If you select phrase strength "custom", you can edit this.
Click the "More Help on Phrases" link for all the details on how phrases are defined.</value>
</data>
<metadata name="bgwWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>114, 17</value>
</metadata>
<metadata name="ofdCustomDictionary.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>229, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>396, 17</value>
</metadata>
</root>
\ No newline at end of file
This diff is collapsed.
// Copyright 2011 Murray Grant
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MurrayGrant.ReadablePassphrase.Dictionaries;
using MurrayGrant.ReadablePassphrase.Words;
namespace KeePassReadablePassphrase
{
public partial class DictionarySizeDetail : Form
{
private WordDictionary _Dictionary;
public DictionarySizeDetail(WordDictionary dictionary)
{
this._Dictionary = dictionary;
InitializeComponent();
}
private void DictionarySizeDetail_Load(object sender, EventArgs e)
{
this.txtNouns.Text = this._Dictionary.CountOf<Noun>().ToString("N0");
this.txtProperNouns.Text = this._Dictionary.CountOf<ProperNoun>().ToString("N0");
this.txtVerbs.Text = this._Dictionary.CountOf<Verb>().ToString("N0");
this.txtSpeechVerbs.Text = this._Dictionary.CountOf<SpeechVerb>().ToString("N0");
this.txtAdjectives.Text = this._Dictionary.CountOf<Adjective>().ToString("N0");
this.txtAdverbs.Text = this._Dictionary.CountOf<Adverb>().ToString("N0");
this.txtPrepositions.Text = this._Dictionary.CountOf<Preposition>().ToString("N0");
this.txtDemonstratives.Text = this._Dictionary.CountOf<Demonstrative>().ToString("N0");
this.txtTheArticle.Text = this._Dictionary.CountOf<Article>().ToString("N0");
this.txtPersonalPronouns.Text = this._Dictionary.CountOf<PersonalPronoun>().ToString("N0");
this.txtIndefinitePronouns.Text = this._Dictionary.CountOf<IndefinitePronoun>().ToString("N0");
this.txtInterrogatives.Text = this._Dictionary.CountOf<Interrogative>().ToString("N0");
this.txtConjunctions.Text = this._Dictionary.CountOf<Conjunction>().ToString("N0");
this.txtNumbers.Text = this._Dictionary.CountOf<Number>().ToString("N0");
this.txtTotal.Text = (this._Dictionary.CountOf<Noun>()
+ this._Dictionary.CountOf<ProperNoun>()
+ this._Dictionary.CountOf<Verb>()
+ this._Dictionary.CountOf<SpeechVerb>()
+ this._Dictionary.CountOf<Adjective>()
+ this._Dictionary.CountOf<Adverb>()
+ this._Dictionary.CountOf<Preposition>()
+ this._Dictionary.CountOf<Demonstrative>()
+ this._Dictionary.CountOf<Article>()
+ this._Dictionary.CountOf<PersonalPronoun>()
+ this._Dictionary.CountOf<Interrogative>()
+ this._Dictionary.CountOf<Conjunction>()
+ this._Dictionary.CountOf<IndefinitePronoun>()
+ this._Dictionary.CountOf<Number>()
).ToString("N0");
this.txtReconciledTotal