Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine($"\tToday is Julian Date {FormatHelpers.DateToJulianDate(DateTime.Now)}");
            //if (args.Length != 4 || args[0] != "-i" || args[0] != "/i" || args[2] != "-o" || args[2] != "/o")
            //{
            //	PrintUsage();
            //	return;
            //}

            //string inputFilePath = args[1];
            //string outputType = args[3].ToLower();

            //if (!File.Exists(inputFilePath))
            //{
            //	Console.WriteLine($"\tError: the file at {inputFilePath} does not exist.");
            //	return;
            //}
            //else if (outputType != "json" || outputType != "binary")
            //{
            //	Console.WriteLine($"\tError: incorrect output type {outputType}. Select either json or binary.");
            //}

            var    curday             = CurdayReader.Read(args[0]);
            string json               = JSONWriter.Serialize(curday);
            var    curdayDeserialized = JSONReader.Deserialize(json);
            string json2              = JSONWriter.Serialize(curdayDeserialized);
        }
Exemple #2
0
        private static object GetSerializableObjects(CurdayHeader header)
        {
            string unknownFlagsString = $"{FormatHelpers.BooleanToYNFlag(header.UnknownFlag1)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag2)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag3)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag4)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag5)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag6)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag7)}{FormatHelpers.BooleanToYNFlag(header.UnknownFlag8)}";

            return(new
            {
                diagnosticsBCK = header.DiagnosticsBCK,
                diagnosticsFWD = header.DiagnosticsFWD,
                scrollSpeed = header.ScrollSpeed,
                numberOfTextAdsAllowedA = header.NumberOfTextAdsAllowedA,
                numberOfTextAdsAllowedB = header.NumberOfTextAdsAllowedB,
                numberOfLinesInTextAd = header.NumberOfLinesInTextAd,
                grphDST = header.GrphDST,
                timezone = header.Timezone,
                unknownFlags = unknownFlagsString,
                diagnosticsVIN = header.DiagnosticsVIN,
                unknownValue1 = header.UnknownValue1,
                dataRevisionNumber = header.DataRevisionValue,
                weatherAirportCode = header.WeatherAirportCode,
                weatherDisplayCityName = header.WeatherCityDisplayName,
                julianDate = header.JulianDate,
                numberOfChannels = header.NumberOfChannels,
                unknownValue2 = header.UnknownValue2,
                unknownValue3 = header.UnknownValue3
            });
        }
        private static List <CurdayProgram> DeserializePrograms(JArray array)
        {
            List <CurdayProgram> result = new List <CurdayProgram>();

            foreach (var token in array)
            {
                CurdayProgram program = new CurdayProgram();

                string timeSlot = (string)token["timeSlot"];
                if (timeSlot == "0" || timeSlot == "49")
                {
                    program.TimeSlot = timeSlot;
                }
                else
                {
                    program.TimeSlot = FormatHelpers.TimeToCurdayTimeSlot(DateTime.Parse((string)token["timeSlot"]));
                }

                program.ProgramFlags  = (string)token["flags"];
                program.ProgramType   = FormatHelpers.NamedTypeToProgramType((string)token["type"]);
                program.MovieCategory = FormatHelpers.NamedCategoryToMovieCategory((string)token["movieCategory"]);
                program.ProgramName   = (string)token["name"];

                result.Add(program);
            }

            return(result);
        }
Exemple #4
0
 private static object GetSerializableObjects(CurdayProgram program)
 {
     return(new
     {
         timeSlot = FormatHelpers.CurdayTimeSlotToTime(program.TimeSlot),
         flags = program.ProgramFlags,
         type = FormatHelpers.ProgramTypeToNamedType(program.ProgramType),
         movieCategory = FormatHelpers.MovieCategoryToNamedCategory(program.MovieCategory),
         name = program.ProgramName
     });
 }