示例#1
0
        public Konfiguration(String filename, Logger log)
        {
            this.logger = log;
            this.logger.WriteLine("loading configuration...");

            // if $home/dspam/dspam-config.xml exists, load it
            // else load from $install_dir/dspam-config.xml
            this._file = filename;

            if (Directory.Exists(this._home_dir) == false)
            {
                Directory.CreateDirectory(this._home_dir);
            }

            if (File.Exists(this._home_dir + filename))
            {
                this.logger.WriteLine("using XML from $HOME");
                this.parser = new KonfigurationParser(this._home_dir + filename);
            }
            else
            {
                this.logger.WriteLine("using XML from DEFAULT_DIR");
                this.parser = new KonfigurationParser(this._default_dir + filename);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.DoEvents();

            try
            {
                KonfigurationParser kp = new KonfigurationParser(@"c:\dspam_config.xml");
                kp.Load();
                // Console.WriteLine(kp.getFileVersion());
                /*
                Konfiguration cfg = new Konfiguration(@"dspam_config.xml");
                cfg.Load();

                return;

                Logger logger = new Logger(@"c:\temp\addin.txt");

                Language lang = new Language(cfg, logger);
                lang.Load();

                Worker w = new Worker(cfg, logger, lang);
                w.Run(true);
                */

                // Console.WriteLine(lang.getToolbarCaption("cB_Button_AsSpam"));

                // MainForm af = new MainForm(cfg, logger, lang, null);
                // TrainingForm af = new TrainingForm(cfg, logger, lang);
                // AktionForm af = new AktionForm(cfg, logger, lang, mp);
                // af.ShowDialog();

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            /*
            Konfiguration cfg = new Konfiguration(@"dspam_config.xml");
            cfg.Load();

            Logger logger = new Logger(@"addin.txt");

            MainForm af = new MainForm(cfg, logger);
            af.ShowDialog();
            */
            /*
            try
            {
                KonfigurationParser cp = new KonfigurationParser(@"c:\dspam_config.xml");
                cp.Load();
                // Console.WriteLine(cp.getValue("AktionForm/rB_trainWith"));
                // Console.WriteLine(cfg.rB_trainWith);
                cp.setValue("TrainingForm/cB_useAutoTrain", "True");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
             */
        }