Пример #1
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);
                    }
                }
            }
        }
Пример #2
0
 public static void Add(Editor editor)
 {
     m_editorList.Add(editor);
     Save();
 }