コード例 #1
0
        /// <summary>
        /// 加载客户端服务端设置。
        /// </summary>
        /// <returns></returns>
        public static RfcServerCollection getServerSettings()
        {
            if (sectionGroup != null)
            {
                try
                {
                    ConfigurationSectionGroup group3 = sectionGroup.SectionGroups["ServerSettings"];
                    if (group3 != null)
                    {
                        RfcTypeConfiguration configuration5 = group3.Sections["ServerTypeConfiguration"] as RfcTypeConfiguration;
                        if (configuration5 != null)
                        {
                            Type type2 = Assembly.LoadFrom(configuration5.AssemblyName).GetType(configuration5.TypeName);
                            if (type2 == null)
                            {
                                throw new Exception("Unable to load class " + configuration5.TypeName + " from " + configuration5.AssemblyName);
                            }
                            //   RfcServerManager.RegisterServerConfiguration((IServerConfiguration)Activator.CreateInstance(type2));
                        }
                        else
                        {
                            RfcServerConfiguration configuration6 = group3.Sections["ServerConfiguration"] as RfcServerConfiguration;
                            if (configuration6 != null)
                            {
                                return(configuration6.Servers);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    // RfcTrace.LogError("Could not initialize configuration:", null, exception);

                    throw;
                }
            }
            return(null);
        }
コード例 #2
0
 /// <summary>
 /// 客户端设置
 /// </summary>
 /// <returns></returns>
 public static RfcDestinationCollection getClientSettings()
 {
     if (sectionGroup != null)
     {
         try
         {
             ConfigurationSectionGroup group2 = sectionGroup.SectionGroups["ClientSettings"];
             if (group2 != null)
             {
                 RfcTypeConfiguration configuration3 = group2.Sections["DestinationTypeConfiguration"] as RfcTypeConfiguration;
                 if (configuration3 != null)
                 {
                     Type type = Assembly.LoadFrom(configuration3.AssemblyName).GetType(configuration3.TypeName);
                     if (type == null)
                     {
                         throw new Exception("Unable to load class " + configuration3.TypeName + " from " + configuration3.AssemblyName);
                     }
                     // RfcDestinationManager.RegisterDestinationConfiguration((IDestinationConfiguration)Activator.CreateInstance(type));
                 }
                 else
                 {
                     RfcDestinationConfiguration configuration4 = group2.Sections["DestinationConfiguration"] as RfcDestinationConfiguration;
                     if (configuration4 != null)
                     {
                         return(configuration4.Destinations);
                         // RfcDestinationManager.RegisterDefaultConfiguration(new DefaultDestinationConfiguration(configuration4.Destinations));
                     }
                 }
             }
         }
         catch (Exception exception)
         {
             // RfcTrace.LogError("Could not initialize configuration:", null, exception);
             throw new Exception(exception.Message);
         }
     }
     return(null);
 }