Пример #1
0
        public eLePhantClientSink(IClientChannelSinkProvider Provider, string url)
        {
            object nextobject = new BinaryClientFormatterSink(this);

            this.m_url               = url;
            this.m_Provider          = Provider as eLePhantClientSinkProvider;
            this.m_NextChannelSink   = nextobject as IClientChannelSink;
            this.m_NextMessageSink   = nextobject as IMessageSink;
            m_preferences            = new Config(Application.StartupPath, "config.xml", "0.02", "lphantKernel");
            this.m_CompressionMethod = (CompressionType)m_preferences.GetEnum("CompressionMethod", CompressionType.Zip);
        }
Пример #2
0
        public CMain(string[] args)
        {
            m_Preferences = new Config(Application.StartupPath, "configInterface.xml", "0.01", "lphantInterface");
            m_Preferences.LoadProperties();

            if (args.Length>0)
                m_elink=args[0];

            //bool noInstanceRuning;
            //m_Mutex=new Mutex(true,InterfaceConstants.GUID,out noInstanceRuning);
            m_Mutex=new Mutex(true,InterfaceConstants.GUID);
            //if (noInstanceRuning)
            if (m_Mutex.WaitOne(0,true))
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnAppDomainException);

                if (m_Preferences.GetBool("StartupLocal",true))
                {
                    Application.Run(new eLePhantForm(m_elink,m_Mutex));
                }
                else if (m_Preferences.GetBool("StartupRemote",false))
                {
                    string remoteIP=m_Preferences.GetString("RemoteIP","");
                    int remotePort=m_Preferences.GetInt("RemotePort",0);
                    string remotePass=m_Preferences.GetString("RemotePassword","");
                    if ((remotePort>0)&&(remoteIP.Length>0)&&(remotePass.Length>0))
                    {
                        CedonkeyCRemoto CRemoto=new CedonkeyCRemoto();
                        if (CRemoto.Connect(remoteIP,remotePass,remotePort))
                        {
                            Application.Run(new eLePhantForm(m_elink,m_Mutex,CRemoto.interfazremota));
                        }
                        else
                        {
                            MessageBox.Show("Can not connect with the host specified in preferences","lphant",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                            Application.Run(new StartForm(m_elink,m_Mutex));
                        }
                    }
                    else
                        Application.Run(new StartForm(m_elink,m_Mutex));
                }
                else
                    Application.Run(new StartForm(m_elink,m_Mutex));
            }
            else
            {
                NotifyToMainInstance();
            }
        }
Пример #3
0
        public CKernel()
        {
            #if VERBOSE
            LogClient=new CLogClient();
            #endif
            m_PortChanged=false;
            m_Version=(Protocol.ELEPHANT_VERSION_MAJOR-1).ToString()+"."+Protocol.ELEPHANT_VERSION.ToString("00");

            Preferences=new Config(DllDirectory, "config.xml", "0.02", "lphantKernel");
            Preferences.PropertyChanged+=new Config.PropertyEventHandler(OnPropertyChanged);
            Preferences.PropertyDefaults+=new Config.PropertyDefaultHandler(OnGetDefaultProperty);
            Preferences.PropertyLoaded+=new Config.PropertyLoadedHandler(OnPropertyLoaded);
            Preferences.LoadProperties();

            Globalization=new Classes.Globalization(LangDirectory, "kernel_", "xml",Preferences.GetString("Language"));

            SourcesOld=new CSourcesOld();
            Listener=new CListener();
            ConnectionsList=new CConnectionsList();
            ServersList=new CServersList();

            FilesList=new CFilesList();
            ClientsList=new CClientsList();
            InterfaceGateway[0]=new CInterfaceGateway();
            InterfaceGateway[0].apw=true;
            //InterfaceGateway[0].CheckPw(Preferences.GetString("RemotePassword"));
            //FilesList.LoadSharedFiles(); // > StartKernel()
            FriendsList=new CFriendsList();

            GlobalStatistics=new CStatistics();
            if (Preferences.GetBool("RemoteControlEnabled"))
            {
                Sremoto=new CRemoting();
            }
            Searchs=new SortedList();
            Queue=new CQueue();
            UDPListener=new CUDPListener(); // UDPListener.Start(); > StartKernel()

            CategoriesList=new CCategoriesList();

            httpDownload=new ChttpDownload();
            httpDownload.Downloaded+=new DownloadedEventHandler(OnFileDownloaded);
        }
Пример #4
0
        public eLePhantClientSink(IClientChannelSinkProvider Provider, string url, object nextobject)
        {
            this.m_url=url;
            this.m_Provider=Provider as eLePhantClientSinkProvider;
            if (nextobject != null)
            {
                this.m_NextChannelSink = nextobject as IClientChannelSink;
                if (this.m_NextChannelSink ==null)
                    this.m_NextChannelSink = (IClientChannelSink)new BinaryClientFormatterSink(this);

                this.m_NextMessageSink = nextobject as IMessageSink;
                if (this.m_NextMessageSink == null)
                    this.m_NextMessageSink = (IMessageSink)new BinaryClientFormatterSink(this);

            }
            m_preferences = new Config(Application.StartupPath, "config.xml", "0.02", "lphantKernel");
            this.m_CompressionMethod=(CompressionType)m_preferences.GetEnum("CompressionMethod",CompressionType.Zip);
        }
Пример #5
0
        private void Initialize()
        {
            m_PreviousState=FormWindowState.Normal;
            SystemIconsList=new CSystemIconsList();
            Skin=new CSkin();
            m_LastIcon=10;

            preferences = new Config(Application.StartupPath, "configInterface.xml", "0.01", "lphantInterface");
            preferences.PropertyChanged += new Config.PropertyEventHandler(m_OnPropertyChanged);
            preferences.PropertyDefaults += new Config.PropertyDefaultHandler(OnGetDefaultProperty);
            preferences.LoadProperties();

            Globalization=new Classes.Globalization(Application.StartupPath+Path.DirectorySeparatorChar+"language", "interface_", "xml",preferences.GetString("Language"));
            m_Globalize();

            m_KernelLoaded=false;

            toolTipMain.SetToolTip(eLePhantButtonConnect,Globalization["LBL_CONNDISC"]);
            toolTipMain.SetToolTip(buttonOptions,Globalization["LBL_OPTIONS"]);

            taskbarNotifier1=new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(),"Client.Resources.Classic.PopUpSkin.bmp"),Color.FromArgb(255,0,0));
            taskbarNotifier1.SetCloseBitmap(new Bitmap(typeof(eLePhantForm),"Client.Resources.Classic.close.bmp"),Color.FromArgb(255,0,255),new Point(127,8));
            taskbarNotifier1.TitleRectangle=new Rectangle(50,65,100,70);
            taskbarNotifier1.ContentRectangle=new Rectangle(8,75,133,100);
            taskbarNotifier1.NormalContentColor = Color.White;
            //taskbarNotifier1.TitleClick+=new EventHandler(TitleClick);
            taskbarNotifier1.ContentClick+=new EventHandler(m_BallonClicked);
            //taskbarNotifier1.CloseClick+=new EventHandler(CloseClick);

            Skin.CurrentSkin=preferences.GetString("Skin","default");
            m_ApplySkin();

            graphics.AutoGraphicScale=preferences.GetBool("AutoGraphicScale",false);
            graphics.GraphicScale=preferences.GetInt("GraphicScale",1);

            FDownloads=new FormDownloads();
            FDownloads.TopLevel=false;
            panelContent.Controls.Add(FDownloads);
            FDownloads.Dock = DockStyle.Fill;
            FDownloads.ApplySkin();

            FUploads=new FormUploads();
            FUploads.TopLevel=false;
            FUploads.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FUploads);
            FUploads.Dock = DockStyle.Fill;
            FUploads.ApplySkin();

            FServers=new FormServers();
            FServers.TopLevel=false;
            FServers.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FServers);
            FServers.Dock = DockStyle.Fill;
            FServers.labelmsg=this.labelStatusMsg;
            FServers.ApplySkin();

            FSearchs=new FormSearch();
            FSearchs.TopLevel=false;
            FSearchs.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FSearchs);
            FSearchs.Dock = DockStyle.Fill;
            FSearchs.ApplySkin();

            FFriends=new FormFriends();
            FFriends.TopLevel=false;
            FFriends.Dock = DockStyle.Fill;
            panelContent.Controls.Add(FFriends);
            FFriends.Dock = DockStyle.Fill;
            FFriends.ApplySkin();
        }