예제 #1
0
 public CollegeData(CollegeDataSettings settings, IMySerializer serializer)
 {
     _Groups          = new List <Group>();
     _TotalResults    = new List <SubjectResult>();
     _SubjectWeights  = settings.Subjectweights;
     this._Serializer = serializer;
 }
예제 #2
0
        static void Main(string[] args)
        {
            ServiceCollection serviceCollection = new ServiceCollection();

            ConfigureServices(serviceCollection);

            var section = configuration.GetSection("Weights");
            List <SubjectWeight> weights = section.Get <List <SubjectWeight> >();

            string filepath               = configuration.GetSection("FilePath").Value;
            string outputfileProcess      = configuration.GetSection("OutputFileProcessPath").Value;
            string outputFileLoaderErrors = configuration.GetSection("OutputfileLoadErrors").Value;
            string OutputFileOverallPath  = configuration.GetSection("OutputFileOverallPath").Value;


            IMySerializer serializer = null;

            foreach (var item in args)
            {
                if (item == "JSON")
                {
                    serializer = new MyJsonSerializer();
                }
            }
            if (serializer == null)
            {
                serializer = new MyXmlSerializer();
            }

            FileCollegeDataLoader loader   = new FileCollegeDataLoader(filepath, serializer);
            CollegeDataSettings   settings = new CollegeDataSettings()
            {
                Subjectweights = weights
            };

            CollegeData.Implementation.CollegeData data = new CollegeData.Implementation.CollegeData(settings, serializer);

            loader.LoadCollegeData(data);
            File.WriteAllText(Path.ChangeExtension(outputFileLoaderErrors, serializer.GetFileExtension()), loader.GetSerializedErrors());
            data.Process();
            File.WriteAllText(Path.ChangeExtension(outputfileProcess, serializer.GetFileExtension()), data.GetSerializedGroups());
            File.WriteAllText(Path.ChangeExtension(OutputFileOverallPath, serializer.GetFileExtension()), data.GetSerializedOverall());
        }
예제 #3
0
 public String Serialize <T>(T obj, IMySerializer serializer)
 {
     return(serializer.Serialize(obj));
 }
 public FileCollegeDataLoader(string filename, IMySerializer serializer)
 {
     _FileToLoad      = filename;
     _Errors          = new List <DataReaderError>();
     this._Serializer = serializer;
 }