Beispiel #1
0
 public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, string profile_home, string[] args, string open_file)
 {
     _instance             = this;
     _homeDirectory        = AdjustDirectory(home_directory);
     _profileHomeDirectory = AdjustDirectory(profile_home);
     _initialOpenFile      = open_file;
     _args = args;
     Debug.Assert(pluginManifest != null);
     _pluginManifest     = pluginManifest;
     _preferenceFileName = Path.Combine(_profileHomeDirectory, "options.conf");
     _preferences        = BuildPreference(_preferenceFileName);
 }
        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 InternalPoderosaWorld(PoderosaStartupContext context) {
     _instance = this;
     _startupContext = context;
     _poderosaCulture = new PoderosaCulture();
     _poderosaLog = new PoderosaLog(this);
     _adapterManager = new AdapterManager();
     _stringResource = new StringResource("Poderosa.Plugin.strings", typeof(InternalPoderosaWorld).Assembly);
     _poderosaCulture.AddChangeListener(_stringResource);
     _pluginManager = new PluginManager(this);
     //ルート
     _rootExtension = _pluginManager.CreateExtensionPoint(ExtensionPoint.ROOT, typeof(IRootExtension), null);
 }
Beispiel #4
0
 public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, StructuredText preference, string[] args, string open_file)
 {
     _instance             = this;
     _homeDirectory        = AdjustDirectory(home_directory);
     _profileHomeDirectory = _homeDirectory;
     _initialOpenFile      = open_file;
     _args = args;
     Debug.Assert(pluginManifest != null);
     _pluginManifest = pluginManifest;
     Debug.Assert(preference != null);
     _preferenceFileName = null;
     _preferences        = preference;
 }
Beispiel #5
0
 public InternalPoderosaWorld(PoderosaStartupContext context)
 {
     _instance        = this;
     _startupContext  = context;
     _poderosaCulture = new PoderosaCulture();
     _poderosaLog     = new PoderosaLog(this);
     _adapterManager  = new AdapterManager();
     _stringResource  = new StringResource("Poderosa.Plugin.strings", typeof(InternalPoderosaWorld).Assembly);
     _poderosaCulture.AddChangeListener(_stringResource);
     _pluginManager = new PluginManager(this);
     //ルート
     _rootExtension = _pluginManager.CreateExtensionPoint(ExtensionPoint.ROOT, typeof(IRootExtension), null);
 }
Beispiel #6
0
        public static IPoderosaApplication CreatePoderosaApplication(string[] args, bool isMonolithic) {
            string home_directory = AppDomain.CurrentDomain.BaseDirectory;
            string preference_home = ResolveProfileDirectory("appdata");
            string open_file = null;

            PluginManifest pm;
            if (isMonolithic)
                pm = PluginManifest.CreateEmptyManifest();
            else
                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 #7
0
 public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, StructuredText preference, string[] args, string open_file) {
     _instance = this;
     _homeDirectory = AdjustDirectory(home_directory);
     _profileHomeDirectory = _homeDirectory;
     _initialOpenFile = open_file;
     _args = args;
     Debug.Assert(pluginManifest != null);
     _pluginManifest = pluginManifest;
     Debug.Assert(preference != null);
     _preferenceFileName = null;
     _preferences = preference;
 }
Beispiel #8
0
 public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, string profile_home, string[] args, string open_file) {
     _instance = this;
     _homeDirectory = AdjustDirectory(home_directory);
     _profileHomeDirectory = AdjustDirectory(profile_home);
     _initialOpenFile = open_file;
     _args = args;
     Debug.Assert(pluginManifest != null);
     _pluginManifest = pluginManifest;
     _preferenceFileName = Path.Combine(_profileHomeDirectory, "options.conf");
     _preferences = BuildPreference(_preferenceFileName);
 }
Beispiel #9
0
        //�N�����ɂ��
        public void InitializePlugins(PoderosaStartupContext sc)
        {
            try {
                _tracer = sc.Tracer;
                Debug.Assert(_tracer != null);

                _allPlugins = new List<Plugin>();
                ListPlugins(Assembly.GetEntryAssembly());
                ListPlugins(sc.PluginManifest);
                Load();
                Order();
                Instantiate();
            }
            catch (Exception ex) {
                _tracer.Trace(ex);
            }
        }