예제 #1
0
        private static void SdkCallback(int eventType, int eventValue, string eventArg, IntPtr context)
        {
            switch (eventType)
            {
            case LogitechArxWrapper.LogiArxEventMobiledeviceArrival:
                //Send your files here
                //public static extern bool LogiArxAddFileAs(string filePath, string fileName, string mimeType = "");

                Console.WriteLine(@"ARX Client Found");

                var webdir = "core";

                //Load JavaScript

                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/libs/jquery/jquery/dist/jquery.js",
                                                    "libs/jquery/jquery/dist/jquery.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/libs/jquery/tether/dist/js/tether.min.js",
                                                    "libs/jquery/tether/dist/js/tether.min.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/libs/jquery/bootstrap/dist/js/bootstrap.js",
                                                    "libs/jquery/bootstrap/dist/js/bootstrap.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/libs/jquery/underscore/underscore-min.js",
                                                    "libs/jquery/underscore/underscore-min.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(
                    webdir + "/libs/jquery/jQuery-Storage-API/jquery.storageapi.min.js",
                    "libs/jquery/jQuery-Storage-API/jquery.storageapi.min.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/libs/jquery/PACE/pace.min.js",
                                                    "libs/jquery/PACE/pace.min.js", "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/scripts/ui-form.js", "scripts/ui-form.js",
                                                    "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/scripts/ffxivdata.js", "scripts/ffxivdata.js",
                                                    "text/javascript");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/scripts/chromatics.js", "scripts/chromatics.js",
                                                    "text/javascript");


                //Load CSS
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/animate.css/animate.min.css",
                                                    "assets/animate.css/animate.min.css", "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/glyphicons/glyphicons.css",
                                                    "assets/glyphicons/glyphicons.css", "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/font-awesome/css/font-awesome.min.css",
                                                    "assets/font-awesome/css/font-awesome.min.css", "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(
                    webdir + "/assets/material-design-icons/material-design-icons.css",
                    "assets/material-design-icons/material-design-icons.css", "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/bootstrap/dist/css/bootstrap.min.css",
                                                    "assets/bootstrap/dist/css/bootstrap.min.css", "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/styles/app.css", "assets/styles/app.css",
                                                    "text/css");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/assets/styles/font.css", "assets/styles/font.css",
                                                    "text/css");

                //Load Images

                var coreImages = Directory.GetFiles(webdir + @"\img", "*.png", SearchOption.AllDirectories);
                foreach (var coreimage in coreImages)
                {
                    var reduced = coreimage.Replace(@"\", "/").Replace(webdir + "/", "");
                    var output  = coreimage.Replace(@"\", "/");
                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "image/png");
                }


                //Load HTML
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/info.html", "info.html", "text/html");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/playerhud.html", "playerhud.html", "text/html");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/partylist.html", "partylist.html", "text/html");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/mapdata.html", "mapdata.html", "text/html");
                LogitechArxWrapper.LogiArxAddFileAs(webdir + "/act.html", "act.html", "text/html");

                //Init HTML
                LogitechArxWrapper.LogiArxSetIndex("info.html");
                Console.WriteLine(@"Switching to info.html");

                break;

            case LogitechArxWrapper.LogiArxEventMobiledeviceRemoval:
                //Device disconnected
                break;

            case LogitechArxWrapper.LogiArxEventTapOnTag:
                if (eventArg == "myBtn")
                {
                    //Do something on this input
                }
                break;
            }
        }
예제 #2
0
        public List <string> LoadPlugins()
        {
            var pluginsdata  = new List <string>();
            var plugindir    = "plugins";
            var pluginSearch = Directory.GetFiles(plugindir + @"\", "*.manifest", SearchOption.AllDirectories);

            if (pluginSearch.Length > 0)
            {
                foreach (var plugin in pluginSearch)
                {
                    using (var sr = new StreamReader(plugin))
                    {
                        try
                        {
                            var _plugname   = sr.ReadToEnd();
                            var plugname    = _plugname.Replace(" ", "_");
                            var plugdir     = plugin.Replace(@"\", "/").Replace(@"plugin.manifest", "");
                            var resourcedir = plugin.Replace(plugindir + "/", "").Replace(@"\plugin.manifest", "");

                            sr.Close();
                            Console.WriteLine(plugname + @" Plugin Found. Attempting to Load..");

                            //Load Data

                            var plugincss =
                                Directory.GetFiles(resourcedir + @"\css\", "*.css", SearchOption.AllDirectories);
                            var pluginjs =
                                Directory.GetFiles(resourcedir + @"\js\", "*.js", SearchOption.AllDirectories);
                            var pluginimgPng =
                                Directory.GetFiles(resourcedir + @"\img\", "*.png", SearchOption.AllDirectories);
                            var pluginimgJpg =
                                Directory.GetFiles(resourcedir + @"\img\", "*.jpg", SearchOption.AllDirectories);
                            var pluginimgGif =
                                Directory.GetFiles(resourcedir + @"\img\", "*.gif", SearchOption.AllDirectories);

                            if (plugincss.Length > 0)
                            {
                                foreach (var css in plugincss)
                                {
                                    var reduced = css.Replace(@"\", "/").Replace(plugdir, "");
                                    var output  = css.Replace(@"\", "/");
                                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "text/css");
                                }
                            }

                            if (pluginjs.Length > 0)
                            {
                                foreach (var js in pluginjs)
                                {
                                    var reduced = js.Replace(@"\", "/").Replace(plugdir, "");
                                    var output  = js.Replace(@"\", "/");
                                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "text/javascript");
                                }
                            }

                            if (pluginimgPng.Length > 0)
                            {
                                foreach (var png in pluginimgPng)
                                {
                                    var reduced = png.Replace(@"\", "/").Replace(plugdir, "");
                                    var output  = png.Replace(@"\", "/");
                                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "image/png");
                                }
                            }

                            if (pluginimgJpg.Length > 0)
                            {
                                foreach (var jpg in pluginimgJpg)
                                {
                                    var reduced = jpg.Replace(@"\", "/").Replace(plugdir, "");
                                    var output  = jpg.Replace(@"\", "/");
                                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "image/jpeg");
                                }
                            }

                            if (pluginimgGif.Length > 0)
                            {
                                foreach (var gif in pluginimgGif)
                                {
                                    var reduced = gif.Replace(@"\", "/").Replace(plugdir, "");
                                    var output  = gif.Replace(@"\", "/");
                                    LogitechArxWrapper.LogiArxAddFileAs(output, reduced, "image/gif");
                                }
                            }

                            var _final = resourcedir + @"\index.html";
                            var final  = _final.Replace(@"\", "/");
                            LogitechArxWrapper.LogiArxAddFileAs("core/scripts/ffxivsetup.js", "ffxivsetup.js",
                                                                "text/javascript");
                            LogitechArxWrapper.LogiArxAddFileAs("core/scripts/ffxivexternal.js", "ffxivexternal.js",
                                                                "text/javascript");
                            LogitechArxWrapper.LogiArxAddFileAs(final, plugname + ".html", "text/html");
                            Console.WriteLine(@"Added file " + final + @" AS " + plugname + @".html");

                            pluginsdata.Add(plugname);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(@"EX: " + ex.Message);
                        }
                    }
                }
            }

            return(pluginsdata);
        }