Пример #1
0
        private static void Main(string[] args)
        {
            if (args.Length == 0)
                byForce = true;

            var reg = new LERegistry();
            reg.GetRegistryEntries();

            // Check new version every week.
            if (!byForce && Int32.Parse(DateTime.Now.ToString("yyyyMMdd")) - reg.Version < 7)
            {
                return;
            }

            if (!SystemHelper.CheckPermission(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                if (!SystemHelper.IsAdministrator())
                {
                    SystemHelper.RunWithElevatedProcess(
                                                        Path.Combine(Assembly.GetExecutingAssembly().Location),
                                                        args);

                    Environment.Exit(0);
                }
                else
                {
                    _notifyIcon.Visible = false;
                    Environment.Exit(0);
                }
            }

            CheckUpdates(GlobalHelper.GetLEVersion(), reg.Version);
        }
Пример #2
0
        private static void Main(string[] args)
        {
            var reg = new LERegistry();
            reg.GetRegistryEntries();

            // Check new version every week.
            if (Int32.Parse(DateTime.Now.ToString("yyyyMMdd")) - reg.Version < 7)
            {
                return;
            }

            if (!SystemHelper.CheckPermission(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                if (!SystemHelper.IsAdministrator())
                {
                    SystemHelper.RunWithElevatedProcess(
                                                        Path.Combine(Assembly.GetExecutingAssembly().Location),
                                                        args);

                    Environment.Exit(0);
                }
                else
                {
                    _notifyIcon.ShowBalloonTip(0,
                                               "Locale Emulator V" + Application.ProductVersion,
                                               "Current directory is read-only, update process aborted.\r\n" +
                                               "Please move LE to a new location and try again.",
                                               ToolTipIcon.Info);

                    Thread.Sleep(5000);
                    _notifyIcon.Visible = false;
                    Environment.Exit(0);
                }
            }

            CheckUpdates(Application.ProductVersion, reg.Version);
        }