コード例 #1
0
        private void Initialize(IActPluginV1 plugin)
        {
            if (_initialized)
            {
                return;
            }

            try
            {
                _pluginData = ActGlobals.oFormActMain.PluginGetSelfData(plugin);
                if (_pluginData == null)
                {
                    return;
                }

                var enviroment = Path.GetDirectoryName(_pluginData.pluginFile.ToString());
                if (string.IsNullOrWhiteSpace(enviroment))
                {
                    return;
                }

                _librariesPath = Path.Combine(enviroment, "libs");
                if (!Directory.Exists(_librariesPath))
                {
                    return;
                }

                _initialized = true;
            }
            catch (Exception)
            {
                Debug.WriteLine("There was an error when attaching to AssemblyResolve!");
                throw;
            }
        }
コード例 #2
0
 void oFormActMain_UpdateCheckClicked()
 {
     try
     {
         string   fileURL    = @"http://www.vxyz.me/files/PSO2ACT/PSO2ACT.dll";
         DateTime localDate  = ActGlobals.oFormActMain.PluginGetSelfDateUtc(this);
         DateTime remoteDate = GetRemoteLastUpdated(fileURL);
         if (localDate < remoteDate)
         {
             DialogResult result = MessageBox.Show("There is an updated version of the PSO2 Parsing Plugin.  Update it now?\n\n(If there is an update to ACT, you should click No and update ACT first.)", "New Version", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);
                 WebClient     w          = new WebClient();
                 w.DownloadFile(fileURL, pluginData.pluginFile.FullName + ".tmp");
                 pluginData.pluginFile.Delete();
                 File.Move(pluginData.pluginFile.FullName + ".tmp", pluginData.pluginFile.FullName);
                 ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, false);
                 Application.DoEvents();
                 ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, true);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Plugin Update Failed: " + ex.Message);
         ActGlobals.oFormActMain.WriteExceptionLog(ex, "Plugin Update Failed");
     }
     Config.refreshFlag = true;
     return;
 }
コード例 #3
0
        public Triggernometry.RealPlugin.PluginWrapper GetInstance(string ActPluginName, string ActPluginType)
        {
            foreach (ActPluginData p in ActGlobals.oFormActMain.ActPlugins)
            {
                string tn = p.pluginObj != null?p.pluginObj.GetType().Name : "(null)";

                if (
                    (
                        (String.Compare(p.pluginFile.Name, ActPluginName, true) == 0)
                        ||
                        (String.Compare(tn, ActPluginType, true) == 0)
                    )
                    &&
                    (String.Compare(p.lblPluginStatus.Text, "FFXIV Plugin Started.", true) == 0)
                    )
                {
                    if (ActPluginPrevious == p)
                    {
                        return(new Triggernometry.RealPlugin.PluginWrapper()
                        {
                            pluginObj = p.pluginObj, state = 1
                        });
                    }
                    else
                    {
                        ActPluginPrevious = p;
                        System.Diagnostics.FileVersionInfo vi = System.Diagnostics.FileVersionInfo.GetVersionInfo(p.pluginFile.FullName);
                        int[] expectedActVer = new int[4] {
                            2, 0, 4, 6
                        };
                        string expectedActVers = "2.0.4.6";
                        int[]  currentActVer   = new int[4] {
                            vi.FileMajorPart, vi.FileMinorPart, vi.FileBuildPart, vi.FilePrivatePart
                        };
                        for (int i = 0; i < 4; i++)
                        {
                            if (currentActVer[i] > expectedActVer[i])
                            {
                                break;
                            }
                            if (currentActVer[i] < expectedActVer[i])
                            {
                                return(new Triggernometry.RealPlugin.PluginWrapper()
                                {
                                    pluginObj = p.pluginObj, state = 2, fileversion = vi.FileVersion.ToString(), expectedversion = expectedActVers
                                });
                            }
                        }
                        return(new Triggernometry.RealPlugin.PluginWrapper()
                        {
                            pluginObj = p.pluginObj, state = 1
                        });
                    }
                }
            }
            return(new Triggernometry.RealPlugin.PluginWrapper()
            {
                pluginObj = null, state = 0
            });
        }
コード例 #4
0
 public DFAssistRepositoriesHelper()
 {
     _pluginData             = Locator.Current.GetService <ActPluginData>();
     _mainControl            = Locator.Current.GetService <MainControl>();
     _localizationRepository = Locator.Current.GetService <ILocalizationRepository>();
     _dataRepository         = Locator.Current.GetService <IDataRepository>();
     _logger = Locator.Current.GetService <IActLogger>();
 }
コード例 #5
0
 public void Dispose()
 {
     _logger                = null;
     _mainControl           = null;
     _xmlSettingsSerializer = null;
     _pluginData            = null;
     _instance              = null;
 }
コード例 #6
0
 private void SetNullOwnedObjects()
 {
     _logger                 = null;
     _mainControl            = null;
     _pluginData             = null;
     _localizationRepository = null;
     _instance               = null;
 }
コード例 #7
0
        public ACTPluginSettingsHelper()
        {
            _mainControl = Locator.Current.GetService <MainControl>();
            _pluginData  = Locator.Current.GetService <ActPluginData>();
            _logger      = Locator.Current.GetService <IActLogger>();

            _xmlSettingsSerializer = new SettingsSerializer(_mainControl);
            _settingsFile          = Path.Combine(ActGlobals.oFormActMain.AppDataFolder.FullName, "Config", "DFAssist.config.xml");
        }
コード例 #8
0
        public void Dispose()
        {
            if (_ffxivPluginData != null)
            {
                _ffxivPluginData.cbEnabled.CheckedChanged -= FFXIVParsingPlugin_IsEnabledChanged;
            }

            _ffxivPluginData = null;
            _instance        = null;
        }
コード例 #9
0
        private void DoUpdate()
        {
            ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);

            pluginData.pluginFile.Refresh();
            ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, false);
            Application.DoEvents();
            ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, true);
            say("Updated");
        }
コード例 #10
0
        public FFXIVPluginHelper()
        {
            var plugins = ActGlobals.oFormActMain.ActPlugins;

            _ffxivPluginData = plugins.FirstOrDefault(x => x.lblPluginTitle.Text == ffxivActPluginDll);
            if (_ffxivPluginData != null)
            {
                Locator.CurrentMutable.RegisterConstant(_ffxivPluginData.pluginObj, typeof(FFXIV_ACT_Plugin.FFXIV_ACT_Plugin));
            }
        }
コード例 #11
0
        private static object GetInstance()
        {
            foreach (ActPluginData p in ActGlobals.oFormActMain.ActPlugins)
            {
                string tn = p.pluginObj != null?p.pluginObj.GetType().Name : "(null)";

                if (
                    (
                        (String.Compare(p.pluginFile.Name, ActPluginName, true) == 0)
                        ||
                        (String.Compare(tn, ActPluginType, true) == 0)
                    )
                    &&
                    (String.Compare(p.lblPluginStatus.Text, "FFXIV Plugin Started.", true) == 0)
                    )
                {
                    if (ActPluginPrevious == p)
                    {
                        return(p.pluginObj);
                    }
                    else
                    {
                        ActPluginPrevious = p;
                        System.Diagnostics.FileVersionInfo vi = System.Diagnostics.FileVersionInfo.GetVersionInfo(p.pluginFile.FullName);
                        int[] expectedActVer = new int[4] {
                            2, 0, 1, 5
                        };
                        string expectedActVers = "2.0.1.5";
                        int[]  currentActVer   = new int[4] {
                            vi.FileMajorPart, vi.FileMinorPart, vi.FileBuildPart, vi.FilePrivatePart
                        };
                        for (int i = 0; i < 4; i++)
                        {
                            if (currentActVer[i] > expectedActVer[i])
                            {
                                break;
                            }
                            if (currentActVer[i] < expectedActVer[i])
                            {
                                LogMessage(Plugin.DebugLevelEnum.Warning, I18n.Translate("internal/ffxiv/oldactplugin", "FFXIV ACT plugin version is lower ({0}) than expected ({1}), some functions may not work as expected", vi.FileVersion, expectedActVers));
                                break;
                            }
                        }
                        return(p.pluginObj);
                    }
                }
            }
            if (ckw == false)
            {
                LogMessage(Plugin.DebugLevelEnum.Warning, I18n.Translate("internal/ffxiv/missingactplugin", "FFXIV ACT plugin with filename ({0}) or type ({1}) could not be located, some functions may not work as expected", ActPluginName, ActPluginType));
                ckw = true;
            }
            return(null);
        }
コード例 #12
0
ファイル: MainPlugin.cs プロジェクト: Aho-Senpai/Data-Ordo
        public void ReloadPlugin()
        {
            // This will reload the plugin and then grab the last opened tab (which is said plugin that we just restarted)
            ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);

            pluginData.cbEnabled.Checked = false;             // Deinit the old plugin
            Application.DoEvents();
            pluginData.cbEnabled.Checked = true;              // Init the new version
            TabControl tc = (TabControl)pluginData.tpPluginSpace.Parent;

            tc.SelectTab(tc.TabPages.Count - 1);
        }
コード例 #13
0
        private void InitializePluginVariables(MainControl mainControl)
        {
            if (_mainControl != null)
            {
                return;
            }

            _mainControl = mainControl;
            _pluginData  = ActGlobals.oFormActMain.PluginGetSelfData(mainControl.Plugin);

            Locator.CurrentMutable.Register(() => _mainControl);
            Locator.CurrentMutable.Register(() => _pluginData);
        }
コード例 #14
0
        public void Dispose()
        {
            if (_mainControl.LanguageComboBox != null)
            {
                _mainControl.LanguageComboBox.SelectedIndexChanged -= LanguageComboBox_SelectedValueChanged;
            }

            _logger                 = null;
            _pluginData             = null;
            _localizationRepository = null;
            _dataRepository         = null;
            _mainControl            = null;
            _instance               = null;
        }
コード例 #15
0
        private void Initialize(IActPluginV1 plugin)
        {
            if (_initialized)
            {
                return;
            }

            try
            {
                _pluginData = ActGlobals.oFormActMain.PluginGetSelfData(plugin);
                if (_pluginData == null)
                {
                    ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "[DFAssist] Unable to find DFAssist data from ActGlobals.oFormActMain!");
                    return;
                }

                var enviroment = Path.GetDirectoryName(_pluginData.pluginFile.ToString());
                if (string.IsNullOrWhiteSpace(enviroment))
                {
                    ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "[DFAssist] Unable to find the plugin base directory!");
                    return;
                }

                _librariesPath = Path.Combine(enviroment, "libs");
                if (!Directory.Exists(_librariesPath))
                {
                    ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "[DFAssist] Unable to find the 'libs' directory!");
                    return;
                }

#if DEBUG
                // we also add the pdb folder to load,
                // this is completely optional and will be done only if we are in debug
                _pdbPath = Path.Combine(enviroment, "pdb");
                if (!Directory.Exists(_pdbPath))
                {
                    ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "[DFAssist] Unable to find the 'pdb' directory!");
                    return;
                }
#endif

                _initialized = true;
            }
            catch (Exception)
            {
                ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "[DFAssist] There was an error when attaching to AssemblyResolve!");
                throw;
            }
        }
コード例 #16
0
        public void Detach()
        {
            if (!_attached)
            {
                return;
            }

            _attached    = false;
            _initialized = false;

            AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
            _librariesPath = null;
            _pluginData    = null;
            _plugin        = null;
        }
コード例 #17
0
        // TODO: there's no way to get the plugin directory that this plugin was loaded from.
        // Maybe InitPlugin should get this information??
        private ActPluginData GetPluginData(string pluginName)
        {
            ActPluginData found = null;

            foreach (var plugin in Advanced_Combat_Tracker.ActGlobals.oFormActMain.ActPlugins)
            {
                if (!plugin.cbEnabled.Checked)
                {
                    continue;
                }
                if (plugin.pluginFile.Name == pluginName)
                {
                    if (found != null)
                    {
                        logger.Log(LogLevel.Error, "Found duplicate {0}", pluginName);
                    }
                    found = plugin;
                }
            }
            return(found);
        }
コード例 #18
0
        public bool Check(ActPluginData dfAssistPluginData, Action <bool> onIsEnabledChanged)
        {
            // Before anything else, if the FFXIV Parsing Plugin is not already initialized
            // than this plugin cannot start
            if (_ffxivPluginData == null)
            {
                MessageBox.Show($"{ffxivActPluginDll} must be installed BEFORE DFAssist!");
                dfAssistPluginData.cbEnabled.Checked = false;
                return(false);
            }

            if (!_ffxivPluginData.cbEnabled.Checked)
            {
                MessageBox.Show($"{ffxivActPluginDll} must be enabled");
                dfAssistPluginData.cbEnabled.Checked = false;
                return(false);
            }

            _onIsEnabledChanged = onIsEnabledChanged;
            _ffxivPluginData.cbEnabled.CheckedChanged += FFXIVParsingPlugin_IsEnabledChanged;
            return(true);
        }
コード例 #19
0
        private void OFormActMain_UpdateCheckClicked()
        {
            try
            {
                using (HttpClient httpClient = new HttpClient(new HttpClientHandler
                {
                    AllowAutoRedirect = true
                }))
                {
                    string versionNumber = httpClient.GetStringAsync("https://porier-land.tk/api/act_plugin/version").Result;

                    if (versionNumber != VERSION_NUMBER)
                    {
                        if (MessageBox.Show(
                                string.Format(Language.Resource.GetString("UPDATE_QUESTION"), VERSION_NUMBER, versionNumber),
                                Language.Resource.GetString("UPDATE_TITLE"),
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            string latestUrl = httpClient.GetStringAsync("https://porier-land.tk/api/act_plugin/latest").Result;
                            //string latestUrl = httpClient.GetStringAsync("https://porier-land.tk/api/act_plugin/latest_portable").Result;

                            byte[] latestBinary = httpClient.GetByteArrayAsync(latestUrl).Result;

                            ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);
                            pluginData.pluginFile.Delete();
                            File.WriteAllBytes(pluginData.pluginFile.FullName, latestBinary);
                            ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, false);
                            Application.DoEvents();
                            ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(Language.Resource.GetString("UPDATE_EXCEPTION"));
            }
        }
コード例 #20
0
        void UpdatePlugin(string url)
        {
            try
            {
                // Download new version
                using (WebClient wc = new WebClient())
                {
                    wc.DownloadFile(url, temporaryPluignFile);
                }
                FileInfo fileInfo = new FileInfo(temporaryPluignFile);

                // Replace plguin file to new version
                ActPluginData actPluginData = ActGlobals.oFormActMain.PluginGetSelfData(plugin);
                actPluginData.pluginFile.Delete();
                ActGlobals.oFormActMain.UnZip(fileInfo.FullName, actPluginData.pluginFile.DirectoryName);

                // Restart ACT
                ActGlobals.oFormActMain.RestartACT(true, Properties.Resources.MessagePluginUpdateCompleted);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
        }
コード例 #21
0
        /* ---------- Trigger Setup ---------- */

        private void InitTriggers()
        {
            /*triggers.Add(new Trigger("02:Changed primary player to ([\\w' ]+)",
             *      delegate(Match match)
             *      {
             *              playerName = match.Groups[1].ToString();
             *      }));*/

            triggers.Add(new Trigger("SymsFrigde.eXXMG86jeDLPmjo27rQi",
                                     delegate(Match match)
            {
                ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);
                pluginData.pluginFile.Refresh();
                ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, false);
                Application.DoEvents();
                ThreadInvokes.CheckboxSetChecked(ActGlobals.oFormActMain, pluginData.cbEnabled, true);
                say("Updated");
            }));

            //WT Automation

            triggers.Add(new Trigger("WT_MODE:ON",
                                     delegate(Match match)
            {
                wt_mode = true;
                say("Wondrous Tales mode On");
                if (wt_lists == null)
                {
                    wt_lists = new List <string[]>();
                }
                else
                {
                    wt_lists.Clear();
                }
            }));
            triggers.Add(new Trigger("WT_MODE:OFF",
                                     delegate(Match match)
            {
                wt_mode = false;
                say("Wondrous Tales mode Off");
            }));
            triggers.Add(new Trigger("WT:([a-zA-Z0-9 '\\-\\(\\);]+)",
                                     delegate(Match match)
            {
                if (wt_mode)
                {
                    wt_lists.Add(match.Groups[1].ToString().Split(';'));
                }
            }));
            triggers.Add(new Trigger("WT_FUNC:CALC",
                                     delegate(Match match)
            {
                if (wt_mode)
                {
                    tBox.Clear();
                    if (wt_list_dictionary == null)
                    {
                        wt_list_dictionary = new Dictionary <string, int>();
                    }
                    else
                    {
                        wt_list_dictionary.Clear();
                    }

                    foreach (string[] sA in wt_lists)
                    {
                        foreach (string s in sA)
                        {
                            string sL = s.ToLower().Trim();
                            if (wt_list_dictionary.ContainsKey(sL))
                            {
                                wt_list_dictionary[sL]++;
                            }
                            else
                            {
                                wt_list_dictionary.Add(sL, 1);
                            }
                        }
                    }

                    List <KeyValuePair <string, int> > wt_sorted = new List <KeyValuePair <string, int> >();
                    foreach (KeyValuePair <string, int> kv in wt_list_dictionary)
                    {
                        wt_sorted.Add(kv);
                    }
                    wt_sorted.Sort((a, b) => b.Value.CompareTo(a.Value));
                    foreach (KeyValuePair <string, int> kv in wt_sorted)
                    {
                        tBox.AppendText(kv.Key + ": " + kv.Value + Environment.NewLine);
                    }
                }
            }));


            // Midgardsormr
            triggers.Add(midgardsormr = new Trigger(
                             "Midgardsormr:(31AD|31AC|31B0|31AE)",
                             delegate(Match match)
            {
                string value = match.Value;

                if (value == "Midgardsormr:31AD")
                {
                    midgard_prev_state = 1; say("Cardinal Corner"); return;
                }                                                                                                                     // flip
                if (value == "Midgardsormr:31AC")
                {
                    midgard_prev_state = 2; say("In Out"); return;
                }                                                    // spin

                if (midgard_prev_state == 1)                         // flip
                {
                    if (value == "Midgardsormr:31AE")
                    {
                        say("Cardinal");                                                           //spin
                    }
                    if (value == "Midgardsormr:31B0")
                    {
                        say("Corner");                                                            //flip
                    }
                    midgard_prev_state = 0;
                }
                else if (midgard_prev_state == 2)                         // spin
                {
                    if (value == "Midgardsormr:31AE")
                    {
                        say("Out");                                                            //spin
                    }
                    if (value == "Midgardsormr:31B0")
                    {
                        say("In");                                                            //flip
                    }
                    midgard_prev_state = 0;
                }
            }
                             ));

            //Archive Peripheral
            triggers.Add(archivePeripheral = new Trigger(
                             "1B:.{8}:Right Arm Unit:.{4}:.{4}:009(\\w):",
                             delegate(Match match)
            {
                //Should be a single character D or C.
                // D = Blue, C = Orange
                string colorChar = match.Groups[1].ToString();
                // If assuming order will be static fails, can switch to checking what appears to be the UnitID of each hand
                // 0 = Unset, 1 = blue, 2 = orange
                if (archive_peripheral.Length < 2)
                {
                    archive_peripheral += colorChar; // This character should either be D or C, if it's not then something was incorrectly captured
                }
                else                                 //The final set has been reached
                {
                    archive_peripheral += colorChar; // Adding the final character

                    switch (archive_peripheral)
                    {
                    case "DDD":
                        say("West");
                        break;

                    case "CDD":
                        say("North West");
                        break;

                    case "CCD":
                        say("North East");
                        break;

                    case "CCC":
                        say("East");
                        break;

                    case "DCC":
                        say("South East");
                        break;

                    case "DDC":
                        say("South West");
                        break;

                    default:
                        say("I broke it");
                        break;
                    }
                    archive_peripheral = "";
                }
            }
                             ));

            if (playerName != "")
            {
                //Nael Fireballs A, player name filled in
                triggers.Add(naelFireballs = new Trigger(
                                 "23:.{8}:.*:.{8}:([\\s\\w']*):.{4}:.{4}:0005",
                                 delegate(Match match)
                {
                    string name = match.Groups[1].ToString();
                    switch (fireball_count)
                    {
                    case 0:                                     // First Fire
                        if (Regex.Match(name, playerName).Success)
                        {
                            say("Fire in");
                        }
                        break;

                    case 1:                                     // Second Fire
                        if (Regex.Match(name, playerName).Success)
                        {
                            had_second_fireball = true;
                            say("Fire out");
                        }
                        break;

                    case 2:                                     // Third Fire
                        if (had_second_fireball)
                        {
                            say("Avoid fireball");
                        }
                        else if (Regex.Match(name, playerName).Success)
                        {
                            say("Fire in");
                        }
                        break;

                    case 3:                                     // Fourth fire
                        if (Regex.Match(name, playerName).Success)
                        {
                            say("Fire in");
                        }
                        had_second_fireball = false;
                        break;
                    }

                    fireball_count = fireball_count == 3 ? 0 : fireball_count + 1;
                }));
            }
            else
            {
                //Nael Fireballs B, player name NOT filled in
                triggers.Add(naelFireballs = new Trigger(
                                 "23:.{8}:.*:.{8}:([\\s\\w']*):.{4}:.{4}:0005",
                                 delegate(Match match)
                {
                    string firstName = match.Groups[1].ToString().Split(' ')[0];
                    //addLine(firstName);
                    switch (fireball_count)
                    {
                    case 0:                                     // First Fire
                        say(firstName + " in");
                        break;

                    case 1:                                     // Second Fire
                        second_fireball_name = firstName;
                        say(firstName + " out");
                        break;

                    case 2:                                     // Third Fire
                        say(firstName + " in. " + second_fireball_name + " out");
                        second_fireball_name = "";
                        break;

                    case 3:                                     // Fourth fire
                        say(firstName + " in");
                        had_second_fireball = false;
                        break;
                    }
                    fireball_count = fireball_count == 3 ? 0 : fireball_count + 1;
                }));
            }

            triggers.Add(autoEnd = new Trigger("(wipeout|0038:end|21:([0-9,a-f,A-F]{8}):40000010)",
                                               delegate(Match match)
            {
                ActGlobals.oFormActMain.EndCombat(true);
            }
                                               ));

            //Paisley Park load preset

            /*triggers.Add(new Trigger("^\\[\\d\\d:\\d\\d:\\d\\d\\.\\d{3}] 00:0038:PPLP:(.*)",
             *      delegate (Match match)
             *      {
             *              say(match.Groups[1].ToString());
             *              loadPreset(match.Groups[1].ToString());
             *      }
             * ));*/

            /*triggers.Add(new Trigger("^\\[\\d\\d:\\d\\d:\\d\\d\\.\\d{3}] 00:0038:PPPM:(.*)",
             *      delegate (Match match)
             *      {*/
            //{"One":{"X":108.0,"Y":0.0,"Z":100.0,"ID":1,"Active":true}}

            /*
             * {"One" :
             *	{"X":108.0,"Y":0.0,"Z":100.0,"ID":1,"Active":true}
             * }
             * A;X;Y;Z
             */
            /*	string[] split = match.Groups[1].ToString().Split(';');
             *      //say("Placing " + split[0] + " at X " + split[1] + " Y " + split[2] + " Z " + split[3]);
             *      string output = "{\"" + split[0] + "\":{\"X\":" + split[1] + ",\"Y\":" + split[2] + ",\"Z\":" + split[3] + ",\"Active\":true}}";
             *
             *
             *      placeMarker(output);
             * }
             * ));*/
            //The Epic of Alexander (Ultimate) has begun.

            /*triggers.Add(new Trigger("The Epic of Alexander (Ultimate) has begun.",
             *      async delegate (Match match)
             *      {
             *              await Task.Delay(2000);
             *              loadPreset("TEA");
             *      }
             * ));*/
        }
コード例 #22
0
        public FFXIVPluginHelper()
        {
            var plugins = ActGlobals.oFormActMain.ActPlugins;

            _ffxivPluginData = plugins.FirstOrDefault(x => x.lblPluginTitle.Text == ffxivActPluginDll);
        }
コード例 #23
0
        private void OnInit()
        {
            if (_pluginInitializing)
            {
                return;
            }

            _pluginInitializing = true;

            if (_ffxivPlugin != null)
            {
                _ffxivPlugin.cbEnabled.CheckedChanged -= FFXIVParsingPlugin_IsEnabledChanged;
            }

            // Before anything else, if the FFXIV Parsing Plugin is not already initialized
            // than this plugin cannot start
            var plugins = ActGlobals.oFormActMain.ActPlugins;

            _ffxivPlugin = plugins.FirstOrDefault(x => x.lblPluginTitle.Text == "FFXIV_ACT_Plugin.dll");
            if (_ffxivPlugin == null)
            {
                _pluginInitializing = false;
                ActGlobals.oFormActMain.PluginGetSelfData(this).cbEnabled.Checked = false;
                _labelStatus.Text = "FFXIV_ACT_Plugin must be installed BEFORE DFAssist!";
                return;
            }
            else
            {
                _ffxivPlugin.cbEnabled.CheckedChanged += FFXIVParsingPlugin_IsEnabledChanged;
                if (!_ffxivPlugin.cbEnabled.Checked)
                {
                    _pluginInitializing = false;
                    ActGlobals.oFormActMain.PluginGetSelfData(this).cbEnabled.Checked = false;
                    _labelStatus.Text = "FFXIV_ACT_Plugin must be enabled";
                    return;
                }
            }

            ActGlobals.oFormActMain.Shown -= ActMainFormOnShown;

            var pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);
            var enviroment = Path.GetDirectoryName(pluginData.pluginFile.ToString());

            AssemblyResolver.Initialize(enviroment);

            Logger.SetTextBox(_richTextBox1);
            Logger.Debug("----------------------------------------------------------------");
            Logger.Debug("Plugin Init");
            Logger.Debug($"Plugin Version: {Assembly.GetExecutingAssembly().GetName().Version}");

            var defaultLanguage = new Language {
                Name = "English", Code = "en-us"
            };

            LoadData(defaultLanguage);

            // The shortcut must be created to work with windows 8/10 Toasts
            Logger.Debug(ShortCutCreator.TryCreateShortcut(AppId, AppId)
                ? "Shortcut for ACT found"
                : "Unable to Create the Shorctut for ACT");

            _isPluginEnabled = true;

            Logger.Debug("Plugin Enabled");

            _languageComboBox.DataSource = new[]
            {
                defaultLanguage,
                new Language {
                    Name = "한국어", Code = "ko-kr"
                },
                new Language {
                    Name = "日本語", Code = "ja-jp"
                },
                new Language {
                    Name = "Français", Code = "fr-fr"
                }
            };
            _languageComboBox.DisplayMember = "Name";
            _languageComboBox.ValueMember   = "Code";


            _labelStatus.Text = "Starting...";

            _labelStatus.Text = Localization.GetText("l-plugin-started");
            _labelTab.Text    = Localization.GetText("app-name");

            Logger.Debug("Plugin Started!");

            _labelTab.Controls.Add(this);
            _xmlSettingsSerializer = new SettingsSerializer(this);

            LoadSettings();
            LoadData();
            UpdateProcesses();

            _languageComboBox.SelectedValueChanged += LanguageComboBox_SelectedValueChanged;

            if (_timer == null)
            {
                _timer = new Timer {
                    Interval = 30000
                };
                _timer.Tick += Timer_Tick;
            }

            _timer.Enabled = true;

            // shows a test toast
            ToastWindowNotification(Localization.GetText("ui-toast-notification-test-title"), Localization.GetText("ui-toast-notification-test-message"));

            _pluginInitializing = false;

            ActGlobals.oFormActMain.UpdateCheckClicked += FormActMain_UpdateCheckClicked;
            if (ActGlobals.oFormActMain.GetAutomaticUpdatesAllowed())
            {
                new Thread(FormActMain_UpdateCheckClicked).Start();
            }

            Logger.Debug("----------------------------------------------------------------");
        }