/// <summary> /// Writes specified hex values in the required position. /// </summary> /// <param name="fileName">The file you're editing.</param> /// <param name="position">The starting point. Usually retried with the FindBytes method.</param> /// <param name="toWrite">A dictionary of locations and bytes that require writing.</param> /// <returns></returns> public static bool WriteBytes(string fileName, long position, Dictionary <long, byte> toWrite) { FileHandling.TakeOwnership(fileName); FileHandling.ClearAttributeFile(fileName); using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite)) { foreach (var values in toWrite) { stream.Position = position + values.Key; stream.WriteByte(values.Value); } } return(true); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(FileHandling.BytesToString(System.Convert.ToDouble(value))); }