示例#1
0
        public LiveClient()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            Application.ApplicationExit += ApplicationApplicationExit;

            InitializeComponent();

            Settings = new Settings();
            if (File.Exists(Settings.SettingsFilePath))
            {
                Settings.Load();
            }

            LogManager.LogManagerInstance             = new NLogManager();
            MonoTorrent.LogManager.LogManagerInstance = new TorrentNLogManager();

            logger.Info("------------------------------starting LiveDC {0}", Assembly.GetExecutingAssembly().GetName().Version);

            _copyData = new CopyData();
            _copyData.CreateHandle(new CreateParams());
            _copyData.Channels.Add("LIVEDC");
            _copyData.DataReceived += CopyDataDataReceived;

            _ao = AsyncOperationManager.CreateOperation(null);


            Utils.FileSizeFormatProvider.BinaryModifiers = new[] { " Б", " КБ", " МБ", " ГБ", " ТБ", " ПБ" };



            _providers.Add(_dcProvider = new DcProvider(Settings, this));
            _providers.Add(new TorrentProvider(this));

            _fsProviders.Add(_httpProvider = new HttpProvider(this));

            InitializeEngine();

            History = new LiveHistoryManager();
            History.Load();

            AutoUpdate = new AutoUpdateManager(this);
            AutoUpdate.CheckUpdate();

            if (!Settings.ShownGreetingsTooltip)
            {
                _icon.ShowBalloonTip(10000, "LiveDC", "Добро пожаловать! Нажмите здесь, чтобы увидеть текущий статус работы.", ToolTipIcon.Info);
                OpenStartPage();

                Settings.ShownGreetingsTooltip = true;
                Settings.Save();
            }
            else if (!Program.SilentMode)
            {
                OpenStartPage();
                _icon.ShowBalloonTip(10000, "LiveDC", "Клиент запущен.", ToolTipIcon.Info);
            }

            if (!string.IsNullOrEmpty(Program.StartMagnet))
            {
                StartFile(Magnet.Parse(Program.StartMagnet));
            }

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
        }