public static bool BinarizeToFile(string targetFilePath, IBinarizable stream) { FileStream fs = null; try { fs = new FileStream(targetFilePath, FileMode.Create); using (var bw = new BinaryWriter(fs)) { fs = null; stream.Binarize(bw); } } catch (Exception ex) { Debug.LogException(ex); return(false); } finally { if (fs != null) { fs.Dispose(); } } return(true); }
public static bool DebinarizeFromFile(string targetFilePath, IBinarizable stream) { FileStream fs = null; try { fs = new FileStream(targetFilePath, FileMode.Open); using (var br = new BinaryReader(fs)) { fs = null; stream.Debinarize(br); } } catch (Exception ex) { Debug.LogException(ex); return(false); } finally { if (fs != null) { fs.Dispose(); } } return(true); }
public static void DebinarizeFromFile(string targetFilePath, IBinarizable stream) { FileStream fs = null; try { fs = new FileStream(targetFilePath, FileMode.Open); using (var br = new BinaryReader(fs)) { fs = null; stream.Debinarize(br); } } finally { if (fs != null) { fs.Dispose(); } } }
public static void BinarizeToFile(string targetFilePath, IBinarizable stream) { FileStream fs = null; try { fs = new FileStream(targetFilePath, FileMode.Create); using (var bw = new BinaryWriter(fs)) { fs = null; stream.Binarize(bw); } } finally { if (fs != null) { fs.Dispose(); } } }