Ejemplo n.º 1
0
        public static void EnsureFileExists(string approved)
        {
            if (!File.Exists(approved))
            {
                var extensionWithoutDot = new FileInfo(approved).Extension.Substring(1);
                if (EmptyFiles.TryGetPathFor(extensionWithoutDot, out var emptyFile))
                {
                    File.Copy(emptyFile, approved, true);
                }
                else
                {
                    File.WriteAllText(approved, " ", Encoding.UTF8);
                }

                ReporterEvents.CreatedApprovedFile(approved);
            }
        }
        public static void EnsureFileExists(string approved)
        {
            if (!File.Exists(approved))
            {
                var fileType = new FileInfo(approved).Extension;
                if (IMAGE_FILE_TYPES.Contains(fileType))
                {
                    using var bitmap = new Bitmap(1, 1);
                    bitmap.SetResolution(96, 96);
                    bitmap.Save(approved);
                }
                else
                {
                    File.WriteAllText(approved, " ", Encoding.UTF8);
                }

                ReporterEvents.CreatedApprovedFile(approved);
            }
        }