Пример #1
0
        /*krnGateway.OnRefreshShared+=new RefreshEvent(m_InvokeOnRefreshShared);
            krnGateway.OnNewSharedFile+=new FileEvent(m_InvokeOnNewSharedFile);
            krnGateway.OnRemovedSharedFile+=new FileEvent(m_InvokeOnRemovedSharedFile);*/
        public void loadSharedFiles()
        {
            krnGateway.RefreshSharedList();
            InterfaceFile[] shareds=krnGateway.GetSharedFileList();
            preferences = krnGateway.GetConfig();

            foreach (InterfaceFile file in shareds)
            {
                store.AppendValues(file.Name,file.Size.ToString(),file.DownloadPriority.ToString(),
                                           file.PercentCompleted.ToString());
            }
        }
Пример #2
0
        /*krnGateway.OnRefreshShared+=new RefreshEvent(m_InvokeOnRefreshShared);
         *      krnGateway.OnNewSharedFile+=new FileEvent(m_InvokeOnNewSharedFile);
         *      krnGateway.OnRemovedSharedFile+=new FileEvent(m_InvokeOnRemovedSharedFile);*/
        public void loadSharedFiles()
        {
            krnGateway.RefreshSharedList();
            InterfaceFile[] shareds = krnGateway.GetSharedFileList();
            preferences = krnGateway.GetConfig();

            foreach (InterfaceFile file in shareds)
            {
                store.AppendValues(file.Name, file.Size.ToString(), file.DownloadPriority.ToString(),
                                   file.PercentCompleted.ToString());
            }
        }
Пример #3
0
 public void SetConfig(InterfacePreferences config)
 {
     CKernel.Preferences.SetProperty("AutoExtendSearch", config.autoextendSearch);
     CKernel.Preferences.SetProperty("AutoReconnect", config.Autoreconect);
     CKernel.Preferences.SetProperty("ICHEnabled", config.ICHEnabled);
     CKernel.Preferences.SetProperty("MaxConnections", config.maxConnexions);
     CKernel.Preferences.SetProperty("MaxServerFails", config.maxServerFails);
     CKernel.Preferences.SetProperty("MaxSourcesPerFile", config.maxSources);
     CKernel.Preferences.SetProperty("MaxUploadRate", config.maxUploadRate);
     CKernel.Preferences.SetProperty("MaxDownloadRate", config.maxDownloadRate);
     //CKernel.Preferences.SetProperty("QueueLength", config.queueLength);
     CKernel.Preferences.SetProperty("SharedFolders", config.sharedFolders);
     CKernel.Preferences.SetProperty("TempFolders", config.TempFolders);
     CKernel.Preferences.SetProperty("UDPPort", config.UDPPort);
     CKernel.Preferences.SetProperty("TCPPort", config.TCPPort);
     CKernel.Preferences.SetProperty("UseEmuleProtocol", config.UseeMuleProtocol);
     CKernel.Preferences.SetProperty("UserName", (config.UserName.Length==0)?"http://www.lphant.com":config.UserName);
     CKernel.Preferences.SetProperty("RemoteControlEnabled", config.RemoteControlEnabled);
     CKernel.Preferences.SetProperty("DownloadServerMet", config.DownloadServerMet);
     CKernel.Preferences.SetProperty("ServerMetUri", config.ServerMetUri);
     CKernel.Preferences.SetProperty("Language", config.Language);
     CKernel.Preferences.SetProperty("AllowViewShared", config.AllowViewShared);
     CKernel.Preferences.SetProperty("UseEmuleProtocol", true);
     //CKernel.Preferences.SetProperty("QueueLength", 200);
     CKernel.Preferences.SetProperty("AutoExtendSearch", true);
     CKernel.Preferences.SetProperty("RemoteControlPort",config.RemoteControlPort);
     if (config.RemoteControlPassword!="*****")
         CKernel.Preferences.SetProperty("RemotePassword",config.RemoteControlPassword);
     CKernel.Preferences.SetProperty("OSigEnabled", config.OSigEnabled);
     CKernel.Preferences.SetProperty("IPFilterEnabled", config.IPFilterEnabled);
     //CKernel.Preferences.SetProperty("UpdateServerListFromClient", false);
     //CKernel.Preferences.SetProperty("UpdateServerListFromServer", true);
     CKernel.Preferences.SetProperty("CompressionMethod", config.CompressionMethod);
     CKernel.Preferences.SetProperty("AllowedIP",config.AllowedIP);
     CKernel.Preferences.SetProperty("StartNextStoppedFile",config.StartNextStoppedFile);
 }
Пример #4
0
        public InterfacePreferences GetConfig()
        {
            InterfacePreferences config=new InterfacePreferences();

            config.autoextendSearch=CKernel.Preferences.GetBool("AutoExtendSearch");
            config.Autoreconect=CKernel.Preferences.GetBool("AutoReconnect");
            config.ICHEnabled=CKernel.Preferences.GetBool("ICHEnabled");
            config.maxConnexions=CKernel.Preferences.GetInt("MaxConnections");
            config.maxDownloadRate=CKernel.Preferences.GetFloat("MaxDownloadRate");
            config.maxServerFails=CKernel.Preferences.GetShort("MaxServerFails");
            config.maxSources=CKernel.Preferences.GetInt("MaxSourcesPerFile");
            config.maxUploadRate=CKernel.Preferences.GetFloat("MaxUploadRate");
            config.queueLength=CKernel.Preferences.GetInt("QueueLength");
            config.sharedFolders=CKernel.Preferences.GetStringArray("SharedFolders");
            config.TempFolders=CKernel.Preferences.GetStringArray("TempFolders");
            config.UDPPort=CKernel.Preferences.GetUShort("UDPPort");
            config.TCPPort=CKernel.Preferences.GetUShort("TCPPort");
            config.UseeMuleProtocol=CKernel.Preferences.GetBool("UseEmuleProtocol");
            config.UserName=CKernel.Preferences.GetString("UserName");
            config.UserID=CKernel.Preferences.GetUInt("ID");
            config.RemoteControlEnabled=CKernel.Preferences.GetBool("RemoteControlEnabled");
            config.DownloadServerMet=CKernel.Preferences.GetBool("DownloadServerMet");
            config.ServerMetUri=CKernel.Preferences.GetString("ServerMetUri");
            config.Language=CKernel.Preferences.GetString("Language");
            config.AllowViewShared=(Constants.AllowViewShared)CKernel.Preferences.GetEnum("AllowViewShared", Constants.AllowViewShared.Nobody);
            config.RemoteControlPort=CKernel.Preferences.GetInt("RemoteControlPort");
            config.RemoteControlPassword="******";//CKernel.Preferences.GetString("RemotePassword");
            config.OSigEnabled=CKernel.Preferences.GetBool("OSigEnabled");
            config.IPFilterEnabled=CKernel.Preferences.GetBool("IPFilterEnabled");
            config.StartNextStoppedFile=CKernel.Preferences.GetBool("StartNextStoppedFile");
            //config.UpdateServerListFromClient = CKernel.Preferences.GetBool("UpdateServerListFromClient");
            //config.UpdateServerListFromServer = CKernel.Preferences.GetBool("UpdateServerListFromServer");

            if(config.UserID>Protocol.LowIDLimit)
                config.IsHighID = true;
            else
                config.IsHighID = false;
            config.AllowedIP=CKernel.Preferences.GetStringArray("AllowedIP");
            config.CompressionMethod=(CompressionType)CKernel.Preferences.GetEnum("CompressionMethod",CompressionType.Zip);
            return config;
        }
Пример #5
0
        public void SetPreferences()
        {
            int i, num_rows;
            bool exists_iter;
            Gtk.TreeIter iter;
            Gtk.TreeView tv;

            m_CheckPreferences();

            InterfacePreferences preferences = new InterfacePreferences();

            exists_iter = stSharedFolders.GetIterFirst (out iter);
            num_rows=0;

            /* Get the number of rows */
            while (exists_iter==true)
            {
                exists_iter = stSharedFolders.IterNext (ref iter);
                num_rows++;
            }

            preferences.sharedFolders = new string[num_rows+1];
            preferences.TempFolders = new string[1];

            preferences.sharedFolders[0] = txtIncomingFolder.Text;

            /* Save the shared folders */
            stSharedFolders.GetIterFirst (out iter);

            for (i=1;i<=num_rows;i++)
            {
                preferences.sharedFolders[i] = tvSharedFolders.Model.GetValue(iter,0).ToString();
                stSharedFolders.IterNext (ref iter);
            }

            exists_iter = stTempFolders.GetIterFirst (out iter);
            num_rows=0;

            /* Get the number of rows */
            while (exists_iter==true)
            {
                exists_iter = stTempFolders.IterNext (ref iter);
                num_rows++;
            }

            preferences.TempFolders = new string[num_rows];

            /* Save the temp folders */
            stTempFolders.GetIterFirst (out iter);

            for (i=0;i<num_rows;i++)
            {
                preferences.TempFolders[i] = tvTempFolders.Model.GetValue(iter,0).ToString();
                stTempFolders.IterNext (ref iter);
            }

            preferences.maxConnexions = Convert.ToInt32(txtMaxConnections.Text);
            preferences.maxDownloadRate = (float)Convert.ToDouble(txtMaxDown.Text);
            preferences.maxSources = Convert.ToInt32(txtMaxSources.Text);
            preferences.maxUploadRate = (float)Convert.ToDouble(txtMaxUp.Text);
            preferences.UserName = txtNick.Text;
            preferences.TCPPort = Convert.ToUInt16(txtTcpPort.Text);
            preferences.UDPPort = Convert.ToUInt16(txtUdpPort.Text);
            preferences.ICHEnabled = chbEnableICH.Active;
            preferences.Autoreconect = chbAutoConnect.Active;
            preferences.maxServerFails = 2;
            preferences.DownloadServerMet = chbServerList.Active;
            preferences.ServerMetUri = txtServerList.Text;

            preferences.RemoteControlEnabled=false;
            preferences.RemoteControlPort=Convert.ToInt32("4771");
            preferences.RemoteControlPassword="******";

            preferences.Language="en-US";
            preferences.OSigEnabled=true;

            if (radioShareAll.Active) preferences.AllowViewShared=Constants.AllowViewShared.All;
            else if (radioShareFriends.Active) preferences.AllowViewShared=Constants.AllowViewShared.Friends;
            else if (radioShareNobody.Active) preferences.AllowViewShared=Constants.AllowViewShared.Nobody;

            preferences.IPFilterEnabled=chbIpFilter.Active;

            krnGateway.SetConfig(preferences);
        }
Пример #6
0
        public void DisplayPreferences(InterfacePreferences preferences)
        {
            txtNick.Text = preferences.UserName;
            txtMaxConnections.Text = preferences.maxConnexions.ToString();
            txtMaxDown.Text = preferences.maxDownloadRate.ToString();
            txtMaxUp.Text = preferences.maxUploadRate.ToString();
            txtMaxSources.Text = preferences.maxSources.ToString();
            txtTcpPort.Text = preferences.TCPPort.ToString();
            txtUdpPort.Text = preferences.UDPPort.ToString();

            foreach (string sharedFolder in preferences.sharedFolders)
            {
                if (sharedFolder==preferences.sharedFolders[0])
                {
                    txtIncomingFolder.Text = sharedFolder;
                }
                else
                {
                    stSharedFolders.AppendValues (sharedFolder);
                }
            }

            foreach (string tmpFolder in preferences.TempFolders)
            {
                stTempFolders.AppendValues (tmpFolder);
            }

            chbEnableICH.Active = preferences.ICHEnabled;
            chbAutoConnect.Active = preferences.Autoreconect;
            chbIpFilter.Active = preferences.IPFilterEnabled;

            radioShareAll.Active = (preferences.AllowViewShared==Constants.AllowViewShared.All);
            radioShareFriends.Active = (preferences.AllowViewShared==Constants.AllowViewShared.Friends);
            radioShareNobody.Active = (preferences.AllowViewShared==Constants.AllowViewShared.Nobody);

            txtServerList.Text = preferences.ServerMetUri;
            chbServerList.Active = preferences.DownloadServerMet;
        }
Пример #7
0
        private void myContextMenuPopup(object sender, System.EventArgs e)
        {
            m_config=krnGateway.GetConfig();
            ContextMenuShared.MenuItems[0].DefaultItem = true;
            m_CheckPriority();
            MenuInfo.OnMenuInfoChange();

            if (SelectedItems.Count==0)
            {
                ContextMenuShared.MenuItems[0].Enabled=false;
                ContextMenuShared.MenuItems[1].Enabled=false;
                ContextMenuShared.MenuItems[3].Enabled=false;
                ContextMenuShared.MenuItems[4].Enabled=false;
                ContextMenuShared.MenuItems[5].Enabled=false;
                ContextMenuShared.MenuItems[7].Enabled=false;
                ContextMenuShared.MenuItems[9].Enabled=false;
                PriorityMenu.MenuItems[0].Enabled=false;
                PriorityMenu.MenuItems[1].Enabled=false;
                PriorityMenu.MenuItems[2].Enabled=false;
                PriorityMenu.MenuItems[3].Enabled=false;
                PriorityMenu.MenuItems[4].Enabled=false;

            }
            if (SelectedItems.Count==1)
            {
                ContextMenuShared.MenuItems[0].Enabled=m_IsCompleted();
                ContextMenuShared.MenuItems[1].Enabled=m_IsCompleted();
                ContextMenuShared.MenuItems[3].Enabled=true;
                ContextMenuShared.MenuItems[4].Enabled=true;
                ContextMenuShared.MenuItems[5].Enabled=m_config.IsHighID;
                ContextMenuShared.MenuItems[7].Enabled=true;
                ContextMenuShared.MenuItems[9].Enabled=true;
                PriorityMenu.MenuItems[0].Enabled=true;
                PriorityMenu.MenuItems[1].Enabled=true;
                PriorityMenu.MenuItems[2].Enabled=true;
                PriorityMenu.MenuItems[3].Enabled=true;
                PriorityMenu.MenuItems[4].Enabled=true;
            }

            if (SelectedItems.Count>1)
            {
                ContextMenuShared.MenuItems[0].Enabled=false;
                ContextMenuShared.MenuItems[1].Enabled=true;
                ContextMenuShared.MenuItems[3].Enabled=false;
                ContextMenuShared.MenuItems[4].Enabled=false;
                ContextMenuShared.MenuItems[5].Enabled=false;
                ContextMenuShared.MenuItems[7].Enabled=true;
                ContextMenuShared.MenuItems[9].Enabled=false;
                PriorityMenu.MenuItems[0].Enabled=true;
                PriorityMenu.MenuItems[1].Enabled=true;
                PriorityMenu.MenuItems[2].Enabled=true;
                PriorityMenu.MenuItems[3].Enabled=true;
                PriorityMenu.MenuItems[4].Enabled=true;
            }
        }
Пример #8
0
 public void SetConfig(InterfacePreferences config)
 {
     krnGateway.SetConfig(config);
 }
Пример #9
0
        private void Connect()
        {
            FServers.Connect(krnGateway);
            FDownloads.Connect(krnGateway);
            FUploads.Connect(krnGateway);
            FSearchs.Connect(krnGateway);
            FFriends.Connect(krnGateway);

            m_Preferences=krnGateway.GetConfig();
            graphics.SetMinValue(0);
            if (m_Preferences.maxDownloadRate>m_Preferences.maxUploadRate)
                graphics.SetMaxValue((int)m_Preferences.maxDownloadRate);
            else
                graphics.SetMaxValue((int)m_Preferences.maxUploadRate);

            activeForm=FDownloads;
            krnGateway.OnRefreshStatus+=new RefreshEvent(m_InvokeOnRefreshStatus);
            krnGateway.OnNewChatMessage+=new SourceEvent(m_InvokeOnNewChatMessage);
            krnGateway.OnStartChatSession+=new ClientEvent(m_InvokeOnStartChatSession);
            krnGateway.OnAddingFriend+=new ClientEvent(m_InvokeOnAddingFriend);
            krnGateway.OnDeleteFriend+=new ClientEvent(m_InvokeOnDeleteFriend);
        }
Пример #10
0
        private void buttonOptions_Click(object sender, System.EventArgs e)
        {
            FormOptions FOptions=new FormOptions(krnGateway);
            FOptions.ShowDialog();
            m_Preferences=krnGateway.GetConfig();

            if (m_Preferences.maxDownloadRate>m_Preferences.maxUploadRate)
                graphics.SetMaxValue((int)m_Preferences.maxDownloadRate);
            else
                graphics.SetMaxValue((int)m_Preferences.maxUploadRate);

            if (preferences.GetString("Skin")!=Skin.CurrentSkin)
            {
                Skin.CurrentSkin=preferences.GetString("Skin");
                m_ApplySkin();
                FDownloads.ApplySkin();
                FUploads.ApplySkin();
                FSearchs.ApplySkin();
                FServers.ApplySkin();
                FFriends.ApplySkin();
            }

            if(preferences.GetString("Language")!=Globalization.Language)
            {
                Globalization.Language = preferences.GetString("Language");
                m_Globalize();
                FDownloads.Globalize();
                FUploads.Globalize();
                FSearchs.Globalize();
                FServers.Globalize();
                FFriends.Globalize();

                FDownloads.downloadList.Globalize();
                FDownloads.sourcesList.Globalize();
                FDownloads.listViewComments.Globalize();
                FDownloads.listViewNames.Globalize();
                FUploads.sharedListView.Globalize();
                FUploads.uploadsList.Globalize();
                FServers.serversList.Globalize();

            }
        }
Пример #11
0
        public void SetPreferences()
        {
            int i;

            m_CheckPreferences();
            InterfacePreferences preferences=new InterfacePreferences();
            preferences.sharedFolders=new string[listBoxDownloadsFolder.Items.Count+1];
            preferences.TempFolders=new string[listBoxTmpFolder.Items.Count];
            preferences.AllowedIP=new string[listBoxAllowedIP.Items.Count];
            preferences.sharedFolders[0]=textBoxIncomingFolder.Text;

            for (i=0;i<listBoxDownloadsFolder.Items.Count;i++)
            {
                preferences.sharedFolders[i+1]=(string)listBoxDownloadsFolder.Items[i];
            }

            for (i=0;i<listBoxTmpFolder.Items.Count;i++)
            {
                preferences.TempFolders[i]=(string)listBoxTmpFolder.Items[i];
            }

            preferences.maxConnexions=Convert.ToInt32(this.textBoxMaxConnections.Text);
            preferences.maxDownloadRate=(float)Convert.ToDouble(this.textBoxMaxDownSpeed.Text);
            preferences.maxSources=Convert.ToInt32(this.textBoxMaxSourcesPerFile.Text);
            preferences.maxUploadRate=(float)Convert.ToDouble(this.textBoxMaxUpSpeed.Text);
            preferences.UserName=this.textBoxNick.Text;
            preferences.TCPPort=Convert.ToUInt16(this.textBoxTCPPort.Text);
            preferences.UDPPort=Convert.ToUInt16(this.textBoxUDPPort.Text);
            preferences.ICHEnabled=this.checkBoxEnableICH.Checked;
            preferences.Autoreconect=this.checkBoxAutoConnect.Checked;
            preferences.maxServerFails=2;
            preferences.RemoteControlEnabled=this.checkBoxRemoteControl.Checked;
            preferences.RemoteControlPort=Convert.ToInt32(textBoxRemoteControlPort.Text);
            preferences.RemoteControlPassword=textBoxRemoteControlPassword.Text;
            preferences.DownloadServerMet=this.checkBoxDownloadServerMet.Checked;
            preferences.ServerMetUri=this.textBoxServerMetUri.Text;

            try
            {
                m_SelectedLanguage = comboBoxLanguage.SelectedValue.ToString();
            }
            catch
            {
                m_SelectedLanguage = "en-US";
            }

            preferences.Language=m_SelectedLanguage;

            if (radioSharedAll.Checked) preferences.AllowViewShared=eLePhant.Types.Constants.AllowViewShared.All;
            else if (radioSharedFriends.Checked) preferences.AllowViewShared=eLePhant.Types.Constants.AllowViewShared.Friends;
            else if (radioSharedNobody.Checked) preferences.AllowViewShared=eLePhant.Types.Constants.AllowViewShared.Nobody;

            preferences.OSigEnabled=this.checkBoxOSig.Checked;
            preferences.IPFilterEnabled=this.checkBoxIPFilter.Checked;
            preferences.CompressionMethod=(CompressionType)this.comboBoxCompressionMethod.SelectedItem;
            for (i=0;i<listBoxAllowedIP.Items.Count;i++)
            {
                preferences.AllowedIP[i]=(string)listBoxAllowedIP.Items[i];
            }
            preferences.StartNextStoppedFile=this.checkBoxStartPaused.Checked;
            krnGateway.SetConfig(preferences);
        }
Пример #12
0
        public void DisplayPreferences(InterfacePreferences preferences)
        {
            foreach (string sharedFolder in preferences.sharedFolders)
            {
                if (sharedFolder==preferences.sharedFolders[0])
                {
                    textBoxIncomingFolder.Text = sharedFolder;
                }
                else
                {
                    listBoxDownloadsFolder.Items.Add(sharedFolder);
                }
            }

            foreach (string tmpFolder in preferences.TempFolders)
            {
                listBoxTmpFolder.Items.Add(tmpFolder);
            }

            this.textBoxMaxConnections.Text=preferences.maxConnexions.ToString();
            this.textBoxMaxDownSpeed.Text=preferences.maxDownloadRate.ToString();
            this.textBoxMaxSourcesPerFile.Text=preferences.maxSources.ToString();
            this.textBoxMaxUpSpeed.Text=preferences.maxUploadRate.ToString();
            this.textBoxNick.Text=preferences.UserName;
            this.textBoxTCPPort.Text=preferences.TCPPort.ToString();
            this.textBoxUDPPort.Text=preferences.UDPPort.ToString();
            this.checkBoxEnableICH.Checked=preferences.ICHEnabled;
            this.checkBoxAutoConnect.Checked=preferences.Autoreconect;
            this.checkBoxDownloadServerMet.Checked=preferences.DownloadServerMet;
            this.checkBoxIPFilter.Checked=preferences.IPFilterEnabled;
            this.textBoxServerMetUri.Text=preferences.ServerMetUri;

            this.comboBoxLanguage.DataSource = m_languageFiles;
            this.comboBoxLanguage.ValueMember = "CultureInfo";
            this.comboBoxLanguage.DisplayMember = "NativeLanguage";
            m_CurrentLanguage = m_GetCompatibleLangage(preferences.Language);
            this.comboBoxLanguage.SelectedValue = m_CurrentLanguage;

            radioSharedAll.Checked=(preferences.AllowViewShared==eLePhant.Types.Constants.AllowViewShared.All);
            radioSharedFriends.Checked=(preferences.AllowViewShared==eLePhant.Types.Constants.AllowViewShared.Friends);
            radioSharedNobody.Checked=(preferences.AllowViewShared==eLePhant.Types.Constants.AllowViewShared.Nobody);

            RegistryKey root = Registry.ClassesRoot;
            RegistryKey key=root.OpenSubKey("ed2k\\shell\\open\\command",true);
            if (key==null) key=root.CreateSubKey("ed2k\\shell\\open\\command");
            string regPath;
            regPath=(string)key.GetValue("");
            if (regPath!=Application.ExecutablePath+" \"%1\"")
            {
                buttonTakeLinks.Enabled=true;
            }
            else
                buttonTakeLinks.Enabled=false;
            //remote control
            this.checkBoxRemoteControl.Checked=preferences.RemoteControlEnabled;
            textBoxRemoteControlPort.Text=preferences.RemoteControlPort.ToString();
            textBoxRemoteControlPassword.Text=preferences.RemoteControlPassword;
            checkBoxOSig.Checked=preferences.OSigEnabled;
            this.comboBoxCompressionMethod.DataSource=listaCompressionMethod;
            comboBoxCompressionMethod.SelectedItem=preferences.CompressionMethod;
            if (preferences.AllowedIP!=null)
                foreach (string tmpAllowedIP in preferences.AllowedIP)
                {
                    listBoxAllowedIP.Items.Add(tmpAllowedIP);
                }
            this.checkBoxStartPaused.Checked=preferences.StartNextStoppedFile;
        }