Пример #1
0
        private void SetDupDetectionCriteriaCheckBox(CheckBox pCheckBox, DuplicateDetectionFlag pFlag, DuplicateDetectionFlag pFlags)
        {
            if (AddonDupSet.ForcedDuplicateDetectionFlags.HasFlag(pFlag))
            {
                pCheckBox.Checked = true;
                pCheckBox.Enabled = false;
                return;
            }

            pCheckBox.Enabled = true;
            pCheckBox.Checked = pFlags.HasFlag(pFlag);
        }
Пример #2
0
        // Used for identifying duplicates
        public static string GetFingerPrint(AddonBasicInfo pAddonBasicInfo)
        {
            StringBuilder fingerprintBuilder = new StringBuilder();

            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Fingerprint))
            {
                return(pAddonBasicInfo.AddonPackage.FingerPrint);
            }

            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.RecompilableFlag))
            {
                fingerprintBuilder.Append($"R:{pAddonBasicInfo.AddonPackage.Recompilable}^");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Publisher))
            {
                fingerprintBuilder.Append($"P:{pAddonBasicInfo.AddonPackage.Publisher}^");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Name))
            {
                fingerprintBuilder.Append($"N:{pAddonBasicInfo.AddonPackage.Name}^");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.LastCompiled))
            {
                fingerprintBuilder.Append($"LC:{pAddonBasicInfo.AddonPackage.LastCompiled:s}^");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.MeshDataSize))
            {
                if (!pAddonBasicInfo.AddonPackage.MeshDataSizeMbytes.HasValue)
                {
                    fingerprintBuilder.Append("M:_^");
                }
                else
                {
                    fingerprintBuilder.Append($"M:{pAddonBasicInfo.AddonPackage.MeshDataSizeMbytes.Value:F5}^");
                }
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.AssetCount))
            {
                AddonAssetSummary summary = pAddonBasicInfo.AddonPackage.AssetSummary;
                fingerprintBuilder.Append(
                    $"A:{summary.Animations}_{summary.Bodyparts}_{summary.Decals}_{summary.CuttingRoomAssets}_{summary.Materials}_{summary.Props}:{summary.PropVariants}_{summary.SkyTextures}_{summary.Sounds}_{summary.SpecialEffects}_{summary.OtherAssets}_{summary.StartMovies}_{summary.Stocks}_{summary.Verbs}^");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.TotalFiles))
            {
                fingerprintBuilder.Append($"F:{pAddonBasicInfo.AddonPackage?.FileSummaryInfo.TotalFiles ?? 0}^");
            }

            return(fingerprintBuilder.ToString());
        }
Пример #3
0
        public static string GetDuplicateDetectionCriteria()
        {
            StringBuilder builder = new StringBuilder();

            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Name))
            {
                builder.Append(" Name,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Publisher))
            {
                builder.Append(" Publisher,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.RecompilableFlag))
            {
                builder.Append(" Republishable,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.LastCompiled))
            {
                builder.Append(" Last published,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.AssetCount))
            {
                builder.Append(" Asset count,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.MeshDataSize))
            {
                builder.Append(" Mesh data size,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.TotalFiles))
            {
                builder.Append(" File count,");
            }
            if (DuplicateDetectionFlag.HasFlag(DuplicateDetectionFlag.Fingerprint))
            {
                builder.Append(" Fingerprint,");
            }
            string text = builder.ToString();

            return(text.Substring(0, text.Length - 1).Trim());
        }