Beispiel #1
0
        public static string[] GetAllEntries(MainWindow.EntryType entryType)
        {
            String fsvPath = HIS_REG_PATH + MainWindow.HISFSVGX + "\\Datenbank",
                   mbsPath = HIS_REG_PATH + MainWindow.HISMBSGX + "\\Datenbank",
                   svaPath = HIS_REG_PATH + MainWindow.HISSVAGX + "\\Datenbank",
                   cobPath = HIS_REG_PATH + MainWindow.HISCOBGX + "\\Datenbank";

            RegistryKey fsvKey = Registry.LocalMachine.OpenSubKey(fsvPath),
                        mbsKey = Registry.LocalMachine.OpenSubKey(mbsPath),
                        svaKey = Registry.LocalMachine.OpenSubKey(svaPath),
                        cobKey = Registry.LocalMachine.OpenSubKey(cobPath);

            if (fsvKey == null)
                Registry.LocalMachine.CreateSubKey(fsvPath);

            if (mbsKey == null)
                Registry.LocalMachine.CreateSubKey(mbsPath);

            if (svaKey == null)
                Registry.LocalMachine.CreateSubKey(svaPath);

            if (cobKey == null)
                Registry.LocalMachine.CreateSubKey(cobPath);

            string[] fsvValues = fsvKey.GetSubKeyNames();
            string[] mbsValues = mbsKey.GetSubKeyNames();
            string[] svaValues = svaKey.GetSubKeyNames();
            string[] cobValues = cobKey.GetSubKeyNames();

            string[] returnValues = new string[0];
            int originalLength = returnValues.Length;
            if ((entryType == MainWindow.EntryType.all) || (entryType == MainWindow.EntryType.FSV))
                returnValues = returnValues.Concat(fsvValues).Distinct().ToArray();
            if ((entryType == MainWindow.EntryType.all) || (entryType == MainWindow.EntryType.MBS))
                returnValues = returnValues.Concat(mbsValues).Distinct().ToArray();
            if ((entryType == MainWindow.EntryType.all) || (entryType == MainWindow.EntryType.SVA))
                returnValues = returnValues.Concat(svaValues).Distinct().ToArray();
            if ((entryType == MainWindow.EntryType.all) || (entryType == MainWindow.EntryType.COB))
                returnValues = returnValues.Concat(cobValues).Distinct().ToArray();

            return returnValues;
        }
Beispiel #2
0
        public static void DeleteEntry(string entry, MainWindow.EntryType entryLocation)
        {
            String fullEntry = "";
            if ((entryLocation == MainWindow.EntryType.all) || (entryLocation == MainWindow.EntryType.FSV))
            {
                fullEntry = HIS_REG_PATH + MainWindow.HISFSVGX + "\\Datenbank\\" + entry;
                if (Registry.LocalMachine.OpenSubKey(fullEntry) != null)
                    Registry.LocalMachine.DeleteSubKeyTree(fullEntry);
            }

            if ((entryLocation == MainWindow.EntryType.all) || (entryLocation == MainWindow.EntryType.MBS))
            {
                fullEntry = HIS_REG_PATH + MainWindow.HISMBSGX + "\\Datenbank\\" + entry;
                if (Registry.LocalMachine.OpenSubKey(fullEntry) != null)
                    Registry.LocalMachine.DeleteSubKeyTree(fullEntry);
            }

            if ((entryLocation == MainWindow.EntryType.all) || (entryLocation == MainWindow.EntryType.SVA))
            {
                fullEntry = HIS_REG_PATH + MainWindow.HISSVAGX + "\\Datenbank\\" + entry;
                if (Registry.LocalMachine.OpenSubKey(fullEntry) != null)
                    Registry.LocalMachine.DeleteSubKeyTree(fullEntry);
            }

            if ((entryLocation == MainWindow.EntryType.all) || (entryLocation == MainWindow.EntryType.COB))
            {
                fullEntry = HIS_REG_PATH + MainWindow.HISCOBGX + "\\Datenbank\\" + entry;
                if (Registry.LocalMachine.OpenSubKey(fullEntry) != null)
                    Registry.LocalMachine.DeleteSubKeyTree(fullEntry);
            }
        }