Пример #1
0
        private static bool LoadMirrorList(String sServer)
        {
            try
            {
                XmlNode node = Online_Parsing_Classes.OnlineAPI.GetMirrors(AppendAPI(sServer, true));

                if (node == null)
                {
                    return(false);
                }

                int count = 0;
                foreach (XmlNode itemNode in node.ChildNodes)
                {
                    // create a new OnlineMirror object
                    var mirror = new DBOnlineMirror();

                    foreach (XmlNode propertyNode in itemNode.ChildNodes)
                    {
                        if (mOnlineToFieldMap.ContainsKey(propertyNode.Name))
                        {
                            mirror[mOnlineToFieldMap[propertyNode.Name]] = propertyNode.InnerText;
                        }
                        else
                        {
                            mirror[propertyNode.Name] = propertyNode.InnerText;
                        }
                    }
                    count++;
                    mMemoryMirrors.Add(mirror);
                }
                MPTVSeriesLog.Write("Received " + count.ToString() + " mirror site(s) from " + sServer);
                return(true);
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write(string.Format("Error: unable to retrieve list of mirrors online: {0}", ex.Message));
                return(false);
            }
        }
Пример #2
0
        private static bool LoadMirrorList(String sServer)
        {
            try
            {
                XmlNode node = Online_Parsing_Classes.OnlineAPI.GetMirrors(appendAPI(sServer, true));

                if (node == null)
                    return false;

                int count = 0;
                foreach (XmlNode itemNode in node.ChildNodes)
                {
                    // create a new OnlineMirror object
                    DBOnlineMirror mirror = new DBOnlineMirror();

                    foreach (XmlNode propertyNode in itemNode.ChildNodes)
                    {
                        if (s_OnlineToFieldMap.ContainsKey(propertyNode.Name))
                            mirror[s_OnlineToFieldMap[propertyNode.Name]] = propertyNode.InnerText;
                        else
                        {
                            mirror[propertyNode.Name] = propertyNode.InnerText;
                        }
                    }
                    count++;
                    memoryMirrors.Add(mirror);
                }
                MPTVSeriesLog.Write("Received " + count.ToString() + " mirror site(s) from " + sServer);
                return true;
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write(string.Format("Error: unable to retrieve list of mirrors online: {0}", ex.Message));
                return false;
            }
        }