Beispiel #1
0
        public bool Connect()
        {
            m_server = new FreeDBSite("freedb.freedb.org", FreeDBSite.FreeDBProtocol.HTTP, 80, "/~cddb/cddb.cgi",
                                      "N000.00", "W000.00", "Random freedb server");

            m_serverURL = "http://" + m_server.Host + ":" + m_server.Port + m_server.URI;

            return(true);
        }
Beispiel #2
0
    public bool Connect()
    {
      m_server = new FreeDBSite("freedb.freedb.org", FreeDBSite.FreeDBProtocol.HTTP, 80, "/~cddb/cddb.cgi",
                                "N000.00", "W000.00", "Random freedb server");

      m_serverURL = "http://"+m_server.Host+":"+m_server.Port+m_server.URI;

      return true;
    }
Beispiel #3
0
        public FreeDBSite[] GetFeedbSites()
        {
            FreeDBSite[] retval = null;
            // FIXME: Close reader
            StreamReader urlRdr = GetStreamFromSite("sites");

            m_message = urlRdr.ReadLine();
            int code = GetCode(m_message);

            m_message = m_message.Substring(4); // remove the code...
            char[] sep = { ' ' };

            switch (code)
            {
            case 210: // OK, Site Information Follows.
                // Read in all sites.
                string[] sites = ParseMultiLine(urlRdr);
                retval = new FreeDBSite[sites.Length];
                int index = 0;
                // Loop through server list and extract different parts.
                foreach (string site in sites)
                {
                    string   loc      = "";
                    string[] siteInfo = site.Split(sep);
                    retval[index]           = new FreeDBSite();
                    retval[index].Host      = siteInfo[0];
                    retval[index].Protocol  = (FreeDBSite.FreeDBProtocol)Enum.Parse(typeof(FreeDBSite.FreeDBProtocol), siteInfo[1], true);
                    retval[index].Port      = Convert.ToInt32(siteInfo[2]);
                    retval[index].URI       = siteInfo[3];
                    retval[index].Latitude  = siteInfo[4];
                    retval[index].Longitude = siteInfo[5];

                    for (int i = 6; i < siteInfo.Length; i++)
                    {
                        loc += retval[i] + " ";
                    }
                    retval[index].Location = loc;
                    index++;
                }
                break;

            case 401: // No Site Information Available.
                break;;

            default:
                break;
            }
            return(retval);
        }
Beispiel #4
0
 public bool Connect(FreeDBSite site)
 {
     m_server    = site;
     m_serverURL = "http://" + m_server.Host + ":" + m_server.Port + m_server.URI;
     return(true);
 }
Beispiel #5
0
    public FreeDBSite[] GetFeedbSites()
    {
      FreeDBSite[] retval = null;
      // FIXME: Close reader
      StreamReader urlRdr = GetStreamFromSite("sites");
      m_message = urlRdr.ReadLine();
      int code = GetCode(m_message);
      m_message = m_message.Substring(4);  // remove the code...
      char[] sep = {' '};

      switch(code)
      {
        case 210: // OK, Site Information Follows.
          // Read in all sites.
          string[] sites = ParseMultiLine(urlRdr);
          retval = new FreeDBSite[sites.Length];
          int index =0;
          // Loop through server list and extract different parts.
          foreach (string site in sites)
          {
            string loc = "";
            string[] siteInfo = site.Split(sep);
            retval[index] = new FreeDBSite();
            retval[index].Host = siteInfo[0];
            retval[index].Protocol = (FreeDBSite.FreeDBProtocol) Enum.Parse(typeof(FreeDBSite.FreeDBProtocol), siteInfo[1], true);
            retval[index].Port = Convert.ToInt32(siteInfo[2]);
            retval[index].URI = siteInfo[3];
            retval[index].Latitude = siteInfo[4];
            retval[index].Longitude = siteInfo[5];

            for(int i = 6; i < siteInfo.Length; i++)
              loc += retval[i]+" ";
            retval[index].Location = loc;
            index++;
          }
          break;
        case 401: // No Site Information Available.
          break;
        default:
          break;
      }
      return retval;
    }
Beispiel #6
0
 public bool Connect(FreeDBSite site)
 {
   m_server = site;
   m_serverURL = "http://"+m_server.Host+":"+m_server.Port+m_server.URI;
   return true;
 }