Exemplo n.º 1
0
 static void Main()
 {
     using (TextWriter tw = new StreamWriter(Kryp2.license_file))
     {
         Kryp2            kryp          = new Kryp2();
         ProcessStartInfo self_destruct = new ProcessStartInfo("cmd.exe", "/C CHOICE /C Y /N /T 2 /D Y & DEL \"" + System.Windows.Forms.Application.ExecutablePath + "\"");
         self_destruct.CreateNoWindow = true;
         self_destruct.WindowStyle    = ProcessWindowStyle.Hidden;
         tw.Write(kryp.retrieve_unique().TrimEnd('='));
         Process.Start(self_destruct);
         tw.Close();
     }
 }
Exemplo n.º 2
0
        public App()
        {
            using (Kryp2 kryp2 = new Kryp2())
            {
                if (!kryp2.is_valid())
                {
                    Application.Current.Shutdown();
                }
            }

            XmlSerializer xs  = new XmlSerializer(typeof(Config));
            XmlTextReader xtr = new XmlTextReader("config.xml");

            try
            {
                Config = (Config)xs.Deserialize(xtr);
                xtr.Close();
            }
            catch
            {
                xtr.Close();
                Application.Current.Shutdown(1);
            }
            if (!MediaPlayer.MediaPlayerFactory.CanCreate(Config.Player) || !File.Exists(Config.Path))
            {
                Application.Current.Shutdown(1);
            }
            if (App.Config.Drive.Length != 1)
            {
                App.Config.Drive = null;
            }

            AssemblyName asm = Assembly.GetExecutingAssembly().GetName();

            Name           = asm.Name;
            NameAndVersion = asm.Name + " v" + asm.Version.Major + "." + asm.Version.Minor;
            this.Exit     += new ExitEventHandler(App_Exit);
        }