public HtmlStepFormatter(HtmlTableFormatter htmlTableFormatter, HtmlMultilineStringFormatter htmlMultilineStringFormatter, LanguageServices languageServices)
 {
     this.htmlTableFormatter = htmlTableFormatter;
     this.htmlMultilineStringFormatter = htmlMultilineStringFormatter;
     this.languageServices = languageServices;
     xmlns = HtmlNamespace.Xhtml;
 }
Beispiel #2
0
        internal Mapper CreateMapper(IConfiguration configuration, string defaultLanguage = "en")
        {
            var languageServices = new LanguageServices(defaultLanguage);
            var mapper           = new Mapper(configuration, languageServices);

            return(mapper);
        }
 public HtmlStepFormatter(HtmlTableFormatter htmlTableFormatter,
                          HtmlMultilineStringFormatter htmlMultilineStringFormatter,
                          LanguageServices languageServices)
 {
     this.htmlTableFormatter           = htmlTableFormatter;
     this.htmlMultilineStringFormatter = htmlMultilineStringFormatter;
     this.languageServices             = languageServices;
     xmlns = HtmlNamespace.Xhtml;
 }
Beispiel #4
0
        private void AddGamez(string[] strTemp, string strTitle, string strFileName, string strFilePath)
        {
            Gamez objGames = new Gamez();

            objGames.Title      = strTitle;
            objGames.Ressources = new List <Ressource>();
            objGames.AddedDate  = DateTime.Now;
            #region File

            objGames.FileName = strFileName;
            objGames.FilePath = strFilePath;

            #endregion
            if (_mapping != null)
            {
                string strLanguage = Util.ConstructString(strTemp, (string[])_mapping["Language"], _nbrBaseParsing);
                objGames.Language = LanguageServices.GetLanguage(strLanguage, true);
            }

            objGames.Media = MediaServices.Get(_strMediaName.Trim(), _mediaType, _path,
                                               _cleanTitle, _entityType, _patternType, _useSubFolder, _bGetImage, _bParseNfo, true);
            #region Cover
            if (_bGetImage == true)
            {
                RessourcesServices.AddImage(Util.GetLocalImage(objGames.FilePath, objGames.FileName, _bFile), objGames, true);
            }
            #endregion
            if (string.IsNullOrEmpty(objGames.Title) == false)
            {
                bool bExist = false;
                if (Dal.GetInstance.GetGames(objGames.Media.Name, objGames.FilePath, objGames.FileName) != null)
                {
                    bExist = true;
                }


                if (bExist == false)
                {
                    #region ParseNfo

                    if (_bParseNfo == true)
                    {
                        string errorMessage;
                        GameServices.ParseNfo(objGames, out errorMessage);
                    }
                    #endregion
                    Dal.GetInstance.AddGame(objGames);

                    _intAddedItem++;
                }
                else
                {
                    _intNotAddedItem++;
                }
            }
        }
Beispiel #5
0
        public void InitCombo()
        {
            for (long i = 0; i < 21; i++)
            {
                cboRating.Items.Add(i);
            }

            cboMedia.ItemsSource    = MediaServices.GetNames();
            cboLanguage.ItemsSource = LanguageServices.GetLanguages();
            cboEditor.DataContext   = PublisherServices.GetPublishers("App_Editor");
            cboFormat.ItemsSource   = BookServices.GetFormats();
        }
Beispiel #6
0
 public ManageLanguage()
 {
     try
     {
         InitializeComponent();
         DataContext = LanguageServices.GetAllLanguages();
     }
     catch (Exception ex)
     {
         CatchException(ex);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CodeRushProxy"/> class.
 /// </summary>
 public CodeRushProxy()
 {
   this.solution = GetNonNull(CodeRush.Solution, "CodeRush.Solution.");
   this.documents = GetNonNull(CodeRush.Documents, "CodeRush.Documents");
   this.file = GetNonNull(CodeRush.File, "CodeRush.File");
   this.textBuffers = GetNonNull(CodeRush.TextBuffers, "CodeRush.TextBuffers");
   this.language = GetNonNull(CodeRush.Language, "CodeRush.Language");
   this.markers = GetNonNull(CodeRush.Markers, "CodeRush.Markers");
   var source = GetNonNull(CodeRush.Source, "CodeRush.Source");
   this.source = new SourceModelProxy(source);
   this.undoStack = GetNonNull(CodeRush.UndoStack, "CodeRush.UndoStack");
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeRushProxy"/> class.
        /// </summary>
        public CodeRushProxy()
        {
            this.solution    = GetNonNull(CodeRush.Solution, "CodeRush.Solution.");
            this.documents   = GetNonNull(CodeRush.Documents, "CodeRush.Documents");
            this.file        = GetNonNull(CodeRush.File, "CodeRush.File");
            this.textBuffers = GetNonNull(CodeRush.TextBuffers, "CodeRush.TextBuffers");
            this.language    = GetNonNull(CodeRush.Language, "CodeRush.Language");
            this.markers     = GetNonNull(CodeRush.Markers, "CodeRush.Markers");
            var source = GetNonNull(CodeRush.Source, "CodeRush.Source");

            this.source    = new SourceModelProxy(source);
            this.undoStack = GetNonNull(CodeRush.UndoStack, "CodeRush.UndoStack");
        }
 public void InitCombo()
 {
     try
     {
         cboRating.ItemsSource   = Enumerable.Range(1, 20);
         CboMedia.ItemsSource    = MediaServices.GetNames();
         CboLanguage.ItemsSource = LanguageServices.GetLanguages();
         CboEditor.DataContext   = PublisherServices.GetPublishers("App_Editor");
     }
     catch (Exception ex)
     {
         Util.LogException(ex);
         new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
     }
 }
        private Project GetProject(string path)
        {
            Project project;

            if (Project.TryGetProject(path, out project))
            {
                LanguageServices obj = new LanguageServices("C#", new TypeInformation("Microsoft.Framework.Runtime.Roslyn", "Microsoft.Framework.Runtime.Roslyn.RoslynProjectReferenceProvider"));

                var prop = project.GetType().GetProperty("LanguageServices", BindingFlags.Public | BindingFlags.Instance);
                if (null != prop && prop.CanWrite)
                {
                    prop.SetValue(project, obj, null);
                }
            }
            return(project);
        }
Beispiel #11
0
        public void InitCombo()
        {
            try
            {
                for (int i = 0; i < 21; i++)
                {
                    cboRating.Items.Add(i);
                }

                cboMedia.ItemsSource    = MediaServices.GetNames();
                cboLanguage.ItemsSource = LanguageServices.GetLanguages();
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
Beispiel #12
0
        public void InitCombo()
        {
            try
            {
                for (int i = 0; i < 21; i++)
                {
                    cboRating.Items.Add(i);
                }

                cboMedia.ItemsSource    = MediaServices.GetNames();
                cboLanguage.ItemsSource = LanguageServices.GetLanguages();
                cboEditor.DataContext   = PublisherServices.GetPublishers("App_Editor");
                cboPlatform.DataContext = GameServices.GetDisctinctPlatforms();
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
Beispiel #13
0
        private void cmdSave_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;

            IList <Language> objSource = LanguageServices.GetAllLanguages();
            IList <Language> objTarget = (IList <Language>)dtgData.DataContext;

            foreach (Language item in objSource)
            {
                if (!objTarget.Contains(item))
                {
                    LanguageServices.Delete(item);
                }
            }
            foreach (Language item in objTarget)
            {
                if (!objSource.Contains(item))
                {
                    LanguageServices.Add(item);
                }
            }
            Close();
        }
Beispiel #14
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Books books = new Books();
                    books.Title       = Util.GetElementValue(node, "Title");
                    books.BarCode     = Util.GetElementValue(node, "BarCode");
                    books.Comments    = Util.GetElementValue(node, "Comments");
                    books.Description = Util.GetElementValue(node, "Description");
                    books.FileName    = Util.GetElementValue(node, "FileName");
                    books.FilePath    = Util.GetElementValue(node, "FilePath");
                    books.Isbn        = Util.GetElementValue(node, "ISBN");

                    #region DateTime
                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        books.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        books.ReleaseDate = dateValue;
                    }
                    #endregion
                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        books.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        books.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsRead"), out boolValue) == true)
                    {
                        books.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        books.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        books.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "NbrPages"), out longValue) == true)
                    {
                        books.NbrPages = longValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rated"), out longValue) == true)
                    {
                        books.Rated = longValue.ToString(CultureInfo.InvariantCulture);
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out longValue) == true)
                    {
                        books.MyRating = longValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] bookNode = query.ToArray();

                    foreach (XElement media in bookNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        books.Media   = newMedia;
                    }
                    #endregion
                    #region Format
                    query = from item in node.Descendants("Format")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement format in bookNode)
                    {
                        books.FileFormat = BookServices.GetFormat(Util.GetElementValue(format, "Name"), true);
                    }
                    #endregion
                    #region Artist
                    query = from item in node.Descendants("Artist")
                            select item;

                    XElement[] artistNode = query.ToArray();

                    Job objJob = ArtistServices.GetJob("Author");
                    foreach (XElement artist in artistNode)
                    {
                        bool   isNew;
                        string fullname  = Util.GetElementValue(artist, "FulleName");
                        Artist newArtist = ArtistServices.Get(fullname, out isNew);

                        if (string.IsNullOrWhiteSpace(newArtist.Aka))
                        {
                            newArtist.Aka = Util.GetElementValue(artist, "Aka");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Bio))
                        {
                            newArtist.Bio = Util.GetElementValue(artist, "Bio");
                        }

                        if (newArtist.BirthDay == null && DateTime.TryParse(Util.GetElementValue(artist, "BirthDay"), out dateValue) == true)
                        {
                            newArtist.BirthDay = dateValue;
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Breast))
                        {
                            newArtist.Breast = Util.GetElementValue(artist, "Breast");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Ethnicity))
                        {
                            newArtist.Ethnicity = Util.GetElementValue(artist, "Ethnicity");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.FirstName))
                        {
                            newArtist.FirstName = Util.GetElementValue(artist, "FirstName");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.LastName))
                        {
                            newArtist.LastName = Util.GetElementValue(artist, "LastName");
                        }

                        if (newArtist.Picture == null)
                        {
                            newArtist.Picture = Convert.FromBase64String(Util.GetElementValue(artist, "Picture"));
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.PlaceBirth))
                        {
                            newArtist.PlaceBirth = Util.GetElementValue(artist, "PlaceBirth");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.WebSite))
                        {
                            newArtist.WebSite = Util.GetElementValue(artist, "WebSite");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.YearsActive))
                        {
                            newArtist.YearsActive = Util.GetElementValue(artist, "YearsActive");
                        }

                        query = from item in artist.Descendants("Credit")
                                select item;

                        XElement[] creditsNode = query.ToArray();

                        foreach (XElement artistCredit in creditsNode)
                        {
                            ArtistCredits artistCredits = new ArtistCredits();

                            artistCredits.Title      = Util.GetElementValue(artistCredit, "Title");
                            artistCredits.BuyLink    = Util.GetElementValue(artistCredit, "BuyLink");
                            artistCredits.EntityType = EntityType.Movie;
                            artistCredits.Notes      = Util.GetElementValue(artistCredit, "Notes");

                            DateTime releaseDate;
                            if (DateTime.TryParse(Util.GetElementValue(artistCredit, "ReleaseDate"), out releaseDate) == true)
                            {
                                artistCredits.ReleaseDate = releaseDate;
                            }

                            if (string.IsNullOrWhiteSpace(artistCredits.Title) == false && string.IsNullOrWhiteSpace(newArtist.FulleName) == false)
                            {
                                if (Dal.GetInstance.GetArtistCredit(artistCredits.Title, newArtist.FulleName) == null)
                                {
                                    newArtist.ArtistCredits.Add(artistCredits);
                                }
                            }
                        }
                        newArtist.Job = objJob;
                        books.Artists.Add(newArtist);
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddArtist(newArtist, books);
                        }
                    }


                    #endregion
                    #region Editor
                    query = from item in node.Descendants("Editor")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement editor in bookNode)
                    {
                        bool isNew;
                        books.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", books.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement languages in bookNode)
                    {
                        books.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement link in bookNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), books, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement type in bookNode)
                    {
                        GenreServices.AddGenre(Util.GetElementValue(type, "RealName"), books, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement images in bookNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, books, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, books);
                            }
                        }
                    }
                    #endregion

                    Dal.GetInstance.AddBook(books);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
 public WordBackgroundFormatter(Configuration configuration, WordTableFormatter wordTableFormatter)
 {
     this.wordTableFormatter = wordTableFormatter;
     this.languageSevices    = new LanguageServices(configuration);
 }
 public LanguageController()
 {
     unitOfWork      = new UnitOfWork();
     languageService = new LanguageServices(unitOfWork);
 }
	    public WordBackgroundFormatter(Configuration configuration, WordTableFormatter wordTableFormatter)
	    {
	        this.wordTableFormatter = wordTableFormatter;
	        this.languageSevices = new LanguageServices(configuration);
	    }
Beispiel #18
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    XXX xxx = new XXX();
                    xxx.Title = Util.GetElementValue(node, "Title");

                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        xxx.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        xxx.ReleaseDate = dateValue;
                    }

                    xxx.BarCode     = Util.GetElementValue(node, "BarCode");
                    xxx.Comments    = Util.GetElementValue(node, "Comments");
                    xxx.Country     = Util.GetElementValue(node, "Country");
                    xxx.Description = Util.GetElementValue(node, "Description");
                    xxx.FileName    = Util.GetElementValue(node, "FileName");
                    xxx.FilePath    = Util.GetElementValue(node, "FilePath");

                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        xxx.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        xxx.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "Seen"), out boolValue) == true)
                    {
                        xxx.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        xxx.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        xxx.ToBeDeleted = boolValue;
                    }

                    #region Int
                    int intValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out intValue) == true)
                    {
                        xxx.MyRating = intValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Runtime"), out intValue) == true)
                    {
                        xxx.Runtime = intValue;
                    }
                    #endregion

                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] mediaNode = query.ToArray();

                    foreach (XElement media in mediaNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        xxx.Media     = newMedia;
                    }

                    #endregion
                    #region FileFormat
                    query = from item in node.Descendants("FileFormat")
                            select item;

                    XElement[] fileFormatNode = query.ToArray();

                    foreach (XElement format in fileFormatNode)
                    {
                        xxx.FileFormat = MovieServices.GetFormat(Util.GetElementValue(format, "Name"));
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    XElement[] languageNode = query.ToArray();

                    foreach (XElement languages in languageNode)
                    {
                        xxx.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    XElement[] linksNode = query.ToArray();

                    foreach (XElement link in linksNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), xxx, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    XElement[] typesNode = query.ToArray();

                    foreach (XElement type in typesNode)
                    {
                        GenreServices.AddGenres(new[] { Util.GetElementValue(type, "RealName") }, xxx, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    XElement[] imagesNode = query.ToArray();

                    foreach (XElement images in imagesNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, xxx, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, xxx);
                            }
                        }
                    }
                    #endregion
                    #region Publisher
                    query = from item in node.Descendants("Studio")
                            select item;

                    XElement[] studioNode = query.ToArray();

                    foreach (XElement studio in studioNode)
                    {
                        bool isNew;
                        xxx.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(studio, "Name"), out isNew, "XXX_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("XXX_Studio", xxx.Publisher);
                        }
                    }
                    #endregion
                    #region Artist
                    query = from item in node.Descendants("Artist")
                            select item;

                    XElement[] artistNode = query.ToArray();

                    foreach (XElement artist in artistNode)
                    {
                        bool   isNew;
                        string fullname  = Util.GetElementValue(artist, "FulleName");
                        Artist newArtist = ArtistServices.Get(fullname, out isNew);

                        if (string.IsNullOrWhiteSpace(newArtist.Aka))
                        {
                            newArtist.Aka = Util.GetElementValue(artist, "Aka");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Bio))
                        {
                            newArtist.Bio = Util.GetElementValue(artist, "Bio");
                        }

                        if (newArtist.BirthDay == null && DateTime.TryParse(Util.GetElementValue(artist, "BirthDay"), out dateValue) == true)
                        {
                            newArtist.BirthDay = dateValue;
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Breast))
                        {
                            newArtist.Breast = Util.GetElementValue(artist, "Breast");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.Ethnicity))
                        {
                            newArtist.Ethnicity = Util.GetElementValue(artist, "Ethnicity");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.FirstName))
                        {
                            newArtist.FirstName = Util.GetElementValue(artist, "FirstName");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.LastName))
                        {
                            newArtist.LastName = Util.GetElementValue(artist, "LastName");
                        }

                        if (newArtist.Picture == null)
                        {
                            newArtist.Picture = Convert.FromBase64String(Util.GetElementValue(artist, "Picture"));
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.PlaceBirth))
                        {
                            newArtist.PlaceBirth = Util.GetElementValue(artist, "PlaceBirth");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.WebSite))
                        {
                            newArtist.WebSite = Util.GetElementValue(artist, "WebSite");
                        }

                        if (string.IsNullOrWhiteSpace(newArtist.YearsActive))
                        {
                            newArtist.YearsActive = Util.GetElementValue(artist, "YearsActive");
                        }

                        query = from item in artist.Descendants("Credit")
                                select item;

                        XElement[] creditsNode = query.ToArray();

                        foreach (XElement artistCredit in creditsNode)
                        {
                            ArtistCredits artistCredits = new ArtistCredits();

                            artistCredits.Title      = Util.GetElementValue(artistCredit, "Title");
                            artistCredits.BuyLink    = Util.GetElementValue(artistCredit, "BuyLink");
                            artistCredits.EntityType = EntityType.Movie;
                            artistCredits.Notes      = Util.GetElementValue(artistCredit, "Notes");

                            DateTime releaseDate;
                            if (DateTime.TryParse(Util.GetElementValue(artistCredit, "ReleaseDate"), out releaseDate) == true)
                            {
                                artistCredits.ReleaseDate = releaseDate;
                            }

                            if (string.IsNullOrWhiteSpace(artistCredits.Title) == false && string.IsNullOrWhiteSpace(newArtist.FulleName) == false)
                            {
                                if (Dal.GetInstance.GetArtistCredit(artistCredits.Title, newArtist.FulleName) == null)
                                {
                                    newArtist.ArtistCredits.Add(artistCredits);
                                }
                            }
                        }

                        ArtistServices.AddArtist(new[] { newArtist }, xxx);
                    }


                    #endregion

                    Dal.GetInstance.AddXxx(xxx);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
 public WordBackgroundFormatter(Configuration configuration)
 {
     this.languageSevices = new LanguageServices(configuration);
 }
Beispiel #20
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    //exit if the user cancels
                    if (_isCancelationPending == true)
                    {
                        return;
                    }

                    Apps apps = new Apps();
                    apps.Title       = Util.GetElementValue(node, "Title");
                    apps.BarCode     = Util.GetElementValue(node, "BarCode");
                    apps.Comments    = Util.GetElementValue(node, "Comments");
                    apps.Description = Util.GetElementValue(node, "Description");
                    apps.FileName    = Util.GetElementValue(node, "FileName");
                    apps.FilePath    = Util.GetElementValue(node, "FilePath");
                    apps.Version     = Util.GetElementValue(node, "Version");

                    #region DateTime
                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        apps.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        apps.ReleaseDate = dateValue;
                    }
                    #endregion
                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        apps.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        apps.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsTested"), out boolValue) == true)
                    {
                        apps.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        apps.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        apps.ToBeDeleted = boolValue;
                    }
                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out longValue) == true)
                    {
                        apps.MyRating = longValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] bookNode = query.ToArray();

                    foreach (XElement media in bookNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        apps.Media    = newMedia;
                    }
                    #endregion
                    #region Publisher
                    query = from item in node.Descendants("Editor")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement editor in bookNode)
                    {
                        bool isNew;
                        apps.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", apps.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement languages in bookNode)
                    {
                        apps.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement link in bookNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), apps, true);
                    }

                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement type in bookNode)
                    {
                        GenreServices.AddGenres(new [] { Util.GetElementValue(type, "RealName") }, apps, true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    bookNode = query.ToArray();

                    foreach (XElement images in bookNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, apps, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, apps);
                            }
                        }
                    }
                    #endregion

                    Dal.GetInstance.AddApps(apps);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
Beispiel #21
0
        private void AddBooks(string[] strTemp, string strTitle, string strFileName, string strFilePath)
        {
            Media objMedia = MediaServices.Get(_strMediaName.Trim(), _mediaType, _path,
                                               _cleanTitle, _entityType, _patternType, _useSubFolder, _bGetImage, _bParseNfo, true);

            const string strBookFormat = "Unknown";
            FileFormat   objFormat     = BookServices.GetFormat(strBookFormat, true);

            //Fix since 2.7.12.0
            strTitle = strTitle.Replace("EPub", "");
            strTitle = strTitle.Replace("Epub", "");
            strTitle = strTitle.Replace("Mobi", "");
            strTitle = strTitle.Replace("epub", "");
            strTitle = strTitle.Replace("mobi", "");
            strTitle = strTitle.Replace(".", " ");
            strTitle = strTitle.Trim();


            Books objBooks = new Books();

            objBooks.Ressources = new List <Ressource>();
            objBooks.Title      = strTitle;
            objBooks.AddedDate  = DateTime.Now;
            #region File

            objBooks.FileName = strFileName;
            objBooks.FilePath = strFilePath;

            #endregion
            if (_mapping != null)
            {
                string strLanguage = Util.ConstructString(strTemp, (string[])_mapping["Language"], _nbrBaseParsing);
                objBooks.Language = LanguageServices.GetLanguage(strLanguage, true);
            }

            objBooks.FileFormat = objFormat;
            objBooks.Media      = objMedia;
            #region Cover

            if (_bGetImage == true)
            {
                RessourcesServices.AddImage(Util.GetLocalImage(objBooks.FilePath, objBooks.FileName, _bFile), objBooks, true);
            }
            int index;
            if (RessourcesServices.GetDefaultCover(objBooks, out index) == null)
            {
                DirectoryInfo objFolder;

                if (_bFile == false)
                {
                    objFolder = new DirectoryInfo(objBooks.FilePath + @"\" + objBooks.FileName);
                }
                else
                {
                    objFolder = new DirectoryInfo(objBooks.FilePath);
                }

                FileInfo[] lstPdf = objFolder.GetFiles("*.pdf", SearchOption.AllDirectories);

                if (lstPdf.Any())
                {
                    RessourcesServices.AddImage(Util.GetImageFromPdf(lstPdf[0].FullName), objBooks, true);
                }
            }

            #endregion
            if (string.IsNullOrEmpty(objBooks.Title) == false)
            {
                bool bExist = false;
                if (Dal.GetInstance.GetBooks(objBooks.Media.Name, objBooks.FilePath, objBooks.FileName) != null)
                {
                    bExist = true;
                }

                if (bExist == false)
                {
                    #region ParseNfo

                    if (_bParseNfo == true)
                    {
                        string errorMessage;
                        BookServices.ParseNfo(objBooks, out errorMessage);
                    }
                    #endregion
                    Dal.GetInstance.AddBook(objBooks);
                    _intAddedItem++;
                }
                else
                {
                    _intNotAddedItem++;
                }
            }
        }
Beispiel #22
0
 public UserBasketController(UserBasketServices userBasket, LanguageServices languageServices)
 {
     _userBasket       = userBasket;
     _languageServices = languageServices;
 }
Beispiel #23
0
 public KeywordResolver(string language)
 {
     this.languageServices = new LanguageServices(language);
 }
 public HomeController(LoginServices loginServices, ProductServices productServices, LanguageServices languageServices)
 {
     _loginServices    = loginServices;
     _productServices  = productServices;
     _languageServices = languageServices;
 }
Beispiel #25
0
 public WordBackgroundFormatter(Configuration configuration)
 {
     this.languageSevices = new LanguageServices(configuration);
 }
Beispiel #26
0
        private void AddXxx(string[] strTemp, string strTitle,
                            string strFileName,
                            string strFilePath)
        {
            Media objMedia = MediaServices.Get(_strMediaName.Trim(), _mediaType, _path,
                                               _cleanTitle, _entityType, _patternType, _useSubFolder, _bGetImage, _bParseNfo, true);

            XXX objEntity = new XXX();

            objEntity.Ressources = new List <Ressource>();
            objEntity.Media      = objMedia;
            objEntity.Title      = strTitle;
            objEntity.FilePath   = strFilePath;
            objEntity.AddedDate  = DateTime.Now;
            objEntity.Ressources = new List <Ressource>();
            objEntity.Genres     = new List <Genre>();
            objEntity.Audios     = new List <Audio>();
            objEntity.Subtitles  = new List <Language>();
            objEntity.Artists    = new List <Artist>();


            #region File

            objEntity.FileName = strFileName;

            #endregion
            #region Language

            if (_mapping != null)
            {
                string strLanguage = Util.ConstructString(strTemp, (string[])_mapping["Language"], _nbrBaseParsing);
                objEntity.Language = LanguageServices.GetLanguage(strLanguage, true);
            }

            #endregion

            if (_bGetImage == true)
            {
                RessourcesServices.AddImage(Util.GetLocalImage(objEntity.FilePath, objEntity.FileName, _bFile), objEntity, true);
            }

            if (string.IsNullOrEmpty(objEntity.Title) == false)
            {
                bool bExist = false;
                if (Dal.GetInstance.GetXxXs(objEntity.Media.Name, objEntity.FilePath, objEntity.FileName) != null)
                {
                    bExist = true;
                }

                if (bExist == false)
                {
                    #region MediaInfo
                    FileInfo file = new FileInfo(Path.Combine(strFilePath, strFileName));
                    if (file.Attributes == FileAttributes.Directory)
                    {
                        if (Directory.Exists(file.FullName) == true)
                        {
                            string[] lstFile = Util.GetFiles(file.FullName, new [] { "*.mkv", "*.mp4", "*.avi", "*.divx" });

                            if (lstFile.Any())
                            {
                                XxxServices.Fill(MediaInfoService.getInfo(lstFile[0], objEntity.Id), objEntity);
                            }
                        }
                    }
                    else if (file.Attributes == FileAttributes.Normal)
                    {
                        XxxServices.Fill(MediaInfoService.getInfo(file.FullName, objEntity.Id), objEntity);
                    }

                    #endregion

                    #region ParseNfo

                    if (_bParseNfo == true)
                    {
                        string errorMessage;
                        XxxServices.ParseNfo(objEntity, out errorMessage);
                    }
                    #endregion
                    Dal.GetInstance.AddXxx(objEntity);

                    _intAddedItem++;
                }
                else
                {
                    _intNotAddedItem++;
                }
            }
        }
Beispiel #27
0
 public Mapper(IConfiguration configuration, string featureLanguage = LanguageServices.DefaultLanguage)
 {
     this.configuration    = configuration;
     this.languageServices = new LanguageServices(featureLanguage);
 }
Beispiel #28
0
 public Mapper(IConfiguration configuration, string featureLanguage = LanguageServices.DefaultLanguage)
 {
     this.configuration = configuration;
     this.languageServices = new LanguageServices(featureLanguage);
 }
Beispiel #29
0
        private void worker_DoWork_XML(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _selectedItems.Length;

                foreach (XElement node in _selectedItems)
                {
                    Gamez games = new Gamez();
                    games.Title       = Util.GetElementValue(node, "Title");
                    games.BarCode     = Util.GetElementValue(node, "BarCode");
                    games.Comments    = Util.GetElementValue(node, "Comments");
                    games.Description = Util.GetElementValue(node, "Description");
                    games.FileName    = Util.GetElementValue(node, "FileName");
                    games.FilePath    = Util.GetElementValue(node, "FilePath");

                    DateTime dateValue;

                    if (DateTime.TryParse(Util.GetElementValue(node, "AddedDate"), out dateValue) == true)
                    {
                        games.AddedDate = dateValue;
                    }

                    if (DateTime.TryParse(Util.GetElementValue(node, "ReleaseDate"), out dateValue) == true)
                    {
                        games.ReleaseDate = dateValue;
                    }

                    #region Bool
                    bool boolValue;

                    if (bool.TryParse(Util.GetElementValue(node, "IsComplete"), out boolValue) == true)
                    {
                        games.IsComplete = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsDeleted"), out boolValue) == true)
                    {
                        games.IsDeleted = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsTested"), out boolValue) == true)
                    {
                        games.Watched = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "IsWhish"), out boolValue) == true)
                    {
                        games.IsWhish = boolValue;
                    }

                    if (bool.TryParse(Util.GetElementValue(node, "ToBeDeleted"), out boolValue) == true)
                    {
                        games.ToBeDeleted = boolValue;
                    }

                    #endregion
                    #region Long
                    int longValue;

                    if (int.TryParse(Util.GetElementValue(node, "Price"), out longValue) == true)
                    {
                        games.Price = longValue;
                    }

                    if (int.TryParse(Util.GetElementValue(node, "Rated"), out longValue) == true)
                    {
                        games.Rated = longValue.ToString(CultureInfo.InvariantCulture);
                    }

                    #endregion
                    #region int
                    int intValue;

                    if (int.TryParse(Util.GetElementValue(node, "Rating"), out intValue) == true)
                    {
                        games.MyRating = intValue;
                    }
                    #endregion
                    #region Media
                    var query = from item in node.Descendants("Media")
                                select item;

                    XElement[] mediaNode = query.ToArray();

                    foreach (XElement media in mediaNode)
                    {
                        Media newMedia = MediaServices.Get(Util.GetElementValue(media, "Name"), true);
                        newMedia.Path = Util.GetElementValue(media, "Path");
                        games.Media   = newMedia;
                    }
                    #endregion
                    #region Links
                    query = from item in node.Descendants("Link")
                            select item;

                    XElement[] linksNode = query.ToArray();

                    foreach (XElement link in linksNode)
                    {
                        LinksServices.AddLinks(Util.GetElementValue(link, "Path"), games, true);
                    }
                    #endregion
                    #region Types
                    query = from item in node.Descendants("Type")
                            select item;

                    XElement[] typekNode = query.ToArray();

                    foreach (XElement type in typekNode)
                    {
                        GenreServices.AddGenres(new[] { Util.GetElementValue(type, "RealName") }, games, true);
                    }
                    #endregion
                    #region Platform
                    query = from item in node.Descendants("Platform")
                            select item;

                    XElement[] platformNode = query.ToArray();

                    foreach (XElement type in platformNode)
                    {
                        games.Platform = GameServices.GetPlatform(Util.GetElementValue(type, "Name"), true);
                    }
                    #endregion
                    #region Image
                    query = from item in node.Descendants("Ressource")
                            select item;

                    XElement[] imagesNode = query.ToArray();

                    foreach (XElement images in imagesNode)
                    {
                        if (Util.GetElementValue(images, "ResourcesType") == "Image")
                        {
                            bool   isDefault = bool.Parse(Util.GetElementValue(images, "IsDefault"));
                            byte[] cover     = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddImage(cover, games, isDefault);
                            }
                        }
                        if (Util.GetElementValue(images, "ResourcesType") == "Background")
                        {
                            byte[] cover = Convert.FromBase64String(Util.GetElementValue(images, "Value"));

                            if (cover.Length > 0)
                            {
                                RessourcesServices.AddBackground(cover, games);
                            }
                        }
                    }
                    #endregion
                    #region Publisher
                    query = from item in node.Descendants("Editor")
                            select item;

                    XElement[] editorNode = query.ToArray();

                    foreach (XElement editor in editorNode)
                    {
                        bool isNew;
                        games.Publisher = PublisherServices.GetPublisher(Util.GetElementValue(editor, "Name"), out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", games.Publisher);
                        }
                    }
                    #endregion
                    #region Language
                    query = from item in node.Descendants("Language")
                            select item;

                    XElement[] languageNode = query.ToArray();

                    foreach (XElement languages in languageNode)
                    {
                        games.Language = LanguageServices.GetLanguage(Util.GetElementValue(languages, "DisplayName"), true);
                    }
                    #endregion
                    Dal.GetInstance.AddGame(games);
                    _intAddedItem++;

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }