Changeset 1611 for trunk/CrypP2P


Ignore:
Timestamp:
Jun 9, 2010, 12:44:27 AM (12 years ago)
Author:
Paul Lelgemann
Message:

o CrypWin: P2P world button always visible
o Changed behaviour of command line option "-p2p" and "-peer2peer": triggers autoconnect to peer-to-peer network during startup of CrypTool
o P2PEditor: "Start" button disabled and moved to settings pane for consistency
o CrypP2P: local workspace path is set to "%TEMP%/CrypTool", if not specified before
+ PeerToPeerProxy has a new setting to enable autoconnecting the peer-to-peer network, if it is not connected during workspace start

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/P2PManager.cs

    r1589 r1611  
    1616
    1717using System;
    18 using System.Windows.Forms;
     18using System.IO;
    1919using Cryptool.P2P.Internal;
    2020using Cryptool.P2P.Worker;
     
    3636        {
    3737            P2PBase = new P2PBase(this);
     38            ValidateSettings();
    3839
    3940            // to forward event from overlay/dht MessageReceived-Event from P2PBase
     
    4748        public P2PBase P2PBase { get; private set; }
    4849        public bool IsP2PConnecting { get; internal set; }
     50        public bool IsAutoconnectConsoleOptionSet { get; set; }
    4951
    5052        #endregion
     
    8890        public void HandleConnectOnStartup()
    8991        {
    90             if (P2PSettings.Default.ConnectOnStartup && IsReadyToConnect())
     92            var isAutoconnectConfiguredOrRequested = P2PSettings.Default.ConnectOnStartup || IsAutoconnectConsoleOptionSet;
     93            var isReadyToConnect = IsReadyToConnect();
     94
     95            if (isReadyToConnect && isAutoconnectConfiguredOrRequested)
    9196            {
    9297                GuiLogMessage("Connect on startup enabled. Establishing connection...", NotificationLevel.Info);
     
    122127            if (OnPeerMessageReceived != null)
    123128                OnPeerMessageReceived(sourceAddr, data);
     129        }
     130
     131        private static void ValidateSettings()
     132        {
     133            if (String.IsNullOrEmpty(P2PSettings.Default.WorkspacePath))
     134            {
     135                var tempForUser = Path.Combine(Path.GetTempPath(), "CrypTool2");
     136                Directory.CreateDirectory(tempForUser);
     137                P2PSettings.Default.WorkspacePath = tempForUser;
     138                P2PSettings.Default.Save();
     139            }
    124140        }
    125141
Note: See TracChangeset for help on using the changeset viewer.