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


C# FileType类代码示例

本文整理汇总了C#中FileType的典型用法代码示例。如果您正苦于以下问题:C# FileType类的具体用法?C# FileType怎么用?C# FileType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileType类属于命名空间,在下文中一共展示了FileType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: G2File

        public string UserComment; // xml format

        #endregion Fields

        #region Constructors

        public G2File(String name, String hash, byte[] hashByte, TypeHash typeHash
            , long size, FileType fileType, String codecInfo
            , FileLocationFound filelocation, int lenghtMedia
            , String protocolName, String linkFile)
            : base(name,hash,hashByte,typeHash,size,fileType,codecInfo,filelocation,lenghtMedia,protocolName,linkFile)
        {
        }
开发者ID:nikkolasg,项目名称:gnutella2,代码行数:13,代码来源:G2File.cs

示例2: GetMediaForProjectByType

        public IEnumerable<IMediaFile> GetMediaForProjectByType(int projectId, FileType type)
        {
            var wikiFiles = WikiFile.CurrentFiles(projectId);

            var mediaFiles = new List<MediaFile>();

            foreach (var wikiFile in wikiFiles)
            {
                var mediaFile = new MediaFile
                {
                    Current = wikiFile.Current,
                    Archived = wikiFile.Archived,
                    CreateDate = wikiFile.CreateDate,
                    Name = wikiFile.Name,
                    Id = wikiFile.Id,
                    CreatedBy = wikiFile.CreatedBy,
                    DotNetVersion = wikiFile.DotNetVersion,
                    Downloads = wikiFile.Downloads,
                    FileType = (FileType)Enum.Parse(typeof(FileType), wikiFile.FileType),
                    FileVersion = wikiFile.NodeVersion,
                    Path = wikiFile.Path,
                    RemovedBy = wikiFile.RemovedBy,
                    SupportsMediumTrust = false,
                    UmbVersion = wikiFile.Versions,
                    Verified = wikiFile.Verified
                };

                if (mediaFiles.Contains(mediaFile) == false)
                    mediaFiles.Add(mediaFile);
            }

            return mediaFiles;
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:33,代码来源:MediaProvider.cs

示例3: ContainingFolder

        public static string ContainingFolder(int sym, FileType type)
        {
            if (sym < 0)
                throw new ArgumentOutOfRangeException("sym");

            return ContainingFolder(sym.ToString(), type);
        }
开发者ID:jdeering,项目名称:SymSharp,代码行数:7,代码来源:Utilities.cs

示例4: ShowFileDialog

        private static FileDialogResult ShowFileDialog(object owner, FileDialog dialog, IEnumerable<FileType> fileTypes, 
            FileType defaultFileType, string defaultFileName)
        {
            int filterIndex = fileTypes.ToList().IndexOf(defaultFileType);
            if (filterIndex >= 0) { dialog.FilterIndex = filterIndex + 1; }
            if (!string.IsNullOrEmpty(defaultFileName))
            {
                dialog.FileName = Path.GetFileName(defaultFileName);
                string directory = Path.GetDirectoryName(defaultFileName);
                if (!string.IsNullOrEmpty(directory))
                {
                    dialog.InitialDirectory = directory;
                }
            }

            dialog.Filter = CreateFilter(fileTypes);
            if (dialog.ShowDialog(owner as Window) == true)
            {
                filterIndex = dialog.FilterIndex - 1;
                if (filterIndex >= 0 && filterIndex < fileTypes.Count())
                {
                    defaultFileType = fileTypes.ElementAt(filterIndex);
                }
                else
                {
                    defaultFileType = null;
                }
                return new FileDialogResult(dialog.FileName, defaultFileType);
            }
            else
            {
                return new FileDialogResult();
            }
        }
开发者ID:jbe2277,项目名称:waf,代码行数:34,代码来源:FileDialogService.cs

示例5: configure

        private void configure(FileType type, P3DOperation operation, String addonPath)
        {
            // Prepare the process to run
            ProcessStartInfo start = new ProcessStartInfo();

            // Enter in the command line arguments, everything you would enter after the executable name itself
            start.Arguments = "-Configure: File=" + type + ", Operation=" + operation + ", Path=" + addonPath;

            // Enter the executable to run, including the complete path
            start.FileName = @"C:\Prepar3D v3\Prepar3D.exe";

            // Do you want to show a console window?
            start.WindowStyle = ProcessWindowStyle.Hidden;
            start.CreateNoWindow = true;
            int exitCode;

            logger.Info("Calling Prepar3D.exe with arguments {0}", start.Arguments);

            // Run the external process & wait for it to finish
            using (Process proc = Process.Start(start))
            {
                proc.WaitForExit();

                // Retrieve the app's exit code
                exitCode = proc.ExitCode;
            }
        }
开发者ID:WillsB3,项目名称:PREPAR3D-Migration-Tool,代码行数:27,代码来源:Main.cs

示例6: Remove

 public void Remove(FileType fileTypes)
 {
     if (FileType.HasFlag(fileTypes))
     {
         FileType &= ~fileTypes;
     }
 }
开发者ID:vadim183,项目名称:CodeValueCollege,代码行数:7,代码来源:FileDescription.cs

示例7: BothHaveTextAndData

 private bool BothHaveTextAndData(FileType addedTypes)
 {
     return
         (FileType.HasFlag(FileType.Data) && addedTypes.HasFlag(FileType.Text))
             ||
             (FileType.HasFlag(FileType.Text) && addedTypes.HasFlag(FileType.Data));
 }
开发者ID:vadim183,项目名称:CodeValueCollege,代码行数:7,代码来源:FileDescription.cs

示例8: IsValidFileType

        /// <summary>
        /// Determines whether [is valid file type] [the specified file type].
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="fileType">Type of the file.</param>
        /// <returns></returns>
        /// <createdOn>1/26/2016 12:27 PM</createdOn>
        public static bool IsValidFileType(this FileUpload control, FileType fileType = FileType.Image)
        {
            if (!control.HasFile || !control.HasFiles)
                throw new Exception("No file exsit in the file upload");

            var isAllowedExtension = false;

            if (control.AllowMultiple)
            {
                foreach (var file in control.PostedFiles)
                {
                    isAllowedExtension = FileTypeSetting.IsAllowedExtension(file.FileName.GetSimpleFileExtension(), fileType);

                    if (!isAllowedExtension)
                        return false;
                }
            }
            else
            {
                isAllowedExtension =
                    FileTypeSetting.IsAllowedExtension(control.PostedFile.FileName.GetSimpleFileExtension(), fileType);
            }

            return isAllowedExtension;
        }
开发者ID:mqasem92,项目名称:QWork,代码行数:32,代码来源:Checking.cs

示例9: IsHeaderLinkOrScriptControlAdded

 private static bool IsHeaderLinkOrScriptControlAdded(Page page, string ResolvedUrl, FileType fType)
 {
     switch (fType)
     {
         case FileType.Css:
             foreach (Control c in page.Header.Controls)
             {
                 var linkControl = c as HtmlLink;
                 if (linkControl == null) continue;
                 if (linkControl.Attributes["href"] == ResolvedUrl)
                     return true;
             }
             break;
         case FileType.Javascript:
             foreach (Control c in page.Header.Controls)
             {
                 var genericControl = c as HtmlGenericControl;
                 if (genericControl == null) continue;
                 if (genericControl.Attributes["src"] == ResolvedUrl)
                     return true;
             }
             break;
     }
     return false;
 }
开发者ID:Learion,项目名称:BruceToolSet,代码行数:25,代码来源:Common.cs

示例10: GetInternalFileType

		internal static FileType GetInternalFileType(FileType fileType)
		{
			switch (fileType)
			{
			case FileType.WordDocument:
			case FileType.WordDocumentX:
			case FileType.WordDocumentMacroX:
			case FileType.WordDocumentTemplateX:
			case FileType.WordDocumentMacroTemplateX:
			case FileType.RTFDocument:
				return FileType.WordDocument;

			case FileType.ExcelSheet:
			case FileType.ExcelSheetX:
			case FileType.ExcelSheetMacroX:
			case FileType.ExcelSheetTemplateX:
			case FileType.ExcelSheetMacroTemplateX:
				return FileType.ExcelSheet;

			case FileType.PowerPoint:
			case FileType.PowerPointX:
			case FileType.PowerPointMacroX:
			case FileType.PowerPointTemplateX:
			case FileType.PowerPointMacroTemplateX:
			case FileType.PowerPointShowX:
			case FileType.PowerPointMacroShowX:
				return FileType.PowerPoint;

			default:
				return fileType;
			}
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:32,代码来源:OfficeApplicationCacheSettings.cs

示例11: AlternateDataStream_CreateStream

        /// <summary>
        /// Create one alternate data stream on the newly created file
        /// </summary>
        /// <param name="fileType">The newly created file type: DataFile, DirectoryFile</param>
        private void AlternateDataStream_CreateStream(FileType fileType)
        {
            dataStreamList = new Dictionary<string, long>();
            long bytesToWrite = 0;
            long bytesWritten = 0;

            //Step 1: Create a new File, it could be a DataFile or a DirectoryFile
            fileName = this.fsaAdapter.ComposeRandomFileName(8);
            createFileType = (fileType == FileType.DataFile ? CreateOptions.NON_DIRECTORY_FILE : CreateOptions.DIRECTORY_FILE);
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Create a file with type: " + fileType.ToString() + " and name: " + fileName, ++testStep);
            status = this.fsaAdapter.CreateFile(
                        fileName,
                        FileAttribute.NORMAL,
                        createFileType,
                        FileAccess.GENERIC_ALL,
                        ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE | ShareAccess.FILE_SHARE_DELETE,
                        CreateDisposition.OPEN_IF);
            this.fsaAdapter.AssertIfNotSuccess(status, "Create file operation failed");

            //Step 2: Write some bytes into the Unnamed Data Stream in the newly created file
            if (fileType == FileType.DataFile)
            {
                //Write some bytes into the DataFile.
                bytesToWrite = 1024;
                bytesWritten = 0;
                dataStreamList.Add("::$DATA", bytesToWrite);

                BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Write the file with " + bytesToWrite + " bytes data.", ++testStep);
                status = this.fsaAdapter.WriteFile(0, bytesToWrite, out bytesWritten);
                this.fsaAdapter.AssertIfNotSuccess(status, "Write data to file operation failed.");
            }
            else
            {
                //Do not write data into DirectoryFile.
                bytesToWrite = 0;
                BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Do not write data into DirectoryFile.", ++testStep);
            }

            //Step 3: Create an Alternate Data Stream <Stream1> in the newly created file
            dataStreamName1 = this.fsaAdapter.ComposeRandomFileName(8);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Create an Alternate Data Stream with name: " + dataStreamName1 + " on this file.", ++testStep);
            status = this.fsaAdapter.CreateFile(
                        fileName + ":" + dataStreamName1 + ":$DATA",
                        FileAttribute.NORMAL | FileAttribute.INTEGRITY_STREAM, // Set Integrity field
                        CreateOptions.NON_DIRECTORY_FILE,
                        FileAccess.GENERIC_ALL,
                        ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE | ShareAccess.FILE_SHARE_DELETE,
                        CreateDisposition.OPEN_IF);
            this.fsaAdapter.AssertIfNotSuccess(status, "Create Alternate Data Stream operation failed");

            //Step 4: Write some bytes into the Alternate Data Stream <Stream1> in the file
            bytesToWrite = 2048;
            bytesWritten = 0;
            dataStreamList.Add(":" + dataStreamName1 + ":$DATA", bytesToWrite);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Write the stream with " + bytesToWrite + " bytes data.", ++testStep);
            status = this.fsaAdapter.WriteFile(0, bytesToWrite, out bytesWritten);
            this.fsaAdapter.AssertIfNotSuccess(status, "Write data to stream operation failed.");
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:64,代码来源:AlternateDataStreamTestCases.cs

示例12: FsCtl_Get_Compression_IsCompressionSupported

        private void FsCtl_Get_Compression_IsCompressionSupported(FileType fileType)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Create file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: FSCTL request with FSCTL_GET_COMPRESSION
            FSCTL_GET_COMPRESSION_Reply compressionReply = new FSCTL_GET_COMPRESSION_Reply();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FSCTL_GET_COMPRESSION_Reply>(compressionReply).Length;

            long bytesReturned;
            byte[] outputBuffer = new byte[0];

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_GET_COMPRESSION");
            status = this.fsaAdapter.FsCtlGetCompression(outputBufferSize, out bytesReturned, out outputBuffer);

            //Step 3: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
            // 2.1.5.9.7   FSCTL_GET_COMPRESSION
            // <64> Section 2.1.5.9.7: This is only implemented by the NTFS and ReFS file systems.
            if (this.fsaAdapter.FileSystem == FileSystem.NTFS || this.fsaAdapter.FileSystem == FileSystem.REFS)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "FSCTL_GET_COMPRESSION is supported, status set to STATUS_SUCCESS.");
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
                        "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
            }
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:33,代码来源:FSCTL_GET_COMPRESSION.cs

示例13: JackrabbitLibrary

 /// <summary>Initializes a new instance of the <see cref="JackrabbitLibrary" /> class.</summary>
 /// <param name="fileType">The type of file</param>
 /// <param name="libraryName">The name of the library.</param>
 /// <param name="version">The version.</param>
 /// <param name="specificity">The version specificity.</param>
 public JackrabbitLibrary(FileType fileType, string libraryName, Version version, SpecificVersion specificity)
 {
     this.FileType = fileType;
     this.LibraryName = libraryName;
     this.Version = version;
     this.Specificity = specificity;
 }
开发者ID:EngageSoftware,项目名称:Engage-Jackrabbit,代码行数:12,代码来源:JackrabbitLibrary.cs

示例14: IsFileType

 public bool IsFileType(FileType type, [NotNull] string extensionName)
 {
     if (extensionName == null) throw new ArgumentNullException(nameof(extensionName));
     Dictionary<string, ExtensionName> map;
     if (!this.mapedType.TryGetValue((int)type, out map)) return false;
     return map.ContainsKey(extensionName.TrimStart('.').ToLower());
 }
开发者ID:nokia6102,项目名称:jasily.cologler,代码行数:7,代码来源:JasilyExtensionName.cs

示例15: MakeFile

 static private FileType MakeFile(JadeCore.Project.FileItem file, string projectDir)
 {
     FileType result = new FileType();
     //Convert to relative path for storage in workspace
     result.Path = JadeUtils.IO.PathUtils.CalculateRelativePath(projectDir + @"\", file.Path.Str);
     return result;
 }
开发者ID:JadeHub,项目名称:Jade,代码行数:7,代码来源:ProjectReaderWriter.cs


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