コード例 #1
0
            public bool Run(PerforceConnection Perforce, TextWriter Log, out string ErrorMessage)
            {
                bool bExists;

                if (!Perforce.ClientExists(Settings.Name, out bExists, Log))
                {
                    ErrorMessage = String.Format("Unable to determine if client already exists.\n\n{0}", Log.ToString());
                    return(false);
                }
                if (bExists)
                {
                    ErrorMessage = String.Format("Client '{0}' already exists.", Settings.Name);
                    return(false);
                }

                PerforceSpec Client = new PerforceSpec();

                Client.SetField("Client", Settings.Name);
                Client.SetField("Owner", Owner);
                Client.SetField("Host", HostName);
                Client.SetField("Stream", Settings.Stream);
                Client.SetField("Root", Settings.RootDir);
                Client.SetField("Options", "rmdir");

                string Message;

                if (!Perforce.CreateClient(Client, out Message, Log))
                {
                    ErrorMessage = Message;
                    return(false);
                }

                ErrorMessage = null;
                return(true);
            }