У меня есть проект, который больше не работает. Я получаю диалоговое окно с сообщением об ошибке «Это приложение не может быть запущено. Хотите просмотреть дополнительную информацию об этой проблеме?». Также в консоли написано «Программа« [10068] BinaryConverter.exe »вышла с кодом 0 (0x0)». Кто-то сказал мне, чтобы снять флажок «Предпочитать 32-битный» вариант. Когда я это делаю, хотя диалоговое окно с ошибкой исчезло, на консоли все равно отображается «Программа [[10068] BinaryConverter.exe» вышла с кодом 0 (0x0). «Я не могу открыть приложение wpf.
РЕДАКТИРОВАТЬ: Кстати, папка релиза пуста. Когда приложение работало, в моей папке релиза были некоторые вещи.
public MainWindow()
{
InitializeComponent();
}
public void readstuff (){
}
public static string getBetween(string strSource, string strStart, string strEnd)
{
int Start, End;
if (strSource.Contains(strStart) && strSource.Contains(strEnd))
{
Start = strSource.IndexOf(strStart, 0) + strStart.Length;
End = strSource.IndexOf(strEnd, Start);
return strSource.Substring(Start, End - Start);
}
else
{
return "";
}
}
private void BrowseButton2(object sender, RoutedEventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
fd.InitialDirectory = "\\\\folder1\\savelocation";
fd.Filter = "Binary Files | *.bin";
fd.ShowDialog();
filePath2.Text = fd.FileName;
}
private void SavingPathButton2(object sender, RoutedEventArgs e)
{
FolderSelectDialog fs = new FolderSelectDialog();
fs.InitialDirectory = "\\\\Nx3200\\supplier\\FONEX\\LambdaGain";
fs.ShowDialog();
savingPath2.Text = fs.FileName;
}
private void StartConversion2(object sender, RoutedEventArgs e)
{
try
{
Byte [] a1 = File.ReadAllBytes(filePath2.Text);
Byte[] a2 = new Byte[2 * (a1.Length)];
int i = 0;
while(i < a1.Length) {
a2[2*i] = a1[i];
a2[(2 * i) + 1] = 0;
i++;
}
try
{
string fullPath = Path.Combine(savingPath2.Text, "new");
File.WriteAllBytes(savingPath2.Text, a2);
MessageBox.Show("Conversion Complete");
} catch (UnauthorizedAccessException ex)
{
Form3 frm3 = new Form3();
frm3.Text = "X-Formatter";
frm3.ShowDialog();
}
}
catch (FileNotFoundException ex)
{
string stackTrace = ex.ToString();
Form1 frm1 = new Form1(stackTrace);
frm1.Text = "X-Formatter";
frm1.ShowDialog();
}
}
private void BrowseButton1(object sender, RoutedEventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
fd.InitialDirectory = "\\\\folder1\\savelocation";
fd.Filter = "Binary Files | *.bin";
fd.ShowDialog();
filePath1.Text = fd.FileName;
}
private void SavingPathButton1(object sender, RoutedEventArgs e)
{
FolderSelectDialog fs = new FolderSelectDialog();
fs.InitialDirectory = "\\\\folder1\\savelocation";
fs.ShowDialog();
savingPath1.Text = fs.FileName;
}
private void StartConversion1(object sender, RoutedEventArgs e)
{
try
{
Byte[] a1 = File.ReadAllBytes(filePath1.Text);
Byte[] a2 = new Byte[(a1.Length) / 2];
a2[0] = a1[0];
int i = 2;
int j = 1;
while (i < a1.Length)
{
a2[j] = a1[i];
i = i + 2;
j += 1;
}
try
{
File.WriteAllBytes(savingPath1.Text, a2);
MessageBox.Show("Conversion Complete");
}
catch (UnauthorizedAccessException ex)
{
Form3 frm3 = new Form3();
frm3.Text = "XGIGA formatter";
frm3.ShowDialog();
}
} catch(FileNotFoundException ex)
{
string stackTrace = ex.ToString();
Form1 frm1 = new Form1(stackTrace);
frm1.Text = "XGIGA Formatter";
frm1.ShowDialog();
}
}
private void FilePath1_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
}
private void Button_Click(object sender, RoutedEventArgs e)
{
AboutBox1 ab = new AboutBox1();
ab.Text = "XGIGA Formatter";
ab.ShowDialog();
}
}