コード例 #1
0
        private void textBox_FileName_TextChanged(object sender, EventArgs e)
        {
            if (listBox_ArchiveFiles.SelectedIndex >= listBox_ArchiveFiles.Items.Count || listBox_ArchiveFiles.SelectedIndex < 0)
            {
                return;
            }
            AFSEntry entry = (AFSEntry)listBox_ArchiveFiles.Items[listBox_ArchiveFiles.SelectedIndex];

            entry.Filename = textBox_FileName.Text;
        }
コード例 #2
0
        private void dateTimePicker_FileDate_ValueChanged(object sender, EventArgs e)
        {
            if (listBox_ArchiveFiles.SelectedIndex >= listBox_ArchiveFiles.Items.Count || listBox_ArchiveFiles.SelectedIndex < 0)
            {
                return;
            }
            AFSEntry entry = (AFSEntry)listBox_ArchiveFiles.Items[listBox_ArchiveFiles.SelectedIndex];

            entry.EntryDateTime = dateTimePicker_FileDate.Value;
        }
コード例 #3
0
        private void listBox_ArchiveFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox_ArchiveFiles.SelectedIndex >= listBox_ArchiveFiles.Items.Count || listBox_ArchiveFiles.SelectedIndex < 0)
            {
                return;
            }
            AFSEntry entry = (AFSEntry)listBox_ArchiveFiles.Items[listBox_ArchiveFiles.SelectedIndex];

            textBox_FileName.Text         = entry.Filename;
            dateTimePicker_FileDate.Value = entry.EntryDateTime;
        }
コード例 #4
0
        private void listBox_ArchiveFiles_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            for (int i = 0; i < files.Length; i++)
            {
                string   file     = files[i];
                FileInfo fileInfo = new FileInfo(file);
                AFSEntry entry    = new AFSEntry();
                entry.Filename = Path.GetFileNameWithoutExtension(file).ToUpper();
                using (FileStream stream = new FileStream(file, FileMode.Open))
                {
                    entry.FileSize      = (uint)stream.Length;
                    entry.Buffer        = new byte[stream.Length];
                    entry.EntryDateTime = fileInfo.LastWriteTime;
                    stream.Read(entry.Buffer, 0, entry.Buffer.Length);
                }
                listBox_ArchiveFiles.Items.Add(entry);
            }
        }