Dll: InSpecialDir

Esta sección esta especialmente diseñada para todos aquellos usuarios que estés desarrollando plugins o aplicaciones y quieran ayuda para dichos plugins o aplicaciones.
Buenas amigos se me a ocurrido crear una dll para tratar de modificar esos archivos del sistema que aveces AMS no nos permite modificar, ay os pongo la idea:

using System;
using System.Collections.Generic;
using System.Text;
using RGiesecke.DllExport;
using System.IO;

namespace InSpecialDir
{
internal static class UnmanagedExports
{
// MakeFiler function arg: txtToWrite, fileName, specialFolder and appendFile
[DllExport("MakeFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static void MakeFile(string txtToWrite, string fileName, int specialFolder, int appendFile)
{
var sFolder = Environment.SpecialFolder.Desktop;
{
if (specialFolder == 1)
sFolder = Environment.SpecialFolder.System;
else if (specialFolder == 2)
sFolder = Environment.SpecialFolder.ApplicationData;
else if (specialFolder == 3)
sFolder = Environment.SpecialFolder.CommonApplicationData;
else if (specialFolder == 4)
sFolder = Environment.SpecialFolder.CommonProgramFiles;
else if (specialFolder == 5)
sFolder = Environment.SpecialFolder.LocalApplicationData;
}

if (appendFile == 1)
File.AppendAllText(Environment.GetFolderPath(sFolder) + fileName, txtToWrite);
else
File.WriteAllText(Environment.GetFolderPath(sFolder) + fileName, txtToWrite);
}

// WriteFile function arg: filename and strText
[DllExport("WriteFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static void WriteFile(string filename, string strText)
{
File.WriteAllText(filename, strText);
}

// SetAttributesFile function arg: filename and fileAtr
[DllExport("SetAttributesFile", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static void SetAttributesFile(string filename, int fileAtr)
{
if (fileAtr == 1)
File.SetAttributes(filename, FileAttributes.Archive);
else if (fileAtr == 2)
File.SetAttributes(filename, FileAttributes.Compressed);
else if (fileAtr == 3)
File.SetAttributes(filename, FileAttributes.Device);
else if (fileAtr == 4)
File.SetAttributes(filename, FileAttributes.Directory);
else if (fileAtr == 5)
File.SetAttributes(filename, FileAttributes.Encrypted);
else if (fileAtr == 6)
File.SetAttributes(filename, FileAttributes.Hidden);
else if (fileAtr == 7)
File.SetAttributes(filename, FileAttributes.Normal);
else if (fileAtr == 8)
File.SetAttributes(filename, FileAttributes.NotContentIndexed);
else if (fileAtr == 9)
File.SetAttributes(filename, FileAttributes.Offline);
else if (fileAtr == 10)
File.SetAttributes(filename, FileAttributes.ReadOnly);
else if (fileAtr == 11)
File.SetAttributes(filename, FileAttributes.ReparsePoint);
else if (fileAtr == 12)
File.SetAttributes(filename, FileAttributes.SparseFile);
else if (fileAtr == 13)
File.SetAttributes(filename, FileAttributes.System);
else if (fileAtr == 14)
File.SetAttributes(filename, FileAttributes.Temporary);
}
}
}


ya me diceis que pos parece la idea

:demo:
reservado...
interesante esto ceone, haber como rulara cuando lo termines.
Mañana empezare con el testeo....