Ejemplo n.º 1
0
        private void PerforceSettingsWindow_Load(object sender, EventArgs e)
        {
            PerforceSyncOptions SyncOptions = Settings.SyncOptions;

            NumRetriesTextBox.Text = (SyncOptions.NumRetries > 0)? SyncOptions.NumRetries.ToString() : "";
            TcpBufferSizeText.Text = (SyncOptions.TcpBufferSize > 0)? SyncOptions.TcpBufferSize.ToString() : "";
        }
Ejemplo n.º 2
0
        public bool Sync(List <string> DepotPaths, int ChangeNumber, Action <PerforceFileRecord> SyncOutput, List <string> TamperedFiles, PerforceSyncOptions Options, TextWriter Log)
        {
            // Write all the files we want to sync to a temp file
            string TempFileName = Path.GetTempFileName();

            using (StreamWriter Writer = new StreamWriter(TempFileName))
            {
                foreach (string DepotPath in DepotPaths)
                {
                    Writer.WriteLine("{0}@{1}", DepotPath, ChangeNumber);
                }
            }

            // Create a filter to strip all the sync records
            bool bResult;

            using (PerforceTagRecordParser Parser = new PerforceTagRecordParser(x => SyncOutput(new PerforceFileRecord(x))))
            {
                StringBuilder CommandLine = new StringBuilder();
                CommandLine.AppendFormat("-x \"{0}\" -z tag", TempFileName);
                if (Options != null && Options.NumRetries > 0)
                {
                    CommandLine.AppendFormat(" -r {0}", Options.NumRetries);
                }
                if (Options != null && Options.TcpBufferSize > 0)
                {
                    CommandLine.AppendFormat(" -v net.tcpsize={0}", Options.TcpBufferSize);
                }
                CommandLine.Append(" sync");
                if (Options != null && Options.NumThreads > 1)
                {
                    CommandLine.AppendFormat(" --parallel=threads={0}", Options.NumThreads);
                }
                bResult = RunCommand(CommandLine.ToString(), null, Line => FilterSyncOutput(Line, Parser, TamperedFiles, Log), CommandOptions.NoFailOnErrors | CommandOptions.IgnoreFilesUpToDateError | CommandOptions.IgnoreExitCode, Log);
            }
            return(bResult);
        }