コード例 #1
0
ファイル: MainForm.cs プロジェクト: nospy/EasyConnect
        private void connectSSHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Poderosa.Forms.MultiPaneControl mc = new Poderosa.Forms.MultiPaneControl();
            //mc.Dock = DockStyle.Fill;
            //mc.BackColor = System.Drawing.Color.AliceBlue;
            //tabPage1.Controls.Add(mc);

            InitialAction a = new InitialAction();
            //Poderosa.Forms.GFrame frame = new Poderosa.Forms.GFrame(a);
            ConnectionHistory hst = GApp.ConnectionHistory;
            Poderosa.Forms.LoginDialog dlg = new Poderosa.Forms.LoginDialog();

            TCPTerminalParam param = hst.TopTCPParam;

            dlg.ApplyParam(param);
            dlg.StartPosition = FormStartPosition.CenterParent;

            //if (GCUtil.ShowModalDialog(_frame, dlg) == DialogResult.OK)
            //frame.Show();
            //GCUtil.ShowModalDialog(frame, dlg);
            //dlg.ShowDialog();
            dlg._hostBox.Text = "palm";
            dlg._methodBox.SelectedIndex = 2;
            dlg._portBox.Text = "22";
            dlg._userNameBox.Text = "bwilliam";
            dlg._passphraseBox.Text = "lkmj9u";
            dlg.OnOK(null, null);

            Connection.ConnectionTag ct = dlg.Result;
        }
コード例 #2
0
ファイル: GApp.cs プロジェクト: nwtajcky/RDManager
        public static void LoadEnvironment(InitialAction act)
        {
            ThemeUtil.Init();

            OptionPreservePlace place = GetOptionPreservePlace();

            _options              = new ContainerOptions();
            _history              = new ConnectionHistory();
            _macroManager         = new MacroManager();
            _container            = new PoderosaContainer();
            _globalCommandTarget  = new ContainerGlobalCommandTarget();
            _interThreadUIService = new ContainerInterThreadUIService();
            _sshKnownHosts        = new SSHKnownHosts();


            //この時点ではOSの言語設定に合ったリソースをロードする。起動直前で必要に応じてリロード
            ReloadStringResource();

            GEnv.Init(_container);
            GEnv.Options              = _options;
            GEnv.GlobalCommandTarget  = _globalCommandTarget;
            GEnv.InterThreadUIService = _interThreadUIService;
            GEnv.SSHKnownHosts        = _sshKnownHosts;
            string dir = GetOptionDirectory(place);

            LoadConfigFiles(dir, act);
            _options.OptionPreservePlace = place;

            //ここまできたら言語設定をチェックし、必要なら読み直し
            if (GUtil.CurrentLanguage != _options.Language)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = _options.Language == Language.Japanese? new CultureInfo("ja") : CultureInfo.InvariantCulture;
                ReloadStringResource();
            }
        }
コード例 #3
0
ファイル: GApp.cs プロジェクト: nwtajcky/RDManager
        public static void CreateGFrame(string[] args)
        {
            InitialAction a = new InitialAction();

            _globalMutex = Win32.CreateMutex(IntPtr.Zero, 0, "PoderosaGlobalMutex");
            bool already_exists = (Win32.GetLastError() == Win32.ERROR_ALREADY_EXISTS);

            if (_globalMutex == IntPtr.Zero)
            {
                throw new Exception("Global mutex could not open");
            }

            LoadEnvironment(a);
            Init(a, args, already_exists);
            //System.Windows.Forms.Application.Run(_frame);
            //_frame.Show();

            if (!_closeWithoutSave)
            {
                SaveEnvironment();
            }
            GEnv.Terminate();

            Win32.CloseHandle(_globalMutex);
        }
コード例 #4
0
        private void connectSSHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Poderosa.Forms.MultiPaneControl mc = new Poderosa.Forms.MultiPaneControl();
            //mc.Dock = DockStyle.Fill;
            //mc.BackColor = System.Drawing.Color.AliceBlue;
            //tabPage1.Controls.Add(mc);

            InitialAction a = new InitialAction();
            //Poderosa.Forms.GFrame frame = new Poderosa.Forms.GFrame(a);
            ConnectionHistory hst = GApp.ConnectionHistory;

            Poderosa.Forms.LoginDialog dlg = new Poderosa.Forms.LoginDialog();

            TCPTerminalParam param = hst.TopTCPParam;

            dlg.ApplyParam(param);
            dlg.StartPosition = FormStartPosition.CenterParent;

            //if (GCUtil.ShowModalDialog(_frame, dlg) == DialogResult.OK)
            //frame.Show();
            //GCUtil.ShowModalDialog(frame, dlg);
            //dlg.ShowDialog();
            dlg._hostBox.Text            = "palm";
            dlg._methodBox.SelectedIndex = 2;
            dlg._portBox.Text            = "22";
            dlg._userNameBox.Text        = "bwilliam";
            dlg._passphraseBox.Text      = "lkmj9u";
            dlg.OnOK(null, null);

            Connection.ConnectionTag ct = dlg.Result;
        }
コード例 #5
0
ファイル: GApp.cs プロジェクト: nwtajcky/RDManager
        public static void Init(InitialAction act, string[] args, bool already_exists)           //GFrameの作成はコンストラクタの後にしないと、GuevaraAppのメソッドをデリゲートの引数にできない。
        {
            if (args.Length > 0)
            {
                act.ShortcutFile = args[0];
            }

            _frame = new GFrame(act);
            _globalCommandTarget.Init(_frame);

            if (already_exists && _options.FrameState == FormWindowState.Normal)
            {
                Rectangle rect = _options.FramePosition;
                rect.Location         += new Size(24, 24);
                _options.FramePosition = rect;
            }

            _frame.DesktopBounds = _options.FramePosition;
            _frame.WindowState   = _options.FrameState;
            _frame.AdjustMRUMenu();

            //キャッチできなかったエラーの補足
            Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
        }
コード例 #6
0
ファイル: GApp.cs プロジェクト: nospy/EasyConnect
        private static void LoadConfigFiles(string dir, InitialAction act)
        {
            if(Win32.WaitForSingleObject(_globalMutex, 10000)!=Win32.WAIT_OBJECT_0) throw new Exception("Global mutex lock error");

            try {
                string optionfile = dir+"options.conf";
                bool config_loaded = false;
                bool macro_loaded = false;

                TextReader reader = null;
                try {
                    if(File.Exists(optionfile)) {
                        reader = new StreamReader(File.Open(optionfile, FileMode.Open, FileAccess.Read), Encoding.Default);
                        if(VerifyConfigHeader(reader)) {
                            ConfigNode root = new ConfigNode("root", reader).FindChildConfigNode("poderosa");
                            if(root!=null) {
                                _options.Load(root);
                                config_loaded = true;
                                _history.Load(root);
                                _macroManager.Load(root);
                                macro_loaded = true;
                            }
                        }
                    }
                }
                catch(Exception ex) {
                    //_errorOccurredOnBoot = true;
                    Debug.WriteLine(ex.StackTrace);
                    GUtil.WriteDebugLog(ex.StackTrace);
                    act.AddMessage("Failed to read the configuration file.\n" + ex.Message);
                }
                finally {
                    if(!config_loaded) _options.Init();
                    if(!macro_loaded)  _macroManager.SetDefault();
                    if(reader != null) reader.Close();
                }

                GEnv.Options = _options; //�����DefaultRenderProfile�������������

                string kh = dir+"ssh_known_hosts";
                if(File.Exists(kh)) {
                    try {
                        _sshKnownHosts.Load(kh);
                    }
                    catch(Exception ex) {
                        _sshKnownHosts.Clear();
                        act.AddMessage("Failed to read the 'ssh_known_hosts' file.\n" + ex.Message);
                    }
                }
            }
            finally {
                Win32.ReleaseMutex(_globalMutex);
            }
        }
コード例 #7
0
ファイル: GApp.cs プロジェクト: nospy/EasyConnect
        public static void Run(string[] args)
        {
            InitialAction a = new InitialAction();
            _globalMutex = Win32.CreateMutex(IntPtr.Zero, 0, "PoderosaGlobalMutex");
            bool already_exists = (Win32.GetLastError()==Win32.ERROR_ALREADY_EXISTS);
            if(_globalMutex==IntPtr.Zero) throw new Exception("Global mutex could not open");

            LoadEnvironment(a);
            Init(a, args, already_exists);
            //System.Windows.Forms.Application.Run(_frame);
            //_frame.Show();
            if(!_closeWithoutSave) SaveEnvironment();
            GEnv.Terminate();

            Win32.CloseHandle(_globalMutex);
        }
コード例 #8
0
ファイル: GApp.cs プロジェクト: nospy/EasyConnect
        public static void LoadEnvironment(InitialAction act)
        {
            ThemeUtil.Init();

            OptionPreservePlace place = GetOptionPreservePlace();
            _options = new ContainerOptions();
            _history = new ConnectionHistory();
            _macroManager = new MacroManager();
            _container = new PoderosaContainer();
            _globalCommandTarget = new ContainerGlobalCommandTarget();
            _interThreadUIService = new ContainerInterThreadUIService();
            _sshKnownHosts = new SSHKnownHosts();

            _options.Init();

            //���̎��_�ł�OS�̌���ݒ�ɍ��������\�[�X����[�h����B�N�����O�ŕK�v�ɉ����ă����[�h
            ReloadStringResource();

            GEnv.Init(_container);
            GEnv.Options = _options;
            GEnv.GlobalCommandTarget = _globalCommandTarget;
            GEnv.InterThreadUIService = _interThreadUIService;
            GEnv.SSHKnownHosts = _sshKnownHosts;
            string dir = GetOptionDirectory(place);
            LoadConfigFiles(dir, act);
            _options.OptionPreservePlace = place;

            //�����܂ł����猾��ݒ��`�F�b�N���A�K�v�Ȃ�ǂݒ���
            if(GUtil.CurrentLanguage!=_options.Language) {
                System.Threading.Thread.CurrentThread.CurrentUICulture = _options.Language==Language.Japanese? new CultureInfo("ja") : CultureInfo.InvariantCulture;
                ReloadStringResource();
            }
        }
コード例 #9
0
ファイル: GApp.cs プロジェクト: nospy/EasyConnect
        public static void Init(InitialAction act, string[] args, bool already_exists)
        {
            //GFrame�̍쐬�̓R���X�g���N�^�̌�ɂ��Ȃ��ƁAGuevaraApp�̃��\�b�h��f���Q�[�g�̈����ɂł��Ȃ��B

            if(args.Length>0) {
                act.ShortcutFile = args[0];
            }

            _frame = new GFrame(act);
            _globalCommandTarget.Init(_frame);

            if(already_exists && _options.FrameState==FormWindowState.Normal) {
                Rectangle rect = _options.FramePosition;
                rect.Location += new Size(24,24);
                _options.FramePosition = rect;
            }

            _frame.DesktopBounds = _options.FramePosition;
            _frame.WindowState = _options.FrameState;
            _frame.AdjustMRUMenu();

            //�L���b�`�ł��Ȃ������G���[�̕⑫
            Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
        }
コード例 #10
0
ファイル: GApp.cs プロジェクト: nwtajcky/RDManager
        private static void LoadConfigFiles(string dir, InitialAction act)
        {
            if (Win32.WaitForSingleObject(_globalMutex, 10000) != Win32.WAIT_OBJECT_0)
            {
                throw new Exception("Global mutex lock error");
            }

            try {
                string optionfile    = dir + "options.conf";
                bool   config_loaded = false;
                bool   macro_loaded  = false;

                TextReader reader = null;
                try {
                    if (File.Exists(optionfile))
                    {
                        reader = new StreamReader(File.Open(optionfile, FileMode.Open, FileAccess.Read), Encoding.Default);
                        if (VerifyConfigHeader(reader))
                        {
                            ConfigNode root = new ConfigNode("root", reader).FindChildConfigNode("poderosa");
                            if (root != null)
                            {
                                _options.Load(root);
                                config_loaded = true;
                                _history.Load(root);
                                _macroManager.Load(root);
                                macro_loaded = true;
                            }
                        }
                    }
                }
                catch (Exception ex) {
                    //_errorOccurredOnBoot = true;
                    Debug.WriteLine(ex.StackTrace);
                    GUtil.WriteDebugLog(ex.StackTrace);
                    act.AddMessage("Failed to read the configuration file.\n" + ex.Message);
                }
                finally {
                    if (!config_loaded)
                    {
                        _options.Init();
                    }
                    if (!macro_loaded)
                    {
                        _macroManager.SetDefault();
                    }
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }

                GEnv.Options = _options;                 //これでDefaultRenderProfileが初期化される

                string kh = dir + "ssh_known_hosts";
                if (File.Exists(kh))
                {
                    try {
                        _sshKnownHosts.Load(kh);
                    }
                    catch (Exception ex) {
                        _sshKnownHosts.Clear();
                        act.AddMessage("Failed to read the 'ssh_known_hosts' file.\n" + ex.Message);
                    }
                }
            }
            finally {
                Win32.ReleaseMutex(_globalMutex);
            }
        }
コード例 #11
0
ファイル: GApp.cs プロジェクト: rfyiamcool/solrex
        private static void LoadEnvironment(InitialAction act)
        {
            ThemeUtil.Init();

            OptionPreservePlace place = GetOptionPreservePlace();
            _options = new ContainerOptions();
            _history = new ConnectionHistory();
            _macroManager = new MacroManager();
            _container = new PoderosaContainer();
            _globalCommandTarget = new ContainerGlobalCommandTarget();
            _interThreadUIService = new ContainerInterThreadUIService();
            _sshKnownHosts = new SSHKnownHosts();

            //���̎��_�ł�OS�̌���ݒ�ɍ��������\�[�X����[�h����B�N�����O�ŕK�v�ɉ����ă����[�h
            ReloadStringResource();

            GEnv.Init(_container);
            GEnv.Options = _options;
            GEnv.GlobalCommandTarget = _globalCommandTarget;
            GEnv.InterThreadUIService = _interThreadUIService;
            GEnv.SSHKnownHosts = _sshKnownHosts;
            string dir = GetOptionDirectory(place);
            LoadConfigFiles(dir, act);
            _options.OptionPreservePlace = place;

            // Check the language settings, re-read it if needed.
            if (GUtil.CurrentLanguage != _options.Language) {
                switch (_options.Language) {
                    case Language.Japanese:
                        System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja");
                    break;
                    case Language.Chinese:
                        System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh");
                    break;
                    default:
                        System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
                    break;
                }
                ReloadStringResource();
            }
        }
コード例 #12
0
ファイル: GApp.cs プロジェクト: VirusFree/VFTerminal
        private static void LoadConfigFiles(string dir, InitialAction act)
        {
            if (Win32.WaitForSingleObject(_globalMutex, 10000) != Win32.WAIT_OBJECT_0) throw new Exception("Global mutex lock error");

            try
            {
                //init defaults
                _options.Init();
                _macroManager.SetDefault();

                GEnv.Options = _options; //�����DefaultRenderProfile�������������
            }
            finally
            {
                Win32.ReleaseMutex(_globalMutex);
            }
        }