コード例 #1
0
        /// <summary>
        /// Parses source/destination data received from server.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public List <P4File> ParseLeftPartialRow(string data)
        {
            if (string.IsNullOrEmpty(data) || string.IsNullOrWhiteSpace(data))
            {
                return(null);
            }
            List <P4File> allFiles = null;
            string        one      = null;
            string        final    = null;

            if (_tab.TabName == TabType.ChangelistView)
            {
                if (data.Contains("Moved files ..."))
                {
                    one   = data.Remove(data.IndexOf("Moved files ..."));
                    final = one.Substring(one.IndexOf("Affected files ..."));
                }
                else if (data.Contains("Differences ..."))
                {
                    one   = data.Remove(data.IndexOf("Differences ..."));
                    final = one.Substring(one.IndexOf("Affected files ..."));
                }
                else if (data.Contains("Affected files ..."))
                {
                    final = data.Substring(data.IndexOf("Affected files ..."));
                }
                else
                {
                    final = data;
                }

                string[] affectedFiles = null;
                if (final.Contains("..."))
                {
                    affectedFiles = final.Split(new string[] { "..." }, StringSplitOptions.RemoveEmptyEntries);
                }
                else
                {
                    if (final.Contains("\\"))
                    {
                        affectedFiles = final.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
                        affectedFiles = CorrectFormat(affectedFiles, "\\");
                    }
                    else if (final.Contains("//"))
                    {
                        affectedFiles = final.Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries);
                        affectedFiles = CorrectFormat(affectedFiles, "//");
                    }
                }

                P4FileBuilder fileBuilder = new P4FileBuilder();
                allFiles = fileBuilder.BuildFiles(affectedFiles);
            }
            else
            {
                allFiles = ParseRightPartialRow(data);
            }

            return(allFiles);
        }
コード例 #2
0
        /// <summary>
        /// Parses destination data.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public List <P4File> ParseRightPartialRow(string data)
        {
            List <P4File> allFiles;

            string[]      affectedFiles = data.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            P4FileBuilder fileBuilder   = new P4FileBuilder();

            allFiles = fileBuilder.BuildFiles(affectedFiles);
            return(allFiles);
        }