-
-
Notifications
You must be signed in to change notification settings - Fork 451
Expand file tree
/
Copy pathConfigurationFile.cs
More file actions
41 lines (30 loc) · 1.01 KB
/
Copy pathConfigurationFile.cs
File metadata and controls
41 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using System.IO;
namespace ImageMagick.Configuration;
internal sealed class ConfigurationFile : IConfigurationFile
{
public ConfigurationFile(string fileName)
{
FileName = fileName;
Data = LoadData();
}
public string FileName { get; }
public string Data { get; set; }
private string LoadData()
{
using var stream = TypeHelper.GetManifestResourceStream(typeof(ConfigurationFile), "ImageMagick.Resources.Xml", FileName);
using var reader = new StreamReader(stream);
var data = reader.ReadToEnd();
data = UpdateDelegatesXml(data);
return data;
}
private string UpdateDelegatesXml(string data)
{
if (Runtime.IsWindows || FileName != "delegates.xml")
return data;
data = data.Replace("@PSDelegate@", "gs");
data = data.Replace("ffmpeg.exe", "ffmpeg");
return data;
}
}