• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CommandArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CommandArgs的典型用法代码示例。如果您正苦于以下问题:C# CommandArgs类的具体用法?C# CommandArgs怎么用?C# CommandArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommandArgs类属于命名空间,在下文中一共展示了CommandArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Run

        public async void Run(CommandArgs e)
        {
            if(!File.Exists(filePath))
            {
                MessageBox.Show(
                    $"Script File was not found. Please check if file exists: {Path.GetFullPath(filePath)}"
                    );
                return;
            }

            var script = CSharpScript.Create(
                File.ReadAllText(filePath),
                _scriptOption,
                typeof(ApiHolder)
                );

            if(!CheckScriptValidity(script))
            {
                MessageBox.Show(
                    $"Detected compile error. Please check log file: {Path.GetFullPath(errorLogPath)}"
                    );
                return;
            }


            var mmm = new ApiHolder(new ScriptPluginApi(Scene, ApplicationForm));
            await script.RunAsync(mmm);
        }
开发者ID:malaybaku,项目名称:RoslynScriptForMMM,代码行数:28,代码来源:ScriptRunner.cs


示例2: Execute

		public Response.IResponse Execute( CommandArgs args )
		{
			var pa = args.As<renameArgs>();

			if( string.IsNullOrWhiteSpace( pa.target ) )
				return new Response.ErrorResponse( "target not specified" );

			// get volume for our target
			var vol = _volumeManager.GetByHash( pa.target );
			if( vol == null )
				return new Response.ErrorResponse( "invalid target" );
			// rename this object and change first if this is directory or a file
			var dirToChange = vol.GetDirectoryByHash( pa.target );
			if( dirToChange == null )
			{
				var fileToChange = vol.GetFileByHash( pa.target );
				if( fileToChange == null )
					return new Response.ErrorResponse( "target not found" );

				var newFile = vol.RenameFile( fileToChange, pa.name );
				if( newFile == null )
					return new Response.ErrorResponse( "errRename" );
				return new Response.RenameResponse( pa.target, newFile );
			}
			else
			{
				var newDir = vol.RenameDirectory( dirToChange, pa.name );
				if( newDir == null )
					return new Response.ErrorResponse( "errRename" );
				return new Response.RenameResponse( pa.target, newDir );
			}
		}
开发者ID:zbw911,项目名称:Dev.elFinder.Connector.MsSql,代码行数:32,代码来源:RenameCommand.cs


示例3: Execute

 public void Execute(CommandArgs args)
 {
     LoadAllTransactions();
     ConvertTodayPaymentsToPending();
     //WriteAllTransactionsToWorsheets();
     ShowSplashWindow();
 }
开发者ID:mariomeyrelles,项目名称:VSTO-Cash-Flow,代码行数:7,代码来源:InitializeBusinessRulesCommand.cs


示例4: Execute

		public Response.IResponse Execute( CommandArgs args )
		{
			var pa = args.As<parentsArgs>();

			if( string.IsNullOrWhiteSpace( pa.target ) )
				return new Response.ErrorResponse( "target not specified" );

			// get volume for our target
			var vol = _volumeManager.GetByHash( pa.target );
			// try to get directory for our target
			var cwd = ( vol != null ? vol.GetDirectoryByHash( pa.target ) : null );
			// if we still haven't got volume service, then something is wrong
			if( cwd == null || cwd.IsReadable.IsFalse() )
				return new Response.ErrorResponse( "target dir not found or access denied" );

			HashSet<Model.DirectoryModel> tree = new HashSet<Model.DirectoryModel>();
			tree.Add( cwd );
			var rootDir = vol.GetRootDirectory();
			// now get parent untill we reach root
			while( cwd != null && cwd.Hash != rootDir.Hash )
			{
				if( cwd.ParentHash == null )
					break;
				var parentDir = vol.GetDirectoryByHash( cwd.ParentHash );
				if( parentDir == null )
					return new Response.ErrorResponse( "error getting parent dir: not found or access denied" );
				tree.Add( parentDir );
				var subDirs = vol.GetSubdirectoriesFlat( parentDir, 0 );
				foreach( var sd in subDirs )
					tree.Add( sd );
				cwd = parentDir;
			}
			return new Response.TreeResponse( tree.ToArray() );
		}
开发者ID:zbw911,项目名称:Dev.elFinder.Connector.MsSql,代码行数:34,代码来源:ParentsCommand.cs


示例5: Parse

        public string Parse(MessageSource sender, CommandArgs args)
        {
            if(args.Args.Count != 2)
            {
                return String.Format("Error - Usage {0} <stream-name> <stream-url>", args.Name);
            }

            var name = args.Args[0];
            var url = args.Args[1];

            Logger.InfoFormat("{0} is adding a new stream. {1} - {2}", sender, name, url);

            if(_handler.GetStream(name) != null) {
                return "Error - A streamer already exists with that name";
            }

            if( !_handler.AddStream(name, url) )
            {
                // Yeah yeah, it's hacky.
                _handler.RemoveAll(a => a.Name == name);

                return "Error - The URL provided can not be handled by any stream plugins.";
            }

            _settings.AddStream(name, url);
            Logger.InfoFormat("{0} added a new stream. {1} - {2}", sender, name, url);
            return string.Format("Success, {0} added as a new streamer", name);
        }
开发者ID:devast8a,项目名称:StreamBot,代码行数:28,代码来源:AddStream.cs


示例6: Execute

		public Response.IResponse Execute( CommandArgs args )
		{
			var ra = args.As<rmArgs>();

			if( ra.targets == null || ra.targets.Length == 0 )
				return new Response.ErrorResponse( "target(s) not specified" );

			IList<string> removeHashes = new List<string>();
			foreach( var toRemove in ra.targets )
			{
				var vol = _volumeManager.GetByHash( toRemove );
				if( vol == null )
					continue;

				var dirToRemove = vol.GetDirectoryByHash( toRemove );
				if( dirToRemove == null )
				{
					var fileToRemove = vol.GetFileByHash( toRemove );
					if( fileToRemove == null )
						continue;

					if( vol.DeleteFile( fileToRemove ) )
						removeHashes.Add( toRemove );
				}
				else
				{
					if( vol.DeleteDirectory( dirToRemove ) )
						removeHashes.Add( toRemove );
				}
			}

			return new Response.RmResponse( removeHashes.ToArray() );
		}
开发者ID:zbw911,项目名称:Dev.elFinder.Connector.MsSql,代码行数:33,代码来源:RmCommand.cs


示例7: Start

        public static void Start(CommandArgs args)
        {
            var server = args.Read<string>();
            var alias = args.Read<string>();

            ConsoleManager.Start(server, alias, $"--alias {alias}");
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:7,代码来源:ConsoleServiceCommands.cs


示例8: OnCommand

        protected override void OnCommand(CommandArgs e)
        {
            switch (e.Command)
            {
                case "navigate":
                    if (e.Data["day"] != null)
                    {
                        StartDate = (DateTime)e.Data["day"];
                    }
                    Update(CallBackUpdateType.Full);
                    break;

                case "refresh":
                    Update(CallBackUpdateType.Full);
                    break;

                case "selected":
                    if (SelectedEvents.Count > 0)
                    {
                        EventInfo ei = SelectedEvents[0];
                        SelectedEvents.RemoveAt(0);
                        UpdateWithMessage("Event removed from selection: " + ei.Text);
                    }

                    break;
            }
        }
开发者ID:alexed1,项目名称:dtrack,代码行数:27,代码来源:KwasantCalendarControl.cs


示例9: Execute

        public void Execute(CommandArgs args)
        {
            var sidePanelArg = args as SidePanelCommandArgs;
            if (sidePanelArg == null)
            {
                return;
            }
            if (sidePanelArg.WpfControl != null) _host.CurrentControl = sidePanelArg.WpfControl;
            if (sidePanelArg.Model != null) _host.Model = sidePanelArg.Model;

            _host.Refresh();
            _host.Show();

            //todo: only for tests
            var svc = new SummaryCalculationService();
            var currentMonthBalance = svc.CalculateBalanceForCurrentMonth(sidePanelArg.Transactions);
            var incomesUpToDate = svc.CalculateIncomesForCurrentMonthUpToGivenDate(sidePanelArg.Transactions, SystemTime.Now());
            var expensesUpToDate = svc.CalculateExpensesForCurrentMonthUpToGivenDate(sidePanelArg.Transactions, SystemTime.Now());
            var accountSummary = svc.CalculateAccountSummary(sidePanelArg.Accounts,
                                                             sidePanelArg.Transactions);

            Singleton<MainStatusAppService>.Instance.EndOfMonthBalance = currentMonthBalance;
            Singleton<MainStatusAppService>.Instance.IncomesUpToDate = incomesUpToDate;
            Singleton<MainStatusAppService>.Instance.ExpensesUpToDate = expensesUpToDate;
            Singleton<MainStatusAppService>.Instance.AccountSummary = accountSummary;
        }
开发者ID:mariomeyrelles,项目名称:VSTO-Cash-Flow,代码行数:26,代码来源:ConfigureSidePanelCommand.cs


示例10: Execute

		public void Execute(CommandArgs commandArgs)
		{
			// ミュート
			pecaPlayer.Mute = true;

			// 終了時のリレー切断
			if (PlayerSettings.DisconnectRealyOnClose)
			{
				pecaPlayer.DisconnectRelay();
			}

			// 終了時の位置とサイズを保存
			if (PlayerSettings.SaveReturnPositionOnClose)
			{
				PlayerSettings.ReturnPosition = form.Location;
			}
			if (PlayerSettings.SaveReturnSizeOnClose)
			{
				PlayerSettings.ReturnSize = pecaPlayer.Size;
			}

			try
			{
				PlayerSettings.Save();
			}
			catch (Exception e)
			{
				Logger.Instance.Error(e.Message);
			}

			Application.Exit();
		}
开发者ID:shinji3,项目名称:PeerstPlayer,代码行数:32,代码来源:CloseCommand.cs


示例11: Parse

        public string Parse(MessageSource sender, CommandArgs args)
        {
            Stream stream;

            if(args.Args.Count != 0)
            {
                if(!sender.Permission.IsOperator)
                {
                    return string.Format("Error - usage {0}. Operators may force updates of other streamers", args.Name);
                }

                stream = _handler.GetStream(args.Args[0]);

                if (stream == null)
                {
                    return "Sorry no streamer exists with that name.";
                }
            }
            else
            {
                stream = _handler.GetStream(sender.Nickname);

                if (stream == null)
                {
                    return "Sorry you don't seem to own a stream.";
                }
            }

            Logger.Info("Manual update for " + stream.Name);
            stream.Update(_handler);
            return "Updating " + stream.Name;
        }
开发者ID:devast8a,项目名称:StreamBot,代码行数:32,代码来源:UpdateStream.cs


示例12: Execute

        public void Execute(CommandArgs commandArgs)
        {
            // 非表示ミュート
            form.Visible = false;
            pecaPlayer.Mute = true;

            // 終了時のリレー切断
            if (PlayerSettings.DisconnectRealyOnClose)
            {
                pecaPlayer.DisconnectRelay();
            }

            // 終了時の位置とサイズを保存
            if (PlayerSettings.SaveReturnPositionOnClose)
            {
                PlayerSettings.ReturnPosition = form.Location;
            }
            if (PlayerSettings.SaveReturnSizeOnClose)
            {
                PlayerSettings.ReturnSize = pecaPlayer.Size;
            }
            PlayerSettings.Save();

            Application.Exit();
        }
开发者ID:progre,项目名称:PeerstPlayer,代码行数:25,代码来源:CloseCommand.cs


示例13: HandlePossibleTypingCommand

        private void HandlePossibleTypingCommand(CommandArgs args, Action nextHandler, Action<SnapshotSpan> actionIfInsideActiveSpan)
        {
            if (_renameService.ActiveSession == null)
            {
                nextHandler();
                return;
            }

            var selectedSpans = args.TextView.Selection.GetSnapshotSpansOnBuffer(args.SubjectBuffer);

            if (selectedSpans.Count > 1)
            {
                // If we have multiple spans active, then that means we have something like box
                // selection going on. In this case, we'll just forward along.
                nextHandler();
                return;
            }

            var singleSpan = selectedSpans.Single();
            SnapshotSpan containingSpan;
            if (_renameService.ActiveSession.TryGetContainingEditableSpan(singleSpan.Start, out containingSpan) &&
                containingSpan.Contains(singleSpan))
            {
                actionIfInsideActiveSpan(containingSpan);
            }
            else
            {
                // It's in a read-only area, so let's commit the rename and then let the character go
                // through

                CommitIfActiveAndCallNextHandler(args, nextHandler);
            }
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:33,代码来源:RenameCommandHandler.cs


示例14: if

		void IShortcutCommand.Execute(CommandArgs commandArgs)
		{
			// ウィンドウ状態が通常の場合にのみ実行する
			if (form.WindowState != FormWindowState.Normal)
			{
				return;
			}

			ScreenSplitCommandArgs args = (ScreenSplitCommandArgs)commandArgs;

			// 分割サイズを設定
			if (args.WidthNum > 0)
			{
				int formWidth = Screen.GetWorkingArea(form).Width / args.WidthNum;
				form.Width = formWidth;
				int movieHeight = (int)(pecaPlayer.Width / pecaPlayer.AspectRate);
				pecaPlayer.SetSize(pecaPlayer.Width, movieHeight);
			}
			else if (args.HeightNum > 0)
			{
				int formHeight = Screen.GetWorkingArea(form).Height / args.HeightNum;
				form.Height = formHeight;
				int movieWidth = (int)(pecaPlayer.Height * pecaPlayer.AspectRate);
				pecaPlayer.SetSize(movieWidth, pecaPlayer.Height);
			}
		}
开发者ID:shinji3,项目名称:PeerstPlayer,代码行数:26,代码来源:ScreenSplitCommand.cs


示例15: Parse

        public string Parse(MessageSource sender, CommandArgs args)
        {
            Console.WriteLine(args.Args.Count);
            if (args.Args.Count < 1 || args.Args.Count > 2)
            {
                return String.Format("Error - Usage {0} <hostname> [permission]", args.Name);
            }

            string permission = "Operator";

            if(args.Args.Count == 2)
            {
                permission = args.Args[1];
            }

            var targetPermission = _settings.GetUserPermission(args.Args[0]);

            // A permission already exists for the target user
            if (targetPermission != null)
            {
                return "This hostname already has permissions attached.";
            }

            var perm = Permission.GetPermission(permission);

            if(perm == null)
            {
                return "No permission exists by that name";
            }

            _settings.AddUserPermission(args.Args[0], perm);

            return String.Format("Added permissions for {0}.", args.Args[0]);
        }
开发者ID:devast8a,项目名称:StreamBot,代码行数:34,代码来源:AddPerm.cs


示例16:

		string IShortcutCommand.GetDetail(CommandArgs commandArgs)
		{
			int size = (int)(pecaPlayer.ImageHeight * 0.1);
			int width = form.Width - (int)(size * pecaPlayer.AspectRate);
			int height = form.Height - size;
			return string.Format("サイズ (-10%)");
		}
开发者ID:shinji3,项目名称:PeerstPlayer,代码行数:7,代码来源:WindowSizeDownCommand.cs


示例17: GetExpandedLineAsync

 /// <summary>Returns the span for the selected line. Extends it if it is a part of a multi line statement or declaration.</summary>
 private Task<IEnumerable<SnapshotSpan>> GetExpandedLineAsync(IEditorOptions editorOptions, CommandArgs args, CancellationToken cancellationToken)
 {
     IEnumerable<SnapshotSpan> selectedSpans = GetSelectedLine(args.TextView);
     var candidateSubmission = GetSubmissionFromSelectedSpans(editorOptions, selectedSpans);
     return CanParseSubmission(candidateSubmission)
         ? Task.FromResult(selectedSpans)
         : ExpandSelectionAsync(selectedSpans, args, cancellationToken);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:9,代码来源:SendToInteractiveSubmissionProvider.cs


示例18: GetSubmissionFromSelectedSpans

        string ISendToInteractiveSubmissionProvider.GetSelectedText(IEditorOptions editorOptions, CommandArgs args, CancellationToken cancellationToken)
        {
            IEnumerable<SnapshotSpan> selectedSpans = args.TextView.Selection.IsEmpty
                ? GetExpandedLineAsync(editorOptions, args, cancellationToken).WaitAndGetResult(cancellationToken)
                : args.TextView.Selection.GetSnapshotSpansOnBuffer(args.SubjectBuffer).Where(ss => ss.Length > 0);

            return GetSubmissionFromSelectedSpans(editorOptions, selectedSpans);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:SendToInteractiveSubmissionProvider.cs


示例19:

		void IShortcutCommand.Execute(CommandArgs commandArgs)
		{
			// TODO バルーンの表示方法を考える
			/*
			string newRes = statusBar.ReadNewRes();
			Help.ShowPopup(form, newRes, Control.MousePosition);
			 */
		}
开发者ID:shinji3,项目名称:PeerstPlayer,代码行数:8,代码来源:ShowNewResCommand.cs


示例20: Show

        public static void Show(CommandArgs args)
        {
            Log.Message(LogTypes.Success, $"Running servers ({ConsoleManager.Childs.Count}):");
            Log.NewLine();

            foreach (var child in ConsoleManager.Childs)
                Log.Message(LogTypes.Info, $"Alias: {child.Key}, Path: {child.Value.Item1}.");
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:8,代码来源:ConsoleServiceCommands.cs



注:本文中的CommandArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CommandBar类代码示例发布时间:2022-05-24
下一篇:
C# CommandAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap