Ich habe einen Hintergrundarbeiter, der tatsächlich eine Methode (DirectoryMethod) aufruft, die den OrdnerBrowserDialog öffnet und einen Hash für alle Dateien im Verzeichnis durchführt. Sobald der Hash abgeschlossen ist, sind die Dateien in einer Listenansicht mit ihrem entsprechenden Hash- und Dateigröße aufgeführt. Jede Hilfe wird sehr geschätzt. Dies ist in Windows -Formularen gegen 2022. < /P>
private void btnBrowse_Click(object sender, EventArgs e)
{
backgroundWorker.RunWorkerAsync();
}
private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
try
{
this.Invoke(new MethodInvoker(delegate
{
// Select the Hash Algorithm
string HashOption = Convert.ToString(comboBox1.SelectedIndex);
// Select how many file to hash; up to 500.
int FileCount;
FileCount = int.Parse(cobFileCount.SelectedItem.ToString());
if (cbIncludeSubs.Checked == true)
{
// Get Top Directory and Sub Directories as well as how many you want.
// Up to 500 files can be loaded.
DirectoryMethod(HashOption, 0, FileCount);
//
}
else if (cbFileDir.Checked == true)
{
// Get all file and subdirectories.
DirectoryMethod(HashOption, 1, FileCount);
//
}
else
{
// Get only files in the Top Directory.
// Only get up to 500 files can be loaded.
DirectoryMethod(HashOption, 1, FileCount);
}
}));
}
catch (Exception exp)
{
MessageBox.Show(exp.Message, "HASHING DIRECTORY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
//
private void DirectoryMethod(string option, int Directories, int FileCount)
{
try
{
/* Add the zero to "int Directories" gets Top Directory and Sub Directories files.
* Without the zero, gets only the Top Directory files.
* This Method also adds a file counter that only permits upto 500 files to be hashed
* at one time. This will keep the user from frezzing the program because on the hashing
* algorithm.*/
//
FolderBrowserDialog FolderBrowserDialog1 = new FolderBrowserDialog();
// Set description and root folder for Dialog.
FolderBrowserDialog1.Description = "Select a Folder to HASH it's Files";
FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
string strSelectedPath;
if (FolderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
strSelectedPath = FolderBrowserDialog1.SelectedPath;
txtFile.Text = FolderBrowserDialog1.SelectedPath;
// Clear the listview even if there's nothing there.
lv.Items.Clear();
string[] filePaths;
if (Directories == 0)
{
filePaths = Directory.GetFiles(strSelectedPath, cbFileType.Text, SearchOption.AllDirectories).Take(FileCount).ToArray();
var selection = option;
int ItemsCount = filePaths.Count();
for (int i = 0; i < ItemsCount; i++)
{
string name = filePaths[i];
// Get file to compute the file size.
FileInfo FileVol = new FileInfo(name);
ListViewItem LI = new ListViewItem(name);
LI = this.lv.Items.Add(name);
// column Hash
LI.SubItems.Add(HashClass.StringFromFilesDirSubsRoutines(name, selection));
string s = HashClass.GetFileSize((int)FileVol.Length);
// Column File Size
LI.SubItems.Add(s);
// File Count
lblCount2.Text = "Count: " + i + 1 + "/" + ItemsCount;
}
}
else
{
filePaths = Directory.GetFiles(strSelectedPath, cbFileType.Text, SearchOption.TopDirectoryOnly).Take(FileCount).ToArray();
var selection = option;
int ItemsCount = filePaths.Count();
foreach (string name in filePaths)
{
ListViewItem LI = new ListViewItem(name);
LI = this.lv.Items.Add(name);
// column Hash
LI.SubItems.Add(HashClass.StringFromFilesDirSubsRoutines(name, selection));
string s = HashClass.GetFileSize((int)name.Length);
// Column File Size
LI.SubItems.Add(s);
// File Count
lblCount2.Text = "Count: " + ItemsCount.ToString();
}
}
txtFile.Text = FolderBrowserDialog1.SelectedPath;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Ich habe einen Hintergrundarbeiter, der tatsächlich eine Methode (DirectoryMethod) aufruft, die den OrdnerBrowserDialog öffnet und einen Hash für alle Dateien im Verzeichnis durchführt. Sobald der Hash abgeschlossen ist, sind die Dateien in einer Listenansicht mit ihrem entsprechenden Hash- und Dateigröße aufgeführt. Jede Hilfe wird sehr geschätzt. Dies ist in Windows -Formularen gegen 2022. < /P> [code] private void btnBrowse_Click(object sender, EventArgs e) { backgroundWorker.RunWorkerAsync(); }
private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { this.Invoke(new MethodInvoker(delegate { // Select the Hash Algorithm string HashOption = Convert.ToString(comboBox1.SelectedIndex); // Select how many file to hash; up to 500. int FileCount; FileCount = int.Parse(cobFileCount.SelectedItem.ToString()); if (cbIncludeSubs.Checked == true) { // Get Top Directory and Sub Directories as well as how many you want. // Up to 500 files can be loaded. DirectoryMethod(HashOption, 0, FileCount); // } else if (cbFileDir.Checked == true) { // Get all file and subdirectories. DirectoryMethod(HashOption, 1, FileCount); // } else { // Get only files in the Top Directory. // Only get up to 500 files can be loaded. DirectoryMethod(HashOption, 1, FileCount); } })); } catch (Exception exp) {
MessageBox.Show(exp.Message, "HASHING DIRECTORY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // private void DirectoryMethod(string option, int Directories, int FileCount) { try { /* Add the zero to "int Directories" gets Top Directory and Sub Directories files. * Without the zero, gets only the Top Directory files. * This Method also adds a file counter that only permits upto 500 files to be hashed * at one time. This will keep the user from frezzing the program because on the hashing * algorithm.*/ // FolderBrowserDialog FolderBrowserDialog1 = new FolderBrowserDialog(); // Set description and root folder for Dialog. FolderBrowserDialog1.Description = "Select a Folder to HASH it's Files"; FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer; string strSelectedPath; if (FolderBrowserDialog1.ShowDialog() == DialogResult.OK) { strSelectedPath = FolderBrowserDialog1.SelectedPath; txtFile.Text = FolderBrowserDialog1.SelectedPath; // Clear the listview even if there's nothing there. lv.Items.Clear(); string[] filePaths; if (Directories == 0) { filePaths = Directory.GetFiles(strSelectedPath, cbFileType.Text, SearchOption.AllDirectories).Take(FileCount).ToArray(); var selection = option; int ItemsCount = filePaths.Count(); for (int i = 0; i < ItemsCount; i++) { string name = filePaths[i]; // Get file to compute the file size. FileInfo FileVol = new FileInfo(name); ListViewItem LI = new ListViewItem(name); LI = this.lv.Items.Add(name); // column Hash LI.SubItems.Add(HashClass.StringFromFilesDirSubsRoutines(name, selection)); string s = HashClass.GetFileSize((int)FileVol.Length); // Column File Size LI.SubItems.Add(s); // File Count lblCount2.Text = "Count: " + i + 1 + "/" + ItemsCount; } } else { filePaths = Directory.GetFiles(strSelectedPath, cbFileType.Text, SearchOption.TopDirectoryOnly).Take(FileCount).ToArray(); var selection = option; int ItemsCount = filePaths.Count(); foreach (string name in filePaths) { ListViewItem LI = new ListViewItem(name); LI = this.lv.Items.Add(name); // column Hash LI.SubItems.Add(HashClass.StringFromFilesDirSubsRoutines(name, selection)); string s = HashClass.GetFileSize((int)name.Length); // Column File Size LI.SubItems.Add(s); // File Count lblCount2.Text = "Count: " + ItemsCount.ToString(); } } txtFile.Text = FolderBrowserDialog1.SelectedPath; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } [/code] Ich danke Ihnen für Ihre Hilfe im Voraus.
Ich versuche, ein Compiler-Makro in C++ zu erstellen, das eine (Compiler-)Variable definiert und dann eine C++-Methode aufruft. Wenn ich beispielsweise Folgendes in meinem C++-Code habe:...
Ich habe ein Online -LLM gefragt und es heißt:
Yes, absolutely. You need to link to the dependency library even when building a static library that calls functions within it.
Zum Beispiel habe ich ein Modul in TypeScript wie:
export function getIndexedDb() : IDBFactory | null
{
if (window.indexedDB)
return window.indexedDB;
else
return null;
}
Kann ich eine JAR-Datei im RAM erstellen und mit Java Runtime ausführen? Die Java-Laufzeit benötigt eine JAR-Datei oder auf der PC-Festplatte gespeicherte Klassendateien. Kann ich eine JAR-Datei wie...
Kann ich eine JAR-Datei im RAM erstellen und mit Java Runtime ausführen? Die Java-Laufzeit benötigt eine JAR-Datei oder auf der PC-Festplatte gespeicherte Klassendateien. Kann ich eine JAR-Datei wie...