<commit_before>﻿using MovieDatabase.DatabaseClassinstance;
using MovieDatabase.EntityData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace MovieDatabase.ExportDataToFiles.ExportingDataToFilesClasses
{
    public class XMLGenerator
    {
        public void XmlGenerate()
        {
            XmlTextWriter writer = new XmlTextWriter("../../../ExportedFiles/Report.xml", System.Text.Encoding.UTF8);
            writer.WriteStartDocument(true);
            writer.Formatting = Formatting.Indented;
            writer.Indentation = 2;
            writer.WriteStartElement("movies");
            var database = new Database();
            var db = database.GetInstance();
            var moviesData = db.Movies
                               .OrderBy(m => m.Name)
                               .ToList();

            foreach (var movieData in moviesData)
            {
                this.CreateNode(movieData, writer);
            }

            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }

        private void CreateNode(Movy movie, XmlTextWriter writer)
        {
            var actors = movie.Employees
                               .Where(a => a.IsDirector == false)
                               .OrderBy(a => a.FirstName)
                               .ToList();
<commit_msg>Modified class XMLGenerator.cs.<commit_after>﻿using MovieDatabase.DatabaseClassinstance;
using MovieDatabase.EntityData;
using MovieDatabase.ExportDataToFiles.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace MovieDatabase.ExportDataToFiles.ExportingDataToFilesClasses
{
    public class XMLGenerator : IGenerator
    {
        public void Generate(Database dbContext)
        {
            XmlTextWriter writer = new XmlTextWriter("../../../ExportedFiles/Report.xml", System.Text.Encoding.UTF8);
            writer.WriteStartDocument(true);
            writer.Formatting = Formatting.Indented;
            writer.Indentation = 2;
            writer.WriteStartElement("movies");
            var db = dbContext.GetInstance();
            var moviesData = db.Movies
                               .OrderBy(m => m.Name)
                               .ToList();

            foreach (var movieData in moviesData)
            {
                this.CreateNode(movieData, writer);
            }

            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }

        private void CreateNode(Movy movie, XmlTextWriter writer)
        {
            var actors = movie.Employees
                               .Where(a => a.IsDirector == false)
                               .OrderBy(a => a.FirstName)
                               .ToList();

{'fraction_non_alphanumeric': 0.09115646258503401, 'fraction_numerical': 0.0013605442176870747, 'mean_word_length': 1.7409133271202237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '684162', 'n_tokens_mistral': 731, 'n_tokens_neox': 707, 'n_words': 148}