Пример #1
0
        static bool CheckTrial(PluginEntry pe)
        {
            TrialMaker t = new TrialMaker("TT6", Application.StartupPath + "\\RegFile.reg",
                //Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetp.dbf",
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\TMSetp.dbf",
                "",
                60, 1000, "745");
            //Environment.SpecialFolder.ApplicationData
            byte[] MyOwnKey = { 97, 250, 1, 5, 84, 21, 7, 63,
            4, 54, 87, 56, 123, 10, 3, 62,
            7, 9, 20, 36, 37, 21, 101, 57};
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            //bool is_trial;
            if (RT != TrialMaker.RunTypes.Expired)
            {
                /*
                if (RT == TrialMaker.RunTypes.Full)
                    is_trial = false;
                else
                    is_trial = true;
                 * */
                return true;
                //Application.Run(new Form1(is_trial));
            }
            return false;
            //return true;
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TrialMaker t = new TrialMaker("TMTest1", Application.StartupPath + "\\RegFile.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetp.dbf",
                                          "Phone: +98 21 88281536\nMobile: +98 912 2881860",
                                          5, 10, "745");

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;
            bool is_trial;

            TrialMaker.RunTypes RT = t.ShowDialog();
            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                //Application.Run(new Form1(is_trial));
            }
        }
Пример #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker t = new TrialMaker("TMTest1", Application.StartupPath + "\\RegFile.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetp.dbf",
                                          "Phone: +98 21 88281536\nMobile: +98 912 2881860",
                                          5, 10, "745");

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;

            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                Application.Run(new Form1(is_trial));
            }
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            TrialMaker t = new TrialMaker("SiriusQuality2", Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\rxsv.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\tndaxlasv.dbf",
                                          "E-mail: [email protected]",
                                          30, 100, "257");

            Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.System));

            byte[] MyOwnKey = { 97, 150,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 121, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;

            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }
                Application.Run(new MainForm(is_trial));
            }
        }
Пример #5
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker t = new TrialMaker("RAT1", Application.StartupPath + "\\RegFile.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\RAT.dbf",
                                          "Phone: +841682699970\nMobile: +84972253758",
                                          30, 7, PASSWORD);

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;

            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                Application.Run(new form.Main(is_trial));
            }

            //Application.Run(new form.Main(true));
        }
Пример #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new frmMain());


            //SplashScreen.SplashScreen.ShowSplashScreen();
            //Application.DoEvents();
            //SplashScreen.SplashScreen.SetStatus("Loading module 1");
            //System.Threading.Thread.Sleep(500);
            //SplashScreen.SplashScreen.SetStatus("Loading module 2");
            //System.Threading.Thread.Sleep(300);
            //SplashScreen.SplashScreen.SetStatus("Loading module 3");
            //System.Threading.Thread.Sleep(900);
            //SplashScreen.SplashScreen.SetStatus("Loading module 4");
            //System.Threading.Thread.Sleep(100);
            //SplashScreen.SplashScreen.SetStatus("Loading module 5");
            //System.Threading.Thread.Sleep(400);
            //SplashScreen.SplashScreen.SetStatus("Loading module 6");
            //System.Threading.Thread.Sleep(50);
            //SplashScreen.SplashScreen.SetStatus("Loading module 7");
            //System.Threading.Thread.Sleep(240);
            //SplashScreen.SplashScreen.SetStatus("Loading module 8");
            //System.Threading.Thread.Sleep(900);
            //SplashScreen.SplashScreen.SetStatus("Loading module 9");
            //System.Threading.Thread.Sleep(240);
            //SplashScreen.SplashScreen.SetStatus("Loading module 10");
            //System.Threading.Thread.Sleep(90);
            //SplashScreen.SplashScreen.CloseForm();

            TrialMaker t = new TrialMaker("EZ_Sales_App_2010", Application.StartupPath + "\\RegFile.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetp.dbf",
                                          "Phone:+0903332010 \nMobile:+0909577079",
                                          30, 300, "66234879121237699861");

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;

            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                Application.Run(new frmMain(is_trial));
            }
        }
Пример #7
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker t = new TrialMaker("StokeRobotLaserControlSys1", Application.StartupPath + "\\RegFile.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\SRLCS1.dbf",
                                          "Mail: [email protected]",
                                          30, 100000, "158");

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            if (RT == TrialMaker.RunTypes.Expired)
            {
                return;
            }

            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            if (CheckActiveProcess() == true)
            {
                Application.Exit();
                return;
            }

            ShowSplashScreen();

            // BasicConfigurator.Configure();
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Application.StartupPath + "\\System\\log.xml"));

            // Einschalten internes Debugging der LOG Komponenete
            // log4net.Util.LogLog.InternalDebugging = true;
            MainApp.log.Info("Application started.");

            // set the NumberGroupSeparator for all forms
            System.Globalization.CultureInfo newCultureInfo = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.LCID);
            newCultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            newCultureInfo.NumberFormat.NumberGroupSeparator   = ",";
            newCultureInfo.TextInfo.ListSeparator = ";";
            Application.CurrentCulture            = newCultureInfo;

            // load the settings
            MainApp.appSettings          = new Settings();
            MainApp.appSettings.FileName = Application.StartupPath + "\\System\\AppSet.xml";
            MainApp.appSettings.ReadSettings();

            mainApp = new MainApp();
            Application.Run(mainApp);
            MainApp.log.Info("Application stopped.");

            MainApp.appSettings.WriteSettings();
        }
Пример #8
0
        static void Main()
        {
            //try
            //{
            if (mutex.WaitOne(TimeSpan.Zero, true))     //<<< make multi instances possible
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //if (DateTime.Now < (new DateTime(2015, 1, 1, 0, 0, 0)))
                //{
                TrialMaker t = new TrialMaker("UDE", Application.StartupPath + "\\RegFile.reg",
                                              Application.StartupPath + "\\Con" + "figW32.d" + "ll",
                                              "[email protected]\nPhone: +91 422 2533603\nMobile: +91 9790101300",
                                              10 + 10 + 5, 100 + 50, "A1" + "9F2");

                byte[] Monkey = { 53, 23, 21, 33,  55, 11,   5, 12,
                                  56, 67, 90, 76, 253, 10,   3, 62,
                                  99, 54, 95, 23, 199, 43, 212, 32 };
                t.TripleDESKey = Monkey;

                TrialMaker.RunTypes RT = t.ShowDialog();
                if (RT == TrialMaker.RunTypes.Full)
                {
                    MessageBox.Show("Good Luck!");
                    Application.Run(new Main());
                }
                else if (RT == TrialMaker.RunTypes.Trial)
                {
                    MessageBox.Show("Trial Period", "Trial", MessageBoxButtons.OK);
                    Application.Run(new Main());
                }
                else
                {
                    MessageBox.Show("Contact [email protected]", "License Expired", MessageBoxButtons.OK);
                }

                //}
                //else
                //{
                //}
            }
            else
            {
                Application.DoEvents();
                // send our Win32 message to make the currently running instance
                // jump on top of all the other windows
                NativeMethods.PostMessage(
                    (IntPtr)NativeMethods.HWND_BROADCAST,
                    NativeMethods.WM_SHOWME,
                    IntPtr.Zero,
                    IntPtr.Zero);
            }
        }
Пример #9
0
        /// <summary>
        /// Check if the trial mode is active or not.
        /// </summary>
        /// <returns>Return true if trial is active</returns>
        public static bool IsTrialActive(out LicenceExpiry licence)
        {
            var tMaker = new TrialMaker("HouseApp", AppDataPath + "\\LICENCE.LICX", AppDataPath + "\\SYS.DAT",
                                        "Contact us Details:\n\nEmail: [email protected] \n\nWebSite: www.ihome.org.il", 30, 150, "745");

            byte[] myOwnKey =
            {
                97, 250,  1,  5,  84, 21,   7, 63,
                4,   54, 87, 56, 123, 10,   3, 62,
                7,    9, 20, 36,  37, 21, 101, 57
            };

            tMaker.TripleDESKey = myOwnKey;

            TrialMaker.RunTypes rt = tMaker.ShowDialog();

            if (rt == TrialMaker.RunTypes.Expired)
            {
                licence = null;
                return(false);
            }
            var isTrial = rt != TrialMaker.RunTypes.Full;

            if (!isTrial)
            {
                // now we need to check that the application has not expired, if so we will delete the licence keys
                licence = LicenceExpiry.Read();
                if (licence != null)
                {
                    if (licence.DaysTillExpiry <= 0)
                    {
                        // delete the licence key
                        if (File.Exists(AppDataPath + "\\LICENCE.LICX"))
                        {
                            File.Delete(string.Format("{0}\\{1}", AppDataPath, "LICENCE.LICX"));
                            MessageBox.Show("Your Licence has Expired", "Licence Expiry", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            Application.Exit();
                        }
                    }
                }
            }
            else
            {
                licence = new LicenceExpiry();

                DateTime dtNow     = DateTime.Now;
                DateTime dtExpires = dtNow.AddDays(tMaker.TrialPeriodDays);

                licence.ExpiryDate = new DateTime(dtExpires.Year, dtExpires.Month, dtExpires.Day + 0, 0, 0, 0);
            }

            return(true);
        }
Пример #10
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker t = new TrialMaker("TMTest1", Application.StartupPath + "\\RegFile365.reg",
                                          Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetp365.dbf",
                                          "Owner : م/محمد دبور",
                                          365, 999999999, "914");

            // أول رقم ده عدد الايام والتاني عدد المرات والتالت الايدنتفاير

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;

            if (RT != TrialMaker.RunTypes.Expired)
            {
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                BackEnd.SessionInfo.cn = new SqlConnection();
                BackEnd.SessionInfo.cn.ConnectionString = BackEnd.SessionInfo.Connection;
                BackEnd.SessionInfo.cn.Open();
                try {
                    SqlCommand cm = new SqlCommand();
                    cm.Connection  = BackEnd.SessionInfo.cn;
                    cm.CommandText = "CREATE TABLE [dbo].[Users]([ID][int] IDENTITY(1, 1) NOT NULL, [UserName] [nvarchar](max) NULL,[Password][nvarchar](max) NULL,[Permissions][nvarchar](max) NULL,CONSTRAINT[PK_Users] PRIMARY KEY CLUSTERED([ID] ASC)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    cm.ExecuteNonQuery();
                    cm.CommandText = "Insert into Users(UserName,Password,Permissions) values('Admin','+Vs4ZHwle88=','yyyyyyyyyyyyyy')";
                    cm.ExecuteNonQuery();
                }
                catch { }
                Application.Run(new FrontEnd.Login());
            }
        }
Пример #11
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker t = new TrialMaker("TMTestSM", Application.StartupPath + "\\RegFile.reg", Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\TMSetup.dbf", "", 30, "745");

            byte[] MyOwenKey = { 97, 250, 1, 5, 84, 21, 7, 63, 4, 54, 87, 56, 123, 10, 3, 62, 7, 9, 20, 36, 37, 21, 101, 57 };
            t.TripleDESKey = MyOwenKey;
            TrialMaker.RunTypes RT = t.ShowDialog();
            string abc             = @"Software\restrictedarea\restrictedValues\pospos\PosPrivate";
            Secure scr             = new Secure();
            bool   logic           = scr.Algorithm(frmDialog.trial_code, abc);

            if (logic == true)
            {
                Application.Run(new Login());
            }
        }
Пример #12
0
        private void mnuRegistro_Click(object sender, EventArgs e)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            string path = appDataPath + @"\Optima\";

            TrialMaker t = new TrialMaker("Optima", Application.StartupPath + "\\RegFile.reg",
                                          path + "\\Optima.dbf",
                                          "Fixo: +55 (21)3226-2645\nCelular: +55 (21)99205-6591",
                                          5, 10, "289", true);

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;

            TrialMaker.RunTypes RT = t.ShowDialog();

            if (RT == TrialMaker.RunTypes.Full)
            {
                MessageBox.Show("Está cópia já foi registrada.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #13
0
        //System.Windows.Forms.Application.EnableVisualStyles();
        // System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                base.OnStartup(e);
                if (ApplicationRunningHelper.AlreadyRunning())
                {
                    System.Windows.Application.Current.Shutdown();
                    return;
                }
                SoftwareLocker.TrialMaker t = new SoftwareLocker.TrialMaker("ZebecLoadMasterGasCommerce", System.IO.Directory.GetCurrentDirectory() + "\\RegFile.reg",
                                                                            Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\1L2O3D4I5C6A7T8O9R2.dbf",
                                                                            "",
                                                                            20, "745");
                byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                    4,   54, 87, 56, 123, 10,   3, 62,
                                    7,    9, 20, 36,  37, 21, 101, 57 };

                t.TripleDESKey = MyOwnKey;
                //TrialMaker.RunTypes Rt=
                TrialMaker.RunTypes RT = t.ShowDialog();
                //bool is_trial;
                if (RT != TrialMaker.RunTypes.Expired)
                {
                    //if (RT == TrialMaker.RunTypes.Full)
                    //    is_trial = false;
                    //else
                    //    is_trial = true;

                    //System.Windows.Application.Run(new MainWindow(is_trial))
                    //if (is_trial == true)
                    //{

                    System.Windows.Application.Current.StartupUri = new Uri("/ZebecLoadMaster;component/MainWindow.xaml",
                                                                            UriKind.Relative);
                    //}
                    //else
                    //{
                    //    System.Windows.Application.Current.Shutdown();
                    //}
                    //LoginDialog dlg = new LoginDialog();
                    //if (dlg.ShowDialog() != true)
                    //    return;

                    //switch (dlg.ChoiceApp)
                    //{
                    //    case ChoiceApp.CustomerEntry:
                    //        StartupUri = new Uri("/MyApp;component/Forms/CustomerEntry.xaml",
                    //            UriKind.Relative);
                    //        break;
                    //    case ChoiceApp.VendorEntry:
                    //        StartupUri = new Uri("/MyApp;component/Forms/VendorEntry.xaml",
                    //            UriKind.Relative);
                    //        break;
                    //}
                }
                else if (RT == TrialMaker.RunTypes.Expired)
                {
                    //System.Windows.MessageBox.Show("Trial Period of this Application Has Expired.Please Contact Administrator");
                    System.Windows.Application.Current.Shutdown();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message + "Error");
            }
        }
Пример #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppDomain.CurrentDomain.SetData("DataDirectory", Directory.GetCurrentDirectory());

            frmSplash splash = new frmSplash();

            splash.Show();
            splash.Cursor = Cursors.AppStarting;


            Application.DoEvents();

            splash.setMensagem("Carregando configurações.");
            splash.setprogresso(100);
            Thread.Sleep(500);
            Application.DoEvents();

            //splash.setMensagem("Sincronizando informações com a nuvem.");
            //Application.DoEvents();

            /*Ao incluir um novo webservice no projeto SYNC copiar o conteundo de <system.serviceModel> </system.serviceModel>
             * para o app.config da aplicação principal.
             */

#if RELEASE
            ////Clientes
            //ClienteProxy cp = new ClienteProxy();
            //try
            //{
            //    cp.SyncCadastroCliente();
            //}
            //catch(Exception ex)
            //{
            //    MessageBox.Show(ex.InnerException.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            ////Produtos
            //ProdutoProxy pp = new ProdutoProxy();
            //try
            //{
            //    pp.SyncCadastroProduto();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //FormaPagVendasProxy fpv = new FormaPagVendasProxy();
            //try
            //{
            //    fpv.SyncFormaPagVendas();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}

            //CidadesProxy cid = new CidadesProxy();
            //try
            //{
            //    cid.SyncCidades();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //ProdutosImpostosProxy prod = new ProdutosImpostosProxy();
            //try
            //{
            //    prod.SyncProdutosImpostos();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //ParcelaProxy parcelas = new ParcelaProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de parcelas");
            //    Application.DoEvents();
            //    parcelas.SyncParcela();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //ProdutosImpostosProxy prod = new ProdutosImpostosProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de Impostos aprendidos.");
            //    Application.DoEvents();
            //    prod.SyncProdutosImpostos();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //CategoriaProxy categ = new CategoriaProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de Categorias.");
            //    Application.DoEvents();
            //    categ.SyncCategoria();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            // ContaCorrenteProxy cc = new ContaCorrenteProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de Conta Corrente.");
            //    Application.DoEvents();
            //    cc.SyncContaCorrente();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //ContaCorrenteProxy cc = new ContaCorrenteProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de Conta Corrente.");
            //    Application.DoEvents();
            //    cc.SyncContaCorrente();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}

            //ContaCorrenteProxy cc = new ContaCorrenteProxy();
            //try
            //{
            //    splash.setMensagem("Sincronizando cadastro de Conta Corrente.");
            //    Application.DoEvents();
            //    cc.SyncContaCorrente();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    throw;
            //}
#endif



            //splash.setprogresso(60);
            //Thread.Sleep(100);
            //Application.DoEvents();

            //splash.setMensagem("Sincronizado.");
            //splash.setprogresso(100);
            //Thread.Sleep(100);
            //Application.DoEvents();

            //Thread.Sleep(50);
            //Application.DoEvents();

            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);


            string path = appDataPath + @"\Optima\";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }



            TrialMaker t = new TrialMaker("Optima", Application.StartupPath + "\\RegFile.reg",
                                          path + "\\Optima.dbf",
                                          "Fixo: +55 (21)3226-2645\nCelular: +55 (21)99205-6591",
                                          30, 10, "289", false);

            byte[] MyOwnKey = { 97, 250,  1,  5,  84, 21,   7, 63,
                                4,   54, 87, 56, 123, 10,   3, 62,
                                7,    9, 20, 36,  37, 21, 101, 57 };
            t.TripleDESKey = MyOwnKey;
            splash.Cursor  = Cursors.Default;
            splash.Dispose();

            TrialMaker.RunTypes RT = t.ShowDialog();
            bool is_trial;
            int  NrDiasTrial = t.NrDiasFimAvalicao();


            if (RT != TrialMaker.RunTypes.Expired)
            {
                string MsgLogin = string.Empty;
                if (RT == TrialMaker.RunTypes.Full)
                {
                    is_trial = false;
                }
                else
                {
                    is_trial = true;
                }

                if (is_trial)
                {
                    MsgLogin = string.Format("Versão de avaliação. Tempo restante: {0} dia(s).", NrDiasTrial);
                }

                frmLogin login = new frmLogin(MsgLogin);


                if (login.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new frmPrincipal());
                }
                else
                {
                    Application.Exit();
                }
            }
            else
            {
                Application.Exit();
            }
        }
Пример #15
0
        static void Main()
        {
            if (PriorProcess() != null)
            {
                MessageBox.Show("Ứng dụng đang chạy", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TrialMaker maker = new TrialMaker("FileExportScheduler", Application.StartupPath + @"\Register.reg", Application.StartupPath + @"\ESSetp.dbf", "", 0xA, 10, "246813579");

            //TrialMaker maker = new TrialMaker("ESMRServer", Application.StartupPath + @"\Register.reg", Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\ATSetp.dbf", "", 0x2d, 0, "246813579");
            maker.TripleDESKey = new byte[] {
                100, 0x86, 0x41, 1, 20, 0x26, 0x47, 0x62, 0x43, 12, 0x4c, 0x58, 11, 9, 14, 0x4c,
                0x36, 0x15, 0x57, 0x7b, 0xe9, 6, 0xc7, 5
            };
            TrialMaker.RunTypes types = maker.ShowDialog();
            int a = maker.DaysToEnd();
            //types = TrialMaker.RunTypes.Licensed;
            bool flag2 = false;

            switch (types)
            {
            case TrialMaker.RunTypes.Trial:
            {
                if (a != 0)
                {
                    flag2 = true;
                }
                break;
            }

            case TrialMaker.RunTypes.Licensed:
                flag2 = true;
                break;

            default:
                Application.Exit();
                return;
            }
            if (flag2)
            {
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                AppDomain.CurrentDomain.TypeResolve     += new ResolveEventHandler(CurrentDomain_TypeResolve);
                using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, @"Global\" + AppGuid))
                {
                    if (!mutex.WaitOne(0, false))
                    {
                        MessageBox.Show("Chương trình đang chạy", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    GC.Collect();


                    Application.Run(new FormMain());
                }
            }
            else
            {
                MessageBox.Show("Chương trình hết hạn sử dụng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }