示例#1
0
            /// <summary>
            /// 安装下一个类型
            /// </summary>
            protected override void nextCreate()
            {
                pathMembers.Clear();
                object    pathValue = typeof(fastCSharp.emit.constructor <>).MakeGenericType(type).GetMethod("Default", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, nullValue <Type> .Array, null).Invoke(null, null);
                string    queryName = (Attribute.QueryName ?? (type.Type.Name + "Id")), query;
                FieldInfo idField = type.Type.GetField("Id", BindingFlags.Instance | BindingFlags.Public);

                if (idField == null || idField.FieldType != typeof(int))
                {
                    query = queryName + "=0";
                }
                else
                {
                    idField.SetValue(pathValue, 1);
                    query = queryName + "=1";
                }
                foreach (fastCSharp.code.memberInfo member in fastCSharp.code.memberInfo.GetMembers <fastCSharp.code.ignoreMember>(type, Attribute.MemberFilter, Attribute.IsAttribute, Attribute.IsBaseTypeAttribute, Attribute.IsInheritAttribute))
                {
                    if (member.Type == typeof(string))
                    {
                        string url = (string)(member.Member as PropertyInfo).GetValue(pathValue, null);
                        if (url.EndsWith(query, StringComparison.Ordinal))
                        {
                            pathMembers.Add(new pathMember {
                                Member = member, Path = url.Substring(0, url.Length - query.Length), QueryName = queryName, IsHash = false, IsIdentity = true
                            });
                        }
                        else
                        {
                            pathMembers.Add(new pathMember {
                                Member = member, Path = url
                            });
                        }
                    }
                    else if (member.Type == typeof(fastCSharp.code.cSharp.webView.hashUrl))
                    {
                        fastCSharp.code.cSharp.webView.hashUrl url = (fastCSharp.code.cSharp.webView.hashUrl)(member.Member as PropertyInfo).GetValue(pathValue, null);
                        if (url.Query == query)
                        {
                            pathMembers.Add(new pathMember {
                                Member = member, Path = url.Path, QueryName = queryName, IsHash = true, IsIdentity = true
                            });
                        }
                        else if (url.Query.EndsWith(query, StringComparison.Ordinal))
                        {
                            pathMembers.Add(new pathMember {
                                Member = member, Path = url.Path, OtherQuery = url.Query.Substring(0, url.Query.Length - query.Length), QueryName = queryName, IsHash = true, IsIdentity = true
                            });
                        }
                    }
                }
                if (pathMembers.Count != 0)
                {
                    _code_.Empty();
                    create(false);
                    code.Add(_code_);
                }
            }
示例#2
0
 /// <summary>
 /// 关闭队列
 /// </summary>
 public void Close()
 {
     Monitor.Enter(nodeLock);
     try
     {
         nodeIndexs.Clear();
         while (nodeIndex != 1)
         {
             nodes[--nodeIndex].Close();
         }
     }
     finally { Monitor.Exit(nodeLock); }
 }