Beispiel #1
0
        //文字列形式から作成
        public static PluginManifest CreateByText(string text)
        {
            PluginManifest m = new PluginManifest();

            StructuredText s = new TextStructuredTextReader(new StringReader(text)).Read();

            if (s.Name == "manifest")
            {
                foreach (object manifestChild in s.Children)
                {
                    StructuredText assemblyEntryNode = manifestChild as StructuredText;
                    if (assemblyEntryNode != null)
                    {
                        PluginManifest.AssemblyEntry entry = m.AddAssembly(assemblyEntryNode.Name);
                        foreach (object assemblyEntryChild in assemblyEntryNode.Children)
                        {
                            StructuredText.Entry pluginEntry = assemblyEntryChild as StructuredText.Entry;
                            if (pluginEntry != null && pluginEntry.name == "plugin")
                            {
                                entry.AddPluginType(pluginEntry.value);
                            }
                        }
                    }
                }
            }

            return(m);
        }
        public static IPoderosaApplication CreatePoderosaApplication(string[] args)
        {
            string         home_directory  = AppDomain.CurrentDomain.BaseDirectory;
            string         preference_home = ResolveProfileDirectory("appdata");
            string         open_file       = null;
            PluginManifest pm = PluginManifest.CreateByFileSystem(home_directory);

            //コマンドライン引数を読む
            int i = 0;

            while (i < args.Length)
            {
                string t = args[i];
                string v = i < args.Length - 1? args[i + 1] : "";
                switch (t)
                {
                case "-p":
                case "--profile":
                    preference_home = ResolveProfileDirectory(v);
                    i += 2;
                    break;

                case "-a":
                case "--addasm":
                    pm.AddAssembly(home_directory, v.Split(';'));
                    i += 2;
                    break;

                case "-r":
                case "--remasm":
                    pm.RemoveAssembly(home_directory, v.Split(';'));
                    i += 2;
                    break;

                case "-open":
                    open_file = v;
                    i        += 2;
                    break;

                default:
                    i++;
                    break;
                }
            }

            if (open_file != null && TryToSendOpenFileMessage(open_file))
            {
                return(null);                                                       //別インスタンスに送信
            }
            PoderosaStartupContext ctx = new PoderosaStartupContext(pm, home_directory, preference_home, args, open_file);

            return(new InternalPoderosaWorld(ctx));
        }
Beispiel #3
0
        //ファイルシステムを読んで作成
        public static PluginManifest CreateByFileSystem(string base_dir)
        {
            PluginManifest m = new PluginManifest();

            //自分のディレクトリにある.dllを検索。アプリケーション版では不要だが、開発時のデバッグ実行時には必要
            string[] dlls = Directory.GetFiles(base_dir, "*.dll");
            foreach (string dll in dlls)
            {
                m.AddAssembly(dll);
            }

            //子ディレクトリ直下のみ検索。
            string[] dirs = Directory.GetDirectories(base_dir);
            foreach (string dir in dirs)
            {
                dlls = Directory.GetFiles(dir, "*.dll");
                foreach (string dll in dlls)
                {
                    m.AddAssembly(dll);
                }
            }

            return(m);
        }
Beispiel #4
0
        //ファイルシステムを読んで作成
        public static PluginManifest CreateByFileSystem(string base_dir) {
            PluginManifest m = new PluginManifest();

            //自分のディレクトリにある.dllを検索。アプリケーション版では不要だが、開発時のデバッグ実行時には必要
            string[] dlls = Directory.GetFiles(base_dir, "*.dll");
            foreach (string dll in dlls)
                m.AddAssembly(dll);

            //子ディレクトリ直下のみ検索。
            string[] dirs = Directory.GetDirectories(base_dir);
            foreach (string dir in dirs) {
                dlls = Directory.GetFiles(dir, "*.dll");
                foreach (string dll in dlls)
                    m.AddAssembly(dll);
            }

            return m;
        }
Beispiel #5
0
        //文字列形式から作成
        public static PluginManifest CreateByText(string text) {
            PluginManifest m = new PluginManifest();

            StructuredText s = new TextStructuredTextReader(new StringReader(text)).Read();

            if (s.Name == "manifest") {
                foreach (object manifestChild in s.Children) {
                    StructuredText assemblyEntryNode = manifestChild as StructuredText;
                    if (assemblyEntryNode != null) {
                        PluginManifest.AssemblyEntry entry = m.AddAssembly(assemblyEntryNode.Name);
                        foreach(object assemblyEntryChild in assemblyEntryNode.Children) {
                            StructuredText.Entry pluginEntry = assemblyEntryChild as StructuredText.Entry;
                            if (pluginEntry != null && pluginEntry.name == "plugin") {
                                entry.AddPluginType(pluginEntry.value);
                            }
                        }
                    }
                }
            }

            return m;
        }
Beispiel #6
0
        //�t�@�C���V�X�e����ǂ�ō쐬
        public static PluginManifest CreateByFileSystem(string base_dir)
        {
            PluginManifest m = new PluginManifest();

            //�����̃f�B���N�g���ɂ���.dll������B�A�v���P�[�V�����łł͕s�v�����A�J�����̃f�o�b�O���s���ɂ͕K�v
            string[] dlls = Directory.GetFiles(base_dir, "*.dll");
            foreach (string dll in dlls)
                m.AddAssembly(dll);

            //�q�f�B���N�g�������̂݌����B
            string[] dirs = Directory.GetDirectories(base_dir);
            foreach (string dir in dirs) {
                dlls = Directory.GetFiles(dir, "*.dll");
                foreach (string dll in dlls)
                    m.AddAssembly(dll);
            }

            return m;
        }