Example #1
0
        private void LoadSeverities(string fullPath)
        {
            _unitsCollection.Clear();
            ClearDatasets();

            if (File.Exists(fullPath))
            {
                FileStream fileStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    uint version = reader.ReadUInt32();

                    // Read Units
                    uint unitsLength = reader.ReadUInt32();
                    var  unitList    = new List <FullUnitValue>((int)unitsLength);
                    for (uint i = 0; i < unitsLength; ++i)
                    {
                        ReadCompileUnit(reader, unitList);
                    }

                    _unitsCollection = new ObservableCollection <FullUnitValue>(unitList);

                    //Read Datasets
                    for (int i = 0; i < Enum.GetNames(typeof(CompileCategory)).Length; ++i)
                    {
                        uint dataLength = reader.ReadUInt32();
                        var  thislist   = new List <CompileValue>((int)dataLength);
                        for (uint k = 0; k < dataLength; ++k)
                        {
                            ReadCompileValue(reader, thislist);
                        }
                        _datasets[i].collection = new ObservableCollection <CompileValue>(thislist);
                    }
                }

                //Post process on read data
                PostProcessLoadedData();
            }

            RecomputeSeverities();
            ScoreDataChanged?.Invoke();
        }
Example #2
0
 public void OnSettingsSeverityChanged()
 {
     RecomputeSeverities();
     ScoreDataChanged?.Invoke();
 }
Example #3
0
        private void LoadSeverities(string fullPath)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            UnitsCollection.Clear();
            Totals.Clear();
            ClearDatasets();

            if (File.Exists(fullPath))
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();

                FileStream fileStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    // Read version
                    uint thisVersion = reader.ReadUInt32();
                    if (thisVersion == VERSION)
                    {
                        // Read Header
                        Timeline.CompilerTimeline.Instance.TimelinePacking = reader.ReadUInt32();

                        // Read Units
                        uint unitsLength = reader.ReadUInt32();
                        var  unitList    = new List <UnitValue>((int)unitsLength);
                        for (uint i = 0; i < unitsLength; ++i)
                        {
                            ReadCompileUnit(reader, unitList, i);
                        }

                        UnitsCollection = new List <UnitValue>(unitList);

                        //Read Datasets
                        for (int i = 0; i < (int)CompileThresholds.Gather; ++i)
                        {
                            uint dataLength = reader.ReadUInt32();
                            var  thislist   = new List <CompileValue>((int)dataLength);
                            for (uint k = 0; k < dataLength; ++k)
                            {
                                ReadCompileValue(reader, thislist);
                            }
                            Datasets[i].collection = new List <CompileValue>(thislist);
                        }
                    }
                    else
                    {
                        OutputLog.Error("Version mismatch! Expected " + VERSION + " - Found " + thisVersion + " - Please export again with matching Data Exporter");
                    }
                }

                fileStream.Close();

                //Post process on read data
                PostProcessLoadedData();

                watch.Stop();
                const long TicksPerMicrosecond = (TimeSpan.TicksPerMillisecond / 1000);
                ulong      microseconds        = (ulong)(watch.ElapsedTicks / TicksPerMicrosecond);
                OutputLog.Log("Score file processed in " + Common.UIConverters.GetTimeStr(microseconds));
            }

            RecomputeSeverities();

            ScoreDataChanged?.Invoke();
        }