Filestream'ing a file in Properties.Resources

  • Thread starter Thread starter Christ Kennedy
  • Start date Start date
C

Christ Kennedy

Guest
I'm building a GUI_FileDialog and its Designer tool.

The designer-tool creates GUI file-dialogs and saves their appearances and details in a File-stream.

Currently, to use any created-GUI-FileDialogs they are created during run-time just like the OpenFileDialo/SaveFileDialog native to C#.

but to set their appearances/details to those recorded using the DesignerTool the Designer-Tool's output file needs to be loaded via a FileStream and the file's name.

- I would like to add the GUI File-Dialog's description file to my project's resources and not rely on it being found on the user's hard-drive ...

to use the GUI_FileDialog is simple :

private void LbtnLoad_Click(object sender, EventArgs e)
{
OpenFileDialog_GUI ofd = new OpenFileDialog_GUI();
ofd.GUI_Load(System.IO.Directory.GetCurrentDirectory() + "\\FileDialog_Tools.fdGui");
ofd.Filter = "File Dialogs (*." + Ck_Objects.FileDialog_GUI.FileExtension + ")|*." + Ck_Objects.FileDialog_GUI.FileExtension;
if (ofd.ShowDialog() == DialogResult.OK)
{
fdGUI.GUI_Load(ofd.FileName);
loadFileDialog_Interface();
fdGUI.Show();
formGUI.instance.FileDialog = fdGUI;
}
}

just like any other OpenFileDialog

and the fdGUI.GUI_Load() function starts like this

public void GUI_Load(string strFileName)
{
cleanExtension(ref strFileName);
FileStream fs = new FileStream(strFileName, FileMode.Open);

// FORM
// size
Width = (int)formatter.Deserialize(fs);
Height = (int)formatter.Deserialize(fs);
// yada yada yada
}

to get results that look like this

1521324.png

because sometimes you ~want~ GUI-nea Pig!

can someone tell me how to read my file-stream from my project's Properties.Resource ?

Christ




my code is perfect until i don't find a bug

Continue reading...
 
Back
Top