Example #1
0
        public static void SaveLiteRecord(RecordLite rec, string path)
        {
            Initialize(false);

            string contents = JsonConvert.SerializeObject(rec, Formatting.Indented);

            File.WriteAllText(path, contents);
        }
Example #2
0
        public RecordLite MakeRecord()
        {
            RecordLite res = new RecordLite(ViewModel.RatedTeam,
                                            ViewModel.IndicatedMatch);

            res.Ratings = ViewModel.Ratings;

            return(res);
        }
Example #3
0
        public RecordLite MakeRecord()
        {
            if (IndicatedMatch == null)
            {
                return(null);
            }

            RecordLite rec = new RecordLite(RatedTeam, IndicatedMatch);

            rec.Ratings = Ratings;
            return(rec);
        }
Example #4
0
        public static RecordLite ParseLiteRecord(string path)
        {
            Initialize(false);

            string     contents = File.ReadAllText(path);
            RecordLite lite     = null;

            try
            {
                lite = JsonConvert.DeserializeObject <RecordLite>(contents);
            }
            catch (JsonException)
            {
                Util.DebugLog(LogLevel.Critical, "Could not deserialize file.");
            }

            return(lite);
        }
        public void LoadAllRecords()
        {
            if (!Directory.Exists(RecordsRoot))
            {
                return;
            }

            DirectoryInfo        root      = new DirectoryInfo(RecordsRoot);
            List <DirectoryInfo> teamInfos = root.EnumerateDirectories().ToList();

            teamInfos.RemoveAll((di) => !di.Name.IsInteger());

            AllRecords.Clear();

            foreach (DirectoryInfo di in teamInfos)
            {
                List <RecordLite> recordSet   = new List <RecordLite>();
                List <FileInfo>   recordFiles = di.EnumerateFiles().ToList();
                foreach (FileInfo fi in recordFiles)
                {
                    RecordLite rec = ScoutingJson.ParseLiteRecord(fi.FullName);

                    if (Event != null && Teams != null)
                    {
                        rec.PostJsonLoading(Event);
                    }

                    recordSet.Add(rec);
                }

                AllRecords.Add(recordSet);
            }

            if (!hasCrunched)
            {
                DoCrunching();
            }
        }