public SqlClientUploadStreamProvider(NameValueConfigurationSection configuration) { string text = configuration["criteriaMethod"]; bool flag = text != null && text.Length != 0; if (flag) { this._criteriaMethod = (SqlClientUploadStreamProvider.CriteriaMethod)Enum.Parse(typeof(SqlClientUploadStreamProvider.CriteriaMethod), text, true); } else { this._criteriaMethod = SqlClientUploadStreamProvider.CriteriaMethod.Identity; } bool flag2 = this._criteriaMethod == SqlClientUploadStreamProvider.CriteriaMethod.Custom; if (flag2) { this._criteriaGenerator = (ConfigurationHashThread.CreateInstance(configuration["criteriaGenerator"], new object[] { configuration }) as ICriteriaGenerator); bool flag3 = this._criteriaGenerator == null; if (flag3) { throw new ApplicationException("无法对CriteriaGenerator进行实例化."); } } this._connectionString = configuration["connectionString"]; this._tablename = configuration["table"]; this._keyfieldname = configuration["keyField"]; this._dataField = configuration["dataField"]; this._filenamefield = configuration["fileNameField"]; }
public FileUploadStreamProvider(NameValueConfigurationSection configuration) { this._location = configuration["location"]; bool flag = this._location == null; if (flag) { throw new ApplicationException(); } bool flag2 = !Path.IsPathRooted(this._location); if (flag2) { this._location = HttpContext.Current.Server.MapPath(this._location); } string text = configuration["existingAction"]; bool flag3 = text != null && text.Length != 0; if (flag3) { this._existingAction = (FileUploadStreamProvider.ExistingAction)Enum.Parse(typeof(FileUploadStreamProvider.ExistingAction), text, true); } else { this._existingAction = FileUploadStreamProvider.ExistingAction.Exception; } string text2 = configuration["fileNameMethod"]; bool flag4 = text2 != null && text2.Length != 0; if (flag4) { this._fileNameMethod = (FileUploadStreamProvider.FileNameMethod)Enum.Parse(typeof(FileUploadStreamProvider.FileNameMethod), text2, true); } else { this._fileNameMethod = FileUploadStreamProvider.FileNameMethod.Client; } bool flag5 = this._fileNameMethod == FileUploadStreamProvider.FileNameMethod.Custom; if (flag5) { this._fileNameGenerator = (ConfigurationHashThread.CreateInstance(configuration["fileNameGenerator"], new object[] { configuration }) as IFileNameGenerator); bool flag6 = this._fileNameGenerator == null; if (flag6) { throw new ApplicationException("无法对FileNameGenerator进行实例化."); } } }
private void InvokeMember(HttpRequest request, byte[] textParts) { object target = ConfigurationHashThread.CreateInstance("System.Web.HttpRawUploadedContent, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", new object[] { textParts.Length, textParts.Length }, BindingFlags.Instance | BindingFlags.NonPublic); Type type = target.GetType(); type.InvokeMember("AddBytes", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, target, new object[] { textParts, 0, textParts.Length }); type.InvokeMember("DoneAddingBytes", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, target, null); request.GetType().InvokeMember("_rawContent", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField, null, request, new object[] { target }); }
internal static object CreateConfigurationHashObject(string configurationtext, string configurationHashKey, params object[] objectarray) { bool flag = string.IsNullOrEmpty(configurationtext); object result; if (flag) { result = null; } else { ConfigurationHashThread._rwlock.AcquireReaderLock(1000); string str = configurationtext; bool flag2 = !string.IsNullOrEmpty(configurationHashKey); if (flag2) { str = str + "#" + configurationHashKey; } object obj2 = ConfigurationHashThread._configurationHashTable[str]; ConfigurationHashThread._rwlock.ReleaseReaderLock(); bool flag3 = obj2 == null; if (flag3) { obj2 = ConfigurationHashThread.CreateInstance(configurationtext, objectarray); bool flag4 = obj2 != null; if (flag4) { ConfigurationHashThread._rwlock.AcquireWriterLock(1000); ConfigurationHashThread._configurationHashTable[str] = obj2; ConfigurationHashThread._rwlock.ReleaseWriterLock(); } } result = obj2; } return(result); }
internal static object CreateInstance(string configurationtext, object[] objectarray) { return(ConfigurationHashThread.CreateInstance(configurationtext, objectarray, BindingFlags.Default)); }
internal static object CreateConfigurationHashObject(string configurationtext, params object[] objectarray) { return(ConfigurationHashThread.CreateConfigurationHashObject(configurationtext, null, objectarray)); }