本文整理汇总了C#中ASObject类的典型用法代码示例。如果您正苦于以下问题:C# ASObject类的具体用法?C# ASObject怎么用?C# ASObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASObject类属于命名空间,在下文中一共展示了ASObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteData
public void WriteData(AMFWriter writer, object data)
{
NameObjectCollectionBase collection = data as NameObjectCollectionBase;
object[] attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
if (attributes != null && attributes.Length > 0)
{
DefaultMemberAttribute defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
PropertyInfo pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new Type[] { typeof(string) });
if (pi != null)
{
ASObject aso = new ASObject();
for (int i = 0; i < collection.Keys.Count; i++)
{
string key = collection.Keys[i];
object value = pi.GetValue(collection, new object[]{ key });
aso.Add(key, value);
}
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(aso);
return;
}
}
//We could not access an indexer so write out as it is.
writer.WriteByte(AMF3TypeCode.Object);
writer.WriteAMF3Object(data);
}
示例2: onMailAudited
private void onMailAudited(string sender, ime.notification.NotifyMessage e, NotificationCenter.Stage stage)
{
if (stage == NotificationCenter.Stage.Receiving)
{
Application.Current.Dispatcher.Invoke((System.Action)delegate
{
if (!DBWorker.IsDBCreated())
return;
XElement xml = e.Body as XElement;
if (xml == null)
return;
XElement msgXml = xml.Element("message");
if (msgXml == null)
return;
ASObject mail = new ASObject();
mail["uuid"] = msgXml.AttributeValue("uuid");
mail["folder"] = "SENDED";
MailWorker.instance.updateMailRecord(mail, new string[] { "folder" });
MailWorker.instance.dispatchMailEvent(MailWorker.Event.Reset, null, null);
Application.Current.Dispatcher.Invoke((System.Action)delegate
{
e.Show();
}, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}
}
示例3: WriteData
public void WriteData(AMFWriter writer, object data)
{
var collection = data as NameObjectCollectionBase;
var attributes = collection.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), false);
if (attributes != null && attributes.Length > 0)
{
var defaultMemberAttribute = attributes[0] as DefaultMemberAttribute;
var pi = collection.GetType().GetProperty(defaultMemberAttribute.MemberName, new[] { typeof(string) });
if (pi != null)
{
var aso = new ASObject();
for (var i = 0; i < collection.Keys.Count; i++)
{
var key = collection.Keys[i];
var value = pi.GetValue(collection, new object[]{ key });
aso.Add(key, value);
}
writer.WriteASO(ObjectEncoding.AMF0, aso);
return;
}
}
//We could not access an indexer so write out as it is.
writer.WriteObject(ObjectEncoding.AMF0, data);
}
示例4: HandleResult
/// <summary>
/// This method supports the Fluorine infrastructure and is not intended to be used directly from your code.
/// </summary>
/// <param name="invocationManager"></param>
/// <param name="memberInfo"></param>
/// <param name="obj"></param>
/// <param name="arguments"></param>
/// <param name="result"></param>
public void HandleResult(IInvocationManager invocationManager, MemberInfo memberInfo, object obj, object[] arguments, object result)
{
if( result is DataSet )
{
DataSet dataSet = result as DataSet;
ASObject asoResult = new ASObject(_remoteClass);
#if !(NET_1_1)
foreach (KeyValuePair<object, object> entry in invocationManager.Properties)
#else
foreach(DictionaryEntry entry in invocationManager.Properties)
#endif
{
if( entry.Key is DataTable )
{
DataTable dataTable = entry.Key as DataTable;
if( dataSet.Tables.IndexOf(dataTable) != -1 )
{
if( !dataTable.ExtendedProperties.ContainsKey("alias") )
asoResult[dataTable.TableName] = entry.Value;
else
asoResult[ dataTable.ExtendedProperties["alias"] as string ] = entry.Value;
}
}
}
invocationManager.Result = asoResult;
}
}
示例5: NetStatusEventArgs
internal NetStatusEventArgs(string message) {
_info = new ASObject();
_info["level"] = "error";
_info["code"] = StatusASO.NC_CALL_FAILED;
//_info["description"] = message;
_info["details"] = message;
}
示例6: getCapabilities
/// <summary>
/// Returns the capabilities of the ServiceBrowser as currently implemented.
/// Universal Remoting enabled projects may choose to implement all or some of the capabilities of the front-end.
/// </summary>
/// <returns>
/// An array of objects. Each object should be in the format {name:String, version:Number, data:*}.
/// </returns>
public ASObject getCapabilities()
{
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ASObject result = new ASObject();
// authentication: This Remoting implementation supports AMF0/AMF3 authentication
ASObject asoAuthentication = new ASObject();
asoAuthentication["name"] = "authentication";
asoAuthentication["version"] = "FormsAuthentication";
asoAuthentication["data"] = "true";
result["authentication"] = asoAuthentication;
// secure: The user of the service browser must authenticate him/herself with
// the unlock method before accessing it.
// The roles of all the methods except verifyLogin and getCapabilities should be set
// to admin.
//ASObject secure = new ASObject();
// codegen: This service browser supports code generation
ASObject asoCodegen = new ASObject();
asoCodegen["name"] = "codegen";
asoCodegen["version"] = version;
asoCodegen["data"] = CodeGeneratorService.GetCodeTemplates();//.ToArray(typeof(object)) as object[];
result["codegen"] = asoCodegen;
result["version"] = version;
// codesave: This service browser supports code saving.
// data in this case may contain the enabled key.
// If enabled is set to false, indicates that the remote class has the remote code
// saving capability, but it is disabled because of a lack of permissions in the target directory.
// if data is null, assume enabled is true.
//ASObject codesave = new ASObject();
return result;
}
示例7: GetInformation
public ASObject GetInformation()
{
ASObject info = new ASObject();
info["name"] = "Fluorine .NET Flash Remoting Gateway";
info["version"] = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return info;
}
示例8: ToRequestObject
public FluorineFx.ASObject ToRequestObject()
{
FluorineFx.ASObject retVal = new ASObject();
retVal.Add("sigTime", _sigTime);
retVal.Add("token", _token);
retVal.Add("flashRevision", _flashRevision);
retVal.Add("userId", _userId);
return retVal;
}
示例9: ReadData
public object ReadData(AMFReader reader, ClassDefinition classDefinition) {
ASObject aso = new ASObject(_typeIdentifier);
reader.AddAMF3ObjectReference(aso);
string key = reader.ReadAMF3String();
aso.TypeName = _typeIdentifier;
while (key != string.Empty) {
object value = reader.ReadAMF3Data();
aso.Add(key, value);
key = reader.ReadAMF3String();
}
return aso;
}
示例10: Invoke
public override void Invoke(AMFContext context) {
MessageBroker messageBroker = _endpoint.GetMessageBroker();
try {
AMFHeader amfHeader = context.AMFMessage.GetHeader(AMFHeader.CredentialsHeader);
if (amfHeader != null && amfHeader.Content != null) {
string userId = ((ASObject)amfHeader.Content)["userid"] as string;
string password = ((ASObject)amfHeader.Content)["password"] as string;
//Clear credentials header, further requests will not send the credentials
ASObject asoObject = new ASObject();
asoObject["name"] = AMFHeader.CredentialsHeader;
asoObject["mustUnderstand"] = false;
asoObject["data"] = null;//clear
AMFHeader header = new AMFHeader(AMFHeader.RequestPersistentHeader, true, asoObject);
context.MessageOutput.AddHeader(header);
IPrincipal principal = _endpoint.GetMessageBroker().LoginManager.Login(userId, amfHeader.Content as IDictionary);
string key = EncryptCredentials(_endpoint, principal, userId, password);
ASObject asoObjectCredentialsId = new ASObject();
asoObjectCredentialsId["name"] = AMFHeader.CredentialsIdHeader;
asoObjectCredentialsId["mustUnderstand"] = false;
asoObjectCredentialsId["data"] = key;//set
AMFHeader headerCredentialsId = new AMFHeader(AMFHeader.RequestPersistentHeader, true, asoObjectCredentialsId);
context.MessageOutput.AddHeader(headerCredentialsId);
} else {
amfHeader = context.AMFMessage.GetHeader(AMFHeader.CredentialsIdHeader);
if (amfHeader != null) {
string key = amfHeader.Content as string;
if (key != null)
_endpoint.GetMessageBroker().LoginManager.RestorePrincipal(key);
} else {
_endpoint.GetMessageBroker().LoginManager.RestorePrincipal();
}
}
} catch (UnauthorizedAccessException exception) {
for (int i = 0; i < context.AMFMessage.BodyCount; i++) {
AMFBody amfBody = context.AMFMessage.GetBodyAt(i);
ErrorResponseBody errorResponseBody = new ErrorResponseBody(amfBody, exception);
context.MessageOutput.AddBody(errorResponseBody);
}
} catch (Exception exception) {
if (log != null && log.IsErrorEnabled)
log.Error(exception.Message, exception);
for (int i = 0; i < context.AMFMessage.BodyCount; i++) {
AMFBody amfBody = context.AMFMessage.GetBodyAt(i);
ErrorResponseBody errorResponseBody = new ErrorResponseBody(amfBody, exception);
context.MessageOutput.AddBody(errorResponseBody);
}
}
}
示例11: ParseQuery
public object ParseQuery(string url, string sql)
{
ASObject aso = new ASObject();
try
{
FluorineFx.ServiceBrowser.Sql.ISqlScript sqlScript = FluorineFx.ServiceBrowser.Sql.SqlParserService.Parse(sql);
aso["message"] = "Sql statement was parsed and found to be a valid";
}
catch (antlr.RecognitionException ex)
{
aso["message"] = "The specified SQL statement failed to be parsed: " + ex.ToString();
}
catch (Exception ex)
{
aso["message"] = "The specified SQL statement failed to be parsed: " + ex.Message;
}
return aso;
}
示例12: GGChatUser
public GGChatUser(ASObject user)
{
try
{
if( user.ContainsKey("banned") )
_banned = bool.Parse(user["banned"].ToString());
if (user.ContainsKey("color"))
_color = (string)user["color"];
if (user.ContainsKey("id"))
_id = int.Parse(user["id"].ToString());
if (user.ContainsKey("level"))
_level = int.Parse(user["level"].ToString());
if (user.ContainsKey("name"))
_name = (string)user["name"];
if (user.ContainsKey("sex"))
_gender = int.Parse(user["sex"].ToString());
}
catch { }
}
示例13: AddSubscriber
public MessageClient AddSubscriber(string clientId, string endpointId, Subtopic subtopic, Selector selector)
{
lock(_objLock)
{
if (subtopic != null)
{
MessagingAdapter messagingAdapter = _messageDestination.ServiceAdapter as MessagingAdapter;
if (messagingAdapter != null)
{
if (!messagingAdapter.AllowSubscribe(subtopic))
{
ASObject aso = new ASObject();
aso["subtopic"] = subtopic.Value;
throw new MessageException(aso);
}
}
}
if (!_subscribers.Contains(clientId))
{
//Set in RtmpService
MessageClient messageClient = new MessageClient(clientId, _messageDestination, endpointId);
messageClient.Subtopic = subtopic;
messageClient.Selector = selector;
messageClient.AddSubscription(selector, subtopic);
AddSubscriber(messageClient);
messageClient.NotifyCreatedListeners();
return messageClient;
}
else
{
MessageClient messageClient = _subscribers[clientId] as MessageClient;
IClient client = FluorineContext.Current.Client;
if (client != null && !client.Id.Equals(messageClient.Client.Id))
{
throw new MessageException("Duplicate subscriptions from multiple Flex Clients");
}
//Reset the endpoint push state for the subscription to make sure its current because a resubscribe could be arriving over a new endpoint or a new session.
messageClient.ResetEndpoint(endpointId);
return messageClient;
}
}
}
示例14: SyncWorker
protected SyncWorker()
{
sql.Clear();
sql.Append("select * from ML_Mail where [email protected]_synced or [email protected]_synced1");
using (DataSet ds = new DataSet())
{
try
{
using (SQLiteCommand cmd = new SQLiteCommand(sql.ToString(), DBWorker.GetConnection()))
{
cmd.Parameters.AddWithValue("@is_synced", 1);
cmd.Parameters.AddWithValue("@is_synced1", 0);
using (SQLiteDataAdapter q = new SQLiteDataAdapter(cmd))
{
q.Fill(ds);
}
}
}
catch (Exception ex)
{
Debug.Write(ex.StackTrace);
}
if (ds.Tables.Count > 0)
{
using (DataTable dt = ds.Tables[0])
{
foreach (DataRow row in dt.Rows)
{
ASObject mail = new ASObject();
foreach (DataColumn column in dt.Columns)
{
mail[column.ColumnName] = row[column];
}
mailList.Add(mail);
}
}
}
}
}
示例15: SubmitQuery
public object SubmitQuery(string url, string sql)
{
Hashtable result = new Hashtable();
try
{
DomainUrl domainUrl = new DomainUrl(url);
Driver driver = DriverFactory.GetDriver(domainUrl);
using (IDbConnection dbConnection = driver.OpenConnection())
{
IDbCommand command = driver.GetDbCommand(sql, dbConnection);
IDbDataAdapter adapter = driver.GetDbDataAdapter();
adapter.SelectCommand = command;
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
ASObject asoResult = new ASObject();
DataTable dataTable = dataSet.Tables[0];
ArrayList rows = new ArrayList(dataTable.Rows.Count);
for (int i = 0; i < dataTable.Rows.Count; i++)
{
DataRow dataRow = dataTable.Rows[i];
ASObject asoRow = new ASObject();
for (int j = 0; j < dataTable.Columns.Count; j++)
{
DataColumn column = dataTable.Columns[j];
asoRow.Add(column.ColumnName, dataRow[column]);
}
rows.Add(asoRow);
}
result["result"] = rows;
}
}
catch (Exception ex)
{
result["message"] = ex.Message;
}
return result;
}