• 大小: 68KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: C#
  • 标签: C#  SD卡  摄像头  

资源简介

C#读取SD卡中的数据,并在指定文件夹中显示出图片!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Text;
using System.Text.Regularexpressions;
using System.Windows.Forms;
using System.Drawing.Imaging;
using INIFILE;

namespace SDcard
{
    public partial class Form1 : Form
    {
        string Datetime_hour Datetime_minute Datetime_second Datetime_Day;
        string path = @“D:\MySdPicture\“;
        string path1;
        int number_camera=0;
        private List ReceiveBuffer = new List(10000000);
        private byte[] Receivebuffer = new byte[100000];

        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender EventArgs e)
        {
            INIFILE.Profile.LoadProfile();  //加载所有 
            textBoxPictureHeight.Text = Profile.G_PictureHeight;
            textBoxPictureWidth.Text = Profile.G_PictureWidth;
            textBoxPictureNumbers.Text = Profile.G_PictureNumbers;
            textBoxStartSector.Text = Profile.G_StartSector;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            Datetime_hour = DateTime.Now.Hour.ToString();
            Datetime_minute = DateTime.Now.Minute.ToString();
            Datetime_Day = DateTime.Now.Day.ToString();
            Datetime_second = DateTime.Now.Second.ToString();
            path1 = path + Datetime_Day + ‘.‘ + Datetime_hour + ‘.‘ + Datetime_minute + ‘.‘ + Datetime_second + “\\“;
        }
        SDUtils SDutils = new SDUtils(“J:“);
        private void ReadOnePicture(long SectorIndex)
        {
            UInt32 SectorNumbers =(Convert.ToUInt32(textBoxPictureWidth.Text)*Convert.ToUInt32(textBoxPictureHeight.Text)/8+512/2-1)/512;
            try
            {
                try
                {
                    for (int i = 0; i < SectorNumbers; i++)
                    {
                        ReceiveBuffer.AddRange(SDutils.ReadSector(SectorIndex + i));
                    }
                    ReceiveBuffer.CopyTo(Receivebuffer);
                }             
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                Bitmap b = new Bitmap(Convert.ToInt32(textBoxPictureWidth.Text) Convert.ToInt32(textBoxPictureHeight.Text));// .Width pictureBoxCamera.Height);
                UInt32 temp tempY;
                UInt32 bitflag = 128;
                try
                {
                    for (UInt32 y = 0; y < Convert.ToUInt32(textBoxPictureHeight.Text); y++) //在开窗区域的纵轴扫描
                    {
                        for (UInt32 x = 0; x < Convert.ToUInt32(textBoxPictureWidth.Text); x++)
                        {
                            tempY = y * Convert.ToUInt32(textBoxPictureWidth.Text);
                            temp = x + tempY;
               

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-06-17 10:52  SDcard\
     目录           0  2013-06-17 13:15  SDcard\SDcard\
     文件        1002  2013-06-17 13:25  SDcard\SDcard.sln
     文件       21504  2013-06-17 13:32  SDcard\SDcard.suo
     目录           0  2013-06-17 10:52  SDcard\SDcard\bin\
     目录           0  2013-06-17 13:25  SDcard\SDcard\bin\Debug\
     文件         101  2013-06-17 15:34  SDcard\SDcard\bin\Debug\Cfg.ini
     文件       18944  2013-06-17 15:32  SDcard\SDcard\bin\Debug\SDcard.exe
     文件       44544  2013-06-17 15:32  SDcard\SDcard\bin\Debug\SDcard.pdb
     文件       11600  2013-06-17 15:34  SDcard\SDcard\bin\Debug\SDcard.vshost.exe
     文件         490  2009-08-31 00:40  SDcard\SDcard\bin\Debug\SDcard.vshost.exe.manifest
     文件        6601  2013-06-17 15:32  SDcard\SDcard\Form1.cs
     文件        8831  2013-06-17 14:48  SDcard\SDcard\Form1.Designer.cs
     文件        5817  2013-06-17 14:48  SDcard\SDcard\Form1.resx
     文件        7503  2013-06-17 13:15  SDcard\SDcard\IniFile.cs
     目录           0  2013-06-17 10:52  SDcard\SDcard\obj\
     目录           0  2013-06-17 10:52  SDcard\SDcard\obj\x86\
     目录           0  2013-06-17 15:32  SDcard\SDcard\obj\x86\Debug\
     文件        2152  2013-06-17 10:52  SDcard\SDcard\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6196  2013-06-17 15:32  SDcard\SDcard\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         200  2013-06-17 14:48  SDcard\SDcard\obj\x86\Debug\GenerateResource.read.1.tlog
     文件         494  2013-06-17 14:48  SDcard\SDcard\obj\x86\Debug\GenerateResource.write.1.tlog
     文件         619  2013-06-17 15:34  SDcard\SDcard\obj\x86\Debug\SDcard.csproj.FileListAbsolute.txt
     文件       18944  2013-06-17 15:32  SDcard\SDcard\obj\x86\Debug\SDcard.exe
     文件         180  2013-06-17 14:48  SDcard\SDcard\obj\x86\Debug\SDcard.Form1.resources
     文件       44544  2013-06-17 15:32  SDcard\SDcard\obj\x86\Debug\SDcard.pdb
     文件         180  2013-06-17 13:25  SDcard\SDcard\obj\x86\Debug\SDcard.Properties.Resources.resources
     目录           0  2013-06-17 10:52  SDcard\SDcard\obj\x86\Debug\TempPE\
     文件        1618  2013-06-17 13:25  SDcard\SDcard\Profile.cs
     文件         487  2013-06-17 10:52  SDcard\SDcard\Program.cs
     目录           0  2013-06-17 10:52  SDcard\SDcard\Properties\
............此处省略7个文件信息

评论

共有 条评论