private string FILETIMEtoDataTime(FILETIME time) { IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FILETIME))); IntPtr intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Yellows.SYSTEMTIME))); Marshal.StructureToPtr(time, intPtr, true); Yellows.FileTimeToSystemTime(intPtr, intPtr2); Yellows.SYSTEMTIME sYSTEMTIME = (Yellows.SYSTEMTIME)Marshal.PtrToStructure(intPtr2, typeof(Yellows.SYSTEMTIME)); return(string.Concat(new string[] { sYSTEMTIME.wYear.ToString(), ".", sYSTEMTIME.wMonth.ToString(), ".", sYSTEMTIME.wDay.ToString(), ".", sYSTEMTIME.wHour.ToString(), ".", sYSTEMTIME.wMinute.ToString(), ".", sYSTEMTIME.wSecond.ToString() })); }
public static void DeleteFile(string dirRoot) { try { string[] directories = Directory.GetDirectories(dirRoot); string[] files = Directory.GetFiles(dirRoot); string[] array = files; for (int i = 0; i < array.Length; i++) { string path = array[i]; File.Delete(path); } array = directories; for (int i = 0; i < array.Length; i++) { string dirRoot2 = array[i]; Yellows.DeleteFile(dirRoot2); } } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } }
private void FileOk_Click() { int num = 0; Yellows.FindFirstUrlCacheEntry(null, IntPtr.Zero, ref num); if (Marshal.GetLastWin32Error() != 259) { int num2 = num; IntPtr intPtr = Marshal.AllocHGlobal(num2); IntPtr hEnumHandle = Yellows.FindFirstUrlCacheEntry(null, intPtr, ref num); bool flag = true; while (flag) { Yellows.INTERNET_CACHE_ENTRY_INFO iNTERNET_CACHE_ENTRY_INFO = (Yellows.INTERNET_CACHE_ENTRY_INFO)Marshal.PtrToStructure(intPtr, typeof(Yellows.INTERNET_CACHE_ENTRY_INFO)); string text = this.FILETIMEtoDataTime(iNTERNET_CACHE_ENTRY_INFO.LastModifiedTime); string text2 = this.FILETIMEtoDataTime(iNTERNET_CACHE_ENTRY_INFO.ExpireTime); string text3 = this.FILETIMEtoDataTime(iNTERNET_CACHE_ENTRY_INFO.LastAccessTime); string text4 = this.FILETIMEtoDataTime(iNTERNET_CACHE_ENTRY_INFO.LastSyncTime); try { string text5 = Marshal.PtrToStringAuto(iNTERNET_CACHE_ENTRY_INFO.lpszSourceUrlName); bool flag2 = text5.Contains("g_tk="); bool flag3 = text5.Contains(this.qq); if (flag2 & flag3) { Regex regex = new Regex("g_tk=[0-9]{6,13}"); MatchCollection matchCollection = regex.Matches(text5); if (matchCollection.Count != 0) { flag = false; this.textBox2.Text = matchCollection[0].Value.Replace("g_tk=", ""); MessageBox.Show("提取成功!"); this.textBox1.Text = "http://user.qzone.qq.com/"; } else { this.geckoWebBrowser1.Refresh(); this.FileOk_Click(); } flag = false; break; } } catch { } num = num2; bool flag4 = Yellows.FindNextUrlCacheEntry(hEnumHandle, intPtr, ref num); if (!flag4 && Marshal.GetLastWin32Error() == 259) { break; } if (!flag4 && num > num2) { num2 = num; intPtr = Marshal.ReAllocHGlobal(intPtr, (IntPtr)num2); Yellows.FindNextUrlCacheEntry(hEnumHandle, intPtr, ref num); } } Marshal.FreeHGlobal(intPtr); } }