Ejemplo n.º 1
0
        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            lblStatus = pluginStatusText;


            var pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);

            enviroment = Path.GetDirectoryName(pluginData.pluginFile.ToString()) + @"\";
            Debug.WriteLine(@"Startup: " + enviroment);

            if (!LoadAssemblies())
            {
                return;
            }

            dataStruct = new ACTDataTemplate();

            pluginScreenSpace.Controls.Add(this);
            this.Dock = DockStyle.Fill;
            pluginScreenSpace.Text = "Chromatics";

            //pluginScreenSpace.Dispose();

            //Events
            ActGlobals.oFormActMain.BeforeLogLineRead       += OnBeforeLogLineRead;
            ActGlobals.oFormActMain.OnCombatStart           += oFormActMain_OnCombatStart;
            ActGlobals.oFormActMain.OnCombatEnd             += oFormActMain_OnCombatEnd;
            ActGlobals.oFormSpellTimers.OnSpellTimerExpire  += oFormSpellTimers_OnSpellTimerExpire;
            ActGlobals.oFormSpellTimers.OnSpellTimerWarning += oFormSpellTimers_OnSpellTimerWarning;
            ActGlobals.oFormSpellTimers.OnSpellTimerRemoved += oFormSpellTimers_OnSpellTimerRemoved;

            //Custom Triggers
            var cTriggers = ActGlobals.oFormActMain.ActiveCustomTriggers;

            //Fetch custom triggers from ACT and store in array
            foreach (var cTrigger in cTriggers)
            {
                var preparse      = cTrigger.Key;
                var preparsearray = preparse.Split(new string[] { "|" }, StringSplitOptions.None);
                customTriggers.Add(preparsearray[1]);
            }


            //Timers

            lblStatus.Text = "Plugin Started";
        }
Ejemplo n.º 2
0
        private void WriteJSON(ACTDataTemplate data)
        {
            try
            {
                var path = enviroment + @"actdata.chromatics";

                using (var file = File.CreateText(path))
                {
                    var serializer = new Newtonsoft.Json.JsonSerializer();
                    serializer.Serialize(file, dataStruct);
                }
            }
            catch (Exception e)
            {
                //throw;
            }
        }