scripts
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Hjg.Pngcs
|
||||
{
|
||||
// Token: 0x0200001D RID: 29
|
||||
public class FileHelper
|
||||
{
|
||||
// Token: 0x060000F1 RID: 241 RVA: 0x00004DA0 File Offset: 0x00002FA0
|
||||
public static Stream OpenFileForReading(string file)
|
||||
{
|
||||
if (file == null || !File.Exists(file))
|
||||
{
|
||||
throw new PngjInputException("Cannot open file for reading (" + file + ")");
|
||||
}
|
||||
return new FileStream(file, FileMode.Open);
|
||||
}
|
||||
|
||||
// Token: 0x060000F2 RID: 242 RVA: 0x00004DDC File Offset: 0x00002FDC
|
||||
public static Stream OpenFileForWriting(string file, bool allowOverwrite)
|
||||
{
|
||||
if (File.Exists(file) && !allowOverwrite)
|
||||
{
|
||||
throw new PngjOutputException("File already exists (" + file + ") and overwrite=false");
|
||||
}
|
||||
return new FileStream(file, FileMode.Create);
|
||||
}
|
||||
|
||||
// Token: 0x060000F3 RID: 243 RVA: 0x00004E15 File Offset: 0x00003015
|
||||
public static PngWriter CreatePngWriter(string fileName, ImageInfo imgInfo, bool allowOverwrite)
|
||||
{
|
||||
return new PngWriter(FileHelper.OpenFileForWriting(fileName, allowOverwrite), imgInfo, fileName);
|
||||
}
|
||||
|
||||
// Token: 0x060000F4 RID: 244 RVA: 0x00004E25 File Offset: 0x00003025
|
||||
public static PngReader CreatePngReader(string fileName)
|
||||
{
|
||||
return new PngReader(FileHelper.OpenFileForReading(fileName), fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user