Changeset 777


Ignore:
Timestamp:
Oct 25, 2009, 12:07:59 PM (12 years ago)
Author:
Matthäus Wander
Message:
  • enabled more generic usage of ArrayIndexer and LengthOf
  • added ArrayIndexer, HMAC, LengthOf to setup
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/ArrayIndexer/ArrayIndexer.cs

    r711 r777  
    1 using System;
     1/*
     2   Copyright 2009 Christian Arnold, Uni Duisburg-Essen
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16using System;
    217using System.Collections.Generic;
    318using System.Linq;
     
    1227{
    1328    [Author("Christian Arnold", "christian.arnold@stud.uni-due.de", "Uni Duisburg-Essen", "")]
    14     [PluginInfo(true, "ArrayIndexer", "Content of the chosen index of the array", "", "ArrayIndexer/arrayindexer.png")]
     29    [PluginInfo(false, "ArrayIndexer", "Content of the chosen index of the array", "", "ArrayIndexer/arrayindexer.png")]
    1530
    1631    public class ArrayIndexer : IThroughput
     
    108123                }
    109124
    110                 if (ObjInput is string[])
    111                 {
    112                     ObjOutput = ((string[])ObjInput)[settings.ArrayIndex];
    113                 }
    114                 else if (ObjInput is byte[])
    115                 {
    116                     ObjOutput = ((byte[])ObjInput)[settings.ArrayIndex];
    117                 }
    118                 else if (ObjInput is int[])
    119                 {
    120                     ObjOutput = ((int[])ObjInput)[settings.ArrayIndex];
    121                 }
    122                 else
    123                 {
    124                     GuiLogMessage("Type of array not supported", NotificationLevel.Error);
    125                     return;
    126                 }
    127                 GuiLogMessage("Array type is " + ObjInput.GetType().ToString() + " with value: " + ObjOutput.ToString(), NotificationLevel.Info);
     125                ObjOutput = ObjInput.GetValue(settings.ArrayIndex);
     126
     127                GuiLogMessage("Array type is " + ObjInput.GetType().ToString() + " with value: " + ObjOutput.ToString(), NotificationLevel.Debug);
    128128            }
    129129        }
  • trunk/CrypPlugins/ArrayIndexer/ArrayIndexer.csproj

    r711 r777  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6     <ProductVersion>9.0.21022</ProductVersion>
     6    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    88    <ProjectGuid>{A066F077-B078-4234-BDD4-3632C0B3C18F}</ProjectGuid>
     
    7676  </Target>
    7777  -->
     78  <PropertyGroup>
     79    <PostBuildEvent>cd "$(ProjectDir)"
     80cd ..\..\CrypWin\$(OutDir)
     81if not exist "./CrypPlugins" mkdir "./CrypPlugins"
     82
     83del /S /Q /A:-S-R-H "$(TargetName)*.*"
     84copy "$(TargetDir)$(TargetName)*.*" "./CrypPlugins"
     85
     86if not exist "./Data" mkdir "./Data"
     87if exist "$(TargetDir)Data" xcopy /Y /S "$(TargetDir)Data" "./Data"
     88</PostBuildEvent>
     89  </PropertyGroup>
    7890</Project>
  • trunk/CrypPlugins/ArrayIndexer/ArrayIndexerSettings.cs

    r711 r777  
    1 using System;
     1/*
     2   Copyright 2009 Christian Arnold, Uni Duisburg-Essen
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16using System;
    217using System.Collections.Generic;
    318using System.Linq;
  • trunk/CrypPlugins/ArrayIndexer/Properties/AssemblyInfo.cs

    r711 r777  
    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/HMAC/HMACSettings.cs

    r771 r777  
    1 using System;
     1/*
     2   Copyright 2009 Holger Pretzsch, University of Duisburg-Essen
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16
     17using System;
    218using System.Collections.Generic;
    319using System.Linq;
  • trunk/CrypPlugins/LengthOf/LengthOf.cs

    r710 r777  
    1 using System;
     1/*
     2   Copyright 2009 Christian Arnold, Uni Duisburg-Essen
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16using System;
    217using System.Collections.Generic;
    318using System.Linq;
     
    924using System.ComponentModel;
    1025
    11 // Currently this PlugIn accepts every Array-Type, string and byte. In other cases a GuiMessage.Error is thrown.
     26// This PlugIn accepts every type. For arrays the number of elements is written.
     27// For everything else the number of characters of the object's string representation is shown.
    1228namespace Cryptool.Plugins.LengthOf
    1329{
     
    2137        private int outputLen = 0;
    2238
    23 
    2439        #region IPlugin Members
    2540
     
    2843            if (ObjInput != null)
    2944            {
    30                 Type typeInput = ObjInput.GetType();
    31                 if (typeInput.IsArray)
     45                if (ObjInput is Array)
    3246                {
    3347                    OutputLen = (ObjInput as Array).Length;
    34                     GuiLogMessage("Object is an array. Length: " + OutputLen, NotificationLevel.Info);
     48                    GuiLogMessage("Object is an array. Length: " + OutputLen, NotificationLevel.Debug);
    3549                }
    3650                else //no array
    3751                {
    38                     if (ObjInput is string)
    39                     {
    40                         string sInput = objInput as String;
    41                         OutputLen = sInput.Length;
    42                     }
    43                     else if (ObjInput is byte)
    44                     {
    45                         string sInput2 = ((byte)objInput).ToString();
    46                         OutputLen = sInput2.Length;
    47                     }
    48                     else
    49                     {
    50                         GuiLogMessage("Inputtype not handled!", NotificationLevel.Error);
    51                     }
    52                     //switch (typeInput.ToString())
    53                     //{
    54                     //    case "System.String":
    55                     //        string sInput = objInput as String;
    56                     //        OutputLen = sInput.Length;
    57                     //        break;
    58                     //    case "System.Byte":
    59                     //        string sInput2 = ((byte)objInput).ToString();
    60                     //        OutputLen = sInput2.Length;
    61                     //        break;
    62                     //    default:
    63                     //        GuiLogMessage("Inputtype not handled!", NotificationLevel.Error);
    64                     //        //throw new Exception("Inputtype not handled!");
    65                     //        break;
    66                     //}
    67                     GuiLogMessage("Object isn't an array. Length: " + OutputLen, NotificationLevel.Info);
     52                    OutputLen = ObjInput.ToString().Length;
     53                    GuiLogMessage("Object isn't an array. Length: " + OutputLen, NotificationLevel.Debug);
    6854                }
    6955            }
  • trunk/CrypPlugins/LengthOf/LengthOf.csproj

    r710 r777  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6     <ProductVersion>9.0.21022</ProductVersion>
     6    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    88    <ProjectGuid>{3ECF3335-7331-4E1A-942F-3340CDEC3EB9}</ProjectGuid>
     
    7676  </Target>
    7777  -->
     78  <PropertyGroup>
     79    <PostBuildEvent>cd "$(ProjectDir)"
     80cd ..\..\CrypWin\$(OutDir)
     81if not exist "./CrypPlugins" mkdir "./CrypPlugins"
     82
     83del /S /Q /A:-S-R-H "$(TargetName)*.*"
     84copy "$(TargetDir)$(TargetName)*.*" "./CrypPlugins"
     85
     86if not exist "./Data" mkdir "./Data"
     87if exist "$(TargetDir)Data" xcopy /Y /S "$(TargetDir)Data" "./Data"
     88</PostBuildEvent>
     89  </PropertyGroup>
    7890</Project>
  • trunk/CrypPlugins/LengthOf/LengthOfSettings.cs

    r710 r777  
    1 using System;
     1/*
     2   Copyright 2009 Christian Arnold, Uni Duisburg-Essen
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16using System;
    217using System.Collections.Generic;
    318using System.Linq;
  • trunk/CrypPlugins/LengthOf/Properties/AssemblyInfo.cs

    r710 r777  
    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/CrypTool 2.0.sln

    r771 r777  
    174174EndProject
    175175Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HMAC", "CrypPlugins\HMAC\HMAC.csproj", "{9DC8FE92-6839-4837-8AAA-D7456F2B288F}"
     176EndProject
     177Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArrayIndexer", "CrypPlugins\ArrayIndexer\ArrayIndexer.csproj", "{A066F077-B078-4234-BDD4-3632C0B3C18F}"
     178EndProject
     179Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LengthOf", "CrypPlugins\LengthOf\LengthOf.csproj", "{3ECF3335-7331-4E1A-942F-3340CDEC3EB9}"
    176180EndProject
    177181Global
     
    991995                {9DC8FE92-6839-4837-8AAA-D7456F2B288F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
    992996                {9DC8FE92-6839-4837-8AAA-D7456F2B288F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
     997                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Debug|.NET.ActiveCfg = Debug|Any CPU
     998                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     999                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1000                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
     1001                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
     1002                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Release|.NET.ActiveCfg = Release|Any CPU
     1003                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1004                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Release|Any CPU.Build.0 = Release|Any CPU
     1005                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
     1006                {A066F077-B078-4234-BDD4-3632C0B3C18F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
     1007                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Debug|.NET.ActiveCfg = Debug|Any CPU
     1008                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     1009                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1010                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
     1011                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
     1012                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Release|.NET.ActiveCfg = Release|Any CPU
     1013                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1014                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Release|Any CPU.Build.0 = Release|Any CPU
     1015                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
     1016                {3ECF3335-7331-4E1A-942F-3340CDEC3EB9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
    9931017        EndGlobalSection
    9941018        GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.