示例#1
0
 protected void OnGetDefault(PropertyDefaultArgs e)
 {
     if (PropertyDefaults != null)
     {
         PropertyDefaults(this, e);
     }
 }
示例#2
0
        /// <summary>
        /// Gets a property out of the collection.
        /// </summary>
        /// <returns>
        /// The property, or <code>null</code>, if the property wasn't found.
        /// </returns>
        /// <param name="key">
        /// The name of the property.
        /// </param>
        public object GetProperty(string key)
        {
            if (!_preferences.ContainsKey(key))
            {
                object def = null;

                PropertyDefaultArgs e = new PropertyDefaultArgs(key, def);
                OnGetDefault(e);
                if (e.Value != null)
                {
                    _preferences[key] = e.Value;
                    return(e.Value);
                }
            }

            object obj = _preferences[key];

            return(obj);
        }
示例#3
0
 /// <summary>
 /// Event handler for preferences class to get the default values.
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">default property arguments</param>
 internal void OnGetDefaultProperty(object sender, PropertyDefaultArgs e)
 {
     switch (e.Key)
     {
         case "TCPPort":
             e.Value=(ushort)4662;
             break;
         case "UDPPort":
             e.Value=(ushort)4672;
             break;
         case "UseEmuleProtocol":
             e.Value=true;
             break;
         case "MaxServerFails":
             e.Value=(short)2;
             break;
         case "UserName":
             e.Value="http://www.lphant.com";
             break;
         case "AutoReconnect":
             e.Value=true;
             break;
         case "ICHEnabled":
             e.Value=true;
             break;
         case "MaxUploadRate":
             e.Value=(float)10;
             break;
         case "AutoExtendSearch":
             e.Value=true;
             break;
         case "ID":
             e.Value=(uint)0;
             break;
         case "MaxDownloadRate":
             e.Value=55.0F;
             break;
         case "MaxConnections":
             e.Value=(int)140;
             break;
         case "QueueLength":
             e.Value=(int)200;
             break;
         case "MaxSourcesPerFile":
             e.Value=(int)900;
             break;
         case "RemoteControlEnabled":
             e.Value=false;
             break;
         case "DownloadServerMet":
             e.Value=false;
             break;
         case "ServerMetUri":
             e.Value="http://www.esel-paradies.de/server/best/server.met";
             break;
         case "AllowViewShared":
             e.Value=Constants.AllowViewShared.Nobody;
             break;
         case "UserHash":
             byte[] myHash=new Byte[16];
             Random rnd=new Random();
             rnd.NextBytes(myHash);
             // identify as eMule?
             if (Preferences.GetBool("UseEmuleProtocol", true))
             {
                 myHash[5]=14;
                 myHash[14]=111;
             }
             e.Value=myHash;
             break;
         case "SharedFolders":
             string[] sharedFolders=new string[1];
             Directory.CreateDirectory(DllDirectory+"incoming");
             sharedFolders[0]=DllDirectory+"incoming";
             e.Value=sharedFolders;
             break;
         case "TempFolders":
             string[] tempFolders=new string[1];
             Directory.CreateDirectory(DllDirectory+"temp");
             tempFolders[0]=DllDirectory+"temp";
             e.Value=tempFolders;
             break;
         case "RemoteControlPort":
             Random rnd2=new Random();
             e.Value=rnd2.Next(6000,8000);
             break;
         case "RemotePassword":
             Random rnd3=new Random();
             byte[] bPass=new byte[10];
             rnd3.NextBytes(bPass);
             e.Value=CKernel.HashToString(bPass);
             break;
         case "Language":
             e.Value=CultureInfo.CurrentCulture.Name;
             break;
         case "OSigEnabled":
             e.Value=false;
             break;
         case "UpdateServerListFromClient":
             e.Value=false;
             break;
         case "UpdateServerListFromServer":
             e.Value=true;
             break;
         case "IPFilterEnabled":
             e.Value=false;
             break;
         case "ReceiveMessageFromFriendOnly":
             e.Value=false;
             break;
         case "CompressionMethod":
             e.Value="Zip";
             break;
         case "StartNextStoppedFile":
             e.Value=false;
             break;
     }
 }
示例#4
0
 internal void OnGetDefaultProperty(object sender, PropertyDefaultArgs e)
 {
     switch (e.Key)
     {
         case "MinimizeToTray":
             e.Value=true;
             break;
         case "TaskBarNotifier":
             e.Value=true;
             break;
         case "PreviewPlayer":
             e.Value="";
             break;
         case "StartupConnectionSelect":
             e.Value=false;
             break;
         case "Language":
             e.Value=CultureInfo.CurrentCulture.Name;
             break;
         case "eLinkFromBrowserStopped":
             e.Value=false;
             break;
         case "FilterShowCount":
             e.Value=true;
             break;
         case "FilterShowTotalSizes":
             e.Value=true;
             break;
         case "AutoSort":
             e.Value=false;
             break;
     }
 }
示例#5
0
 protected void OnGetDefault(PropertyDefaultArgs e)
 {
     if (PropertyDefaults != null)
     {
         PropertyDefaults(this, e);
     }
 }
示例#6
0
        /// <summary>
        /// Gets a property out of the collection.
        /// </summary>
        /// <returns>
        /// The property, or <code>null</code>, if the property wasn't found.
        /// </returns>
        /// <param name="key">
        /// The name of the property.
        /// </param>
        public object GetProperty(string key)
        {
            if (!_preferences.ContainsKey(key))
            {
                object def = null;

                PropertyDefaultArgs e = new PropertyDefaultArgs(key, def);
                OnGetDefault(e);
                if (e.Value != null)
                {
                    _preferences[key] = e.Value;
                    return e.Value;
                }
            }

            object obj = _preferences[key];

            return obj;
        }