Beispiel #1
0
        public ClassConfig()
        {
            configSavePath       = "C:\\";
            configIsMP3Download  = true;
            configIsTXTDownload  = false;
            configIsHtmlDownload = false;
            configVOATypeList    = new ArrayList();

            for (int i = 0; i < typeName.Length; i++)
            {
                VOA.ClassConfigVOAType voaType = new ClassConfigVOAType();
                voaType.TypeName = typeName[i];
                voaType.TypeURL  = typeURL[i];
                if (i == 0)
                {
                    voaType.TypeCategory   = "VOA Standard English";
                    voaType.TpyeIsDownload = true;
                }
                else if (i > 0 && i <= 14)
                {
                    voaType.TypeCategory   = "VOA Special English";
                    voaType.TpyeIsDownload = false;
                }
                else
                {
                    voaType.TypeCategory   = "VOA English Learning";
                    voaType.TpyeIsDownload = false;
                }
                configVOATypeList.Add(voaType);
            }
        }
Beispiel #2
0
 public static Boolean ReadConfigFile()
 {
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load("VOA.inf");
         XmlNodeList nodeList = document.GetElementsByTagName("ConfigItem");
         for (int i = 0; i < nodeList.Count; i++)
         {
             XmlNode node = nodeList.Item(i);
             string  test = node.Attributes["Name"].Value + " Value:" + node.Attributes["Value"].Value;
             if (node.Attributes["Name"].Value == "configSavePath")
             {
                 VOA.ClassConfig.configSavePath = node.Attributes["Value"].Value;
             }
             else if (node.Attributes["Name"].Value == "configIsHtmlDownload")
             {
                 VOA.ClassConfig.configIsHtmlDownload = node.Attributes["Value"].Value == "False" ? false : true;
             }
             else if (node.Attributes["Name"].Value == "configIsMP3Download")
             {
                 VOA.ClassConfig.configIsMP3Download = node.Attributes["Value"].Value == "False" ? false : true;
             }
             else if (node.Attributes["Name"].Value == "configIsTXTDownload")
             {
                 VOA.ClassConfig.configIsTXTDownload = node.Attributes["Value"].Value == "False" ? false : true;
             }
             else
             {
                 for (int j = 0; j < VOA.ClassConfig.configVOATypeList.Count; j++)
                 {
                     ClassConfigVOAType config = (ClassConfigVOAType)VOA.ClassConfig.configVOATypeList[j];
                     if (node.Attributes["Name"].Value == config.TypeName)
                     {
                         config.TpyeIsDownload = node.Attributes["Value"].Value == "False" ? false : true;
                     }
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }