コード例 #1
0
ファイル: Frontend.cs プロジェクト: RAOF/smuxi
 public static void InitLocalEngine()
 {
     Engine.Engine.Init();
     _EngineVersion = Engine.Engine.Version;
     Session        = new Engine.Session(Engine.Engine.Config,
                                         Engine.Engine.ProtocolManagerFactory,
                                         "local");
     Session.RegisterFrontendUI(_MainWindow.UI);
     _UserConfig = Session.UserConfig;
     ConnectEngineToGUI();
 }
コード例 #2
0
ファイル: Frontend.cs プロジェクト: licnep/smuxi
        public static void Init(string[] args)
        {
            System.Threading.Thread.CurrentThread.Name = "Main";

            if (!(args.Length >= 1))
            {
                Console.Error.WriteLine("Usage: smuxi-test.exe profile");
                Environment.Exit(1);
            }

#if LOG4NET
            _Logger.Info("smuxi-test starting");
#endif

            _FrontendConfig = new FrontendConfig("Test");
            _FrontendConfig.Load();

            string profile = args[0];
            if (String.IsNullOrEmpty(profile))
            {
                Console.Error.WriteLine("profile parameter must not be empty!");
                Environment.Exit(1);
            }

            IFrontendUI ui = new TestUI();

            Session session = null;
            if (profile == "local")
            {
                Engine.Engine.Init();
                session = new Engine.Session(Engine.Engine.Config,
                                             Engine.Engine.ProtocolManagerFactory,
                                             "local");
                session.RegisterFrontendUI(ui);
            }
            else
            {
                // remote engine
                EngineManager engineManager = new EngineManager(_FrontendConfig, ui);
                engineManager.Connect(profile);
                session = engineManager.Session;
            }

            if (session == null)
            {
                Console.Error.WriteLine("Session is null, something went wrong setting up or connecting to the engine!");
                Environment.Exit(1);
            }

            _Session         = session;
            _UserConfig      = session.UserConfig;
            _FrontendManager = session.GetFrontendManager(ui);
            _FrontendManager.Sync();

            if (_UserConfig.IsCaching)
            {
                // when our UserConfig is cached, we need to invalidate the cache
                _FrontendManager.ConfigChangedDelegate = new SimpleDelegate(_UserConfig.ClearCache);
            }

            while (true)
            {
                string line = Console.ReadLine();
                // TODO: remove the entered line from output
                //Console.WriteLine(Escape+"M");

                _ExecuteCommand(line);
            }
        }
コード例 #3
0
ファイル: Frontend.xaml.cs プロジェクト: pacificIT/smuxi
        public void InitLocalEngine()
        {
            Engine.Engine.Init();

            EngineVersion = Engine.Engine.Version;

            Session = new Engine.Session(Engine.Engine.Config,

                                         Engine.Engine.ProtocolManagerFactory,

                                         "local");

            Session.RegisterFrontendUI(MainWindow.UI);

            UserConfig = Session.UserConfig;

            ConnectEngineToGUI();
        }