private static void WaitForInitialization() { var status = WaitForIntializationCompletion(); var del = new InitializationCompletedDelegate(InitializationCompleted); del(status); }
private void WaitForInitialization() { bool success = false; InitializationCompletedDelegate del = new InitializationCompletedDelegate(InitializationCompleted); try { InjectionHelper.WaitForIntializationCompletion(); this.BeginInvoke(del, true, null); success = true; } catch (Exception ex) { this.BeginInvoke(del, false, ex.Message); } if (success) { try { CollentAllVersions(); } catch { } } }
private void WaitForInitialization() { InjectionHelper.Status status = InjectionHelper.WaitForIntializationCompletion(); InitializationCompletedDelegate del = new InitializationCompletedDelegate(InitializationCompleted); del(status); }
private void WaitForInitialization() { InjectionHelper.Status status = InjectionHelper.WaitForIntializationCompletion(); InitializationCompletedDelegate del = new InitializationCompletedDelegate(InitializationCompleted); this.BeginInvoke(del, status); }
private void WaitForInitialization() { InjectionHelper.Status status = InjectionHelper.WaitForIntializationCompletion(); InitializationCompletedDelegate del = new InitializationCompletedDelegate(InitializationCompleted); this.BeginInvoke(del, status); // the following code collects the offset cache to help me improve the code if (status == InjectionHelper.Status.Ready) { string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); dir = Regex.Replace(dir, @"^(file\:\\)", string.Empty); dir = Path.Combine(dir, "cache"); if (Directory.Exists(dir)) { string [] files = Directory.GetFiles(dir, "*.cache", SearchOption.TopDirectoryOnly); foreach (string file in files) { try { // collect the cache and upload to my server to improve the initialization speed string url = string.Format("http://jerrywang.zoka.cc/cache/upload.php?hash={0}", Path.GetFileNameWithoutExtension(file)); HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; request.Method = "POST"; byte[] buffer = null; using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); } request.ContentLength = buffer.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(buffer, 0, buffer.Length); requestStream.Close(); using (Stream responseStream = request.GetResponse().GetResponseStream()) { using (StreamReader sr = new StreamReader(responseStream)) { string text = sr.ReadToEnd(); Trace.WriteLine(text); } } } catch (System.Exception ex) { } } // foreach } // if } }
private void WaitForInitialization() { InjectionHelper.Status status = InjectionHelper.WaitForIntializationCompletion(); InitializationCompletedDelegate del = new InitializationCompletedDelegate(InitializationCompleted); this.BeginInvoke(del, status); // the following code collects the offset cache to help me improve the code /*if (status == InjectionHelper.Status.Ready) * { * string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", "") + "\\cache"; * if (Directory.Exists(dir)) * { * string[] files = Directory.GetFiles(dir, "*.cache", SearchOption.TopDirectoryOnly); * foreach (string file in files) * { * try * { * // collect the cache and upload to my server to improve the initialization speed * string url = string.Format("http://jerrywang.zoka.cc/cache/upload.php?hash={0}", Path.GetFileNameWithoutExtension(file)); * HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; * request.Method = "POST"; * * byte[] buffer = null; * using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) * { * buffer = new byte[fs.Length]; * fs.Read(buffer, 0, buffer.Length); * fs.Close(); * } * * request.ContentLength = buffer.Length; * Stream requestStream = request.GetRequestStream(); * requestStream.Write(buffer, 0, buffer.Length); * requestStream.Close(); * * using (Stream responseStream = request.GetResponse().GetResponseStream()) * { * using (StreamReader sr = new StreamReader(responseStream)) * { * string text = sr.ReadToEnd(); * Trace.WriteLine(text); * } * } * } * catch * { * } * }// foreach * }// if * }*/ }