本文整理汇总了C#中Directory.GetFilenames方法的典型用法代码示例。如果您正苦于以下问题:C# Directory.GetFilenames方法的具体用法?C# Directory.GetFilenames怎么用?C# Directory.GetFilenames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory.GetFilenames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] args)
{
string directory = args[0];
Tag t = new Tag(0x8,0x80);
Directory d = new Directory();
uint nfiles = d.Load( directory );
if(nfiles == 0) return 1;
//System.Console.WriteLine( "Files:\n" + d.toString() );
// Use a StrictScanner, need to use a reference to pass the C++ pointer to
// MyWatcher implementation
SmartPtrStrictScan sscan = StrictScanner.New();
StrictScanner s = sscan.__ref__();
MyWatcher watcher = new MyWatcher(s);
s.AddTag( t );
bool b = s.Scan( d.GetFilenames() );
if(!b) return 1;
for(int i = 0; i < (int)nfiles; ++i)
{
if( !s.IsKey( d.GetFilenames()[i] ) )
{
System.Console.WriteLine( "File is not DICOM or could not be read: " + d.GetFilenames()[i] );
}
}
System.Console.WriteLine( "Scan:\n" + s.toString() );
System.Console.WriteLine( "success" );
return 0;
}
示例2: Main
public static int Main(string[] args)
{
string directory = args[0];
string outfilename = args[1];
Directory d = new Directory();
uint nfiles = d.Load( directory, true );
if(nfiles == 0) return 1;
//System.Console.WriteLine( "Files:\n" + d.toString() );
// Implement fast path ?
// Scanner s = new Scanner();
string descriptor = "My_Descriptor";
FilenamesType filenames = d.GetFilenames();
gdcm.DICOMDIRGenerator gen = new DICOMDIRGenerator();
gen.SetFilenames( filenames );
gen.SetDescriptor( descriptor );
if( !gen.Generate() )
{
return 1;
}
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "GenerateDICOMDIR" );
gdcm.Writer writer = new Writer();
writer.SetFile( gen.GetFile() );
writer.SetFileName( outfilename );
if( !writer.Write() )
{
return 1;
}
return 0;
}
示例3: Main
public static int Main(string[] args)
{
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My Standardize App" );
// http://www.oid-info.com/get/1.3.6.1.4.17434
string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );
string dir1 = args[0];
string dir2 = args[1];
// Check input is valid:
if( !gdcm.PosixEmulation.FileIsDirectory(dir1) )
{
System.Console.WriteLine( "Input directory: " + dir1 + " does not exist. Sorry" );
return 1;
}
if( !gdcm.PosixEmulation.FileIsDirectory(dir2) )
{
System.Console.WriteLine( "Output directory: " + dir2 + " does not exist. Sorry" );
return 1;
}
Directory d = new Directory();
uint nfiles = d.Load( dir1, true );
if(nfiles == 0) return 1;
// Process all filenames:
FilenamesType filenames = d.GetFilenames();
for( uint i = 0; i < nfiles; ++i )
{
string filename = filenames[ (int)i ];
string outfilename = filename.Replace( dir1, dir2 );
System.Console.WriteLine( "Filename: " + filename );
System.Console.WriteLine( "Out Filename: " + outfilename );
if( !ProcessOneFile( filename, outfilename ) )
{
System.Console.WriteLine( "Could not process filename: " + filename );
//return 1;
}
}
return 0;
}
示例4: Main
public static int Main(string[] args)
{
string directory = args[0];
Tag t = new Tag(0x8,0x8);
Directory d = new Directory();
uint nfiles = d.Load( directory );
if(nfiles == 0) return 1;
//System.Console.WriteLine( "Files:\n" + d.toString() );
Scanner s = new Scanner();
s.AddTag( t );
bool b = s.Scan( d.GetFilenames() );
if(!b) return 1;
System.Console.WriteLine( "Scan:\n" + s.toString() );
System.Console.WriteLine( "success" );
return 0;
}
示例5: Main
public static int Main(string[] args)
{
string directory = args[0];
Tag t = new Tag(0x8,0x8);
Directory d = new Directory();
uint nfiles = d.Load( directory );
if(nfiles == 0) return 1;
//System.Console.WriteLine( "Files:\n" + d.toString() );
//Scanner s = new Scanner();
SmartPtrScan sscan = Scanner.New();
Scanner s = sscan.__ref__();
SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(s, "MySimple");
s.AddTag( t );
bool b = s.Scan( d.GetFilenames() );
if(!b) return 1;
System.Console.WriteLine( "Scan:\n" + s.toString() );
System.Console.WriteLine( "success" );
return 0;
}
示例6: Main
public static int Main(string[] args)
{
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My ClinicalTrial App" );
// http://www.oid-info.com/get/1.3.6.1.4.17434
string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );
gdcm.Global global = gdcm.Global.GetInstance();
if( !global.LoadResourcesFiles() )
{
System.Console.WriteLine( "Could not LoadResourcesFiles" );
return 1;
}
string dir1 = args[0];
string dir2 = args[1];
// Check input is valid:
if( !gdcm.PosixEmulation.FileIsDirectory(dir1) )
{
System.Console.WriteLine( "Input directory: " + dir1 + " does not exist. Sorry" );
return 1;
}
if( !gdcm.PosixEmulation.FileIsDirectory(dir2) )
{
System.Console.WriteLine( "Output directory: " + dir2 + " does not exist. Sorry" );
return 1;
}
Directory d = new Directory();
uint nfiles = d.Load( dir1, true );
if(nfiles == 0) return 1;
string certpath = gdcm.Filename.Join(gdcm.Testing.GetSourceDirectory(), "/Testing/Source/Data/certificate.pem" );
gdcm.CryptographicMessageSyntax cms = new gdcm.CryptographicMessageSyntax();
if( !cms.ParseCertificateFile( certpath ) )
{
return 1;
}
//Anonymizer ano = new Anonymizer();
SmartPtrAno sano = Anonymizer.New();
Anonymizer ano = sano.__ref__();
//SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(ano, "Anonymizer");
MyWatcher watcher = new MyWatcher(ano);
ano.SetCryptographicMessageSyntax( cms );
// Process all filenames:
FilenamesType filenames = d.GetFilenames();
for( uint i = 0; i < nfiles; ++i )
{
string filename = filenames[ (int)i ];
string outfilename = filename.Replace( dir1, dir2 );
System.Console.WriteLine( "Filename: " + filename );
System.Console.WriteLine( "Out Filename: " + outfilename );
if( !ProcessOneFile( ano , filename, outfilename ) )
{
System.Console.WriteLine( "Could not process filename: " + filename );
return 1;
}
}
return 0;
}
示例7: Main
public static int Main(string[] args)
{
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My ClinicalTrial App" );
// http://www.oid-info.com/get/1.3.6.1.4.17434
string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );
gdcm.Global global = gdcm.Global.GetInstance();
if( !global.LoadResourcesFiles() )
{
System.Console.WriteLine( "Could not LoadResourcesFiles" );
return 1;
}
if( args.Length != 2 )
{
System.Console.WriteLine( "Usage:" );
System.Console.WriteLine( "ClinicalTrialIdentificationWorkflow input_dir output_dir" );
return 1;
}
string dir1 = args[0];
string dir2 = args[1];
// Check input is valid:
if( !gdcm.PosixEmulation.FileIsDirectory(dir1) )
{
System.Console.WriteLine( "Input directory: " + dir1 + " does not exist. Sorry" );
return 1;
}
if( !gdcm.PosixEmulation.FileIsDirectory(dir2) )
{
System.Console.WriteLine( "Output directory: " + dir2 + " does not exist. Sorry" );
return 1;
}
// Recursively search all file within this toplevel directory:
Directory d = new Directory();
uint nfiles = d.Load( dir1, true );
if(nfiles == 0) return 1;
// Let's use the pre-shipped certificate of GDCM.
string certpath = gdcm.Filename.Join(gdcm.Testing.GetSourceDirectory(), "/Testing/Source/Data/certificate.pem" );
gdcm.CryptoFactory fact = gdcm.CryptoFactory.GetFactoryInstance();
gdcm.CryptographicMessageSyntax cms = fact.CreateCMSProvider();
if( !cms.ParseCertificateFile( certpath ) )
{
System.Console.WriteLine( "PEM Certificate : " + certpath + " could not be read. Sorry" );
return 1;
}
//Anonymizer ano = new Anonymizer();
// A reference to an actual C++ instance is required here:
SmartPtrAno sano = Anonymizer.New();
Anonymizer ano = sano.__ref__();
//SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(ano, "Anonymizer");
MyWatcher watcher = new MyWatcher(ano);
// Explicitly specify the Cryptographic Message Syntax to use:
ano.SetCryptographicMessageSyntax( cms );
// Process all filenames:
FilenamesType filenames = d.GetFilenames();
for( uint i = 0; i < nfiles; ++i )
{
string filename = filenames[ (int)i ];
string outfilename = filename.Replace( dir1, dir2 );
System.Console.WriteLine( "Filename: " + filename );
System.Console.WriteLine( "Out Filename: " + outfilename );
if( !ProcessOneFile( ano , filename, outfilename ) )
{
System.Console.WriteLine( "Could not process filename: " + filename );
return 1;
}
}
return 0;
}