public static bool CheckAndDownloadApp(DownloadType dlt) { if (UpdateSetting.ServerDown) { return(false); } try { DateTime lastUpdateDate = FileTimeStamp(dlt.file2Download);// response1.LastModified; DateTime currentVersionDate = System.IO.File.GetLastWriteTime(dlt.PC_Destination); TimeSpan span = lastUpdateDate.Subtract(currentVersionDate); if (span.Days > 0 || span.Hours * 3600 + span.Minutes * 60 + span.Seconds > 100)//min 5 min { DialogsResult res = DialogsResult.Yes; FileInfo file = new FileInfo(Assembly.GetExecutingAssembly().Location); res = StaticFormsCalls.DoResult("Nieuwe versie " + FileName(dlt.PC_Destination) + " downloaden?", "Nieuwe versie aanwezig", false); if (res == DialogsResult.Yes) { // writeDownloadInfo(); return(true); } } } catch (Exception err) { StaticFormsCalls.ShowMessage("Update check van " + FileName(dlt.file2Download) + err.Message); } return(false); }
public void Create(int delay, string fileName) { if (images.Count == 0 || images[0] == null) { return; } string path = StaticFormsCalls.StartupPath; Delay[0] = (byte)((delay * 5) % 256); Delay[1] = (byte)((delay * 5) / 256); int gif = fileName.ToUpper().IndexOf(".GIF");//Constants.GIFFilename if (gif > 0) { fileName = fileName.Substring(0, gif); } try { string GifFile = path + fileName + ".GIF"; if (File.Exists(GifFile)) { File.Delete(GifFile); } MemoryStream MS = new MemoryStream(); BinaryReader BR = new BinaryReader(MS); BinaryWriter BW = new BinaryWriter(new FileStream(GifFile, FileMode.Create)); images[0].Save(MS, ImageFormat.Gif); byte[] B = MS.ToArray(); B[10] = (byte)(B[10] & 0X78); //No global color table. BW.Write(B, 0, 13); BW.Write(GifAnimation); WriteGifImg(B, BW); for (int I = images.Count - 2; I > 1; I--) { MS.SetLength(0); images[I].Save(MS, ImageFormat.Gif); B = MS.ToArray(); WriteGifImg(B, BW); } if (AddReverse) { for (int I = 2; I < images.Count - 1; I++) { MS.SetLength(0); images[I].Save(MS, ImageFormat.Gif); B = MS.ToArray(); WriteGifImg(B, BW); } } BW.Write(B[B.Length - 1]); BW.Close(); MS.Dispose(); StaticFormsCalls.ShowMessage("Created animated gif at: " + GifFile); System.Diagnostics.Process.Start(@"C:\Program Files\Internet Explorer\iexplore.exe", GifFile); while (images.Count > 0) { Image im = images[0]; images.RemoveAt(0); im.Dispose(); } GC.Collect(); } catch { } finally { } }