// HtmlAgilityPack V1.0 - Simon Mourier
using System;
using System.Diagnostics;
using System.IO;
namespace HtmlAgilityPack
{
internal struct IOLibrary
{
internal static void MakeWritable(string path)
{
if (!File.Exists(path))
return;
File.SetAttributes(path, File.GetAttributes(path) & ~FileAttributes.ReadOnly);
}
internal static void CopyAlways(string source, string target)
{
if (!File.Exists(source))
return;
Directory.CreateDirectory(Path.GetDirectoryName(target));
MakeWritable(target);
File.Copy(source, target, true);
}
}
#if TARGET_JVM1
internal struct HtmlLibrary
{
[Conditional("DEBUG")]
internal static void GetVersion(out string version)
{
System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1, true);
version = sf.GetMethod().DeclaringType.Assembly.GetName().Version.ToString();
}
[Conditional("DEBUG")]
[Conditional("TRACE")]
internal static void Trace(object Value)
{
// category is the method
string name = null;
GetCurrentMethodName(2, out name);
System.Diagnostics.Trace.WriteLine(Value, name);
}
[Conditional("DEBUG")]
[Conditional("TRACE")]
internal static void TraceStackFrame(int steps)
{
string name = null;
GetCurrentMethodName(2, out name);
string trace = "";
for(int i=1;i