/// <summary>
        /// Чтение информации из файла формата IMS QTI 2.1.
        /// </summary>
        /// <param name="qfPath">Путь к файлу.</param>
        public override bool ReadQti(string qfPath)
        {
            XmlTextReader reader = new XmlTextReader(qfPath);
            bool result = true;
            Id = Guid.NewGuid();
            string HtmlText = "<HTML>\n<HEAD>\n<BASE href=\"" + Application.StartupPath +
                "\\\">\n</HEAD>\n<BODY>\n<P>";

            try
            {
                reader = new XmlTextReader(qfPath);
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name.Equals("assessmentItem", StringComparison.OrdinalIgnoreCase))
                        {
                            if (reader.GetAttribute("timeDependent") != null)
                            {
                                bool.TryParse(reader.GetAttribute("timeDependent"), out isTimeDependent);
                            }
                            if (reader.GetAttribute("identifier") != null)
                            {
                                identifier = reader.GetAttribute("identifier");
                            }
                            if (reader.GetAttribute("adaptive") != null)
                            {
                                bool.TryParse(reader.GetAttribute("adaptive"), out isAdaptive);
                            }
                            if (reader.GetAttribute("title") != null)
                            {
                                Text = reader.GetAttribute("title");
                            }
                            else Text = reader.GetAttribute("identifier");
                        }

                        if (reader.Name.Equals("correctResponse", StringComparison.OrdinalIgnoreCase))
                        {
                            bool endCycle = false;
                            ResponseVariant rv = new ResponseVariant(this);
                            rv.Weight = 1.0;

                            while (!endCycle && reader.Read())
                            {
                                if (reader.Name.Equals("value", StringComparison.OrdinalIgnoreCase))
                                {
                                    rv.Responses.Add(reader.ReadString());
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (reader.Name.Equals("correctResponse", StringComparison.OrdinalIgnoreCase))
                                    {
                                        endCycle = true;
                                    }
                                }
                            }
                            ResponseVariants.Add(rv);
                        }

                        if (reader.Name.Equals("itemBody", StringComparison.OrdinalIgnoreCase))
                        {
                            bool endCycle = false; // флаг окончания цикла
                            // считываем содержимое тега itemBody
                            while (!endCycle && reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    if (reader.Name.Equals("p", StringComparison.OrdinalIgnoreCase))
                                    {
                                        string s = reader.ReadInnerXml();
                                        HtmlText += "<P>" + ConvertXmlStringToHtml(s, qfPath) + "</P>";
                                    }

                                    if (reader.Name.Equals("img", StringComparison.OrdinalIgnoreCase))
                                    {
                                        try
                                        {
                                            // создаём папку для картинок проекта
                                            if (!Directory.Exists(Warehouse.Warehouse.RelativeImagesDirectory))
                                            {
                                                Directory.CreateDirectory(Warehouse.Warehouse.RelativeImagesDirectory);
                                            }
                                            // копируем туда картинку
                                            var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));

                                            // var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));
                                            File.Copy(Path.GetDirectoryName(qfPath) + "\\" + reader.GetAttribute("src"), destPath, true);
                                            // var inner = TagNames.ImageTagName;
                                            string height = reader.GetAttribute("height");
                                            string width = reader.GetAttribute("width");
                                            string align = reader.GetAttribute("align");
                                            string border = reader.GetAttribute("border");
                                            string hspace = reader.GetAttribute("hspace");
                                            string sf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));
                                            HtmlText += "<IMG" + " border=\"" + border + "\" hspace=\"" + hspace + "\" align=\"" + align + "\" sdocument=\"0\" src=\"" + sf + "\" height=\"" + height + "\" width=\"" + width + "\"" + ">";
                                        }
                                        catch (FileNotFoundException)
                                        {
                                            MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                            "Visual Editor",
                                                            MessageBoxButtons.OK,
                                                            MessageBoxIcon.Error);
                                        }
                                    }

                                    #region самодеятельность с медиа
                                    if (reader.Name.Equals("object", StringComparison.OrdinalIgnoreCase))
                                    {
                                        try
                                        {
                                            if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp4" || Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".flv")
                                            {
                                                if (!Directory.Exists(Warehouse.Warehouse.RelativeVideosDirectory))
                                                {
                                                    Directory.CreateDirectory(Warehouse.Warehouse.RelativeVideosDirectory);
                                                }
                                                // копируем туда картинку
                                                string data = reader.GetAttribute("data");
                                                var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorVideosDirectory, Path.GetFileName(data));
                                                var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                                File.Copy(sourcePath, destPath, true);

                                                string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Vid.png"));
                                                string sf = Path.Combine(Warehouse.Warehouse.RelativeVideosDirectory, Path.GetFileName(data));
                                                HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                            }

                                            else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp3")
                                            {
                                                if (!Directory.Exists(Warehouse.Warehouse.RelativeAudiosDirectory))
                                                {
                                                    Directory.CreateDirectory(Warehouse.Warehouse.RelativeAudiosDirectory);
                                                }
                                                // копируем туда картинку
                                                var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));
                                                var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(reader.GetAttribute("data")));

                                                File.Copy(sourcePath, destPath, true);

                                                string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Aud.png"));
                                                string sf = Path.Combine(Warehouse.Warehouse.RelativeAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));

                                                HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                            }

                                            else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".swf")
                                            {
                                                if (!Directory.Exists(Warehouse.Warehouse.RelativeFlashesDirectory))
                                                {
                                                    Directory.CreateDirectory(Warehouse.Warehouse.RelativeFlashesDirectory);
                                                }
                                                // копируем туда картинку
                                                string data = reader.GetAttribute("data");
                                                var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorFlashesDirectory, Path.GetFileName(data));
                                                var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                                File.Copy(sourcePath, destPath, true);

                                                string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Anim.png"));
                                                string sf = Path.Combine(Warehouse.Warehouse.RelativeFlashesDirectory, Path.GetFileName(data));
                                                HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");

                                            }
                                        }
                                        catch (FileNotFoundException)
                                        {
                                            MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                            "Visual Editor",
                                                            MessageBoxButtons.OK,
                                                            MessageBoxIcon.Error);
                                        }
                                    }
                                    #endregion
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (reader.Name.Equals("itemBody", StringComparison.OrdinalIgnoreCase))
                                    {
                                        endCycle = true;
                                    }
                                }
                            }
                        }

                        if (reader.Name.Equals("prompt", StringComparison.OrdinalIgnoreCase))
                        {
                            string s = reader.ReadInnerXml();
                            HtmlText += "<P>" + ConvertXmlStringToHtml(s, qfPath) + "</P>";
                        }
                        /*
                        if (reader.Name.Equals("object", StringComparison.OrdinalIgnoreCase))
                        {
                            try
                            {
                                if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp4" || Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".flv")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeVideosDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeVideosDirectory);
                                    }
                                    // копируем туда картинку
                                    // копируем туда картинку
                                    string data = reader.GetAttribute("data");
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorVideosDirectory, Path.GetFileName(data));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Vid.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeVideosDirectory, Path.GetFileName(data));
                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                }

                                else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp3")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeAudiosDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeAudiosDirectory);
                                    }
                                    // копируем туда картинку
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(reader.GetAttribute("data")));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Aud.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));

                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                }

                                else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".swf")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeFlashesDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeFlashesDirectory);
                                    }
                                    // копируем туда картинку
                                    string data = reader.GetAttribute("data");
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorFlashesDirectory, Path.GetFileName(data));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Anim.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeFlashesDirectory, Path.GetFileName(data));
                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");

                                }
                            }
                            catch (FileNotFoundException)
                            {
                                MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                "Visual Editor",
                                                MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                            }
                        }*/

                        if (reader.Name.Equals("responseIf", StringComparison.OrdinalIgnoreCase) ||
                            reader.Name.Equals("responseElseIf", StringComparison.OrdinalIgnoreCase) ||
                            reader.Name.Equals("responseElse", StringComparison.OrdinalIgnoreCase))
                        {
                            string responseString = string.Empty;
                            string mark = string.Empty;
                            bool endCycle = false;
                            string name = reader.Name;

                            while (!endCycle && reader.Read())
                            {
                                if (reader.Name.Equals("baseValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    if (reader.GetAttribute("baseType").Equals("identifier", StringComparison.OrdinalIgnoreCase))
                                    {
                                        responseString = reader.ReadString();
                                    }
                                    else if (reader.GetAttribute("baseType").Equals("integer", StringComparison.OrdinalIgnoreCase) ||
                                             reader.GetAttribute("baseType").Equals("float", StringComparison.OrdinalIgnoreCase))
                                    {
                                        if (name.Equals("responseIf", StringComparison.OrdinalIgnoreCase))
                                        {
                                            string m = reader.ReadString();
                                            m = m.Replace(".", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                            m = m.Replace(",", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                            Marks = int.Parse(m);
                                            mark = m;
                                        }
                                        else
                                        {
                                            mark = reader.ReadString();
                                        }
                                    }
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (reader.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                                    {
                                        endCycle = true;
                                    }
                                }
                            }

                            if (!responseString.Equals(string.Empty))
                            {
                                ResponseVariant rv = new ResponseVariant(this);
                                rv.Responses.Add(responseString);
                                if (mark != string.Empty)
                                {
                                    if (!name.Equals("responseElse", StringComparison.OrdinalIgnoreCase))
                                    {
                                        mark = mark.Replace(".", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                        mark = mark.Replace(",", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                        if (Marks != 0)
                                            rv.Weight = Double.Parse(mark) / Marks;
                                        else rv.Weight = 0;
                                    }
                                }
                                ResponseVariants.Add(rv);
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("При чтении файла вопроса произошла ошибка. (" + qfPath + ")",
                                "Visual Editor",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                result = false;
            }
            finally
            {
                reader.Close();
                HtmlText += "</P>\n</BODY>\n</HTML>";
                //   FillImagesArray();
            }

            // мои художества
            this.DocumentHtml = HtmlText;
            success = true;
            return result;
        }
        public override bool ReadQti(string qfPath)
        {
            XmlTextReader reader = new XmlTextReader(qfPath);
            bool result = true;
            Id = Guid.NewGuid();
            string HtmlText = "<HTML>\n<HEAD>\n<BASE href=\"" + Application.StartupPath +
                "\\\">\n</HEAD>\n<BODY>\n<P>";

            try
            {
                //"вынимаем" элементы ответа               
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name.Equals("simpleChoice"))
                        {
                            Response r = new Response();
                            r.DocumentHtml = "<HTML>\n<HEAD>\n<BASE href=\"" + Application.StartupPath +
                                         "\\\">\n</HEAD>\n<BODY>\n<P>";
                            if (reader.GetAttribute("identifier") != null)
                            {
                                try
                                {
                                    r.Id = Guid.NewGuid();//new Guid(reader.GetAttribute("identifier"));
                                    r.Text = reader.GetAttribute("identifier");
                                    r.Identifier = reader.GetAttribute("identifier");
                                }
                                catch
                                {
                                    r.Identifier = reader.GetAttribute("identifier");
                                    r.Id = Guid.NewGuid();
                                    r.Text = reader.GetAttribute("identifier");
                                }
                            }
                            if (reader.GetAttribute("fixed") != null)
                            {
                                r.IsFixed = bool.Parse(reader.GetAttribute("fixed"));
                            }
                            string s = reader.ReadInnerXml();
                            r.DocumentHtml += ConvertXmlStringToHtml(s, qfPath);
                            r.DocumentHtml += "</P>\n</BODY>\n</HTML>";
                            // r.FillImagesArray();
                            // Responses.Add(r);
                            Nodes.Add(r);
                        }
                    }
                }
                reader.Close();

                //затем "вынимаем" всё остальное
                reader = new XmlTextReader(qfPath);
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name.Equals("assessmentItem", StringComparison.OrdinalIgnoreCase))
                        {
                            if (reader.GetAttribute("timeDependent") != null)
                            {
                                bool.TryParse(reader.GetAttribute("timeDependent"), out isTimeDependent);
                            }
                            if (reader.GetAttribute("identifier") != null)
                            {
                                identifier = reader.GetAttribute("identifier");
                            }
                            if (reader.GetAttribute("adaptive") != null)
                            {
                                bool.TryParse(reader.GetAttribute("adaptive"), out isAdaptive);
                            }
                            if (reader.GetAttribute("title") != null)
                            {
                                Text = reader.GetAttribute("title");
                            }
                            else Text = reader.GetAttribute("identifier");
                        }

                        if (reader.Name.Equals("correctResponse", StringComparison.OrdinalIgnoreCase))
                        {
                            bool endCycle = false;
                            ResponseVariant rv = new ResponseVariant(this);
                            rv.Weight = 1.0;

                            while (!endCycle && reader.Read())
                            {
                                if (reader.Name.Equals("value", StringComparison.OrdinalIgnoreCase))
                                {
                                    string value = reader.ReadString();
                                    foreach (Response response in Responses)
                                    {
                                        if ((response.Id.ToString() == value) || response.Identifier == value)
                                        {
                                            rv.Responses.Add(response);
                                        }
                                    }
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (reader.Name.Equals("correctResponse", StringComparison.OrdinalIgnoreCase))
                                    {
                                        endCycle = true;
                                    }
                                }
                            }
                            ResponseVariants.Add(rv);
                        }

                        if (reader.Name.Equals("mapping", StringComparison.OrdinalIgnoreCase))
                        {
                            try
                            {
                                if (reader.GetAttribute("lowerBound") != null)
                                    LowerBound = int.Parse(reader.GetAttribute("lowerBound"));
                                if (reader.GetAttribute("upperBound") != null)
                                    Marks = int.Parse(reader.GetAttribute("upperBound"));
                                if (reader.GetAttribute("defaultValue") != null)
                                    DefaultValue = int.Parse(reader.GetAttribute("defaultValue"));
                            }
                            catch
                            {
                                MessageBox.Show("Что-то не так О_о");
                            }
                        }

                        if (reader.Name.Equals("mapEntry", StringComparison.OrdinalIgnoreCase))
                        {
                            foreach (Response response in Responses)
                            {
                                if (response.Id.ToString() == reader.GetAttribute("mapKey"))
                                {
                                    if (reader.GetAttribute("mappedValue") != null)
                                    {
                                        string s = reader.GetAttribute("mappedValue");
                                        // разделитель, используемый в системе
                                        string decimalSeparator = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator;
                                        // подменяем точки и запятые на разделитель, используемый в системе, чтобы преобразовать строку в число без ошибок
                                        s = s.Replace(".", decimalSeparator);
                                        s = s.Replace(",", decimalSeparator);
                                        double d;
                                        Double.TryParse(s, out d);
                                        response.MappedValue = d;
                                    }
                                }
                            }
                        }

                        if (reader.Name.Equals("itemBody", StringComparison.OrdinalIgnoreCase))
                        {
                            // считываем содержимое тега itemBody
                            while (!reader.Name.Equals("choiceInteraction", StringComparison.OrdinalIgnoreCase) && reader.Read())
                            {
                                if (reader.Name.Equals("p", StringComparison.OrdinalIgnoreCase))
                                {
                                    string s = reader.ReadInnerXml();
                                    HtmlText += "<P>" + ConvertXmlStringToHtml(s, qfPath) + "</P>";
                                }

                                if (reader.Name.Equals("img", StringComparison.OrdinalIgnoreCase))
                                {
                                    try
                                    {
                                        // создаём папку для картинок проекта
                                        if (!Directory.Exists(Warehouse.Warehouse.RelativeImagesDirectory))
                                        {
                                            Directory.CreateDirectory(Warehouse.Warehouse.RelativeImagesDirectory);
                                        }
                                        // копируем туда картинку
                                        var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));

                                        // var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));
                                        File.Copy(Path.GetDirectoryName(qfPath) + "\\" + reader.GetAttribute("src"), destPath, true);
                                        // var inner = TagNames.ImageTagName;
                                        string height = reader.GetAttribute("height");
                                        string width = reader.GetAttribute("width");
                                        string align = reader.GetAttribute("align");
                                        string border = reader.GetAttribute("border");
                                        string hspace = reader.GetAttribute("hspace");
                                        string sf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName(reader.GetAttribute("src")));
                                        HtmlText += "<IMG" + " border=\"" + border + "\" hspace=\"" + hspace + "\" align=\"" + align + "\" sdocument=\"0\" src=\"" + sf + "\" height=\"" + height + "\" width=\"" + width + "\"" + ">";
                                    }
                                    catch (FileNotFoundException)
                                    {
                                        MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                        "Visual Editor",
                                                        MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                                    }
                                }
                                #region самодеятельность с медиа
                                if (reader.Name.Equals("object", StringComparison.OrdinalIgnoreCase))
                                {
                                    try
                                    {
                                        if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp4" || Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".flv")
                                        {
                                            if (!Directory.Exists(Warehouse.Warehouse.RelativeVideosDirectory))
                                            {
                                                Directory.CreateDirectory(Warehouse.Warehouse.RelativeVideosDirectory);
                                            }
                                            // копируем туда картинку
                                            string data = reader.GetAttribute("data");
                                            var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorVideosDirectory, Path.GetFileName(data));
                                            var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                            File.Copy(sourcePath, destPath, true);

                                            string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Vid.png"));
                                            string sf = Path.Combine(Warehouse.Warehouse.RelativeVideosDirectory, Path.GetFileName(data));
                                            HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                        }

                                        else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp3")
                                        {
                                            if (!Directory.Exists(Warehouse.Warehouse.RelativeAudiosDirectory))
                                            {
                                                Directory.CreateDirectory(Warehouse.Warehouse.RelativeAudiosDirectory);
                                            }
                                            // копируем туда картинку
                                            var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));
                                            var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(reader.GetAttribute("data")));

                                            File.Copy(sourcePath, destPath, true);

                                            string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Aud.png"));
                                            string sf = Path.Combine(Warehouse.Warehouse.RelativeAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));

                                            HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                        }

                                        else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".swf")
                                        {
                                            if (!Directory.Exists(Warehouse.Warehouse.RelativeFlashesDirectory))
                                            {
                                                Directory.CreateDirectory(Warehouse.Warehouse.RelativeFlashesDirectory);
                                            }
                                            // копируем туда картинку
                                            string data = reader.GetAttribute("data");
                                            var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorFlashesDirectory, Path.GetFileName(data));
                                            var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                            File.Copy(sourcePath, destPath, true);

                                            string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Anim.png"));
                                            string sf = Path.Combine(Warehouse.Warehouse.RelativeFlashesDirectory, Path.GetFileName(data));
                                            HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");

                                        }
                                    }
                                    catch (FileNotFoundException)
                                    {
                                        MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                        "Visual Editor",
                                                        MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                                    }
                                }
                                #endregion

                            }
                        }

                        if (reader.Name.Equals("choiceInteraction", StringComparison.OrdinalIgnoreCase))
                        {
                            if (reader.GetAttribute("responseIdentifier") != null)
                            {
                                identifier = reader.GetAttribute("responseIdentifier");
                            }
                            if (reader.GetAttribute("shuffle") != null)
                            {
                                IsShuffle = bool.Parse(reader.GetAttribute("shuffle"));
                            }
                            if (reader.GetAttribute("maxChoices") != null)
                            {
                                MaxChoices = int.Parse(reader.GetAttribute("maxChoices"));
                            }
                        }

                        if (reader.Name.Equals("prompt", StringComparison.OrdinalIgnoreCase))
                        {
                            string s = reader.ReadInnerXml();
                            HtmlText += "<P>" + ConvertXmlStringToHtml(s, qfPath) + "</P>";
                        }
                        /*
                        if (reader.Name.Equals("object", StringComparison.OrdinalIgnoreCase))
                        {
                            try
                            {
                                if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp4" || Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".flv")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeVideosDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeVideosDirectory);
                                    }
                                    // копируем туда картинку
                                    // копируем туда картинку
                                    string data = reader.GetAttribute("data");
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorVideosDirectory, Path.GetFileName(data));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Vid.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeVideosDirectory, Path.GetFileName(data));
                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                }

                                else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".mp3")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeAudiosDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeAudiosDirectory);
                                    }
                                    // копируем туда картинку
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(reader.GetAttribute("data")));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Aud.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeAudiosDirectory, Path.GetFileName(reader.GetAttribute("data")));

                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");
                                }

                                else if (Path.GetExtension(Path.GetFileName(reader.GetAttribute("data"))) == ".swf")
                                {
                                    if (!Directory.Exists(Warehouse.Warehouse.RelativeFlashesDirectory))
                                    {
                                        Directory.CreateDirectory(Warehouse.Warehouse.RelativeFlashesDirectory);
                                    }
                                    // копируем туда картинку
                                    string data = reader.GetAttribute("data");
                                    var destPath = Path.Combine(Warehouse.Warehouse.AbsoluteEditorFlashesDirectory, Path.GetFileName(data));
                                    var sourcePath = Path.Combine(Path.GetDirectoryName(qfPath), Path.GetFileName(data));

                                    File.Copy(sourcePath, destPath, true);

                                    string asf = Path.Combine(Warehouse.Warehouse.RelativeImagesDirectory, Path.GetFileName("\\Images\\Anim.png"));
                                    string sf = Path.Combine(Warehouse.Warehouse.RelativeFlashesDirectory, Path.GetFileName(data));
                                    HtmlText += string.Concat("<IMG src=\"" + asf + "\" width=\"16\" height=\"16\" sdocument=\"0\" src_=\"" + sf + "\" >");

                                }
                            }
                            catch (FileNotFoundException)
                            {
                                MessageBox.Show("Изображение " + reader.GetAttribute("src") + " не найдено.",
                                                "Visual Editor",
                                                MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                            }
                        }*/

                        if (reader.Name.Equals("responseIf", StringComparison.OrdinalIgnoreCase) ||
                            reader.Name.Equals("responseElseIf", StringComparison.OrdinalIgnoreCase) ||
                            reader.Name.Equals("responseElse", StringComparison.OrdinalIgnoreCase))
                        {
                            ArrayList list = new ArrayList(0);
                            string mark = string.Empty;
                            bool endCycle = false;
                            string name = reader.Name;

                            while (!endCycle && reader.Read())
                            {
                                if (reader.Name.Equals("baseValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    if (reader.GetAttribute("baseType").Equals("identifier", StringComparison.OrdinalIgnoreCase))
                                    {
                                        string response = reader.ReadString();
                                        // разбиваем строку на слова
                                        Match match = Regex.Match(response, @"\w+");
                                        // цикл по всем словам
                                        while (match.Success)
                                        {
                                            list.Add(match.ToString());
                                            match = match.NextMatch();
                                        }
                                    }
                                    else if (reader.GetAttribute("baseType").Equals("integer", StringComparison.OrdinalIgnoreCase) ||
                                             reader.GetAttribute("baseType").Equals("float", StringComparison.OrdinalIgnoreCase))
                                    {
                                        mark = reader.ReadString();
                                    }
                                }
                                else if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    if (reader.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                                    {
                                        endCycle = true;
                                    }
                                }
                            }

                            if (list.Count > 0)
                            {
                                ResponseVariant rv = new ResponseVariant(this);
                                foreach (Response r in Responses)
                                {
                                    foreach (string id in list)
                                    {
                                        if (r.Identifier == id && !rv.Responses.Contains(id))
                                        {
                                            rv.Responses.Add(r);
                                        }
                                    }
                                }
                                if (mark != string.Empty)
                                {
                                    mark = mark.Replace(".", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                    mark = mark.Replace(",", NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator);
                                    if (Marks != 0)
                                        rv.Weight = Double.Parse(mark) / Marks;
                                    else rv.Weight = 0;
                                }
                                ResponseVariants.Add(rv);
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("При чтении файла вопроса произошла ошибка. (" + qfPath + ")",
                                "Visual Editor",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                result = false;
            }
            finally
            {
                reader.Close();
                HtmlText += "</P>\n</BODY>\n</HTML>";
                // FillImagesArray();
            }

            this.DocumentHtml = HtmlText;
            success = true;
            return result;
        }