Changeset 975 for trunk/CrypPluginBase


Ignore:
Timestamp:
Dec 10, 2009, 2:32:26 PM (12 years ago)
Author:
Matthäus Wander
Message:

CrypPluginBase:

  • centralized directory pathes to static DirectoryHelper
  • adapted Enigma and QuadraticSieve to use tempdir pathes from DirectoryHelper

BooleanOperators:

  • surrounded broken UI code snippet with Dispatcher call

Gate:

  • removed broken sample
Location:
trunk/CrypPluginBase
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPluginBase/CrypPluginBase.csproj

    r948 r975  
    6464    <Compile Include="Control\IControlCost.cs" />
    6565    <Compile Include="Control\IControlEncryption.cs" />
     66    <Compile Include="IO\DirectoryHelper.cs" />
    6667    <Compile Include="Miscellaneous\DataManager.cs" />
    6768    <Compile Include="IApplication.cs" />
     
    8788      <SubType>Code</SubType>
    8889    </Compile>
    89     <Compile Include="Miscellaneous\PluginResource.cs" />
    9090    <Compile Include="Miscellaneous\Tokenizer.cs" />
    9191    <Compile Include="PluginExtension.cs" />
  • trunk/CrypPluginBase/IO/CryptoolStream.cs

    r947 r975  
    2222    public class CryptoolStream : Stream
    2323    {
    24         private const string TempDirectoryName = "CrypTool Temp Files";
    2524        private const string TempFileExtension = "csf";
    2625
    27         private static readonly string directoryName;
    2826        private string fileName;
    2927        private FileStream fileStream;
    3028        private bool isReadOnly;
    31 
    32         static CryptoolStream()
    33         {
    34           directoryName = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), TempDirectoryName), Guid.NewGuid().ToString());
    35           if (!Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName);
    36         }
    37 
    38         public static string TemporaryDirectoryName
    39         {
    40             get { return directoryName; }
    41         }
    4229
    4330        public string FileName
     
    11299          try
    113100          {
    114             this.fileName = Path.Combine(directoryName, Guid.NewGuid() + "." + TempFileExtension);
     101            if (!Directory.Exists(DirectoryHelper.DirectoryLocalTemp)) Directory.CreateDirectory(DirectoryHelper.DirectoryLocalTemp);
     102
     103            this.fileName = DirectoryHelper.GetNewTempFilePath(TempFileExtension);
    115104            this.fileStream = new FileStream(this.fileName, FileMode.CreateNew);
    116105
     
    179168            else
    180169            {
    181                 this.fileName = Path.Combine(directoryName, Guid.NewGuid() + "." + TempFileExtension);
     170                if (!Directory.Exists(DirectoryHelper.DirectoryLocalTemp)) Directory.CreateDirectory(DirectoryHelper.DirectoryLocalTemp);
     171
     172                this.fileName = DirectoryHelper.GetNewTempFilePath(TempFileExtension);
    182173                this.fileStream = new FileStream(this.fileName, FileMode.CreateNew);
    183174            }
     
    242233        public static void CleanTempFiles()
    243234        {
    244             foreach (FileInfo fInfo in new DirectoryInfo(directoryName).GetFiles("*." + TempFileExtension))
     235            foreach (FileInfo fInfo in new DirectoryInfo(DirectoryHelper.DirectoryLocalTemp).GetFiles("*." + TempFileExtension))
    245236            {
    246237              fInfo.Delete();
     
    251242        {
    252243          CleanTempFiles();
    253           Directory.Delete(directoryName);
     244          Directory.Delete(DirectoryHelper.DirectoryLocalTemp);
    254245        }
    255246
Note: See TracChangeset for help on using the changeset viewer.