Click here to Skip to main content
15,884,739 members
Home / Discussions / C#
   

C#

 
QuestionBacking up database file using SMO error Pin
gamer112727-Aug-10 16:52
gamer112727-Aug-10 16:52 
Questionbuilding a win form application problem Pin
mrkeivan27-Aug-10 11:37
mrkeivan27-Aug-10 11:37 
AnswerRe: building a win form application problem Pin
Not Active27-Aug-10 12:01
mentorNot Active27-Aug-10 12:01 
QuestionWin7 No PingCompletedCallback on timeout? Pin
Gavin Coates27-Aug-10 7:44
Gavin Coates27-Aug-10 7:44 
QuestionCustom file type Pin
Etienne_12327-Aug-10 5:29
Etienne_12327-Aug-10 5:29 
AnswerRe: Custom file type Pin
OriginalGriff27-Aug-10 5:46
mveOriginalGriff27-Aug-10 5:46 
GeneralRe: Custom file type Pin
Etienne_12327-Aug-10 6:14
Etienne_12327-Aug-10 6:14 
AnswerRe: Custom file type Pin
Chris Trelawny-Ross27-Aug-10 5:47
Chris Trelawny-Ross27-Aug-10 5:47 
A simple trick might be to write some binary value - an indicator byte/int/long plus some indicator of the type of image that the rest of the file contains (e.g. 0xD1CEDBEE + ".JPG" for a total of 8 bytes, or 12 if you save the string as multibyte characters) - at the beginning of a new file, then stream the binary of the high-res image immediately following that byte. Save the file with a custom extension 'xxx.hires' or somesuch.

The presence of the custom header will prevent any standard software from being able to process the file as a recognized image file.

The custom app can validate the header, then create a .Net Image object from the remainder of the content in the file.

Specifying the embedded image type in the header allows for future implementations that use other file formats (which may not necessarily be images at all). If you don't like having ".JPG" in readable characters, XOR each byte of the string with some binary value, say 0x53. Just XOR them again when reading them back, to get back to the original characters.

You should probably also include a length field describing the embedded string, for flexibility, instead of assuming that it is always going to be 4 characters; I would also include a version # "just in case".
AnswerRe: Custom file type Pin
OriginalGriff27-Aug-10 5:51
mveOriginalGriff27-Aug-10 5:51 
GeneralRe: Custom file type Pin
Etienne_12327-Aug-10 6:18
Etienne_12327-Aug-10 6:18 
GeneralRe: Custom file type Pin
OriginalGriff27-Aug-10 8:20
mveOriginalGriff27-Aug-10 8:20 
GeneralRe: Custom file type Pin
Etienne_12327-Aug-10 10:52
Etienne_12327-Aug-10 10:52 
GeneralRe: Custom file type Pin
OriginalGriff27-Aug-10 20:24
mveOriginalGriff27-Aug-10 20:24 
AnswerRe: Custom file type Pin
Kubajzz27-Aug-10 5:52
Kubajzz27-Aug-10 5:52 
AnswerRe: Custom file type Pin
Luc Pattyn27-Aug-10 6:04
sitebuilderLuc Pattyn27-Aug-10 6:04 
GeneralRe: Custom file type Pin
Yusuf27-Aug-10 12:23
Yusuf27-Aug-10 12:23 
GeneralRe: Custom file type Pin
AspDotNetDev27-Aug-10 12:43
protectorAspDotNetDev27-Aug-10 12:43 
GeneralRe: Custom file type Pin
Yusuf27-Aug-10 18:50
Yusuf27-Aug-10 18:50 
GeneralRe: Custom file type Pin
AspDotNetDev27-Aug-10 20:04
protectorAspDotNetDev27-Aug-10 20:04 
AnswerRe: Custom file type Pin
AspDotNetDev27-Aug-10 6:51
protectorAspDotNetDev27-Aug-10 6:51 
AnswerRe: Custom file type Pin
I Believe In GOD27-Aug-10 7:38
I Believe In GOD27-Aug-10 7:38 
AnswerRe: Custom file type Pin
Not Active27-Aug-10 9:43
mentorNot Active27-Aug-10 9:43 
GeneralRe: Custom file type Pin
Etienne_12327-Aug-10 10:54
Etienne_12327-Aug-10 10:54 
AnswerRe: Custom file type Pin
Yusuf27-Aug-10 12:26
Yusuf27-Aug-10 12:26 
QuestionDetecting low memory Pin
Madmaximus27-Aug-10 3:42
Madmaximus27-Aug-10 3:42 

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.