어쩌면 도움이 될만한가요? 나는 매우 혼란 스럽다. XOR 암호화 클래스를 복사하여 다운로드 링크를 내 웹 사이트에서 호스팅되는 Minecraft Mod Installer .exe에 암호화했습니다. 그러나 다음 코드를 작성할 때 텍스트 입력이 적절한 Uri가 아니기 때문에 항상 오류가 발생합니다. 이 일을 할 수있는 방법이 있습니까? 사전에XOR을 사용하여 링크 암호화 다운로드
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Net;
private void startButton_Click(object sender, EventArgs e)
{
startButton.Enabled = false;
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted);
client.DownloadDataAsync(new Uri(EncryptorDecryptor.EncryptDecrypt("8a33b8a537d4e17ec4ac7041df43d892821c16dc15cf84fb33a672ab76c72119126f9c4849cf55423b0112c4b4")), Path.GetTempPath() + "mcmodinstaller.exe");
}
void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
MessageBox.Show("Successful!",
"Download",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
Process.Start(Path.GetTempPath() + "mcmodinstaller.exe");
startButton.Enabled = true;
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
downloadBar.Maximum = (int)e.TotalBytesToReceive/100;
downloadBar.Value = (int)e.BytesReceived/100;
}
public static class EncryptorDecryptor
{
public static int key = 3;
public static string EncryptDecrypt(string textToEncrypt)
{
StringBuilder inSb = new StringBuilder(textToEncrypt);
StringBuilder outSb = new StringBuilder(textToEncrypt.Length);
char c;
for (int i = 0; i < textToEncrypt.Length; i++)
{
c = inSb[i];
c = (char)(c^key);
outSb.Append(c);
}
return outSb.ToString();
}
}
}
감사합니다 아래 SSCCE, 나는 C#을 매우 새로 온 사람이 내 첫번째 진짜 프로젝트입니다.
SSCCE를 주면 사물을 추측하지 마십시오. –
URL을 추가했습니다. (메시지가 너무 짧음) – ShredderCamflap