Ejemplo n.º 1
0
        public static void CreateThumbnails(string iFile, string oFile, int time)
        {
            VideoFile videoInfo = GetVideoInfo(iFile);

            oFile = ShellPathNameConvert.ToShortPathName(Path.GetDirectoryName(oFile)) + "\\" + Path.GetFileName(oFile);
            iFile = ShellPathNameConvert.ToShortPathName(iFile);
            var num = videoInfo.Duration.TotalSeconds / 2.0;

            if (num > 8.0)
            {
                num = 8.0;
            }
            var arguments = string.Format(" -y -i {0}  -f image2 -ss {2}.001 -s 240x180 {1}", iFile, oFile, time);
            var p         = CreateProcess(ffmpeg, arguments);

            RunProcess(p);
        }
Ejemplo n.º 2
0
        private const string UpgraderProgram  = "AutoUpgrade.exe"; //升级程序文件名

        /// <summary>
        /// 检查版本
        /// </summary>
        /// <param name="AppExit">退出应用程序</param>
        public static void CheckVersion(ref bool AppExit)
        {
            AppExit = false;

            string checkResultFile = Application.StartupPath + "\\" + Guid.NewGuid().ToString().Replace("-", "") + ".ver"; //临时文件
            string upgrader        = Application.StartupPath + "\\" + UpgraderProgram;

            File.WriteAllText(checkResultFile, "");                                  //创建空文件

            checkResultFile = ShellPathNameConvert.ToShortPathName(checkResultFile); //转换为DOS文件名

            Process pro = new Process();

            pro.StartInfo = new ProcessStartInfo(upgrader, Arg_CheckVersion + " " + checkResultFile);
            pro.StartInfo.UseShellExecute = false;
            pro.Start();
            pro.WaitForExit(); //等待检查

            if (File.Exists(checkResultFile))
            {
                string result = File.ReadAllText(checkResultFile);
                File.Delete(checkResultFile);                  //删除临时文件

                if ((result != "") && (int.Parse(result) > 0)) //有新版本
                {
                    if (Msg.AskQuestion("服务器上有新版本下载, 需要下载吗?"))
                    {
                        AppExit = true;
                        Process.Start(upgrader, Arg_MainEXECall);
                    }
                    else
                    {
                        Msg.ShowInformation("您没有升级版本,不能运行程序!");
                        AppExit = true;
                    }
                    return;
                }
            }
        }