我想在 C# 中创建一个下载并自动将 ipa 文件安装到 iphone/ipad 中?但我不知道该怎么做。我只使用命令方式下载文件,但它不会自动安装到我的 iphone/ipad 中?这可能在 C# 中做吗?
它错误的代码只是它的理想选择:
protected void Page_Load(object sender, EventArgs e)
{
string filePath = string.Empty;
string appType = string.Empty;
//ios
filePath = "appFile/Apps.ipa";
appType = "application/octet-stream";
Response.ClearContent();
Response.ContentType = MimeType(Path.GetExtension(fName),appType);
Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}",System.IO.Path.GetFileName(fName)));
Response.AddHeader("Content-Length", sz.ToString("F0"));
Response.TransmitFile(fName);
Response.End();
}
public static string MimeType(string Extension,string appMineType)
{
string mime = appMineType;
if (string.IsNullOrEmpty(Extension))
return mime;
string ext = Extension.ToLower();
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (rk != null && rk.GetValue("Content Type") != null)
mime = rk.GetValue("Content Type").ToString();
return mime;
}