Changeset 794


Ignore:
Timestamp:
Oct 28, 2009, 3:09:01 PM (12 years ago)
Author:
arnold
Message:

Update von P2PPlugins (DHTremove hat noch einen Fehler, daher wurde die Funktionalität auskommentiert).

Location:
trunk
Files:
6 added
5 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerBase/P2PPeer.cs

    r789 r794  
    2828{
    2929    [Author("Christian Arnold", "arnold@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    30     [PluginInfo(false, "P2P_Peer", "Creates a new Peer", "", "PeerToPeerBase/ct2_p2p_load_medium.png")]
     30    [PluginInfo(false, "P2P_Peer", "Creates a new Peer", "", "PeerToPeerBase/ct2_p2p_system_icon_medium.png")]
    3131    public class P2PPeer : IIOMisc
    3232    {
     
    144144        #region In and Output
    145145
    146         private IP2PControl p2pMaster;
    147         [PropertyInfo(Direction.ControlMaster, "Master Peer", "One peer to rule them all", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
    148         public IP2PControl P2PControlMaster
     146        private IP2PControl p2pSlave;
     147        [PropertyInfo(Direction.ControlSlave, "Master Peer", "One peer to rule them all", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
     148        public IP2PControl P2PControlSlave
    149149        {
    150150            get
    151151            {
    152                 if (this.p2pMaster == null)
     152                if (this.p2pSlave == null)
    153153                    // to commit the settings of the plugin to the IControl
    154                     this.p2pMaster = new P2PPeerMaster(p2pBase);
    155                 return this.p2pMaster;
     154                    this.p2pSlave = new P2PPeerMaster(p2pBase);
     155                return this.p2pSlave;
    156156            }
    157157            set
    158158            {
    159                 if (this.p2pMaster != null)
    160                     this.p2pMaster.OnStatusChanged -= p2pMaster_OnStatusChanged;
     159                if (this.p2pSlave != null)
     160                    this.p2pSlave.OnStatusChanged -= p2pSlave_OnStatusChanged;
    161161                //{
    162162                //    //Only when using asynchronous p2p-Start-method, remove event handler for OnPeerJoinedCompletely
    163                 //    this.p2pMaster.onPeerJoinedCompletely -= OnPeerJoinedCompletely;
     163                //    this.p2pSlave.OnPeerJoinedCompletely -= OnPeerJoinedCompletely;
    164164                //}
    165                 if (this.p2pMaster != value)
     165                if (this.p2pSlave != value)
    166166                {
    167                     this.p2pMaster.OnStatusChanged +=new IControlStatusChangedEventHandler(p2pMaster_OnStatusChanged);
     167                    this.p2pSlave.OnStatusChanged +=new IControlStatusChangedEventHandler(p2pSlave_OnStatusChanged);
    168168                    //Only when using asynchronous p2p-Start-method, add event handler for OnPeerJoinedCompletely
    169                     //this.p2pMaster.OnPeerJoinedCompletely += new PeerJoinedP2P(OnPeerJoinedCompletely);
    170                     this.p2pMaster = value;
    171                     OnPropertyChanged("P2PControlMaster");
     169                    //this.p2pSlave.OnPeerJoinedCompletely += new PeerJoinedP2P(OnPeerJoinedCompletely);
     170                    this.p2pSlave = value;
     171                    OnPropertyChanged("P2PControlSlave");
    172172                }
    173173            }
    174174        }
    175175
    176         void p2pMaster_OnStatusChanged(IControl sender, bool readyForExecution)
     176        void p2pSlave_OnStatusChanged(IControl sender, bool readyForExecution)
    177177        {
    178178            if (readyForExecution)
     
    206206        public bool DHTremove(string sKey)
    207207        {
    208             return this.p2pBase.SynchRemove(sKey);
     208            // derzeit liegt wohl in peerq@play ein Fehler in der Methode...
     209            // erkennt den Übergabeparameter nicht an und wirft dann "ArgumentNotNullException"...
     210            // Problem an M.Helling und S.Holzapfel von p@p weitergegeben...
     211            // return this.p2pBase.SynchRemove(sKey);
     212            return false;
    209213        }
    210214
  • trunk/CrypPlugins/PeerToPeerBase/PeerToPeerBase.cs

    r783 r794  
    4040 *
    4141 * TODO:
    42  * Testing asynchronous methods incl. EventHandlers
     42 * - dht.Remove-Method makes problems... "ArgumentNotNullException"
     43 *   event though the Parameter is correctly set to a valid value!
     44 *   --> forwarded to the p@p-Team
     45 * - Testing asynchronous methods incl. EventHandlers
    4346 *
    4447 * TO DO in Related Projects:
     
    8386        #endregion
    8487
    85 
    8688        #region Variables
    8789
     
    344346            AutoResetEvent are = new AutoResetEvent(false);
    345347            // this method returns always a GUID to distinguish between asynchronous actions
     348
     349            // ROAD WORKS: This function throws an error (ArgumentNotNullException).
     350            //             I think that's an error in the p@p-environment --> forwarded to the p@p-Team
    346351            Guid g = this.dht.Remove(OnSynchRemoveCompleted, sKey);
    347352
  • trunk/CrypPlugins/PeerToPeerBase/PeerToPeerBase.csproj

    r789 r794  
    113113  </ItemGroup>
    114114  <ItemGroup>
    115     <Resource Include="ct2_p2p_load_medium.png" />
    116   </ItemGroup>
    117   <ItemGroup>
    118     <None Include="C:\Users\Munin\Desktop\P2PMaster.cd">
    119       <Link>P2PMaster.cd</Link>
    120     </None>
     115    <Resource Include="ct2_p2p_system_icon_medium.png" />
     116    <Resource Include="ct2_p2p_system_icon_small.png" />
     117    <Resource Include="ct2_p2p_system_icon_tall.png" />
    121118  </ItemGroup>
    122119  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/CrypPlugins/PeerToPeer_DHTstore/P2PDHTstore.cs

    r783 r794  
    2929namespace Cryptool.Plugins.PeerToPeer
    3030{
     31    /// <summary>
     32    /// This PlugIn only works, when its connected with a P2P_Peer object.
     33    /// </summary>
    3134    [Author("Christian Arnold", "arnold@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    32     [PluginInfo(false, "P2P_DHTstore", "Storing data in DHT", "", "PeerToPeer_DHTstore/ct2_p2p_store_medium.png")]
     35    [PluginInfo(false, "P2P_DHTstore", "Storing data in DHT", "", "PeerToPeer_DHTstore/ct2_dht_store_icon_medium.png")]
    3336    public class P2P_DHTstore : IInput
    3437    {
     
    3740        #region In and Output
    3841
    39         private IP2PControl p2pSlave;
    40         [PropertyInfo(Direction.ControlSlave,"P2P Slave","Input the P2P-Peer-PlugIn","",true,false,DisplayLevel.Beginner,QuickWatchFormat.Text,null)]
    41         public IP2PControl P2PSlave
     42        private IP2PControl p2pMaster;
     43        /// <summary>
     44        /// Catches the completely configurated, initialized and joined P2P object from the P2PPeer-Slave-PlugIn.
     45        /// </summary>
     46        [PropertyInfo(Direction.ControlMaster,"P2P Slave","Input the P2P-Peer-PlugIn","",true,false,DisplayLevel.Beginner,QuickWatchFormat.Text,null)]
     47        public IP2PControl P2PMaster
    4248        {
    4349            get
    4450            {
    45                 if (this.p2pSlave == null)
     51                return this.p2pMaster;
     52            }
     53            set
     54            {
     55                if (p2pMaster != null)
    4656                {
    47                     //TO DO: überlegen wie Parameter übergeben werden...
    48                     p2pSlave = new Cryptool.Plugins.PeerToPeer.P2PPeerMaster(null);
     57                    p2pMaster.OnStatusChanged -= P2PMaster_OnStatusChanged;
    4958                }
    50                 return this.p2pSlave;
    51             }
     59                if (value != null)
     60                {
     61                    value.OnStatusChanged += new IControlStatusChangedEventHandler(P2PMaster_OnStatusChanged);
     62                    p2pMaster = (P2PPeerMaster)value;
     63                    OnPropertyChanged("P2PMaster");
     64                }
     65                else
     66                {
     67                    p2pMaster = null;
     68                }
     69            }
     70        }
     71
     72        private void P2PMaster_OnStatusChanged(IControl sender, bool readyForExecution)
     73        {
     74            //throw new NotImplementedException();
    5275        }
    5376
     
    121144        public void Execute()
    122145        {
    123             if (P2PSlave != null && DhtKey != null && DhtValue != null)
    124             {
    125                 P2PSlave.DHTstore(DhtKey, DhtKey);
     146            // if no P2P Slave PlugIn is connected with this PlugIn --> No execution!
     147            if (P2PMaster == null)
     148            {
     149                GuiLogMessage("No P2P_Peer connected with this PlugIn!", NotificationLevel.Error);
     150                return;
     151            }
     152            if (DhtKey != null && DhtValue != null)
     153            {
     154                P2PMaster.DHTstore(DhtKey, DhtKey);
    126155                GuiLogMessage("KeyValue-Pair will be stored in the DHT Entry '" + DhtKey + "'. Value: " + DhtValue, NotificationLevel.Info);
    127156            }
    128157            else
    129158            {
    130                 GuiLogMessage("No key and/or value in inputs", NotificationLevel.Error);
     159                GuiLogMessage("No key and/or value in inputs. Storing isn't possible.", NotificationLevel.Error);
    131160            }
    132161        }
     
    177206
    178207        #endregion
    179 
    180         internal void LogInternalState()
    181         {
    182             throw new NotImplementedException();
    183         }
    184208    }
    185209}
  • trunk/CrypPlugins/PeerToPeer_DHTstore/PeerToPeer_DHTstore.csproj

    r783 r794  
    7070  </ItemGroup>
    7171  <ItemGroup>
    72     <Resource Include="ct2_p2p_store_medium.png" />
     72    <Resource Include="ct2_dht_store_icon_medium.png" />
     73    <Resource Include="ct2_dht_store_icon_small.png" />
     74    <Resource Include="ct2_dht_store_icon_tall.png" />
    7375  </ItemGroup>
    7476  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/CrypTool 2.0.sln

    r789 r794  
    188188EndProject
    189189Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLK", "CrypPlugins\CLK\CLK.csproj", "{1B04DDAA-3DA9-4AC9-85C0-E819C790CA34}"
     190EndProject
     191Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PeerToPeer_DHTload", "CrypPlugins\PeerToPeer_DHTload\PeerToPeer_DHTload.csproj", "{2E31391D-225F-4DCF-BB65-806D714BC314}"
     192EndProject
     193Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PeerToPeer_DHTremove", "CrypPlugins\PeerToPeer_DHTremove\PeerToPeer_DHTremove.csproj", "{D7940152-CBCF-4A65-96BB-6BEDB20DED7E}"
    190194EndProject
    191195Global
     
    10751079                {1B04DDAA-3DA9-4AC9-85C0-E819C790CA34}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
    10761080                {1B04DDAA-3DA9-4AC9-85C0-E819C790CA34}.Release|Mixed Platforms.Build.0 = Release|Any CPU
     1081                {2E31391D-225F-4DCF-BB65-806D714BC314}.Debug|.NET.ActiveCfg = Debug|Any CPU
     1082                {2E31391D-225F-4DCF-BB65-806D714BC314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     1083                {2E31391D-225F-4DCF-BB65-806D714BC314}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1084                {2E31391D-225F-4DCF-BB65-806D714BC314}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
     1085                {2E31391D-225F-4DCF-BB65-806D714BC314}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
     1086                {2E31391D-225F-4DCF-BB65-806D714BC314}.Release|.NET.ActiveCfg = Release|Any CPU
     1087                {2E31391D-225F-4DCF-BB65-806D714BC314}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1088                {2E31391D-225F-4DCF-BB65-806D714BC314}.Release|Any CPU.Build.0 = Release|Any CPU
     1089                {2E31391D-225F-4DCF-BB65-806D714BC314}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
     1090                {2E31391D-225F-4DCF-BB65-806D714BC314}.Release|Mixed Platforms.Build.0 = Release|Any CPU
     1091                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Debug|.NET.ActiveCfg = Debug|Any CPU
     1092                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     1093                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
     1094                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
     1095                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
     1096                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Release|.NET.ActiveCfg = Release|Any CPU
     1097                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
     1098                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Release|Any CPU.Build.0 = Release|Any CPU
     1099                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
     1100                {D7940152-CBCF-4A65-96BB-6BEDB20DED7E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
    10771101        EndGlobalSection
    10781102        GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.