Inheritance: IDisposable
示例#1
0
        private static void Main()
        {
            Guid guid;

            if (!Directory.Exists(dir) && File.Exists(dir)) {
                File.Delete(dir);
            }

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

            if (File.Exists(file)) {
                string text = File.ReadAllText(file);
                if (string.IsNullOrEmpty(text) || !Guid.TryParse(text, out guid)) {
                    guid = Guid.NewGuid();
                }
            } else {
                guid = Guid.NewGuid();
            }

            File.WriteAllText(file, guid.ToString());

            Job job = new Job();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new BuildTools(guid, job));
        }
示例#2
0
        /// <summary>
        /// Constructor for the form
        /// </summary>
        public BuildTools(Guid guid, Job job)
        {
            InitializeComponent();
            _job = job;
            _googleAnalytics = new GoogleAnalytics(guid);
            _runner = new Runner(this, _job, _googleAnalytics);
            undoBT.Visible = false;
            progress.Visible = false;

            versionBox.SelectedIndex = 0;
            GetVersions();

            // delegates
            _appendDelegate = AppendText;
            _appendRawDelegate = AppendRawText;
            _disableDelegate = Disable;
            _enableDelegate = Enable;
            _showProgressDelegate = ProgressShow;
            _hideProgressDelegate = ProgressHide;
            _indeterminateProgressDelegate = ProgressIndeterminate;
            _progressPercentDelegate = Progress;
            _updateVersionsDelegate = UpdateVersions;

            if (File.Exists(Program.CheckUpdate)) {
                string text = File.ReadAllText(Program.CheckUpdate);
                if (string.IsNullOrEmpty(text) || text.Trim().ToLower() == "false") {
                    autoUpdateCB.Checked = false;
                }
            }

            Console.WriteLine(guid.ToString());
            new Thread(delegate () {
                _googleAnalytics.SendEvent("Application", "Start");
            }).Start();
        }