コード例 #1
0
        public ISocialPerson GetPerson(string userID)
        {
            OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Function, @"GetPerson called."));

            Person p;

            p = PersonCache.FindFirst(userID);
            if (p == null)
            {
                try
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Function, @"Calling OSCProvider.GetPerson."));

                    p = m_provider.GetPerson(userID);
                }
                catch (COMException cex)
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Exceptions, cex.Message, cex));

                    if (Helpers.IsOSCException(cex))
                    {
                        throw;
                    }
                    else
                    {
                        throw new OSCException(@"GetPerson call failed.", OSCExceptions.OSC_E_INTERNAL_ERROR, cex);
                    }
                }
                catch (ApplicationException ex)
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Exceptions, ex.Message, ex));
                    throw new OSCException(@"GetPerson call failed.", OSCExceptions.OSC_E_INTERNAL_ERROR, ex);
                }
                if (p != null)
                {
                    PersonCache.AddPerson(p);
                }
            }
            if (p != null)
            {
                return(new OSCPerson(m_provider, p));
            }
            else
            {
                return(null);//TODO : if p==null, i need to throw OSC_E_NOT_FOUND;
            }
        }
コード例 #2
0
        public string FindPerson(string userID)
        {
            OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Function, @"FindPerson called."));
            Person p;

            p = PersonCache.FindFirst(userID);
            if (p == null)
            {
                try
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Function, @"Calling GetPerson."));

                    p = m_provider.GetPerson(userID);
                }
                catch (COMException cex)
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Exceptions, cex.Message, cex));

                    if (Helpers.IsOSCException(cex))
                    {
                        throw;
                    }
                    else
                    {
                        throw new OSCException(@"GetPerson call failed.", OSCExceptions.OSC_E_INTERNAL_ERROR, cex);
                    }
                }
                catch (ApplicationException ex)
                {
                    OSCProvider.OnTraceEvent(this, new OSCEventArgs(TraceType.Exceptions, ex.Message, ex));

                    throw new OSCException(@"GetPerson call failed.", OSCExceptions.OSC_E_INTERNAL_ERROR, ex);
                }
                PersonCache.AddPerson(p);
            }
            p.SchemaVersion = m_provider.ProviderData.SchemaVersion;
            if (p != null)
            {
                return(p.Xml);
            }
            else
            {
                return(string.Empty);
            }
        }