Click here to Skip to main content
15,908,768 members
Home / Discussions / C#
   

C#

 
QuestionSure this has been asked before but can not find answer (c# prototypes) Pin
Andy Braham8-Feb-10 6:16
Andy Braham8-Feb-10 6:16 
AnswerRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
OriginalGriff8-Feb-10 6:27
mveOriginalGriff8-Feb-10 6:27 
GeneralRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
Andy Braham8-Feb-10 7:21
Andy Braham8-Feb-10 7:21 
GeneralRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
Dave Kreskowiak8-Feb-10 7:25
mveDave Kreskowiak8-Feb-10 7:25 
GeneralRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
harold aptroot8-Feb-10 7:40
harold aptroot8-Feb-10 7:40 
GeneralRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
DaveyM698-Feb-10 8:03
professionalDaveyM698-Feb-10 8:03 
AnswerRe: Sure this has been asked before but can not find answer (c# prototypes) Pin
Richard MacCutchan8-Feb-10 6:56
mveRichard MacCutchan8-Feb-10 6:56 
Questionzipping an xml file Pin
Shtel8-Feb-10 4:29
Shtel8-Feb-10 4:29 
Hello there!
I have an Xdocument created programatically, and i wan't to zip it and save it in a gzip file.
Now my problem is that i want the name of the zip file, to be independent from the name of the zipped file...
i.e the zip file will be foo.gz, and the file inside will be test.xml. Now i have read that
by using -GZipStream- you can't actually give a name to your file. i have managed to zip files, but not name them... any ideas?

Here is how i do it at the moment

private void Compress(XDocument doc, string fullUserFilePath)
{
            byte[] buffer;

            MemoryStream memoryStream = new MemoryStream();
            XmlWriter writer = XmlWriter.Create(memoryStream);

            doc.Save(writer);

            writer.Close();

            memoryStream.Position = 0;

            buffer = new byte[memoryStream.Length];
            memoryStream.Read(buffer, 0, buffer.Count());
            using (FileStream outfile = new FileStream(fullUserFilePath, FileMode.Create, FileAccess.Write))
            {
                using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
                {
                    using (BinaryWriter sw = new BinaryWriter(stream))
                    {
                        sw.Write(buffer);
                    }
                }
            }
}

AnswerRe: zipping an xml file Pin
musefan8-Feb-10 4:42
musefan8-Feb-10 4:42 
GeneralRe: zipping an xml file Pin
Shtel8-Feb-10 5:01
Shtel8-Feb-10 5:01 
GeneralRe: zipping an xml file Pin
musefan8-Feb-10 5:15
musefan8-Feb-10 5:15 
GeneralRe: zipping an xml file Pin
Shtel8-Feb-10 6:04
Shtel8-Feb-10 6:04 
GeneralRe: zipping an xml file Pin
harold aptroot8-Feb-10 6:44
harold aptroot8-Feb-10 6:44 
GeneralRe: zipping an xml file [modified] Pin
musefan8-Feb-10 7:03
musefan8-Feb-10 7:03 
AnswerRe: zipping an xml file Pin
harold aptroot8-Feb-10 7:33
harold aptroot8-Feb-10 7:33 
QuestionSolving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
User 68218818-Feb-10 4:06
User 68218818-Feb-10 4:06 
AnswerRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
Not Active8-Feb-10 4:20
mentorNot Active8-Feb-10 4:20 
GeneralRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
User 68218818-Feb-10 4:38
User 68218818-Feb-10 4:38 
AnswerRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
V.8-Feb-10 4:24
professionalV.8-Feb-10 4:24 
GeneralRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
User 68218818-Feb-10 4:37
User 68218818-Feb-10 4:37 
AnswerRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") [modified] Pin
rhuiden8-Feb-10 4:43
rhuiden8-Feb-10 4:43 
GeneralRe: Solving (string) and creating the screen - Ex.: CreateScreen("screenTest") Pin
User 68218818-Feb-10 11:47
User 68218818-Feb-10 11:47 
Questioncontrols in richtextbox Pin
asdf232118-Feb-10 3:19
asdf232118-Feb-10 3:19 
QuestionMultiple Clients Running One Server Application Pin
Bob Steel-Smith8-Feb-10 3:16
Bob Steel-Smith8-Feb-10 3:16 
AnswerRe: Multiple Clients Running One Server Application Pin
Keith Barrow8-Feb-10 3:42
professionalKeith Barrow8-Feb-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.