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

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.

Dictionary:

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

WordPatterns:

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

AnotherEditor:

  • 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 :-)

Location:
trunk/CrypPlugins/WordPatterns
Files:
6 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • 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("1.0.0.0")]
    36 [assembly: AssemblyFileVersion("1.0.0.0")]
     35[assembly: AssemblyVersion("2.0.*")]
     36//[assembly: AssemblyFileVersion("1.0.0.0")]
  • trunk/CrypPlugins/WordPatterns/WordPatterns.cs

    r510 r511  
    3131
    3232            private string inputText;
    33             private string inputDict;
     33            private string[] inputDict;
    3434            private string outputText;
    3535
     
    5757
    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
     135
     136                while (wordCount < inputDict.Length && !stop)
    136137                {
    137                     string word = enumerator.Current;
     138                    string word = inputDict[wordCount];
    138139                    Pattern p = new Pattern(word);
    139140
     
    147148                    if (++wordCount % 10000 == 0)
    148149                    {
    149                         ProgressChanged(enumerator.Position, enumerator.Length);
     150                        ProgressChanged(wordCount, inputDict.Length);
    150151                    }
    151152                }
    152153
    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"
    9298
    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"
     101
     102if not exist "./Data" mkdir "./Data"
     103xcopy /Y /S "$(TargetDir)Data" "./Data"
     104</PostBuildEvent>
    95105  </PropertyGroup>
    96106</Project>
Note: See TracChangeset for help on using the changeset viewer.