Пример #1
0
 public void Read (TProtocol iprot)
 {
   iprot.IncrementRecursionDepth();
   try
   {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) { 
         break;
       }
       switch (field.ID)
       {
         case 0:
           if (field.Type == TType.Struct) {
             Success = new ServiceConfig();
             Success.Read(iprot);
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         default: 
           TProtocolUtil.Skip(iprot, field.Type);
           break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
   }
   finally
   {
     iprot.DecrementRecursionDepth();
   }
 }
Пример #2
0
 public IAsyncResult Begin_SetConfiguration(AsyncCallback callback, object state, ServiceConfig newConfig)
 {
   return send_SetConfiguration(callback, state, newConfig);
 }
Пример #3
0
 public void send_SetConfiguration(ServiceConfig newConfig)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("SetConfiguration", TMessageType.Call, seqid_));
   SetConfiguration_args args = new SetConfiguration_args();
   args.NewConfig = newConfig;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Пример #4
0
 public IAsyncResult send_SetConfiguration(AsyncCallback callback, object state, ServiceConfig newConfig)
Пример #5
0
      /// <summary>
      /// Sets the current service configuration
      /// </summary>
      /// <param name="newConfig"></param>
      public void SetConfiguration(ServiceConfig newConfig)
      {
        #if !SILVERLIGHT
        send_SetConfiguration(newConfig);
        recv_SetConfiguration();

        #else
        var asyncResult = Begin_SetConfiguration(null, null, newConfig);
        End_SetConfiguration(asyncResult);

        #endif
      }
Пример #6
0
        public void SetConfiguration(ServiceConfig newConfig)
        {
            // Lock the config so we don't try to modify and dispatch the service configuration at the same time
            lock (m_configLock)
            {
                m_pageIds = new List<string>();
                m_pageIds.Add(newConfig.PageId);

                m_apiPollingPeriod = newConfig.PollingPeriod;
                m_rainmeterInstallDir = newConfig.RainmeterExe;
            }

            // Write the new config out to the config file for persistance
            using (XmlWriter writer = XmlWriter.Create("ServiceConfig.xml"))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("JustGivingServiceConfig");

                // Rainmeter install directory
                writer.WriteStartElement("RainmeterInstallDir");
                writer.WriteString(m_rainmeterInstallDir);
                writer.WriteEndElement();

                // Polling period
                writer.WriteStartElement("PollingPeriod");
                writer.WriteString(m_apiPollingPeriod.ToString());
                writer.WriteEndElement();

                // Page ID
                writer.WriteStartElement("PageId");
                writer.WriteString(m_pageIds.First());
                writer.WriteEndElement();

                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
        }
Пример #7
0
        // Thrift accessors
        public ServiceConfig GetConfiguration()
        {
            ServiceConfig config = new ServiceConfig();

            // We don't want something to be accessing the config if it's in the middle of being changed
            lock (m_configLock)
            {
                config.PageId = m_pageIds.First(); // Obviously this will change when the rainmeter skin supports multiple fundraisers
                config.PollingPeriod = m_apiPollingPeriod;
                config.RainmeterExe = m_rainmeterInstallDir;
            }

            return config;
        }