当前位置: 首页>>代码示例>>C#>>正文


C# String.Skip方法代码示例

本文整理汇总了C#中String.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# String.Skip方法的具体用法?C# String.Skip怎么用?C# String.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


在下文中一共展示了String.Skip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(String[] args)
    {
        if (args.Length == 0) return;

        var dir = Environment.CurrentDirectory;
        if (args[0].StartsWith("/dir:")) { dir = args[0].Substring("/dir:".Length); args = args.Skip(1).ToArray(); }
        if (args.Length == 0) return;

        var process = new Process();
        process.StartInfo.WorkingDirectory = dir;
        process.StartInfo.FileName = args[0];
        process.StartInfo.Arguments = String.Join(" ", args.Skip(1).ToArray());
        process.Start();
    }
开发者ID:xeno-by,项目名称:dotwindows,代码行数:14,代码来源:runner.cs

示例2: Main

    public static int Main(String[] args)
    {
        var asm = Assembly.GetEntryAssembly();
        var dir = Path.GetDirectoryName(asm.Location);
        var target = dir + @"\setenvcore.exe";
        if (args.Length > 3) args = new []{args[0], args[1], String.Join(" ", args.Skip(2))};
        if (args[2].Contains(" ")) args[2] = "\"" + args[2];
        var cmdline = String.Join(" ", args);
        Console.Write("setenv " + cmdline);

        var psi = new ProcessStartInfo(target, cmdline);
        psi.CreateNoWindow = true;
        psi.UseShellExecute = false;
        psi.ErrorDialog = false;
        psi.RedirectStandardOutput = true;
        var p = Process.Start(psi);

        var output = p.StandardOutput;
        p.WaitForExit();
        Console.WriteLine(output.ReadToEnd());
        return p.ExitCode;
    }
开发者ID:xeno-by,项目名称:dotwindows,代码行数:22,代码来源:setenv.cs

示例3: Main

    public static void Main(String[] args)
    {
        var sublime = @"C:\Program Files\Sublime Text 2\sublime_text.exe";
        var home = new DirectoryInfo(@"%APPDATA%\Sublime Text 2".Expand());

        var projects = new DirectoryInfo(home.FullName + @"\Projects");
        var default_prj = null as String;
        if (projects.Exists && projects.GetFiles("*.is.default").Length == 1) {
          var default_file = projects.GetFiles("*.is.default")[0];
          default_prj = Path.GetFileNameWithoutExtension(default_file.FullName);
          default_prj = Path.GetFileNameWithoutExtension(default_prj);
          if (args.Length == 0) args = new []{default_prj};
        }

        if (args.Length > 0) {
          if (args[0] == "/new") {
        args = args.Skip(1).ToArray();

        var file0 = new FileInfo(args[0]);
        var dir0 = new DirectoryInfo(args[0]);
        if (file0.Exists) dir0 = file0.Directory;

        FileInfo project = null;
        if (args.Length > 2 && args[args.Length - 2] == "/name") {
          project = new FileInfo(projects + "\\" + args[args.Length - 1] + ".sublime-project");
          if (project.Exists) {
            MessageBox.Show(String.Format("Project \"{0}\" already exists found. \r\n\r\n" +
                                          "There already exists find project file {1}.", args[args.Length - 1], project.FullName),
                                          "Sublime Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
          }
          args = args.Take(args.Length - 2).ToArray();
        } else {
          var idx = 0;
          Func<FileInfo> gen = () => new FileInfo(projects + "\\" + dir0.Name + (idx == 0 ? "" : idx.ToString()) + ".sublime-project");
          while (gen().Exists) idx++;
          project = gen();
        }

        var lines = new List<String>();
        lines.Add("{");
        lines.Add("  \"folders\":");
        lines.Add("  [");
        for (var i = 0; i < args.Length; ++i) {
          var file = new FileInfo(args[i]);
          var dir = new DirectoryInfo(args[i]);
          if (file.Exists) dir = file.Directory;

          var dir_as_sublimepath = dir.FullName;
          dir_as_sublimepath = dir_as_sublimepath.Replace("\\", "/");
          dir_as_sublimepath = dir_as_sublimepath.Replace(":/", "/");
          dir_as_sublimepath = "/" + dir_as_sublimepath;

          lines.Add("    {");
          lines.Add("      \"path\": \"" + dir_as_sublimepath + "\"");
          lines.Add("    }");
          if (i != args.Length - 1) lines[lines.Count - 1] = lines[lines.Count - 1] + ",";
        }
        lines.Add("  ]");
        lines.Add("}");
        project.WriteAllLines(lines);

        lines = new List<String>();
        lines.Add("{");
        lines.Add("  \"build_system\": \"Packages/User/Myke.sublime-build\",");
        lines.Add("  \"show_minimap\": false,");
        lines.Add("  \"show_open_files\": true,");
        lines.Add("  \"show_tabs\": true,");
        lines.Add("  \"side_bar_visible\": true,");
        lines.Add("  \"side_bar_width\": 256.0,");
        lines.Add("  \"status_bar_visible\": true");
        lines.Add("}");
        var workspace = new FileInfo(Path.ChangeExtension(project.FullName, "sublime-workspace"));
        workspace.WriteAllLines(lines);

        args = new []{"--project", "\"" + project.FullName + "\""}.Concat(args).ToArray();
          } else {
        var file0 = new FileInfo(args[0]);
        var dir0 = new DirectoryInfo(args[0]);
        if (file0.Exists) dir0 = file0.Directory;

        if (file0.Exists || dir0.Exists || args[0].Contains(".")) {
          // don't do any postprocessing of args => open in current instance of sublime
          // upd. the hack below is needed because "sublime file_name" is currently broken!!
          var sublimeNotYetOpen = Process.GetProcesses().Where(process => process.ProcessName != null && process.ProcessName.EndsWith("sublime_text")).Count() == 0;
          if (sublimeNotYetOpen) {
            var project = new FileInfo(projects + "\\kep.sublime-project");
            args = new []{"--project", "\"" + project.FullName + "\"", args[0]};
          }
        } else {
          var project = new FileInfo(projects + "\\" + args[0] + ".sublime-project");
          if (!project.Exists) {
            MessageBox.Show(String.Format("Project \"{0}\" not found. \r\n\r\n" +
                                          "Could not find project file {1}.", args[0], project),
                                          "Sublime Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
          } else {
            if (args.Length == 2 && (args[1].ToLower() == "/reg" || args[1].ToLower() == "/register")) {
              projects.GetFiles("*.is.default").ToList().ForEach(file => file.Delete());
              var default_file = new FileInfo(Path.ChangeExtension(project.FullName, "is.default"));
//.........这里部分代码省略.........
开发者ID:xeno-by,项目名称:dotwindows,代码行数:101,代码来源:sublime.cs

示例4: Run


//.........这里部分代码省略.........
			int timeout = 5;
			// FIXME: AddCommand () ignores this
			int seq = 0;
			ws.AddCommand (login, lane.id, cmd_name, always, nonfatal, timeout, seq);
		} else if (command == "edit-step") {
			if (args.Length < 3) {
				Console.WriteLine ("Usage: edit-step <lane> <step name> [<edit options>]");
				return 1;
			}
			string lane_name = args [1];
			string cmd_name = args [2];
			var lane = FindLaneByName (lane_name);
			if (lane == null)
				return 1;
			var cmd = FindCmdByName (lane, cmd_name);
			if (cmd == null)
				return 1;

			int? seq = null;
			int? timeout = null;
			bool nonfatal = cmd.nonfatal;
			bool alwaysexecute = cmd.alwaysexecute;
			string filename = null;
			string arguments = null;
			string upload_files = null;
			OptionSet p = new OptionSet ()
				.Add ("seq=", v => seq = Int32.Parse (v))
				.Add ("timeout=", v => timeout = Int32.Parse (v))
				.Add ("nonfatal=", v => nonfatal = Boolean.Parse (v))
				.Add ("alwaysexecute=", v => alwaysexecute = Boolean.Parse (v))
				.Add ("filename=", v => filename = v)
				.Add ("arguments=", v => arguments = v)
				.Add ("upload-files=", v => upload_files = v);
			var new_args = p.Parse (args.Skip (3).ToArray ());
			if (new_args.Count > 0) {
				Console.WriteLine ("Unknown arguments: " + String.Join (" ", new_args.ToArray ()));
				return 1;
			}

			PrintCmd (cmd);

			if (seq != null)
				ws.EditCommandSequence (login, cmd.id, (int)seq);
			if (filename != null)
				ws.EditCommandFilename (login, cmd.id, filename);
			if (arguments != null)
				ws.EditCommandArguments (login, cmd.id, arguments);
			if (upload_files != null)
				ws.EditCommandUploadFiles (login, cmd.id, upload_files);
			if (timeout != null)
				ws.EditCommandTimeout (login, cmd.id, (int)timeout);
			if (alwaysexecute != cmd.alwaysexecute)
				ws.SwitchCommandAlwaysExecute (login, cmd.id);
			if (nonfatal != cmd.nonfatal)
				ws.SwitchCommandNonFatal (login, cmd.id);

			cmd = FindCmdByName (lane, cmd_name);
			if (cmd == null)
				return 1;
			Console.WriteLine ("=>");
			PrintCmd (cmd);
		} else if (command == "add-lane-file") {
			if (args.Length < 3) {
				Console.WriteLine ("Usage: add-lane-file <lane> <lane file name>");
				return 1;
			}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:67,代码来源:WrenchCmdClient.cs


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