本文整理汇总了C#中File.listFiles方法的典型用法代码示例。如果您正苦于以下问题:C# File.listFiles方法的具体用法?C# File.listFiles怎么用?C# File.listFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File.listFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createDirectoryList
private void createDirectoryList(File file)
{
mArrayList.Clear();
mArrayList.Add(PARENT_DIRECTORY_PATH);
File[] files = file.listFiles();
if (files != null)
{
Arrays.sort(files);
for (int i = 0; i < files.Length; i++)
{
if (files[i].Directory)
{
mArrayList.Add(files[i].Name + DIRECTORY_DELIMITER);
}
else
{
mArrayList.Add(files[i].Name);
}
}
}
}
示例2: onListItemClick
//.........这里部分代码省略.........
mBixolonPrinter.PowerSavingMode;
break;
case 11: // setPowerSavingMode
DialogManager.showPowerSavingModeDialog(mPowerSavingModeDialog, MainActivity.this);
break;
case 12: // set page mode
Intent intent = new Intent(MainActivity.this, typeof(PageModeActivity));
startActivity(intent);
break;
case 13: // initialize
mBixolonPrinter.initialize();
break;
case 14: // getBsCodePage
mBixolonPrinter.BsCodePage;
break;
case 15: // setBsCodePage
DialogManager.showBsCodePageDialog(mBsCodePageDialog, MainActivity.this);
break;
case 16: // setPrintColor
DialogManager.showPrintColorDialog(mPrintColorDialog, MainActivity.this);
break;
case 17: // printText
intent = new Intent(MainActivity.this, typeof(PrintTextActivity));
startActivity(intent);
break;
case 18: // print1dBarcode
intent = new Intent(MainActivity.this, typeof(Print1dBarcodeActivity));
startActivity(intent);
break;
case 19: // printPdf417
DialogManager.showPdf417Dialog(mPdf417Dialog, MainActivity.this);
break;
case 20: // printQrCode
DialogManager.showQrCodeDialog(mQrCodeDialog, MainActivity.this);
break;
case 21: // printMaxiCode
DialogManager.showMaxiCodeDialog(mMaxiCodeDialog, MainActivity.this);
break;
case 22: // printDataMatrix
DialogManager.showDataMatrixDialog(mDataMatrixDialog, MainActivity.this);
break;
case 23: // printBitmap
intent = new Intent(MainActivity.this, typeof(PrintBitmapAcitivity));
startActivity(intent);
break;
case 24: // printPdfFiles
File file = new File(Environment.ExternalStorageDirectory.AbsolutePath);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.File[] files = file.listFiles(new java.io.FilenameFilter()
File[] files = file.listFiles(new FilenameFilterAnonymousInnerClassHelper(this));
if (files.Length > 0)
{
new DialogFragmentAnonymousInnerClassHelper(this, files)
.show(FragmentManager, "PrintPdfFiles");
}
else
{
Toast.makeText(ApplicationContext, "No PDF file", Toast.LENGTH_SHORT).show();
}
break;
case 25: // kickOutDrawer
mBixolonPrinter.kickOutDrawer(BixolonPrinter.DRAWER_CONNECTOR_PIN2);
mBixolonPrinter.kickOutDrawer(BixolonPrinter.DRAWER_CONNECTOR_PIN5);
break;
case 26: // directIo
DialogManager.showDirectIoDialog(mDirectIoDialog, MainActivity.this);
break;
case 27: // NV image manager
intent = new Intent(MainActivity.this, typeof(NvImageActivity));
startActivity(intent);
break;
case 28: // updateFirmware
intent = new Intent(MainActivity.this, typeof(FileExplorerActivity));
startActivityForResult(intent, REQUEST_CODE_SELECT_FIRMWARE);
break;
case 29: // MSR manager
mBixolonPrinter.MsrMode;
break;
}
}
示例3: showFileList
private void showFileList()
{
File file = new File(PATH);
File[] files = file.listFiles(new FileFilterAnonymousInnerClassHelper(this));
if (files != null && files.Length > 0)
{
string[] items = new string[files.Length];
for (int i = 0; i < items.Length; i++)
{
items[i] = files[i].AbsolutePath;
}
ListDialogFragment.showDialog(SupportFragmentManager, "PDF file list", items);
}
else
{
Toast.makeText(ApplicationContext, "No PDF file", Toast.LENGTH_SHORT).show();
}
}
示例4: listFilesTest
public void listFilesTest()
{
File target = new File(this.tempPath); // TODO: Initialize to an appropriate value
File[] actual;
actual = target.listFiles();
Assert.IsNotNull(actual);
}
示例5: selectImage
/// <summary>
/// select an image file for processing filter.
/// </summary>
private void selectImage()
{
mFileNames = null;
File cameraDirectory = new File(mCameraDirectory);
if (!cameraDirectory.exists())
{
cameraDirectory.mkdirs();
return;
}
File[] cameraImages = cameraDirectory.listFiles(new FileFilterAnonymousInnerClassHelper(this));
if (cameraImages == null || cameraImages.Length == 0)
{
return;
}
mFileNames = new string[cameraImages.Length];
for (int i = 0; i < cameraImages.Length; i++)
{
mFileNames[i] = mCameraDirectory + "/" + cameraImages[i].Name;
}
(new AlertDialog.Builder(Sample_Filter.this)).setTitle("Select Image").setItems(mFileNames, new OnClickListenerAnonymousInnerClassHelper(this))
.show();
}