public void QouteStringLiteral() { var adapter = new CommandAdapter(); Assert.AreEqual("'test'", adapter.QuoteStringLiteral("test")); Assert.AreEqual("'tes''t'", adapter.QuoteStringLiteral("tes't")); }
public DataTable GetSelect(string query = "") { Table = new DataTable(); using (ConnectionAdapter connection = getConnection(@ConnectionString)) { // Connect to the database then retrieve the schema information. connection.Open(); string command = ""; if (query != "") { command = query; } else { command = "SELECT * FROM " + TableName; } using (CommandAdapter cmd = getCommandAdapter(command, connection)) { using (IDataReader reader = cmd.ExecuteReader()) { Table.Load(reader); return(Table); } } } }
/// <summary> /// 群聊处理和事件触发分发 /// </summary> public static async ValueTask GroupMessageParse(object sender, GroupMessageEventArgs groupMessage) { //读取配置文件 if (!ConfigManager.TryGetUserConfig(groupMessage.LoginUid, out UserConfig userConfig)) { await groupMessage.SourceGroup.SendGroupMessage("读取配置文件(User)时发生错误\r\n请联系机器人管理员"); Log.Error("AntiRain会战管理", "无法读取用户配置文件"); return; } //会战管理 if (CommandAdapter.GetPCRGuildBattlecmdType(groupMessage.Message.RawText, out var battleCommand)) { Log.Info("PCR会战管理", $"获取到指令[{battleCommand}]"); //判断模块使能 if (userConfig.ModuleSwitch.PCR_GuildManager) { PcrGuildBattleChatHandle chatHandle = new(sender, groupMessage, battleCommand); chatHandle.GetChat(); } else { Log.Warning("AntiRain会战管理", "会战功能未开启"); } } }
static void Main(string[] args) { IExecutor executor = new CommandExecutor(); IAdapter adapter = new CommandAdapter(); WebSocketListener webSocketListener = new WebSocketListener(executor, adapter); webSocketListener.StartServer(8888); }
public void CanRegisterAnAdapter() { mapSvc.Register(typeof(object), typeof(MockAdapter)); CommandAdapter ad = mapSvc.CreateAdapter(typeof(object)); Assert.AreSame(typeof(MockAdapter), ad.GetType()); }
private async void OnSelect(object sender, RoutedEventArgs e) { using (IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); var sicilList = await cmd.Select(); this.RadGridView1.ItemsSource = sicilList; } }
private async void OnSelectById(object sender, RoutedEventArgs e) { using (IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); SICIL sicil = await cmd.SelectById(9377); this.RadGridView1.ItemsSource = new List<SICIL>() { sicil }; } }
private async void OnQuery(object sender, RoutedEventArgs e) { using (IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); var sicilList = await cmd.Query("GetAll", HttpMethods.get, null); this.RadGridView1.ItemsSource = sicilList; } }
private async void OnQuerySingle(object sender, RoutedEventArgs e) { using(IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); SICIL sicil = await cmd.QuerySingle("GetById", HttpMethods.get, new Temp() { id = 9390 }); this.RadGridView1.ItemsSource = new List<SICIL>() { sicil }; } }
/// <summary> /// On unit respond. /// </summary> /// <param name="command">Respond Command.</param> protected virtual void OnUnitRespond(Command command) { if (!IsSettingsValid) { return; } CommandAdapter.RespondCommand(command); }
public void UnregisterAdapter() { mapSvc.Register(typeof(object), typeof(MockAdapter)); mapSvc.UnRegister(typeof(object)); CommandAdapter ad = mapSvc.CreateAdapter(typeof(object)); Assert.IsNull(ad); }
public void CanFindAdapterForAssignableType() { mapSvc.Register(typeof(MockInvoker), typeof(MockAdapter)); CommandAdapter adapter = mapSvc.CreateAdapter(typeof(AnotherMockInvoker)); Assert.IsNotNull(adapter); Assert.AreEqual(typeof(MockAdapter), adapter.GetType()); }
private async System.Threading.Tasks.Task RebindGrid() { using (IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); var sicilList = await cmd.Select(); this.RadGridView1.ItemsSource = new ObservableCollection<SICIL>(sicilList.OrderByDescending(s => s.SICIL2K).ToList()); } }
public IHttpActionResult Inactive([FromUri] Guid id) { DesativarAnuncioRequest request = new DesativarAnuncioRequest(); var command = CommandAdapter.ToDesativarAnuncioCommand(request); Handler.Handle(command); return(Ok()); }
public void QuoteIdentifier() { var adapter = new CommandAdapter(); Assert.AreEqual("test", adapter.QuoteIdentifier("test")); Assert.ThrowsException <ArgumentException>(() => adapter.QuoteIdentifier("tes't")); adapter = new SqlCommandAdapter(); Assert.AreEqual("[test]", adapter.QuoteIdentifier("test")); Assert.ThrowsException <ArgumentException>(() => adapter.QuoteIdentifier("tes't")); }
public void UnquoteIdentifier() { var adapter = new CommandAdapter(); Assert.AreEqual("[test]", adapter.UnquoteIdentifier("[test]")); Assert.AreEqual("[tes''t]", adapter.UnquoteIdentifier("[tes''t]")); adapter = new SqlCommandAdapter(); Assert.AreEqual("test", adapter.UnquoteIdentifier("[test]")); Assert.ThrowsException <InvalidOperationException>(() => adapter.UnquoteIdentifier("[tes't]")); }
private IPoderosaMenu[] CreatePopupMenuItems() { List <IPoderosaMenu> result = new List <IPoderosaMenu>(); foreach (ICommandResultProcessorMenuItem item in TerminalEmulatorPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(POPUP_MENU_EXTENSION_POINT).GetExtensions()) { CommandAdapter ca = new CommandAdapter(this, item); result.Add(new PoderosaMenuItemImpl( new PoderosaCommandImpl(new ExecuteDelegate(ca.Execute), new CanExecuteDelegate(ca.CanExecute)), item.Text)); } return(result.ToArray()); }
private async void OnLoaded(object sender, RoutedEventArgs e) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); //this.cbxPERSONELTIPK.Adapter = cmd; this.cbxPERSONELTIPK.LoadItems(); SICIL sicil = await cmd.SelectById(9377); this.binding = new Binding(sicil, new DbSchemaMetaDataProvider(typeof(SICIL)), SLUtility.FindIEntityControls(this.LayoutRoot)) { ValidateOnValueChanged = true }; this.binding.DataBind(); sicil.ADI = "Adı Değişti mi"; }
private async void OnSave(object sender, RoutedEventArgs e) { if (this.binding.ReadValues()) { SICIL sicil = (SICIL)this.binding.Entity; CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); int result = await cmd.Upsert(sicil, this.binding.GetFields()); MessageBox.Show("Etkilenen Kayıt Sayısı: " + result); } else MessageBox.Show("Geçerlilik Denetimi Başarılı Değil"); }
private async void OnUpdateSelected(object sender, RoutedEventArgs e) { SICIL selected = this.RadGridView1.SelectedItem as SICIL; if (null != selected) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); int result = await cmd.Update(selected, s => s.SICILKOD, s => s.ADI, s=> s.SICILNO, s=> s.SOYADI); MessageBox.Show("Update - Etkilenen Kayıt Sayısı: " + result); await this.RebindGrid(); } }
private void Start() { var register = new CommandUnitRegister(); var units = commandUnits.GetComponentsInChildren <MonoCommandUnit>(true); foreach (var unit in units) { register.RegisterUnit(unit); } var adapter = new CommandAdapter(commandIO, new CommandParser()); CommandProcessor.Instance.Initialize(adapter, register); }
private async void OnBatchUpdate(object sender, RoutedEventArgs e) { using (IndicatorManager m = new IndicatorManager(this.RadBusyIndicator1)) { var list = this.RadGridView1.ItemsSource as IEnumerable<SICIL>; if (null != list) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); var result = await cmd.BatchUpdate(list, s => s.SICILKOD, s => s.ADI, s => s.SOYADI); MessageBox.Show("BatchUpdate - Etkilenen Kayıt Sayısı: " + result); } } }
private static string GetColumnName(CommandAdapter commandAdapter, string prefix, string columnName, string alias) { Contracts.Requires.NotNullOrWhiteSpace(columnName, nameof(columnName)); var result = new StringBuilder(); result.AppendIf(!String.IsNullOrWhiteSpace(prefix), $"{prefix}{commandAdapter.SchemaSeparator}"); result.Append(commandAdapter.QuoteIdentifier(columnName)); if (!String.IsNullOrWhiteSpace(alias)) { result.Append($"{CommandAdapter.As}{commandAdapter.QuoteIdentifier(alias)}"); } return(result.ToString()); }
private async void OnBatchInsert(object sender, RoutedEventArgs e) { var list = this.RadGridView1.ItemsSource as IEnumerable<SICIL>; if (null != list) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); // string[] ins = new string[] { "ADI", "MEZUNBOLK", "PERSONELTIPK", "SICILKOD", "SICILNO", "SOYADI" }; Expression<Func<SICIL, object>>[] ins = { s => s.ADI, s => s.MEZUNBOLK, s => s.PERSONELTIPK, s => s.SICILKOD, s => s.SICILNO, s => s.SOYADI }; int result = await cmd.BatchInsert(list, AppX.Data.Common.BatchCommandMode.Batch, ins); MessageBox.Show("Insert - Etkilenen Kayıt Sayısı: " + result); } }
/// <summary> /// Scan command from IO and execute. /// </summary> public virtual void ScanCommandExecute() { if (!IsSettingsValid) { return; } var commands = CommandAdapter.DequeueCommands(); if (commands != null) { foreach (var command in commands) { UnitRegister.Execute(command); } } }
private async void OnInsert(object sender, RoutedEventArgs e) { var list = this.RadGridView1.ItemsSource as ObservableCollection<SICIL>; if (null != list) { SICIL sicil = new SICIL() { ADI = "18", CINSIYET = 1, MEZUNBOLK = 30, PERSONELTIPK = 1, SICILKOD = 18, SICILNO = "18", SOYADI = "18" }; list.Insert(0, sicil); CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); //int result = await cmd.Insert(sicil, "ADI", "MEZUNBOLK", "PERSONELTIPK", "SICILKOD", "SICILNO", "SOYADI"); int result = await cmd.Insert(sicil, s => s.ADI, s => s.MEZUNBOLK, s => s.PERSONELTIPK, s => s.SICILKOD, s => s.SICILNO, s => s.SOYADI); MessageBox.Show("Insert - Etkilenen Kayıt Sayısı: " + result); await this.RebindGrid(); } }
public void IsValidIdentifier() { var adapter = new CommandAdapter(); Assert.IsTrue(adapter.IsValidIdentifier("test")); Assert.IsTrue(adapter.IsValidIdentifier("@test")); Assert.IsTrue(adapter.IsValidIdentifier("#test")); Assert.IsTrue(adapter.IsValidIdentifier("_test")); Assert.IsFalse(adapter.IsValidIdentifier("1test")); Assert.IsFalse(adapter.IsValidIdentifier("$test")); Assert.IsFalse(adapter.IsValidIdentifier("t est")); Assert.IsFalse(adapter.IsValidIdentifier("t'est")); Assert.IsFalse(adapter.IsValidIdentifier("[test]")); Assert.IsTrue(adapter.IsValidIdentifier("@@test")); Assert.IsTrue(adapter.IsValidIdentifier("##test")); Assert.IsTrue(adapter.IsValidIdentifier("@_test")); Assert.IsTrue(adapter.IsValidIdentifier("@#test")); Assert.IsTrue(adapter.IsValidIdentifier("t$est")); }
private async void OnUpsert(object sender, RoutedEventArgs e) { SICIL selected = this.RadGridView1.SelectedItem as SICIL; if (null != selected) { CommandAdapter<SICIL> cmd = new CommandAdapter<SICIL>(App.GetSICILUrl()); selected.SICIL2K = 0; // selected.MEZUNBOLK = 0; selected.MEZUNBOLK = 67; // string[] up = new string[] { "ADI" }; // string[] ins = new string[] { "ADI", "MEZUNBOLK", "PERSONELTIPK", "SICILKOD", "SICILNO", "SOYADI" }; Expression<Func<SICIL, object>>[] up = { s => s.ADI, s => s.MEZUNBOLK }; Expression<Func<SICIL, object>>[] ins = { s => s.ADI, s => s.MEZUNBOLK, s => s.PERSONELTIPK, s => s.SICILKOD, s => s.SICILNO, s => s.SOYADI }; int result = await cmd.Upsert(selected, up, ins); MessageBox.Show("Upsert - Update - Etkilenen Kayıt Sayısı: " + result); await this.RebindGrid(); } }
/// <summary> /// Cria uma nova instância de Tank /// </summary> /// <param name="parent">Nível pai do Tank</param> public Tank(Level parent) { Parent = parent; RemoveCommand = new CommandAdapter(true) { Action = (p) => { //remove o tanque Parent.Items.Remove((Tank)p); //procura pelas conexões associadas ao tanque var t = Parent.Project.Connections.Where(x => x.Origin.Tank == p || x.Target.Tank == p).ToList(); //remove as conexões associadas ao tanque foreach (var tank in t) { Parent.Project.Connections.Remove(tank); } } }; SimulationCode = DefaultCode; }
/// <summary> /// Cria uma nova instância de TankProperties /// </summary> public TankProperties() { this.InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif _editor = this.FindControl <TextEditor>("Editor"); _editor.Background = Brushes.Transparent; _editor.Options.ConvertTabsToSpaces = true; _editor.Options.IndentationSize = 4; _editor.ShowLineNumbers = true; _editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#"); _editor.TextArea.TextEntered += textEditor_TextArea_TextEntered; _editor.TextArea.TextEntering += textEditor_TextArea_TextEntering; _editor.TextArea.TextInput += TextArea_TextInput; _editor.TextArea.Initialized += (s, a) => AnalyzeCodeSyntax(); _editor.KeyUp += TextArea_KeyUp; _editor.TextArea.IndentationStrategy = new AvaloniaEdit.Indentation.CSharp.CSharpIndentationStrategy(); _insightWindow = new OverloadInsightWindow(_editor.TextArea); _editor.FontFamily = GetPlatformFontFamily(); _editor.TextArea.PointerMoved += TextArea_PointerMoved; foldingManager = FoldingManager.Install(_editor.TextArea); foldingStretegy = new BraceFoldingStrategy(); var textMarkerService = new TextMarkerService(_editor.Document); _editor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService); _editor.TextArea.TextView.LineTransformers.Add(textMarkerService); IServiceContainer services = _editor.Document.GetService <IServiceContainer>(); if (services != null) { services.AddService(typeof(ITextMarkerService), textMarkerService); } this.textMarkerService = textMarkerService; this.AddHandler(PointerWheelChangedEvent, (o, i) => { if (i.KeyModifiers != KeyModifiers.Control) { return; } if (i.Delta.Y > 0) { _editor.FontSize++; } else { _editor.FontSize = _editor.FontSize > 1 ? _editor.FontSize - 1 : 1; } }, RoutingStrategies.Bubble, true); codeService = CodeAnalysisService.LoadDocument(_editor.Document.Text); UndoCommand = new CommandAdapter(true) { Action = (p) => _editor.Undo() }; RedoCommand = new CommandAdapter(true) { Action = (p) => _editor.Redo() }; }
/// <summary> /// Cria uma nova instância de TankViewModel /// </summary> public TankViewModel() { InputConnectionCommand = new CommandAdapter(true, InputConnectionRequested); OutputConnectionCommand = new CommandAdapter(true, OutputConnectionRequested); }
/// <summary> /// Cria uma nova instância de MainWindowViewModel /// </summary> public MainWindowViewModel() { // atribui os eventos do helper de conexões entre os tanques ConnectionHelper.ConnectionStarted += OnConnectionStarted; ConnectionHelper.ConnectionCompleted += OnConnectionCompleted; Project = new Project(); Project.Levels = new ObservableCollection <Level>(); var level = new Level(Project); level.Items = new ObservableCollection <Tank>() { new Tank(level) }; level.Name = "Nível 1"; level.AddCommand = new CommandAdapter() { Action = (p) => { Project.Levels[0].Items.Add(new Tank(level)); } }; Project.Levels.Add(level); Project.Connections = new ObservableCollection <Link>(); //inicializa e configura o simulador Simulator = new Simulator(); Simulator.SimulationType = SimulationType.RealTime; Simulator.SimulationDuration = TimeSpan.FromMinutes(5); Simulator.Tick += (s, a) => jobs.Enqueue(a); Simulator.PropertyChanged += (s, a) => UpdateCommands(); StartSimulationLoop(); //configura o comando de abertura de arquivo OpenCommand = new CommandAdapter(true) { Action = (p) => Open() }; //configura o comando de salvamento do projeto SaveCommand = new CommandAdapter(true) { Action = (p) => Save() }; //configura o comando de partida do simulador StartCommand = new CommandAdapter(true) { Action = async(p) => { //limpa os dados da plotagem atual if (!Simulator.IsPaused) { try { ChartService.GetService().Clear(); LogService.GetService().Clear(); ErrorService.GetService().Clear(); //percorre todos os tanques foreach (var l in Project.Levels) { foreach (var t in l.Items) { //compila o código de todos os tanques await t.Compile(); t.SimulationTank.Simulator = Simulator; t.SimulationTank.SaveChartCommand = s => ExportPng(ChartControl, s); //chama o método de inicialização de cada tanque t.SimulationTank.OnSimulationStarting(); } } } catch (CompilationException ce) { ErrorService.GetService().AddRange(ce.Errors); Simulator.Stop(); ShowErrorDialog("A simulação falhou ao iniciar. Por favor verifique a lista de erros"); SelectedTabIndex = 3; return; } catch (Exception e) { Simulator.Stop(); ShowErrorDialog("Ocorreu um erro desconhecido ao iniciar a simulação:\n" + e.Message); return; } } //inicia a simulação Simulator.Start(); } }; //configura o comando de pausa do simulador PauseCommand = new CommandAdapter(false) { Action = (p) => Simulator.Pause() }; //configura o comando de parada do simulador StopCommand = new CommandAdapter(false) { Action = (p) => Simulator.Stop() }; //configura o comando de abertura da janela de pripriedades dos tanques ShowTankPropertiesCommand = new CommandAdapter(true) { Action = (p) => new Views.TankProperties().SetTank((Tank)p).ShowDialog(App.MainWindow) }; //configura o comando de remoção de conexões entre tanques RemovePipeCommand = new CommandAdapter(true) { Action = (p) => Project.Connections.Remove((Link)p) }; //configura o comando de adição de níveis AddLevelCommand = new CommandAdapter(true) { Action = (p) => { var level = new Level(Project); level.Name = $"Nível {Project.Levels.Count + 1}"; level.Items = new ObservableCollection <Tank>() { new Tank(level) }; level.AddCommand = new CommandAdapter(true) { Action = (p) => level.Items.Add(new Tank(level)) }; Project.Levels.Add(level); } }; //configura o comando para exportar imagens do diagrama ExportCommand = new CommandAdapter(true) { Action = Export }; SimulationSettingsCommand = new CommandAdapter(true) { Action = async(p) => { Views.SimulationSettings s = new Views.SimulationSettings(); s.ViewModel.IsRealTime = Simulator.SimulationType == SimulationType.RealTime; await s.ShowDialog(App.MainWindow); Simulator.SimulationType = s.ViewModel.IsRealTime ? SimulationType.RealTime : SimulationType.Transient; Simulator.SimulationDuration = s.ViewModel.Duration; Simulator.SimulationInterval = s.ViewModel.Interval; } }; RefreshChartCommand = new CommandAdapter(true) { Action = (p) => ((OxyPlot.Avalonia.PlotView)p).ResetAllAxes() }; ChartZoomInCommand = new CommandAdapter(true) { Action = (p) => ((OxyPlot.Avalonia.PlotView)p).ZoomAllAxes(1.1) }; ChartZoomOutCommand = new CommandAdapter(true) { Action = (p) => ((OxyPlot.Avalonia.PlotView)p).ZoomAllAxes(0.9) }; AboutCommand = new CommandAdapter(true) { Action = (p) => IsAboutOpen = true }; CheckCommandLine(); }
/// <summary> /// 群聊处理和事件触发分发 /// </summary> public static async ValueTask GroupMessageParse(object sender, GroupMessageEventArgs groupMessage) { //配置文件实例 ConfigManager configManager = new ConfigManager(groupMessage.LoginUid); //读取配置文件 if (!configManager.LoadUserConfig(out UserConfig userConfig)) { await groupMessage.SourceGroup.SendGroupMessage("读取配置文件(User)时发生错误\r\n请联系机器人管理员"); Log.Error("AntiRain会战管理", "无法读取用户配置文件"); return; } //指令匹配 //#开头的指令(会战) -> 关键词 -> 正则 //会战管理 if (CommandAdapter.GetPCRGuildBattlecmdType(groupMessage.Message.RawText, out PCRGuildBattleCommand battleCommand)) { Log.Info("PCR会战管理", $"获取到指令[{battleCommand}]"); //判断模块使能 if (userConfig.ModuleSwitch.PCR_GuildManager) { PcrGuildBattleChatHandle chatHandle = new PcrGuildBattleChatHandle(sender, groupMessage, battleCommand); chatHandle.GetChat(); } else { Log.Warning("AntiRain会战管理", "会战功能未开启"); } } //聊天关键词 if (CommandAdapter.GetKeywordType(groupMessage.Message.RawText, out KeywordCommand keywordCommand)) { Log.Info("关键词触发", $"触发关键词[{keywordCommand}]"); switch (keywordCommand) { case KeywordCommand.Hso: if (userConfig.ModuleSwitch.Hso) { HsoHandle hso = new HsoHandle(sender, groupMessage); hso.GetChat(); } break; //将其他的的全部交给娱乐模块处理 default: if (userConfig.ModuleSwitch.HaveFun) { Surprise surprise = new Surprise(sender, groupMessage); surprise.GetChat(keywordCommand); } break; } } //正则匹配 if (CommandAdapter.GetRegexType(groupMessage.Message.RawText, out RegexCommand regexCommand)) { Log.Info("正则触发", $"触发正则匹配[{regexCommand}]"); switch (regexCommand) { case RegexCommand.CheruDecode: case RegexCommand.CheruEncode: //判断模块使能 if (userConfig.ModuleSwitch.Cheru) { CheruHandle cheru = new CheruHandle(sender, groupMessage); cheru.GetChat(regexCommand); } break; case RegexCommand.GetGuildRank: //判断模块使能 if (userConfig.ModuleSwitch.PCR_GuildRank) { GuildRankHandle guildRank = new GuildRankHandle(sender, groupMessage); guildRank.GetChat(regexCommand); } break; //调试 case RegexCommand.Debug: if (groupMessage.SenderInfo.Role == MemberRoleType.Member) { Log.Warning("Auth Warning", $"成员[{groupMessage.Sender.Id}]正尝试执行调试指令"); } else { // if (groupMessage.Message.RawText.Length <= 5) return; // string para = // groupMessage.Message.RawText.Substring(5, groupMessage.Message.RawText.Length - 5); // if (int.TryParse(para, out int id)) // { // CharaParser charaParser = new CharaParser(); // List<CQCode> message = new List<CQCode>(); // message.Add(CQCode.CQText(id.ToString())); // message.Add(CQCode.CQText(charaParser.FindChara(id)?.GetCharaNameCN() ?? string.Empty)); // message.Add(CQCode.CQImage($"https://redive.estertion.win/icon/unit/{id}31.webp")); // await groupMessage.SourceGroup.SendGroupMessage(message); // } } break; //将其他的的全部交给娱乐模块处理 default: if (userConfig.ModuleSwitch.HaveFun) { Surprise surprise = new Surprise(sender, groupMessage); surprise.GetChat(regexCommand); } break; } } }
private IPoderosaMenu[] CreatePopupMenuItems() { List<IPoderosaMenu> result = new List<IPoderosaMenu>(); foreach (ICommandResultProcessorMenuItem item in TerminalEmulatorPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(POPUP_MENU_EXTENSION_POINT).GetExtensions()) { CommandAdapter ca = new CommandAdapter(this, item); result.Add(new PoderosaMenuItemImpl( new PoderosaCommandImpl(new ExecuteDelegate(ca.Execute), new CanExecuteDelegate(ca.CanExecute)), item.Text)); } return result.ToArray(); }