private void LoadTimingFile(string FilePath)
        {
            TimingDataViewModel NewTimingData = TimingDataViewModel.FromBinaryFile(FileReference.FromString(FilePath));

            // If this is an aggregate, hook up the open commands for the file rows.
            if (NewTimingData.Type == UnrealBuildTool.TimingDataType.Aggregate)
            {
                foreach (TimingDataViewModel File in NewTimingData.Children[0].Children.Cast <TimingDataViewModel>())
                {
                    OpenTimingDataCommand FileOpenCommand = new OpenTimingDataCommand(File);
                    FileOpenCommand.OpenAction =
                        (ViewModel) =>
                    {
                        TimingDataViewModel FileTimingData = NewTimingData.LoadTimingDataFromBinaryBlob(File.Name);
                        Dispatcher.BeginInvoke(new Action(() => { AddTimingDataViewModelToTabs(FileTimingData); }));
                    };

                    File.OpenCommand = FileOpenCommand;
                }
            }

            AddTimingDataViewModelToTabs(NewTimingData);
        }
Esempio n. 2
0
        private void LoadTimingFile(string FilePath)
        {
            if (!File.Exists(FilePath))
            {
                string ErrorString = "Unable to load file \"" + FilePath + "\"";
                Console.WriteLine(ErrorString);
                MessageBox.Show(ErrorString + Environment.NewLine + "(File not found)",
                                "File Not Found",
                                MessageBoxButton.OK,
                                MessageBoxImage.Question);
                return;
            }

            JumpList.AddToRecentCategory(FilePath);

            try
            {
                TimingDataViewModel NewTimingData = TimingDataViewModel.FromBinaryFile(FileReference.FromString(FilePath));

                // If this is an aggregate, hook up the open commands for the file rows.
                if (NewTimingData.Type == UnrealBuildTool.TimingDataType.Aggregate)
                {
                    foreach (TimingDataViewModel File in NewTimingData.Children[0].Children.Cast <TimingDataViewModel>())
                    {
                        OpenTimingDataCommand FileOpenCommand = new OpenTimingDataCommand(File);
                        FileOpenCommand.OpenAction =
                            (ViewModel) =>
                        {
                            TimingDataViewModel FileTimingData = NewTimingData.LoadTimingDataFromBinaryBlob(File.Name);
                            Dispatcher.BeginInvoke(new Action(() => { AddTimingDataViewModelToTabs(FileTimingData); }));
                        };

                        File.OpenCommand = FileOpenCommand;
                    }
                }
                AddTimingDataViewModelToTabs(NewTimingData);
            }
            catch (System.IO.EndOfStreamException e)
            {
                string ErrorString = "Unable to load file \"" + FilePath + "\"";
                Console.WriteLine(ErrorString);
                Console.WriteLine(e.ToString());
                MessageBox.Show(ErrorString + Environment.NewLine + "(may be corrupted)",
                                "Error Loading Timing File",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }