Пример #1
0
        async void Main_Load(object sender, EventArgs e)
        {
            changeVersionButton.Visible = File.Exists(Settings.Default.MainExecPath);

            Settings.Default.SettingChanging += Default_SettingChanging;
            iracingEvents.NewSessionData += iracingEvents_NewSessionData;
            iracingEvents.Connected += iracingEvents_Connected;
            iracingEvents.Disconnected += iracingEvents_Disconnected;
            iracingEvents.StartListening();

            workingFolderTextBox.Text = Settings.Default.WorkingFolder;

            logMessagges = new LogMessages();
            Trace.Listeners.Add(new MyListener(logMessagges.TraceMessage));

            LogListener.ToFile(GetDefaultLogFileName());
            AwsLogListener.SetPhaseGeneral();

            new Task(LogSystemInformation).Start();

            fileWatchTimer = new System.Windows.Forms.Timer();
            fileWatchTimer.Interval = 10;
            fileWatchTimer.Tick += (s, a) => OnGameDataFileChanged();
            fileWatchTimer.Start();

            videoBitRate.Text = Settings.Default.videoBitRate.ToString();
            sourceVideoTextBox.Text = Settings.Default.lastVideoFile;

            BeginProcessButton.Enabled = false;

            iRacingProcess = new IRacingReplay()
                .WhenIRacingStarts(() => 
                {
                    BeginProcessButton.Enabled = true;
                    workingFolderTextBox_TextChanged(null, null); 
                    ProcessErrorMessageLabel.Visible = false; 
                    WaitingForIRacingLabel.Visible = false;
                })
                .InTheBackground(errorMessage => { });

            try
            {
                var items = await GitHubAccess.GetVersions("vipoo", "iRacingReplayOverlay.net");

                var currentVersionItem = items.FirstOrDefault(r => r.VersionStamp == AboutBox1.AssemblyVersion);
                var isNewVersionAvailable = false;

                if (currentVersionItem.VersionStamp == null)
                    isNewVersionAvailable = true;
                else
                {
                    var isPreRelease = currentVersionItem.Prerelease;

                    var latestVersion = items.OrderByDescending(r => new Version(r.VersionStamp)).Where(r => r.Prerelease == isPreRelease).First();
                    isNewVersionAvailable = new Version(latestVersion.VersionStamp) > AboutBox1.AssemblyVersionStamp;
                }

                if (isNewVersionAvailable)
                    newVersionMessage.Visible = true;
            }
            catch(Exception ee)
            {
                TraceError.WriteLine(ee.Message);
                TraceError.WriteLine(ee.StackTrace);
            }
        }
Пример #2
0
        async void Main_Load(object sender, EventArgs e)
        {
            changeVersionButton.Visible = File.Exists(Settings.Default.MainExecPath);

            Settings.Default.SettingChanging += Default_SettingChanging;
            iracingEvents.NewSessionData     += iracingEvents_NewSessionData;
            iracingEvents.Connected          += iracingEvents_Connected;
            iracingEvents.Disconnected       += iracingEvents_Disconnected;
            iracingEvents.StartListening();

            workingFolderTextBox.Text = Settings.Default.WorkingFolder;

            logMessagges = new LogMessages();
            Trace.Listeners.Add(new MyListener(logMessagges.TraceMessage));

            LogListener.ToFile(GetDefaultLogFileName());
            AwsLogListener.SetPhaseGeneral();

            new Task(LogSystemInformation).Start();

            fileWatchTimer          = new System.Windows.Forms.Timer();
            fileWatchTimer.Interval = 10;
            fileWatchTimer.Tick    += (s, a) => OnGameDataFileChanged();
            fileWatchTimer.Start();

            videoBitRate.Text       = Settings.Default.videoBitRate.ToString();
            sourceVideoTextBox.Text = Settings.Default.lastVideoFile;

            BeginProcessButton.Enabled = false;

            iRacingProcess = new IRacingReplay()
                             .WhenIRacingStarts(() =>
            {
                BeginProcessButton.Enabled = true;
                workingFolderTextBox_TextChanged(null, null);
                ProcessErrorMessageLabel.Visible = false;
                WaitingForIRacingLabel.Visible   = false;
            })
                             .InTheBackground(errorMessage => { });

            try
            {
                var items = await GitHubAccess.GetVersions("vipoo", "iRacingReplayOverlay.net");

                var currentVersionItem    = items.FirstOrDefault(r => r.VersionStamp == AboutBox1.AssemblyVersion);
                var isNewVersionAvailable = false;

                if (currentVersionItem.VersionStamp == null)
                {
                    isNewVersionAvailable = true;
                }
                else
                {
                    var isPreRelease = currentVersionItem.Prerelease;

                    var latestVersion = items.OrderByDescending(r => new Version(r.VersionStamp)).Where(r => r.Prerelease == isPreRelease).First();
                    isNewVersionAvailable = new Version(latestVersion.VersionStamp) > AboutBox1.AssemblyVersionStamp;
                }

                if (isNewVersionAvailable)
                {
                    newVersionMessage.Visible = true;
                }
            }
            catch (Exception ee)
            {
                TraceError.WriteLine(ee.Message);
                TraceError.WriteLine(ee.StackTrace);
            }
        }
Пример #3
0
        void Main_Load(object sender, EventArgs e)
        {
            changeVersionButton.Visible = File.Exists(Settings.Default.MainExecPath);

            Settings.Default.SettingChanging += Default_SettingChanging;
            iracingEvents.NewSessionData += iracingEvents_NewSessionData;
            iracingEvents.Connected += iracingEvents_Connected;
            iracingEvents.Disconnected += iracingEvents_Disconnected;
            iracingEvents.StartListening();

            workingFolderTextBox.Text = Settings.Default.WorkingFolder;

            logMessagges = new LogMessages();
            Trace.Listeners.Add(new MyListener(logMessagges.TraceMessage));

            LogListener.ToFile(GetDefaultLogFileName());

            new Task(LogSystemInformation).Start();

            fileWatchTimer = new System.Windows.Forms.Timer();
            fileWatchTimer.Interval = 10;
            fileWatchTimer.Tick += (s, a) => OnGameDataFileChanged();
            fileWatchTimer.Start();

            videoBitRate.Text = Settings.Default.videoBitRate.ToString();
            sourceVideoTextBox.Text = Settings.Default.lastVideoFile;

            BeginProcessButton.Enabled = false;

            iRacingProcess = new IRacingReplay()
                .WhenIRacingStarts(() => 
                {
                    BeginProcessButton.Enabled = true;
                    workingFolderTextBox_TextChanged(null, null); 
                    ProcessErrorMessageLabel.Visible = false; 
                    WaitingForIRacingLabel.Visible = false;
                })
                .InTheBackground(errorMessage => { });
        }