public void InitAll(AthameApplication application)
        {
            Log.Debug(Tag, "Init plugin settings");
            if (Plugins == null)
            {
                throw new InvalidOperationException("InitAll can only be called after LoadAll");
            }
            foreach (var plugin in Plugins)
            {
                // If it's a service plugin, add it to main service collection
                var service = plugin.Service;
                if (service == null)
                {
                    continue;
                }

                // Restore the config
                plugin.SettingsFile.Load();
                plugin.Service.Settings = plugin.SettingsFile.Settings;

                // Call Init
                plugin.Plugin.Init(application, plugin.Context);

                AddService(plugin.Service);
            }
        }
Пример #2
0
        public static void Main()
        {
            // Create app instance config
            DefaultApp = new AthameApplication
            {
                IsWindowed = true,
#if DEBUG
                UserDataPath = Path.Combine(Directory.GetCurrentDirectory(), "UserDataDebug")
#else
                UserDataPath = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                    "Athame")
#endif
            };

            // Ensure user data dir
            Directory.CreateDirectory(DefaultApp.UserDataPath);

            // Load settings
            SettingsPath    = DefaultApp.UserDataPathOf(SettingsFilename);
            DefaultSettings = new SettingsManager <AthameSettings>(SettingsPath);
            DefaultSettings.Load();

            DefaultPluginManager = new PluginManager(Path.Combine(Directory.GetCurrentDirectory(), PluginManager.PluginDir));

            // Begin main form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
Пример #3
0
        public static void Main(string[] args)
        {
            TaskDialogHelper.MainCaption = "Athame";
            // Create app instance config
            DefaultApp = new AthameApplication
            {
                IsWindowed = true
            };

            var dataDir = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "Athame");
            var userDataDirArgIndex = Array.IndexOf(args, "--user-data-dir");

            if (userDataDirArgIndex != -1 &&
                args.Length <= userDataDirArgIndex + 2)
            {
                var dir = args[userDataDirArgIndex + 1];
                if (Directory.Exists(dir))
                {
                    dataDir = Path.Combine(dir, "Athame Data");
                }
            }
            DefaultApp.UserDataPath = dataDir;


            // Install logging
            LogDir = DefaultApp.UserDataPathOf("Logs");
            Directory.CreateDirectory(LogDir);
            Log.AddLogger("file", new FileLogger(LogDir));
#if !DEBUG
            Log.Filter = Level.Warning;
            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Log.WriteException(Level.Fatal, "AppDomain", eventArgs.ExceptionObject as Exception);
            };
#else
            Log.AddLogger("debug", new DebugLogger());
#endif
            Log.Debug(Tag, "Logging installed on AppDomain");

            // Ensure user data dir
            Directory.CreateDirectory(DefaultApp.UserDataPath);

            // Load settings
            SettingsPath    = DefaultApp.UserDataPathOf(SettingsFilename);
            DefaultSettings = new SettingsFile <AthameSettings>(SettingsPath);
            DefaultSettings.Load();

            // Create plugin manager instance
            DefaultPluginManager = new PluginManager(Path.Combine(Directory.GetCurrentDirectory(), PluginManager.PluginDir));

            Log.Debug(Tag, "Ready to begin main form loop");
            // Begin main form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Пример #4
0
        public static void Main(string[] args)
        {
            // Create app instance config
            DefaultApp = new AthameApplication
            {
                IsWindowed = true,
#if DEBUG
                UserDataPath = Path.Combine(Directory.GetCurrentDirectory(), "UserDataDebug")
#else
                UserDataPath = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                    "Athame")
#endif
            };

            // Install logging
            LogDir = DefaultApp.UserDataPathOf("Logs");
            Directory.CreateDirectory(LogDir);
            Log.AddLogger("file", new FileLogger(LogDir));
#if !DEBUG
            Log.Filter = Level.Warning;
            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Log.WriteException(Level.Fatal, "AppDomain", eventArgs.ExceptionObject as Exception);
            };
#else
            Log.AddLogger("debug", new DebugLogger());
#endif
            Log.Debug(Tag, "Logging installed on AppDomain");

            // Ensure user data dir
            Directory.CreateDirectory(DefaultApp.UserDataPath);

            // Load settings
            SettingsPath    = DefaultApp.UserDataPathOf(SettingsFilename);
            DefaultSettings = new SettingsFile <AthameSettings>(SettingsPath);
            DefaultSettings.Load();

            // Create plugin manager instance
            DefaultPluginManager = new PluginManager(Path.Combine(Directory.GetCurrentDirectory(), PluginManager.PluginDir));
            if (args.Length >= 2)
            {
                if (args[0] == "/loadSinglePlugin")
                {
                    DefaultPluginManager.SetSinglePlugin(args[1]);
                }
            }

            Log.Debug(Tag, "Ready to begin main form loop");
            // Begin main form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
Пример #5
0
 /// <summary>
 /// Called when the plugin is loaded.
 /// </summary>
 /// <param name="application">The current host application instance.</param>
 /// <param name="pluginContext">Information about the plugin's location.</param>
 public abstract void Init(AthameApplication application, PluginContext pluginContext);
Пример #6
0
 public override void Init(AthameApplication application, PluginContext pluginContext)
 {
 }
Пример #7
0
        public static void Main(string[] args)
        {
            //var tempDir = System.IO.Directory.CreateDirectory("Temp");
            //Shell shell = new Shell();
            //Folder folder = shell.NameSpace(tempDir.FullName);
            //var item = folder.ParseName("test.txt");

            //foreach (FolderItem file in folder.Items())
            //{
            //    if (file.Name == "test.txt")
            //    {

            //    }
            //}
            //Folder folder2 = shell.BrowseForFolder(0, "Select a destination for this media:", 0, 0);
            //if (folder == null)
            //{
            //    return;
            //}
            //folder2.CopyHere(item);



            TaskDialogHelper.MainCaption = "Athame";
            // Create app instance config
            DefaultApp = new AthameApplication
            {
                IsWindowed = true
            };

            var dataDir = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "Athame");
            var userDataDirArgIndex = Array.IndexOf(args, "--user-data-dir");

            if (userDataDirArgIndex != -1 &&
                args.Length <= userDataDirArgIndex + 2)
            {
                var dir = args[userDataDirArgIndex + 1];
                if (Directory.Exists(dir))
                {
                    dataDir = Path.Combine(dir, "Athame Data");
                }
            }
            DefaultApp.UserDataPath = dataDir;


            // Install logging
            LogDir = DefaultApp.UserDataPathOf("Logs");
            Directory.CreateDirectory(LogDir);
            Log.AddLogger("file", new FileLogger(LogDir));
#if !DEBUG
            Log.Filter = Level.Warning;
            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Log.WriteException(Level.Fatal, "AppDomain", eventArgs.ExceptionObject as Exception);
            };
#else
            Log.AddLogger("debug", new DebugLogger());
#endif
            Log.Debug(Tag, "Logging installed on AppDomain");

            // Ensure user data dir
            Directory.CreateDirectory(DefaultApp.UserDataPath);

            // Load settings
            SettingsPath    = DefaultApp.UserDataPathOf(SettingsFilename);
            DefaultSettings = new SettingsFile <AthameSettings>(SettingsPath);
            DefaultSettings.Load();

            // Create plugin manager instance
            DefaultPluginManager = new PluginManager(Path.Combine(Directory.GetCurrentDirectory(), PluginManager.PluginDir), DefaultApp.UserDataPath);

            Log.Debug(Tag, "Ready to begin main form loop");
            // Begin main form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }