Click here to Skip to main content
16,014,940 members
Home / Discussions / C#
   

C#

 
GeneralRe: Printing Pin
Mazdak27-Mar-02 1:56
Mazdak27-Mar-02 1:56 
Generalstring array Pin
Mazdak26-Mar-02 21:27
Mazdak26-Mar-02 21:27 
GeneralRe: string array Pin
SimonS26-Mar-02 21:48
SimonS26-Mar-02 21:48 
GeneralRe: string array Pin
Mazdak26-Mar-02 22:09
Mazdak26-Mar-02 22:09 
Generalbackup Pin
BLaZiNiX26-Mar-02 19:01
BLaZiNiX26-Mar-02 19:01 
GeneralRe: backup Pin
James T. Johnson26-Mar-02 23:10
James T. Johnson26-Mar-02 23:10 
GeneralRe: backup Pin
BLaZiNiX27-Mar-02 15:35
BLaZiNiX27-Mar-02 15:35 
GeneralRe: backup Pin
James T. Johnson27-Mar-02 18:09
James T. Johnson27-Mar-02 18:09 
I don't have anything premade but I can come up with a general solution that will need a little tweaking Smile | :)

[Serializable()]
public class BackupFile : ISerializable
{
	private string _filename = "";
	private byte[] _filedata = null;
 
	public string Filename
	{
		get { return _filename; }
		set { _filename = value; }
	}
 
	public byte[] FileData 
	{
		get { return _filedata; }
		set { _filedata = value; }
	}
 
	// Don't allow default constructor use
	private BackupFile() { }
 
	public BackupFile(string filename)
	{
		Filename = filename;
		FileData = null;
	}
 
	public BackupFile(SerializationInfo info, StreamingContext context)
	{
		byte [] tempB = new byte[1];

		Filename = (string) info.GetValue("filename", typeof(string));
		FileData = (byte[]) info.GetValue("filedata", temp.GetType());
 
		WriteFileToDisk();
 
		FileData = null; // "free" the memory used by the file
	}
 
	public void GetObjectData(SerializationInfo info, StreamingContext context)
	{
		FileData = LoadFileFromDisk();
 
		info.AddValue("filename", Filename, Filename.GetType());
		info.AddValue("filedata", FileData, FileData.GetType());
 
		FileData = null;  // "free" the memory used by the file
	}
 
	private void WriteFileToDisk()
	{
		// Open the file specified by Filename and write the bytes stored in 
		// FileData to it
	}
 
	private void LoadFileFromDisk()
	{
		// Open the file specified by Filename and copy the data from the stream
		// to FileData
	}
}
Now you may wish to also offer compression as well, there is a .NET implementation of gzip/zip available at ICSharpCode.NET.

The compression library is GPL, but there is an exception that reads "As a special exception, if you link this library with other files to produce an executable, this library does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License."

James

[Edit: AHA! I finally figured out how to get the "extra" linebreaks to appear... They can't be blank lines Smile | :) Each "blank" line needs a space on it. Pardon me while I celebrate Jig | [Dance] ]

Sonork ID: 100.11138 - Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971

QuestionDynamically assign QueryString to SRC? Pin
26-Mar-02 13:02
suss26-Mar-02 13:02 
AnswerRe: Dynamically assign QueryString to SRC? Pin
David Wengier26-Mar-02 13:18
David Wengier26-Mar-02 13:18 
GeneralRe: Dynamically assign QueryString to SRC? Pin
26-Mar-02 13:44
suss26-Mar-02 13:44 
GeneralRe: Dynamically assign QueryString to SRC? Pin
David Wengier26-Mar-02 13:52
David Wengier26-Mar-02 13:52 
GeneralMatlab & C# Pin
26-Mar-02 8:25
suss26-Mar-02 8:25 
QuestionCapturing Cursor Keys? Pin
Zombies with Coffee, LLC26-Mar-02 7:54
professionalZombies with Coffee, LLC26-Mar-02 7:54 
AnswerRe: Capturing Cursor Keys? Pin
James T. Johnson26-Mar-02 8:11
James T. Johnson26-Mar-02 8:11 
GeneralRe: Capturing Cursor Keys? Pin
Zombies with Coffee, LLC26-Mar-02 8:17
professionalZombies with Coffee, LLC26-Mar-02 8:17 
QuestionDynamic C# dll components? Pin
Filip Strugar26-Mar-02 7:32
Filip Strugar26-Mar-02 7:32 
AnswerRe: Dynamic C# dll components? Pin
Filip Strugar26-Mar-02 7:42
Filip Strugar26-Mar-02 7:42 
GeneralRe: Dynamic C# dll components? Pin
James T. Johnson26-Mar-02 7:46
James T. Johnson26-Mar-02 7:46 
GeneralRe: Dynamic C# dll components? Pin
Filip Strugar26-Mar-02 8:13
Filip Strugar26-Mar-02 8:13 
GeneralRe: Dynamic C# dll components? Pin
James T. Johnson26-Mar-02 12:35
James T. Johnson26-Mar-02 12:35 
GeneralRe: Dynamic C# dll components? Pin
Filip Strugar28-Mar-02 7:39
Filip Strugar28-Mar-02 7:39 
GeneralDeriving combobox Pin
Marc L'Ecuyer26-Mar-02 5:05
Marc L'Ecuyer26-Mar-02 5:05 
GeneralBitmaps disappearing Pin
26-Mar-02 4:45
suss26-Mar-02 4:45 
GeneralRe: Bitmaps disappearing Pin
David Wengier26-Mar-02 10:16
David Wengier26-Mar-02 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.