コード例 #1
0
        private static XElement GetEntryElement(PodiumPluginUIEntry entryInfo, string templateXML, double currentY, uint currentPosition, bool stripFormatting)
        {
            StringBuilder playerRecordXml = new StringBuilder(templateXML);

            playerRecordXml.Replace("{[Y]}", currentY.ToString(CultureInfo.InvariantCulture));
            playerRecordXml.Replace("{[Rank]}", currentPosition + ".");
            playerRecordXml.Replace("{[Value]}", entryInfo.Value);

            string description = SecurityElement.Escape(entryInfo.Description);

            if (stripFormatting)
            {
                description = TMSPSPluginBase.StripTMColorsAndFormatting(description);
            }

            playerRecordXml.Replace("{[Description]}", description);

            return(XElement.Parse(playerRecordXml.ToString()));
        }
コード例 #2
0
        private void InitializePlugins()
        {
            Plugins = TMSPSPluginBase.GetPlugins(ApplicationDirectory, _logger);
            Plugins.RemoveAll(p => p is TMSPSCorePlugin);
            Plugins.Insert(0, new TMSPSCorePlugin(Path.Combine(ApplicationDirectory, @"Plugins\Core")));

            HostContext = GetHostContext();
            HostContext.ShutdownRequested += HostContext_ShutdownRequested;

            if (HostContext == null)
            {
                Log.ErrorToUI("Could not create HostContext, stopping TMSPS!");
                return;
            }

            Log.InfoToUI(string.Format("{0} Plugins found, starting to initialize plugins.", Plugins.Count));

            foreach (ITMSPSPlugin plugin in Plugins)
            {
                plugin.InitPlugin(HostContext, new ConsoleUILogger("TMSPS", string.Format(" - [{0}]", plugin.ShortName)));
            }

            Log.InfoToUI("Plugins initialized.");
        }