public override void ProcessCommand()
        {
            try
            {
                bool process =
                    ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
                    ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase);

                if (!process)
                {
                    return;
                }

                AniDB_AnimeRepository rep   = new AniDB_AnimeRepository();
                AniDB_Anime           anime = rep.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                string appPath =
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string filePath = Path.Combine(appPath, "Anime_HTTP");

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                string fileName         = string.Format("AnimeDoc_{0}.xml", AnimeID);
                string fileNameWithPath = Path.Combine(filePath, fileName);

                string rawXML = "";
                if (File.Exists(fileNameWithPath))
                {
                    StreamReader re = File.OpenText(fileNameWithPath);
                    rawXML = re.ReadToEnd();
                    re.Close();
                }

                AnimeXML xml = new AnimeXML();
                xml.AnimeID        = AnimeID;
                xml.AnimeName      = anime.MainTitle;
                xml.DateDownloaded = 0;
                xml.Username       = ServerSettings.AniDB_Username;
                xml.XMLContent     = rawXML;

                AzureWebAPI.Send_AnimeXML(xml);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
                return;
            }
        }
Ejemplo n.º 2
0
        public override void ProcessCommand()
        {
            try
            {
                bool process =
                    ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
                    ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase);

                if (!process)
                {
                    return;
                }

                SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                string filePath = ServerSettings.AnimeXmlDirectory;

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                string fileName         = string.Format("AnimeDoc_{0}.xml", AnimeID);
                string fileNameWithPath = Path.Combine(filePath, fileName);

                string rawXML = "";
                if (File.Exists(fileNameWithPath))
                {
                    StreamReader re = File.OpenText(fileNameWithPath);
                    rawXML = re.ReadToEnd();
                    re.Close();
                }

                Azure_AnimeXML xml = new Azure_AnimeXML
                {
                    AnimeID        = AnimeID,
                    AnimeName      = anime.MainTitle,
                    DateDownloaded = 0,
                    Username       = ServerSettings.AniDB_Username,
                    XMLContent     = rawXML
                };
                AzureWebAPI.Send_AnimeXML(xml);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
                return;
            }
        }
        public override void ProcessCommand()
        {
            try
            {
                bool process = false;

                if (!process)
                {
                    return;
                }

                SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                string filePath = ServerSettings.Instance.AnimeXmlDirectory;

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                string fileName         = $"AnimeDoc_{AnimeID}.xml";
                string fileNameWithPath = Path.Combine(filePath, fileName);

                string rawXML = string.Empty;
                if (File.Exists(fileNameWithPath))
                {
                    StreamReader re = File.OpenText(fileNameWithPath);
                    rawXML = re.ReadToEnd();
                    re.Close();
                }

                Azure_AnimeXML xml = new Azure_AnimeXML
                {
                    AnimeID        = AnimeID,
                    AnimeName      = anime.MainTitle,
                    DateDownloaded = 0,
                    Username       = ServerSettings.Instance.AniDb.Username,
                    XMLContent     = rawXML
                };
                AzureWebAPI.Send_AnimeXML(xml);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex);
            }
        }