Exemple #1
0
 private void AddEditor(string name, string application, string arguments)
 {
     if (!string.IsNullOrEmpty(name) &&
         !string.IsNullOrEmpty(application) &&
         !string.IsNullOrEmpty(arguments))
     {
         EditorCollection.Add(new Editor(name, application, arguments));
     }
 }
Exemple #2
0
        /// <summary>
        /// Loads the image editors into the application from the editors.xml file.
        /// </summary>
        public static void Load()
        {
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + XML_FILE))
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(AppDomain.CurrentDomain.BaseDirectory + XML_FILE);

                XmlNodeList xeditors = xdoc.SelectNodes(EDITOR_XPATH);

                foreach (XmlNode xeditor in xeditors)
                {
                    Editor        editor  = new Editor();
                    XmlNodeReader xreader = new XmlNodeReader(xeditor);

                    while (xreader.Read())
                    {
                        if (xreader.IsStartElement())
                        {
                            switch (xreader.Name)
                            {
                            case EDITOR_NAME:
                                xreader.Read();
                                editor.Name = xreader.Value;
                                break;

                            case EDITOR_APPLICATION:
                                xreader.Read();
                                editor.Application = xreader.Value;
                                break;

                            case EDITOR_ARGUMENTS:
                                xreader.Read();
                                editor.Arguments = xreader.Value;
                                break;
                            }
                        }
                    }

                    xreader.Close();

                    if (!string.IsNullOrEmpty(editor.Name) &&
                        !string.IsNullOrEmpty(editor.Application) &&
                        !string.IsNullOrEmpty(editor.Arguments))
                    {
                        EditorCollection.Add(editor);
                    }
                }
            }
        }