当前位置: 首页>>代码示例>>C#>>正文


C# File.listFiles方法代码示例

本文整理汇总了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);
					}
				}
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:22,代码来源:FileExplorerActivity.cs

示例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;
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:101,代码来源:MainActivity.cs

示例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();
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:19,代码来源:MainActivity.cs

示例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);
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:7,代码来源:FileTest.cs

示例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();

		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:32,代码来源:Sample_Filter.cs


注:本文中的File.listFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。