Ejemplo n.º 1
0
        /// <summary>
        ///   Loads dotfuscator xml map files using a naming convention of name-version.xml.
        ///   The version can be 1..4 digits.
        /// </summary>
        /// <param name="mapping">Mapping to load into.</param>
        /// <param name="paths">Paths of xml files to load.</param>
        /// <param name="errorHandler">Called for each file that fails to load.</param>
        /// <param name="progress">Progress handler</param>
        public static void LoadDotfuscator(this IMapping mapping, IEnumerable <string> paths, Action <string, Exception> errorHandler, Action <string, float> progress)
        {
            int fileNum = 0;

            foreach (var path in paths)
            {
                try
                {
                    var version = GetVersionFromFilename(path);
                    mapping.LoadDotfuscator(path, version, f => progress(path, (fileNum + f) / paths.Count()));
                    fileNum++;
                }
                catch (Exception ex)
                {
                    errorHandler?.Invoke(path, ex);
                }
            }
        }