All pastes #168483 Raw Edit

Something

public text v1 · immutable
·published 2006-09-13 01:16 UTC
rendered paste body
            DirectoryInfo dir = new DirectoryInfo(@"C:\AddOns");
            DirectoryInfo[] dirlist = dir.GetDirectories();
            textBox1.Text = dirlist.Length + " dirs";
            foreach(DirectoryInfo q in dirlist)
            {  // Go through each sub-directory...

                tw.WriteStartElement("Addon");
                tw.WriteAttributeString("name", q.Name);
                // give the XML an element called Addon,
                // with the directory name as the name attribute

                FileInfo[] files = q.GetFiles();
                foreach (FileInfo f in files)
                {  // Go through each file...
                    tw.WriteStartElement("file");
                    tw.WriteAttributeString("name", f.Name);
                    tw.WriteElementString("Size", f.Length.ToString());
                    tw.WriteElementString("MD5", getMd5(f.ToString()));
                    tw.WriteEndElement();
                }  // ... and grab the filename, size, and md5

                tw.WriteEndElement();
            }