예제 #1
0
        /// <summary>
        /// Determines if this file is a build product.
        /// </summary>
        /// <param name="File">File path</param>
        /// <param name="FileStats">P4 file stats.</param>
        /// <returns>True if this is a Windows build product. False otherwise.</returns>
        private static bool IsBuildProduct(string File, P4FileStat FileStats)
        {
            if(FileStats.Type == P4FileType.Binary)
            {
                return true;
            }

            return FileStats.Type == P4FileType.Text && File.EndsWith(".exe.config", StringComparison.InvariantCultureIgnoreCase);
        }
예제 #2
0
        private static void ParseFileType(string Filetype, ref P4FileStat Stat)
        {
            var AllFileTypes = GetEnumValuesAndKeywords(typeof(P4FileType));
            var AllAttributes = GetEnumValuesAndKeywords(typeof(P4FileAttributes));

            Stat.Type = P4FileType.Unknown;
            Stat.Attributes = P4FileAttributes.None;

            // Parse file flags
            var OldFileFlags = GetEnumValuesAndKeywords(typeof(P4FileAttributes), OldStyleBinaryFlags);
            foreach (var FileTypeFlag in OldFileFlags)
            {
                if ((!String.IsNullOrEmpty(FileTypeFlag.Value) && Char.ToLowerInvariant(FileTypeFlag.Value[0]) == Char.ToLowerInvariant(Filetype[0]))
                    // @todo: This is a nasty hack to get .ipa files to work - RobM plz fix?
                    || (FileTypeFlag.Value == "F" && Filetype == "ubinary"))
                {
                    Stat.IsOldType = true;
                    Stat.Attributes |= (P4FileAttributes)FileTypeFlag.Key;
                    break;
                }
            }
            if (Stat.IsOldType)
            {
                Filetype = Filetype.Substring(1);
            }
            // Parse file type
            var TypeAndAttributes = Filetype.Split('+');
            foreach (var FileType in AllFileTypes)
            {
                if (FileType.Value == TypeAndAttributes[0])
                {
                    Stat.Type = (P4FileType)FileType.Key;
                    break;
                }
            }
            // Parse attributes
            if (TypeAndAttributes.Length > 1 && !String.IsNullOrEmpty(TypeAndAttributes[1]))
            {
                var FileAttributes = TypeAndAttributes[1];
                for (int AttributeIndex = 0; AttributeIndex < FileAttributes.Length; ++AttributeIndex)
                {
                    char Attr = FileAttributes[AttributeIndex];
                    foreach (var FileAttribute in AllAttributes)
                    {
                        if (!String.IsNullOrEmpty(FileAttribute.Value) && FileAttribute.Value[0] == Attr)
                        {
                            Stat.Attributes |= (P4FileAttributes)FileAttribute.Key;
                            break;
                        }
                    }
                }
            }
        }