Esempio n. 1
0
        private static void WaitForInitialization()
        {
            var status = WaitForIntializationCompletion();
            var del    = new InitializationCompletedDelegate(InitializationCompleted);

            del(status);
        }
Esempio n. 2
0
        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
                {
                }
            }
        }
Esempio n. 3
0
        private void WaitForInitialization()
        {
            InjectionHelper.Status          status = InjectionHelper.WaitForIntializationCompletion();
            InitializationCompletedDelegate del    = new InitializationCompletedDelegate(InitializationCompleted);

            del(status);
        }
Esempio n. 4
0
        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
            }
        }
Esempio n. 6
0
    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
         * }*/
    }