I always felt that I posted this section.Code, Is a very 'cup with 'thing.
As an iPhone coders, I don't bother to manually add plist files and use code to generate them. Requirement. It is to make a directory for all the files in the current folder of some or some types. In this example, txt is used as an example. Finally, a standard plist file that can be used in xcode is generated. In fact, later I thought that objectivec can be fully implemented, but the familiarity with C # is indeed better...
Code Class Program
{
Static Void Main ( String [] ARGs)
{
// Create the file and writer.
Filestream FS = New Filestream ( " Info. plist " , Filemode. Create );
Xmltextwriter W = New Xmltextwriter (FS, encoding. utf8 );
// Start the document.
W. writestartdocument ();
// Add commets
W. writecomment ( " Doctype plist public \ " - // Apple // DTD plist 1.0 // En \"\" Http://www.apple.com/DTDs/PropertyList-1.0.dtd ");
// Plist start
W. writestartelement ( " Plist " );
// Plist version
W. writeattributestring ( " Version " , " 1.0 " );
W. writestartelement ("Array");
String Pathname = System. environment. currentdirectory;
Directoryinfo di = New Directoryinfo (pathname );
Filesysteminfo [] FSI = Di. getfilesysteminfos ();
Foreach (Filesysteminfo fi In FSI)
{
If (Fi. extension. Contains ( " . Txt " ))
{
// Write a key string pair
W. writestartelement ( " Dict " );
W. writeelementstring ( " Key " , Fi. Name. tostring ());
W. writeelementstring ( " String " , Fi. name. tostring ();
W. writeendelement ();
}< BR >}
//End the document.
W. writeendelement ();
W. writeendelement ();
W. writeenddocument ();
W. Flush ();
FS. Close ();
}
}