Exemple #1
0
        /// <summary>
        /// 依照目前的代码,任何设置均将在下次启动时生效。即时更新的机制有待补充
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Enter_Click(object sender, RoutedEventArgs e)
        {
            Stc.GloConf = Conf;
            ConfigController Save = new ConfigController(Conf);

            Save.SavingConfigFile();
            Close();
        }
Exemple #2
0
        static Stc()
        {
            ConfigController Start = new ConfigController();

            //判断几个关键的文件和路径是否存在
            if (!File.Exists(Start.Configs.Save_session))
            {
                File.Create(Start.Configs.Save_session).Close();
            }
            if (!File.Exists(Start.Configs.Input_file))
            {
                File.Create(Start.Configs.Input_file).Close();
            }
            if (!Directory.Exists(Start.Configs.Dir))
            {
                Directory.CreateDirectory(Start.Configs.Dir);
            }
            //if (!File.Exists(@"HistoryList.log"))
            //{
            //    File.Create(@"HistoryList.log").Close();
            //}
            Start.Make();
            Aria2Process = new Process();
            Aria2Process.StartInfo.FileName       = Config.Aria2cPath;
            Aria2Process.StartInfo.CreateNoWindow = true;
            Aria2Process.StartInfo.Arguments      = @"--conf-path=" + Config.Aria2cConfigPath;
            Aria2Process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
            Aria2Process.Start();
            GloConf = Start.Configs;//给全局配置变量赋值,同时初始化所有其他全局变量
            Config.WebSocketPath = string.Format("ws://127.0.0.1:{0}/jsonrpc", GloConf.Rpc_listen_port);
            Config.Rpc_secret    = GloConf.Rpc_secret;
            Line   = new JRCtler(Config.WebSocketPath);//这里的逻辑重新梳理后,可以允许ezAria2作为客户端,控制其他主机的下载服务
            ProCtl = new ProgressController();
            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            Application.Current.Exit        += new ExitEventHandler(Quit);
            Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(Crash);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }