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/CrypPlugins/PeerToPeer_DHTstore
Files:
3 added
3 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • 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" />
Note: See TracChangeset for help on using the changeset viewer.