c#实现对MP4等文件属性信息的读取以及对txt文件内容的读取
来源:互联网 发布:淘宝上架时间查询 编辑:程序博客网 时间:2024/05/21 09:56
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Shell32;
namespace ReadText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ReadTextFile(@"C:\test\医院名称.MP4");
}
//将路径传进去
private void ReadTextFile(string filePath)
{
//需要引用Shell32.dll文件
ShellClass sc = new ShellClass();
Folder dir = sc.NameSpace(Path.GetDirectoryName(filePath));
FolderItem item = dir.ParseName(Path.GetFileName(filePath));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 50; i++)
{
sb.Append(i.ToString());
sb.Append(":");
sb.Append(dir.GetDetailsOf(item, i));
sb.Append("\r\n");
}
string c = sb.ToString();
textBox1.Text = c; //在TextBox上显示
//读取文件txt内容
// string[] lines = File.ReadAllLines(filePath);
//foreach (var line in lines)
//{
// textBox1.AppendText(line + Environment.NewLine);
//}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Shell32;
namespace ReadText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ReadTextFile(@"C:\test\医院名称.MP4");
}
//将路径传进去
private void ReadTextFile(string filePath)
{
//需要引用Shell32.dll文件
ShellClass sc = new ShellClass();
Folder dir = sc.NameSpace(Path.GetDirectoryName(filePath));
FolderItem item = dir.ParseName(Path.GetFileName(filePath));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 50; i++)
{
sb.Append(i.ToString());
sb.Append(":");
sb.Append(dir.GetDetailsOf(item, i));
sb.Append("\r\n");
}
string c = sb.ToString();
textBox1.Text = c; //在TextBox上显示
//读取文件txt内容
// string[] lines = File.ReadAllLines(filePath);
//foreach (var line in lines)
//{
// textBox1.AppendText(line + Environment.NewLine);
//}
}
}
}
0 0
- c#实现对MP4等文件属性信息的读取以及对txt文件内容的读取
- 读取txt文件的内容
- C#读取TXT文件的代码实现
- 使用RandomAccessFile 对日志文件读取,以及读取追加的文件内容。
- 【Android】读取txt文件的内容以及其编码问题
- c# 读取txt文件内容
- C# 读取Txt文件内容
- c# 读取txt文件中特定内容后的文字
- c++对txt文件的读取与写入
- c++对txt文件的读取与写入
- C++对txt文件的读取和写入
- 对txt文件中读取的字母进行排序
- c++对txt文件的读取与写入
- c++对txt文件的读取和写入
- c++对txt文件的读取与写入
- 用java实现对文件的读取
- 读取TXT文件内容的方法
- 读取TXT文件内容的方法
- 跟着鬼哥学爬虫-9-python微信-4-我要自动看美女!
- listview 使用方法
- 笔记:日期字符串的严格校验方式
- SWUST626 分数分解
- 操作系统的优先读者和优先写着的读者/写着问题
- c#实现对MP4等文件属性信息的读取以及对txt文件内容的读取
- python常用模块介绍之三:logging模块
- STM32的USB相关资料(转载)
- 洛谷P1002 Codevs1011 过河卒 --2002年NOIP全国联赛普及组 dp递推
- PS怎么修改数字如 2011变为2013
- linux上apache源码安装
- QFile 类 用法
- 移动开发中如何整合HTML 5和原生代码
- 哈希表的实现