This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// The hack for substitution of standard configuration file | |
| /// question at StackOweflow: http://stackoverflow.com/questions/6150644/change-default-app-config-at-runtime | |
| /// a solution: http://stackoverflow.com/a/6151688/2833774 | |
| /// </summary> | |
| public abstract class AppConfigChanger : IDisposable | |
| { | |
| public static AppConfigChanger Change(string path) | |
| { | |
| return new AppConfigSubstitutor(path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Text; | |
| namespace ConsoleApplication2 | |
| { | |
| internal class Program | |
| { | |
| private static void Main(string[] args) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ExtractEmbeddedResourcesToFiles() | |
| { | |
| Assembly a = typeof (SomeTypeFromAssemblyWithResources).Assembly; | |
| string d = Path.GetDirectoryName(a.Location); | |
| string outputDir = Path.Combine(d, subFolder); | |
| if (Directory.Exists(outputDir) == false) | |
| { | |
| Directory.CreateDirectory(outputDir); | |
| } | |
| List<string> rs = a.GetManifestResourceNames().Where(n => n.Contains(prefix)).ToList(); |
NewerOlder