• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FileType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Document

		public Document(string filePath, bool needSaveAs)
		{
			this.needSaveAs = needSaveAs;
		
			if (!File.Exists(filePath))
				throw new FileNotFoundException("\"{0}\" does not exist.".F(filePath), filePath);

			try
			{
				foreach (string line in GetFileContent(filePath))
					lines.Add(new Line(line, LineModification.Clean, this));
			}
			catch
			{
				throw new FileNotFoundException("\"{0}\" could not be opened.".F(filePath), filePath);
			}

			point = new Caret(this);
			mark = new Caret(this);

			this.filePath = filePath;
			this.fileType = Config.ChooseFileType(filePath);

			if (lines.Count == 0)
				lines.Add(new Line("", LineModification.Clean, this));

			lastModified = File.GetLastWriteTime(filePath);
		}
开发者ID:chrisforbes,项目名称:corfu,代码行数:28,代码来源:Document.LoadSave.cs


示例17: FindLinks

        public void FindLinks(string[] words, FileType type, TasClient tas, TasSayEventArgs e)
        {
            if (words.Length == 0)
            {
                Battle b = tas.MyBattle;
                if (b == null) return;
                ah.Respond(e, string.Format("Getting Zero-K mirrors for currently hosted {0}", type));
                if (type == FileType.Map) GetLinksAsync(b.MapName, e);
                else GetLinksAsync(b.ModName, e);
            }
            else
            {
                int[] resultIndexes;
                string[] resultVals;
                int cnt;
                if (type == FileType.Map) cnt = ah.FilterMaps(words, out resultVals, out resultIndexes);
                else cnt = ah.FilterMods(words, out resultVals, out resultIndexes);

                if (cnt == 0) ah.Respond(e, string.Format("No such {0} found", type));
                else
                {
                    ah.Respond(e, string.Format("Getting Zero-K mirrors for {0}, please wait", resultVals[0]));
                    GetLinksAsync(resultVals[0], e);
                }
            }
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:26,代码来源:ResourceLinkSpringieClient.cs


示例18: BothHaveRarAndGZip

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


示例19: AlternateDataStream_Set_FileShortNameInformation

        private void AlternateDataStream_Set_FileShortNameInformation(FileType fileType)
        {
            //Prerequisites: Create streams on a newly created file

            //Step 1: Set FILE_SHORTNAME_INFORMATION
            FileShortNameInformation shortNameInfo = new FileShortNameInformation();

            string shortName = this.fsaAdapter.ComposeRandomFileName(8);
            shortNameInfo.FileName = Encoding.Unicode.GetBytes(shortName);
            shortNameInfo.FileNameLength = (uint)shortNameInfo.FileName.Length;

            byte[] inputBuffer = TypeMarshal.ToBytes<FileShortNameInformation>(shortNameInfo);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. SetFileInformation with FileInfoClass.FILE_SHORTNAME_INFORMATION.", ++testStep);
            status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_SHORTNAME_INFORMATION, inputBuffer);
            if (this.fsaAdapter.IsShortNameSupported == false)
            {
                BaseTestSite.Log.Add(LogEntryKind.Debug, "FileShortNameInformation is not supported.");
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
                    "If a file system does not support a specific File Information Class, STATUS_INVALID_PARAMETER MUST be returned.");
            }
            else
            {
                if (status == MessageStatus.SHORT_NAMES_NOT_ENABLED_ON_VOLUME)
                {
                    BaseTestSite.Log.Add(LogEntryKind.Debug, "If Open.File.Volume.GenerateShortNames is FALSE, the operation MUST be failed with STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME.");
                    BaseTestSite.Log.Add(LogEntryKind.Debug, "To enable short name in specific volume, such as volume with driver letter N:, use command: fsutil 8dot3name set N: 0.");
                }
                else
                {
                    this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status,
                        "If Open.Stream.StreamType is DataStream and Open.Stream.Name is not empty. The operation MUST be failed with STATUS_INVALID_PARAMETER.");
                }
            }
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:35,代码来源:AlternateDataStream_FileInfo_Set_FileShortNameInformation.cs


示例20: GetDelimiter

        internal static char GetDelimiter(FileType fileType)
        {
            char delimiter;
            switch (fileType)
            {
                case FileType.CSV:
                {
                        delimiter = ',';
                        break;
                }

                case FileType.TXT:
                {
                        delimiter = '\t';
                        break;
                }
                default:
                {
                    Debug.Assert(false, "Un supported FileType");
                    delimiter = ',';
                    break;
                }
            }

            return delimiter;
        }
开发者ID:jayawantsawant,项目名称:WPFSamples,代码行数:26,代码来源:const.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FileUnitTester类代码示例发布时间:2022-05-24
下一篇:
C# FileSystemWatcher类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap