Sep 14, 2009, 2:12:27 AM (12 years ago)
Matthäus Wander

Added new concept of central data files:

  • added new directory "Data" to CT2. It may consist of several subdirectories with different types of data. Currently there is only "wordlists".
  • Plugins can use new class DataManager to automatically loads a list of all available data files of a given type.
  • for each data file there may be an optional file with metainformation. This metafile must have the suffix ".metainfo" to a given existing file name (including file extension).
  • the metafiles are simple text files with a "key=value" format
  • all keys are read by DataManager and made available via class DataMetaFileInfo
  • the user may add additional wordlist files without any code or configuration changes
  • DataManager was ought to be part of CrypCore but it uses the Tokenizer which is part of CrypPluginBase. Therefore the DataManager has been moved to CrypPluginBase for now.


  • changed Dictionary to use the above DataManager concept
  • added new string[] output
  • marked existing string output as deprecated


  • changed dictionary input to use the string[] property
  • adapted project sample to use Dictionary instead of FileInput


  • added QuickWatchView of any array type as text

The deployment of build-in datafiles is currently designed as the following example of Dictionary explains: (subject to change)

  • Create directory Data/wordlists and move data files into there
  • Create metafiles for data files (optional step)
  • Assure data files (and metafiles) have the following properties:
    • Build Action: none
    • Copy: Copy always
  • Change the PostBuild events to the following code snippet: (note that the assembly name has been replaced by a variable, which is useful for all plugins, even if not using data files)
cd "$(ProjectDir)"
cd ..\..\CrypWin\$(OutDir)
if not exist "./CrypPlugins" mkdir "./CrypPlugins"

del /F /S /Q /s /q "$(TargetName)*.*"
copy "$(TargetDir)$(TargetName)*.*" "./CrypPlugins"

if not exist "./Data" mkdir "./Data"
xcopy /Y /S "$(TargetDir)Data" "./Data"

Disclaimer: It's late. This revision may contain errors :-)

6 added
2 deleted
3 edited


  • trunk/CrypPlugins/WordPatterns/Properties/AssemblyInfo.cs

    r435 r511  
    66// set of attributes. Change these attribute values to modify the information
    77// associated with an assembly.
    8 [assembly: AssemblyTitle("PatternSearch")]
     8[assembly: AssemblyTitle("WordPatterns")]
    99[assembly: AssemblyDescription("")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
    12 [assembly: AssemblyProduct("PatternSearch")]
     12[assembly: AssemblyProduct("WordPatterns")]
    1313[assembly: AssemblyCopyright("Copyright ©  2009")]
    1414[assembly: AssemblyTrademark("")]
    3333// by using the '*' as shown below:
    3434// [assembly: AssemblyVersion("1.0.*")]
    35 [assembly: AssemblyVersion("")]
    36 [assembly: AssemblyFileVersion("")]
     35[assembly: AssemblyVersion("2.0.*")]
     36//[assembly: AssemblyFileVersion("")]
  • trunk/CrypPlugins/WordPatterns/WordPatterns.cs

    r510 r511  
    3232            private string inputText;
    33             private string inputDict;
     33            private string[] inputDict;
    3434            private string outputText;
    5858        [PropertyInfo(Direction.InputData, "Input dictionary", "Word dictionary", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
    59         public string InputDict
     59        public string[] InputDict
    6060        {
    6161            get
    6666            {
    6767                inputDict = value;
     68                dictPatterns = null; // force rebuild of dictionary patterns
    6869                OnPropertyChanged("InputDict");
    6970            }
    132133                dictPatterns = new Dictionary<Pattern, IList<string>>();
    133134                int wordCount = 0;
    134                 WordEnumerator enumerator = WordTokenizer.tokenize(inputDict).GetCustomEnumerator();
    135                 while(enumerator.MoveNext() && !stop) // has next
     136                while (wordCount < inputDict.Length && !stop)
    136137                {
    137                     string word = enumerator.Current;
     138                    string word = inputDict[wordCount];
    138139                    Pattern p = new Pattern(word);
    147148                    if (++wordCount % 10000 == 0)
    148149                    {
    149                         ProgressChanged(enumerator.Position, enumerator.Length);
     150                        ProgressChanged(wordCount, inputDict.Length);
    150151                    }
    151152                }
    153                 ProgressChanged(enumerator.Position, enumerator.Length);
     154                ProgressChanged(wordCount, inputDict.Length);
    154155                GuiLogMessage(string.Format("Processed {0} words from dictionary.", wordCount), NotificationLevel.Info);
    155156            }
  • trunk/CrypPlugins/WordPatterns/WordPatterns.csproj

    r438 r511  
    6969  </ItemGroup>
    7070  <ItemGroup>
    71     <None Include="WordPatterns_deutsch.txt">
     71    <None Include="Data\wordlists\WordPatterns_deutsch.txt">
     72      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     73    </None>
     74    <None Include="Data\wordlists\WordPatterns_english.txt">
    7275      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    7376    </None>
    7477  </ItemGroup>
    7578  <ItemGroup>
    76     <None Include="WordPatterns_english.txt">
     79    <None Include="Data\wordlists\WordPatterns_deutsch.txt.metainfo">
     80      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     81    </None>
     82    <None Include="Data\wordlists\WordPatterns_english.txt.metainfo">
    7783      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    7884    </None>
    9197if not exist "./CrypPlugins" mkdir "./CrypPlugins"
    93 del /F /S /Q /s /q "WordPatterns*.*"
    94 copy "$(TargetDir)WordPatterns*.*" "./CrypPlugins"</PostBuildEvent>
     99del /F /S /Q /s /q "$(TargetName)*.*"
     100copy "$(TargetDir)$(TargetName)*.*" "./CrypPlugins"
     102if not exist "./Data" mkdir "./Data"
     103xcopy /Y /S "$(TargetDir)Data" "./Data"
    95105  </PropertyGroup>
Note: See TracChangeset for help on using the changeset viewer.