Exemplo n.º 1
0
        public static void FileNotFoundLog(FileNotFoundException e)
        {
            List <string> log = new List <string>();

            log.Add("FileNotFoundError");
            log.Add(e.Message);
            Errorlogs.PrintLogs(log);
        }
Exemplo n.º 2
0
        public static void InputNoCorrectNumberLog(ArgumentOutOfRangeException e)
        {
            List <string> log = new List <string>();

            log.Add("InputNoCorrectNumberError");
            log.Add("Fehlermeldung: " + e.Message);
            log.Add("Fehler bei der Auswahl des Songs.");
            log.Add("Fehlerbehebung: Programm mit Song erneut starten, nur 1, 2 oder 3 eingeben.");
            Errorlogs.PrintLogs(log);
        }
Exemplo n.º 3
0
        public static void SongNameNotFoundLog(System.Net.WebException e, string songname)
        {
            List <string> log = new List <string>();

            log.Add("SongNameNotFoundError");
            log.Add("Fehlermeldung: " + e.Message);
            log.Add("Der Song \"" + songname + "\" konnte nicht in der CCLI-Datenbank gefunden werden.");
            log.Add("Fehlerbehebung: CCLI-Nummer überprüfen, ggf. ändern und Programm neustarten");
            Errorlogs.PrintLogs(log);
        }
Exemplo n.º 4
0
        public static void OpenedWithWrongArgumentsLog(string[] args)
        {
            List <string> log = new List <string>();

            log.Add("OpenedWithWrongArgumentsError");
            log.Add("Folgende Argumente wurden angegeben:");
            foreach (string item in args)
            {
                log.Add(item);
            }
            Errorlogs.PrintLogs(log);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            string inputFileDirectory = "";

            if (args.Length == 1 && args[0].EndsWith(".txt"))
            {
                Logfiles.InitializingSuccededLog();
                inputFileDirectory = args[0];
            }
            else
            {
                Console.WriteLine("Bitte mit einer .TXT Datei öffnen!");
                Errorlogs.OpenedWithWrongArgumentsLog(args);
                Console.WriteLine("Zum Beenden Enter drücken.");
                Console.ReadLine();
                Environment.Exit(0);
            }

            StreamReader inputReader = new StreamReader(inputFileDirectory);
            string       currentReaderLine;

            string[] linesInOutputFile = new string[0];

            try
            {
                //Reads every line in the Output File to check for duplicates later
                linesInOutputFile = File.ReadAllLines("Output.ccli");
            }
            catch (FileNotFoundException e)
            {
                //Creates File Output.ccli if necessary
                Errorlogs.FileNotFoundLog(e);
                OutputHandling.CreateFile(e.FileName);
            }

            //Reads Input File
            while ((currentReaderLine = inputReader.ReadLine()) != null)
            {
                int cclinumber;
                if (int.TryParse(currentReaderLine, out cclinumber))
                {
                    InputIsAnInteger(cclinumber, linesInOutputFile);
                }
                else
                {
                    Console.WriteLine("Bitte nur CCLI-Nummern angeben!");
                }
            }

            inputReader.Close();
            Console.WriteLine("Enter drücken zum Beenden");
            Console.ReadLine();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Downloads HTML-Text of searchresults by pasting the CCLI-Number into the URL
        /// </summary>
        /// <returns>Songname or "noSongnameError" as Songname</returns>
        public string DownloadWebsiteByNumber()
        {
            WebClient webclient = new System.Net.WebClient();

            try
            {
                string webdata = webclient.DownloadString("https://de.songselect.com/songs/" + this.number);
                return(webdata);
            }

            catch (WebException e)
            {
                Console.WriteLine("Fehler bei Song {0}. Bitte Error-Logs überprüfen!", this.number);
                Errorlogs.SongnameNotFoundLog(e, this.number);
                string noSongname = "noSongnameError";
                return(noSongname);
            }
        }