//更新程序
namespace AutoUpdate {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) {
if(args.Length != 1) {
return;
}
var arg = args[0].Split("|*|");
if(arg.Length == 0) {
return;
}
string runPath = arg[0];
string procesName = arg[1];
Process[] processes = Process.GetProcesses();
foreach(Process process in processes) {
if(process.ProcessName == procesName) {
process.Kill(true);
}
}
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form_update(runPath));
}
}
}
public static class ImageEx {
/// <summary>
/// 旋转图片
/// </summary>
/// <param name="image"></param>
/// <param name="angle"></param>
/// <returns></returns>
public static Image RotateImage(this Image image, float angle) {
if(image == null)
throw new ArgumentNullException("image");
float dx = image.Width / 2.0f;
float dy = image.Height / 2.0f;
Bitmap rotatedBmp = new Bitmap(image.Width, image.Height);
rotatedBmp.SetResolution(image.HorizontalResolution, image.VerticalResolution);
Graphics g = Graphics.FromImage(rotatedBmp);
g.TranslateTransform(dx, dy);
g.RotateTransform(angle);
g.TranslateTransform(-dx, -dy);
g.DrawImage(image, new PointF(0, 0));
g.Dispose();
return rotatedBmp;
}
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。