Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            /*StreamReader sr1 = new StreamReader(@".\file1.txt");
             * string  line1 = sr1.ReadLine();
             * sr1.Close();
             * try
             * {
             * DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
             * MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(line1));
             * CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoProvider.CreateDecryptor(bytes, bytes), CryptoStreamMode.Read);
             * StreamReader reader = new StreamReader(cryptoStream);
             *  string tyms = reader.ReadToEnd();
             *   zen = int.Parse(tyms);
             *  }
             *  catch (Exception xex)
             *  {
             *      zen = 30;
             *      MessageBox.Show("Trial expierd");
             *      Close();
             *  }
             *
             *
             * if (zen >= 13)
             * {
             *  MessageBox.Show("12 Trial Run Over");
             *  Close();
             *  //Application.Exit();
             *
             * }
             * else
             *  if (zen < 13)
             * {
             *  MessageBox.Show("It is a Trial Version RUNS REMAINING: "+(13 - zen));
             *  zen = zen + 1;
             *
             *  zen.ToString();
             *  DESCryptoServiceProvider cryptoProvider1 = new DESCryptoServiceProvider();
             *  MemoryStream memoryStream1 = new MemoryStream();
             *  CryptoStream cryptoStream1 = new CryptoStream(memoryStream1, cryptoProvider1.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write);
             *  StreamWriter writer = new StreamWriter(cryptoStream1);
             *  writer.Write(zen);
             *  writer.Flush();
             *  cryptoStream1.FlushFinalBlock();
             *  writer.Flush();
             *  string store = Convert.ToBase64String(memoryStream1.GetBuffer(), 0, (int)memoryStream1.Length);
             *
             *  System.IO.File.WriteAllText(@".\file1.txt", string.Empty);
             *  StreamWriter sw1 = new StreamWriter(@".\file1.txt", true, Encoding.ASCII);
             *  sw1.Write(store);
             *  sw1.Close();
             */
            try
            {
                StreamReader sr = new StreamReader(@".\file2.txt");


                pic = sr.ReadLine();


                if (pic != null)
                {  //MessageBox.Show("STRING IS" +line );
                    if (File.Exists(pic) != true)
                    {
                        pic = null;
                    }
                }


                //close the file
                sr.Close();
            }
            catch (Exception xex)
            {
                MessageBox.Show("Exception: " + xex.Message);
            } //

            String line;

            try
            {
                StreamReader sr = new StreamReader(@".\file.txt");


                line = sr.ReadLine();


                if (line != null)
                {     //MessageBox.Show("STRING IS" +line );
                    if (File.Exists(line) == true)
                    {
                        this.button1.Text            = "";
                        this.button1.BackgroundImage = global::WindowsFormsApplication1.Properties.Resources.downloadpp;
                        // form2.Tag = this;
                        form2.Show();
                        this.Show();
                        form2.start(line, pic);
                    }
                    else
                    {
                        // form2.Tag = this;
                        form2.Show();
                        this.Show();
                    }
                }
                else
                {
                    // form2.Tag = this;
                    form2.Show();
                    this.Show();
                }

                //close the file
                sr.Close();
            }
            catch (Exception xex)
            {
                MessageBox.Show("Exception: " + xex.Message);
            }

            // form2.Tag = this;
            // form2.Show(this);
            // Hide();
            //}
        }