Ejemplo n.º 1
0
        /// <summary>
        /// Shows logs
        /// </summary>
        /// <param name="m">Handle to previous window</param>
        /// <param name="fileName">File name</param>
        /// <param name="source">Choose directory: 1 - logs from apache, 2 - logs from archive</param>
        public showLog(MainWindow m, string fileName, int source)
        {
            this.mw = m;
            this.s  = source;
            this.fn = fileName;
            InitializeComponent();
            rtbShowLog.SelectAll();
            rtbShowLog.Cut();
            rtbShowLog.AppendText(lm.showLog(fileName, source));

            string logDirectory;

            if (source == 1)
            {
                logDirectory = rc.getValue("logLocation");                   //get log directory from registy
            }
            else
            {
                logDirectory = rc.getValue("backupLocation");
            }
            tbdirectory.Text = logDirectory + "\\" + fileName;

            if (source == 2)
            {
                clearlog.Visibility     = Visibility.Hidden;
                addtoarchove.Visibility = Visibility.Hidden;
            }
            else
            {
                clearlog.Visibility     = Visibility.Visible;
                addtoarchove.Visibility = Visibility.Visible;
            }
        }
        public disactiveModule(MainWindow m)
        {
            this.mw = m;
            InitializeComponent();
            Class.registryClass rg   = new Class.registryClass();
            string       dir         = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
            FileStream   fin         = new FileStream(dir, FileMode.Open);
            StreamReader fstr_in     = new StreamReader(fin);
            string       data        = fstr_in.ReadToEnd();
            int          firstmodule = data.IndexOf("LoadModule ");

            data = data.Remove(0, firstmodule - 2);
            string[] datalines = data.Split('\n');
            string   buf;

            foreach (string line in datalines)
            {
                if (line.Contains("LoadModule "))
                {
                    buf = line.Remove(0, line.IndexOf("e ") + 2);
                    buf = buf.Remove(buf.IndexOf(" "));
                    lbmodules.Items.Add(buf);
                }
            }
            fstr_in.Close();
            fin.Close();
        }
Ejemplo n.º 3
0
        public mainConfigurationFiles(MainWindow m)
        {
            this.mw = m;
            InitializeComponent();
            Class.registryClass rg   = new Class.registryClass();
            string apacheLogLocation = rg.getValue("apacheLocation") + "\\conf";

            if (!Directory.Exists(apacheLogLocation))
            {
                MessageBox.Show("Brak plików konfiguracyjnych! Przywróć dane z kopi zapasowej", "ERROR");
            }
            else
            {
                string[] files = Directory.GetFiles(apacheLogLocation, "*.conf");
                foreach (string dir in files)
                {
                    lbFiles.Items.Add(dir.Remove(0, apacheLogLocation.Length + 1));
                }
                apacheLogLocation += "\\extra";
                files              = Directory.GetFiles(apacheLogLocation, "*.conf");
                if (!Directory.Exists(apacheLogLocation))
                {
                    MessageBox.Show("Brak plików konfiguracyjnych! Przywróć dane z kopi zapasowej", "ERROR");
                }
                else
                {
                    foreach (string dir in files)
                    {
                        lbFiles.Items.Add(dir.Remove(0, apacheLogLocation.Length - 5));
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Deactive module in httpd.conf
 /// </summary>
 /// <param name="moduleName">Module name in httpd.conf</param>
 /// <returns></returns>
 public bool deactiveModule(string moduleName)
 {
     try
     {
         Class.registryClass rg = new Class.registryClass();
         string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
         FileStream   fin       = new FileStream(dir, FileMode.Open);
         StreamReader fstr_in   = new StreamReader(fin);
         string       data      = fstr_in.ReadToEnd();
         fstr_in.Close();
         fin.Close();
         int          indexofname = data.IndexOf(" " + moduleName + " ");
         string       buf         = data.Insert(indexofname - 10, "#");
         FileStream   fout        = new FileStream(dir, FileMode.Create);
         StreamWriter fstr_out    = new StreamWriter(fout);
         fstr_out.Write(buf);
         fstr_out.Close();
         fout.Close();
         return(true);
     }
     catch (Exception e)
     {
         MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
         return(false);
     }
 }
Ejemplo n.º 5
0
        public string showActualValue(string STRING)
        {
            /// <summary>
            /// Returns searched value from httpd.conf file
            /// </summary>

            try
            {
                Class.registryClass rg = new Class.registryClass();
                string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
                FileStream   fin       = new FileStream(dir, FileMode.Open);
                StreamReader fstr_in   = new StreamReader(fin);
                string       data      = fstr_in.ReadToEnd();
                fstr_in.Close();
                fin.Close();

                string buf = data.Remove(0, data.IndexOf(STRING));
                data = buf.Remove(data.IndexOf("\n"));


                string[] datalines = buf.Split('\n');


                data = datalines[1];

                return(data);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Błąd: " + ex.Message);
            }
            return("0");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Checking configuration file and preparing it
        /// </summary>
        /// <returns></returns>
        public bool checkConfigureModules()
        {
            try
            {
                Class.registryClass rg = new Class.registryClass();
                string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
                FileStream   fin       = new FileStream(dir, FileMode.Open);
                StreamReader fstr_in   = new StreamReader(fin);

                string data = fstr_in.ReadToEnd();
                fstr_in.Close();
                fin.Close();
                if (data.Contains("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                {
                    return(true);
                }
                else
                {
                    if (configureModules())
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
                return(false);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Acctive module
        /// </summary>
        /// <param name="moduleName">Module name in httpd.conf</param>
        /// <returns></returns>
        public bool activeModule(string moduleName)
        {
            try{
                Class.registryClass rg = new Class.registryClass();
                string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
                FileStream   fin       = new FileStream(dir, FileMode.Open);
                StreamReader fstr_in   = new StreamReader(fin);
                string       data      = fstr_in.ReadToEnd();
                fstr_in.Close();
                fin.Close();
                int indexofname = data.IndexOf(" " + moduleName + " ");
                if (indexofname > data.IndexOf("#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!") || indexofname < data.IndexOf("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                {
                    return(false);
                }
                string       buf      = data.Remove(indexofname - 11, 1);
                FileStream   fout     = new FileStream(dir, FileMode.Create);
                StreamWriter fstr_out = new StreamWriter(fout);
                fstr_out.Write(buf);
                fstr_out.Close();
                fout.Close();

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
                return(false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Showing, hiding buttons and loading data to listbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbsource_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            Class.registryClass registry = new Class.registryClass();
            string apacheLogLocation     = registry.getValue("apacheLocation") + "\\logs\\";
            string archiveLocation       = registry.getValue("logLocation");

            if (!Directory.Exists(apacheLogLocation))
            {
                Directory.CreateDirectory(apacheLogLocation);
            }
            if (!Directory.Exists(archiveLocation))
            {
                Directory.CreateDirectory(archiveLocation);
            }
            try
            {
                string[] apacheLogFiles  = Directory.GetFiles(apacheLogLocation, "*.log");
                string[] archiveLogFiles = Directory.GetFiles(archiveLocation, "*.log");
                if (cbsource.SelectedIndex == 1)
                {
                    lbLogs.Items.Clear();
                    foreach (string dir in apacheLogFiles)
                    {
                        lbLogs.Items.Add(dir.Remove(0, apacheLogLocation.Length));
                    }
                    deletearchive.Visibility = Visibility.Hidden;
                    addtoarchive.Visibility  = Visibility.Visible;
                    clearlog.Visibility      = Visibility.Visible;
                }
                if (cbsource.SelectedIndex == 2)
                {
                    lbLogs.Items.Clear();
                    foreach (string dir in archiveLogFiles)
                    {
                        lbLogs.Items.Add(dir.Remove(0, archiveLocation.Length + 1));
                    }
                    addtoarchive.Visibility  = Visibility.Hidden;
                    clearlog.Visibility      = Visibility.Hidden;
                    deletearchive.Visibility = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Class.mail
        /// </summary>
        /// <param name="s">Sender's email address</param>
        /// <param name="uname">Username (SMTP server login)</param>
        /// <param name="passwd">Password (SMTP)</param>
        public mail()
        {
            string uname  = rc.getValue("emailUname");
            string passwd = rc.getValue("emailPassword");
            string s      = rc.getValue("email");

            this.client  = new SmtpClient(rc.getValue("auditSMTP"));
            this.sender  = s;
            this.address = new MailAddress(s);
            this.client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            this.basicCredential.UserName     = uname;
            this.basicCredential.Password     = passwd;
            this.client.UseDefaultCredentials = false;
            this.client.Credentials           = this.basicCredential;
            this.client.EnableSsl             = true;
            this.client.Port = 587;
            message.From     = address;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Adding module to configuration file(default deactive), and copy module file to module location
        /// </summary>
        /// <param name="moduleName"></param>
        /// <param name="moduleLocation"></param>
        /// <returns></returns>
        public string addModule(string moduleName, string moduleLocation)
        {
            try
            {
                Class.registryClass rg = new Class.registryClass();
                string apachelocation  = rg.getValue("apacheLocation");
                string filename        = moduleLocation;
                while (filename.Contains('\\'))
                {
                    filename = filename.Remove(0, filename.IndexOf('\\') + 1);
                }
                filename = "modules/" + filename;
                string apachemodulelocation = apachelocation + "/" + filename;
                if (File.Exists(apachemodulelocation))
                {
                    return("Nie można dodać. Ten plik istnieje.");
                }
                else
                {
                    File.Copy(moduleLocation, apachemodulelocation); // w tym miejscu dokonano skopiowania krok 1
                }

                SortedDictionary <string, string> modules = returnModuleList(0);
                modules.Add(moduleName, filename);       //w tym miejscu dodano do słownika nazwe modułu i lokalizacje

                FileStream   fin     = new FileStream(apachelocation + "/conf/httpd.conf", FileMode.Open);
                StreamReader fstr_in = new StreamReader(fin);
                string       data    = fstr_in.ReadToEnd();
                fstr_in.Close();
                fin.Close();
                int start = data.IndexOf("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!") + 55;
                int stop  = data.IndexOf("#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!") - start;
                data  = data.Remove(start, stop);
                start = data.IndexOf("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!") + 55;
                string line = "";
                data = data.Insert(start, "\n");
                foreach (KeyValuePair <string, string> pair in modules)
                {
                    line   = "#LoadModule " + pair.Key + " " + pair.Value + "\n";
                    data   = data.Insert(start, line);
                    start += line.Length;
                }

                FileStream   fout     = new FileStream(apachelocation + "\\conf\\httpd.conf", FileMode.Truncate);
                StreamWriter fstr_out = new StreamWriter(fout);
                fstr_out.Write(data);
                fstr_out.Close();
                fout.Close();
                return("true");
            }
            catch (Exception e)
            { return(e.ToString()); }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Adding starting and ending label to httpd.conf
 /// </summary>
 /// <returns></returns>
 public bool configureModules()
 {
     try
     {
         Class.registryClass rg = new Class.registryClass();
         string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
         FileStream   fin       = new FileStream(dir, FileMode.Open);
         StreamReader fstr_in   = new StreamReader(fin);
         string       data      = fstr_in.ReadToEnd();
         fstr_in.Close();
         fin.Close();
         int firstmodule = 0;
         if (data.IndexOf("\nLoadModule") > data.IndexOf("\n#LoadModule"))
         {
             firstmodule = data.IndexOf("\n#LoadModule");
         }
         else
         {
             firstmodule = data.IndexOf("\nLoadModule");
         }
         data = data.Insert(firstmodule - 1, "\n\n\n#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!");
         string[] datalines = data.Split('\n');
         int      secmodule = 0;
         foreach (string line in datalines)
         {
             if (line.Contains("#LoadModule "))
             {
                 secmodule = data.IndexOf(line) + line.Length;
             }
             if (line.Contains("LoadModule "))
             {
                 firstmodule = data.IndexOf(line) + line.Length;
             }
         }
         if (firstmodule < secmodule)
         {
             firstmodule = secmodule;
         }
         data = data.Insert(firstmodule, "\n#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!\n\n");
         FileStream   fout     = new FileStream(dir, FileMode.Truncate);
         StreamWriter fstr_out = new StreamWriter(fout);
         fstr_out.Write(data);
         fout.Close();
         fstr_out.Close();
         return(true);
     }
     catch (Exception e)
     {
         MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
         return(false);
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Deleting module from configuration file and module file
        /// </summary>
        /// <param name="moduleName">Name of module from httpd.conf</param>
        /// <param name="modulelocation">Location of module from httpd.conf</param>
        /// <returns></returns>
        public bool deleteModule(string moduleName, string modulelocation)
        {
            try
            {
                Class.registryClass rg      = new Class.registryClass();
                string       apachelocation = rg.getValue("apacheLocation");
                string       httpdlocation  = apachelocation + "\\conf\\httpd.conf";
                FileStream   fin            = new FileStream(httpdlocation, FileMode.Open);
                StreamReader fstr_in        = new StreamReader(fin);
                string       data           = fstr_in.ReadToEnd();
                fstr_in.Close();
                fin.Close();
                int    indexofname;
                int    lngth;
                string newdata;
                if (data.Contains("#LoadModule " + moduleName))
                {
                    indexofname = data.IndexOf("#LoadModule " + moduleName);
                    lngth       = data.IndexOf(modulelocation) + modulelocation.Length - indexofname;
                    newdata     = data.Remove(indexofname, lngth + 1);
                }
                else
                {
                    indexofname = data.IndexOf("LoadModule " + moduleName);
                    lngth       = data.IndexOf(modulelocation) + modulelocation.Length - indexofname;
                    newdata     = data.Remove(indexofname, lngth + 1);
                }
                if (modulelocation.Contains('"'))
                {
                    modulelocation = modulelocation.Remove(modulelocation.IndexOf("\""), 1);
                    modulelocation = modulelocation.Remove(modulelocation.IndexOf("\""), 1);
                    File.Delete(modulelocation);
                }
                else
                {
                    modulelocation = modulelocation.Remove(0, modulelocation.IndexOf('/'));
                    File.Delete(apachelocation + "\\modules\\" + modulelocation);
                }

                FileStream   fout     = new FileStream(httpdlocation, FileMode.Truncate);
                StreamWriter fstr_out = new StreamWriter(fout);
                fstr_out.Write(newdata);
                fstr_out.Close();
                fout.Close();
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
                return(false);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Rewrite extra\\httpd-vhosts.conf
 /// </summary>
 /// <param name="data"></param>
 /// <returns>Configuration file content</returns>
 public bool vhwrite(string data)
 {
     try
     {
         Class.registryClass rg      = new Class.registryClass();
         string       apachelocation = rg.getValue("apacheLocation");
         string       dir            = apachelocation + "\\conf\\extra\\httpd-vhosts.conf";
         FileStream   fout           = new FileStream(dir, FileMode.Truncate);
         StreamWriter fstr_out       = new StreamWriter(fout);
         fstr_out.Write(data);
         fstr_out.Close();
         fout.Close();
         return(true);
     }
     catch (Exception e)
     {
         MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
         return(false);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Return extra/httpd-vhosts.conf
 /// </summary>
 /// <returns></returns>
 public string vhread()
 {
     try
     {
         Class.registryClass rg      = new Class.registryClass();
         string       apachelocation = rg.getValue("apacheLocation");
         string       dir            = apachelocation + "\\conf\\extra\\httpd-vhosts.conf";
         FileStream   fin            = new FileStream(dir, FileMode.Open);
         StreamReader fstr_in        = new StreamReader(fin);
         string       data           = fstr_in.ReadToEnd();
         fstr_in.Close();
         fin.Close();
         return(data);
     }
     catch (Exception e)
     {
         MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
         return(null);
     }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Add configuration to RichTextBox
 /// </summary>
 /// <param name="m"></param>
 public editConfigurationFile(MainWindow m, string fileName)
 {
     try
     {
         this.mw = m;
         InitializeComponent();
         string dir = rg.getValue("apacheLocation") + "\\conf\\" + fileName;
         this.fn = dir;
         FileStream   fin     = new FileStream(dir, FileMode.Open);
         StreamReader fstr_in = new StreamReader(fin);
         rtbShowConfig.SelectAll();
         rtbShowConfig.Cut();
         rtbShowConfig.AppendText(fstr_in.ReadToEnd());
         fstr_in.Close();
         fin.Close();
     }
     catch (Exception e)
     {
         MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
     }
 }
Ejemplo n.º 16
0
        public void changeValue(string STRING, string changedValue)
        {
            /// <summary>
            /// Changing values
            /// </summary>

            Class.registryClass rg = new Class.registryClass();
            string       dir       = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
            FileStream   fin       = new FileStream(dir, FileMode.Open);
            StreamReader fstr_in   = new StreamReader(fin);
            string       data      = fstr_in.ReadToEnd();

            fstr_in.Close();
            fin.Close();

            string buf = data.Replace(STRING, changedValue);

            FileStream   fout     = new FileStream(dir, FileMode.Create);
            StreamWriter fstr_out = new StreamWriter(fout);

            fstr_out.Write(buf);
            fstr_out.Close();
            fout.Close();
        }
Ejemplo n.º 17
0
 private void btnSaveSettings_Click(object sender, RoutedEventArgs e)
 {
     if (this.checkSave.IsChecked == true)
     {
         this.rc.setValue("Configured", "true");
     }
     if (this.SO_Email.Text != this.rc.getValue("SO_EMAIL") || this.SO_Email.Text != String.Empty)
     {
         if (this.SO_Email.Text.Trim() != String.Empty && this.SO_Email.Text.Length > 0 && this.SO_Email.Text.Contains("@"))
         {
             rc.setValue("SO_EMAIL", this.SO_Email.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu email! Adres musi mieć formę : [email protected] ", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Address.Text != this.rc.getValue("AUDITSMTP") || this.SMTP_Address.Text != String.Empty)
     {
         if (this.SMTP_Address.Text.Trim() != String.Empty && this.SMTP_Address.Text.Contains(".") && this.SMTP_Address.Text.Length > 0)
         {
             this.rc.setValue("AUDITSMTP", this.SMTP_Address.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu serwera SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.Server_Email.Text != this.rc.getValue("EMAIL") || this.Server_Email.Text != String.Empty)
     {
         if (this.Server_Email.Text.Trim() != String.Empty && this.Server_Email.Text.Length > 0 && this.Server_Email.Text.Contains("@"))
         {
             rc.setValue("EMAIL", this.Server_Email.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu email! Adres musi mieć formę : [email protected] ", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Username.Text != rc.getValue("emailUname") || this.SMTP_Username.Text != String.Empty)
     {
         if (this.SMTP_Username.Text.Trim() != String.Empty && this.SMTP_Username.Text.Length > 0)
         {
             rc.setValue("emailUname", this.SMTP_Username.Text);
         }
         else
         {
             MessageBox.Show("Podaj nazwę użytkownika SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Password.Password != rc.getValue("emailPassword") && this.SMTP_Password.Password != String.Empty)
     {
         if (this.SMTP_Password.Password.Trim() != String.Empty && this.SMTP_Password.Password.Length > 0)
         {
             rc.setValue("emailPassword", this.SMTP_Password.Password);
         }
         else
         {
             MessageBox.Show("Podaj hasło użytkownika SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.serviceName.Text != this.rc.getValue("SERVICENAME") || this.serviceName.Text != String.Empty)
     {
         if (this.serviceName.Text.Trim() != String.Empty && this.serviceName.Text.Length > 0)
         {
             rc.setValue("SERVICENAME", this.serviceName.Text);
         }
         else
         {
             MessageBox.Show("Podaj nazwę usługi Apache", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Ejemplo n.º 18
0
 public serviceControl()
 {
     this.serviceName = rc.getValue("serviceName");
 }
Ejemplo n.º 19
0
 public Backup()
 {
     this.ApacheLocation = registry.getValue("ApacheLocation") + "\\conf";
     this.BackupLocation = registry.getValue("BackupLocation");
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Return dictionary of names and directory of modules
        /// </summary>
        /// <param name="searchrule">Shows: 0 - all modules, 1 - deactive modules, 2 - active modules</param>
        /// <returns>Key - module name, value - module directory</returns>
        public SortedDictionary <string, string> returnModuleList(int searchrule)
        {
            SortedDictionary <string, string> modules = new SortedDictionary <string, string>();

            try
            {
                Class.registryClass rg   = new Class.registryClass();
                string       dir         = rg.getValue("apacheLocation") + "\\conf\\httpd.conf";
                FileStream   fin         = new FileStream(dir, FileMode.Open);
                StreamReader fstr_in     = new StreamReader(fin);
                string       data        = fstr_in.ReadToEnd();
                int          firstmodule = data.IndexOf("LoadModule ");
                data = data.Remove(0, firstmodule - 2);
                string[] datalines = data.Split('\n');
                string   buf;
                bool     check = false;
                switch (searchrule)
                {
                case 0:
                    foreach (string line in datalines)
                    {
                        try
                        {
                            if (line.Contains("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                check = true;
                            }
                            if (check)
                            {
                                if (line.Contains("LoadModule ") && (!line.Contains("# LoadModule")))
                                {
                                    buf = line.Remove(0, line.IndexOf("e ") + 2);
                                    modules.Add(buf.Remove(buf.IndexOf(" ")), buf.Remove(0, buf.IndexOf(" ") + 1));
                                }
                            }
                            if (line.Contains("#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Błąd : " + e.Message, "Błąd",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    break;

                case 1:
                    foreach (string line in datalines)
                    {
                        try
                        {
                            if (line.Contains("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                check = true;
                            }
                            if (check)
                            {
                                if (line.Contains("#LoadModule "))
                                {
                                    buf = line.Remove(0, line.IndexOf("e ") + 2);
                                    modules.Add(buf.Remove(buf.IndexOf(" ")), buf.Remove(0, buf.IndexOf(" ") + 1));
                                }
                            }
                            if (line.Contains("#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Błąd : " + e.Message, "Błąd",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    break;

                case 2:
                    foreach (string line in datalines)
                    {
                        try
                        {
                            if (line.Contains("#HERE STARTS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                check = true;
                            }
                            if (check)
                            {
                                if (line[0] == 'L' && line.Contains("LoadModule "))
                                {
                                    buf = line.Remove(0, line.IndexOf("e ") + 2);
                                    modules.Add(buf.Remove(buf.IndexOf(" ")), buf.Remove(0, buf.IndexOf(" ") + 1));
                                }
                            }
                            if (line.Contains("#HERE ENDS CONFIGURATION MODULES, DON'T DELETE THIS!"))
                            {
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Błąd : " + e.Message, "Błąd",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    break;
                }
                fstr_in.Close();
                fin.Close();
                return(modules);
            }
            catch (Exception e)
            {
                MessageBox.Show("BŁĄD: " + e.ToString(), "ERROR");
                return(modules);
            }
        }