【问题标题】:p4 opened -a in C# Perforce Wrapper or P4 APIp4 在 C# Perforce Wrapper 或 P4 API 中打开 -a
【发布时间】:2012-12-18 02:06:51
【问题描述】:

我发现这个帖子很有帮助,我想问问 Ian Norton 关于他的包装。 HERE 是 IanNorton 发布的我正在尝试的包装器的链接。我不确定这是否是正确的提问地点,而且当涉及到他的回复时,我也不想创建一个新线程。所以我会继续前进,忍受任何可能出现的反弹。

我目前正在尝试使用您的包装器,但当我运行它时,我似乎无法让它触发任何东西。我不想使用选项,因为我只想将其设置为在计时器上运行的 .exe。很简单,我想使用 p4 打开 -a cmd 并将输出输出打印到文件中。这就对了。此 NooB 将不胜感激任何帮助。

非常感谢!

这是我仅使用命令行所得到的。不幸的是,我无法将我的信息输出到文本文件。

using System;
using System.Diagnostics;
using System.IO;

namespace P4OpenCMD
{
    class P4Opened
    {
        // Main begins program execution.
        static void Main(string[] args)
        {
            string temp = string.Empty;

            if (temp != string.Empty)
            {
                Process p = new Process();
                ProcessStartInfo info = new ProcessStartInfo();
                info.FileName = "cmd.exe";
                info.RedirectStandardInput = true;
                info.UseShellExecute = false;

                p.StartInfo = info;
                p.Start();

                StreamWriter sw = p.StandardInput;

                using (sw = p.StandardInput)
                {
                    if (sw.BaseStream.CanWrite)
                    {
                        sw.WriteLine("set P4PORT=####");
                        sw.WriteLine("set P4USER=####");
                        sw.WriteLine("set P4CLIENT=####");
                        sw.WriteLine("set P4PASSWD=####");
                        sw.WriteLine("p4 opened -a //Depot/...");
                        sw.WriteLine("pause;");
                    }
                    Console.WriteLine();
                }
                sw.Close();
                p.WaitForExit();
                p.Close();
            }
        }
    }
}

【问题讨论】:

    标签: c# api wrapper perforce


    【解决方案1】:

    如果你这样做,你应该处于良好状态:

    info.FileName = "cmd.exe";
    info.Arguments = "/c p4 opened > opened.txt";
    

    【讨论】:

    • 我已经开始简单地使用 cmd 行并且取得了成功(除了输出到文件),建议我使用 API。就我个人而言,我只想完成这件事:)
    猜你喜欢
    • 2014-11-19
    • 2012-02-02
    • 1970-01-01
    • 2015-03-11
    • 1970-01-01
    • 2010-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多