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


C# FileAttributes.ToString方法代码示例

本文整理汇总了C#中FileAttributes.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FileAttributes.ToString方法的具体用法?C# FileAttributes.ToString怎么用?C# FileAttributes.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileAttributes的用法示例。


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

示例1: Add

        public void Add(HttpContent content, string name, string fileName, FileAttributes attributes, DateTime lastWriteTimeUtc)
        {
            if (content.Headers.ContentDisposition == null)
            {
                content.Headers.ContentDisposition = new ContentDispositionHeaderValue("dir-sync-data")
                                                         {
                                                             Name = name,
                                                             FileName = fileName,
                                                             FileNameStar = fileName,
                                                         };
                var parameters = content.Headers.ContentDisposition.Parameters;

                parameters.Add(new NameValueHeaderValue("fileAttributes", HttpUtility.UrlEncode(attributes.ToString())));
                parameters.Add(new NameValueHeaderValue("lastWriteTimeUtc", lastWriteTimeUtc.ToFileTime().ToString(CultureInfo.InvariantCulture)));
            }

            base.Add(content);
        }
开发者ID:peteraglen,项目名称:condep-dsl,代码行数:18,代码来源:MultipartSyncDirContent.cs

示例2: SetFileAttributes

 public NtStatus SetFileAttributes(string fileName, FileAttributes attributes, DokanFileInfo info)
 {
     try
     {
         File.SetAttributes(GetPath(fileName), attributes);
         return Trace("SetFileAttributes", fileName, info, DokanResult.Success, attributes.ToString());
     }
     catch (UnauthorizedAccessException)
     {
         return Trace("SetFileAttributes", fileName, info, DokanResult.AccessDenied, attributes.ToString());
     }
     catch (FileNotFoundException)
     {
         return Trace("SetFileAttributes", fileName, info, DokanResult.FileNotFound, attributes.ToString());
     }
     catch (DirectoryNotFoundException)
     {
         return Trace("SetFileAttributes", fileName, info, DokanResult.PathNotFound, attributes.ToString());
     }
 }
开发者ID:shlatchz,项目名称:dokan-dotnet,代码行数:20,代码来源:Mirror.cs

示例3: SerializeAttributes

 private static string SerializeAttributes(FileAttributes attributes)
 {
     var output = attributes.ToString();
     output = ReplaceCommasWithAltSeparator(output);
     return output;
 }
开发者ID:dbremner,项目名称:lessmsi,代码行数:6,代码来源:FileEntryGraph.cs

示例4: AddModFile

		/// <summary>
		/// Adds the mod file to the mod manager.
		/// </summary>
		/// <param name="p_cocConfirmOverwrite">The delegate to call to resolve conflicts with existing files.</param>
		protected void AddModFile(ConfirmOverwriteCallback p_cocConfirmOverwrite)
		{
			string strPath = String.IsNullOrEmpty(Descriptor.SourcePath) ? Descriptor.DefaultSourcePath : Descriptor.SourcePath;
			string strDestinationHD = String.Empty;
			m_booFinishedDownloads = true;

			FileAttributes faAttributes = new FileAttributes();

			try
			{
				faAttributes = File.GetAttributes(strPath);
			}
			catch (DirectoryNotFoundException)
			{
				OverallMessage = String.Format("Could not find a part of the path: {0}", strPath);
				ItemMessage = "Path error";
				Status = TaskStatus.Error;
				OnTaskEnded(OverallMessage, null);
			}

			FileInfo fiArchive = new FileInfo(strPath);
			long lngDestinationFreeSpace = fiArchive.Length;

			if (Path.GetPathRoot(m_gmdGameMode.GameModeEnvironmentInfo.ModDirectory) != Path.DirectorySeparatorChar.ToString())
			{
				DriveInfo diDestinationHD = new DriveInfo(Path.GetPathRoot(m_gmdGameMode.GameModeEnvironmentInfo.ModDirectory));
				lngDestinationFreeSpace = diDestinationHD.TotalFreeSpace;
				strDestinationHD = diDestinationHD.Name;
			}

			if (lngDestinationFreeSpace < fiArchive.Length)
			{
				OverallMessage = String.Format("Not enough free space on your HD: {0}", strDestinationHD);
				ItemMessage = "Not enough free space on your HD.";
				Status = TaskStatus.Error;
				OnTaskEnded(OverallMessage, null);
			}
			else if (faAttributes.ToString().IndexOf(FileAttributes.ReadOnly.ToString()) > -1)
			{
				OverallMessage = String.Format("The archive is read only: {0}", strPath);
				ItemMessage = "The archive is read only";
				Status = TaskStatus.Error;
				OnTaskEnded(OverallMessage, null);
			}
			else if (!File.Exists(strPath))
			{
				OverallMessage = String.Format("File does not exist: {0}", strPath);
				ItemMessage = "File does not exist";
				Status = TaskStatus.Error;
				OnTaskEnded(OverallMessage, null);
			}
			else
			{
				ModBuilder mbrModBuilder = new ModBuilder(m_gmdGameMode.GameModeEnvironmentInfo, m_eifEnvironmentInfo, new NexusFileUtil(m_eifEnvironmentInfo));
				mbrModBuilder.PropertyChanged += new PropertyChangedEventHandler(ModBuilder_PropertyChanged);
				mbrModBuilder.TaskEnded += new EventHandler<TaskEndedEventArgs>(ModBuilder_TaskEnded);
				mbrModBuilder.BuildFromFile(m_mfrModFormatRegistry, strPath, p_cocConfirmOverwrite);
				m_lstRunningTasks.Add(mbrModBuilder);
			}
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:64,代码来源:AddModTask.cs

示例5: SetFileAttributes

 public NtStatus SetFileAttributes(string fileName, FileAttributes attributes, DokanFileInfo info)
 {
     // TODO: Possibly return NotImplemented here
     return Trace(nameof(SetFileAttributes), fileName, info, DokanResult.Success, attributes.ToString());
 }
开发者ID:cristhiand3,项目名称:DokanCloudFS,代码行数:5,代码来源:CloudOperations.cs

示例6: toolEditDelete_Click

        private void toolEditDelete_Click(object sender, EventArgs e)
        {
            object copytoclip = dataGridView1.GetClipboardContent();
            //object copytoclip = dataGridView1.cop;
            string testc = copytoclip.ToString();
            string[] pieces = testc.Split('\t');
            int sss = dataGridView1.CurrentCell.RowIndex;

            StringCollection paths = new StringCollection();
            //MessageBox.Show(dataGridView1.Rows[sss].Cells[0].Value.ToString());

            //string s = "Selected: \n";

            Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);
            int[] sr;
            sr = new Int32[selectedRowCount];
            Array.Sort(sr);

            FileAttributes attr = new FileAttributes();

            for (int i = 0; i < selectedRowCount; i++)
            {
                sr[i] = dataGridView1.SelectedRows[i].Index;

                attr = File.GetAttributes(@gPath.Text + "\\" + dataGridView1.Rows[sr[i]].Cells[0].Value.ToString());

                if (attr.ToString() == "Directory")
                {
                    MessageBox.Show("a");
                    System.IO.Directory.Delete(gPath.Text + "\\" + dataGridView1.Rows[sr[i]].Cells[0].Value.ToString(), true);
                }
                else
                {
                    MessageBox.Show("b");
                    System.IO.File.Delete(gPath.Text + "\\" + dataGridView1.Rows[sr[i]].Cells[0].Value.ToString());
                }
            }

            //MessageBox.Show(attr.ToString());
        }
开发者ID:caloriscz,项目名称:Tikira,代码行数:40,代码来源:Form1.cs


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