本文整理汇总了C#中Internal类的典型用法代码示例。如果您正苦于以下问题:C# Internal类的具体用法?C# Internal怎么用?C# Internal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Internal类属于命名空间,在下文中一共展示了Internal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRDATA
internal override void ReadRDATA(Internal.ByteReader reader)
{
// The format of the data within a DNS TXT record is one or more
// strings, packed together in memory without any intervening gaps
// or padding bytes for word alignment.
//
// The format of each constituent string within the DNS TXT record is
// a single length byte, followed by 0-255 bytes of text data.
// TXT-DATA strings are not guaranteed to consist purely of ASCII printable
// characters though this is usually the case.
List<Datagram> strings = new List<Datagram>();
for (int total = 0; total < Base.RDLENGTH; )
{
byte length = reader.ReadByte();
if (length > 0)
{
if (total + length >= Base.RDLENGTH)
throw new InvalidResponseException(
"Invalid length byte in TXT record: String data would exceed RDLENGTH.");
strings.Add(reader.ReadBytes(length));
}
total += (length + 1);
}
Strings = strings.ToArray();
}
示例2: BuildArrayValue
private Data BuildArrayValue(Internal.ValueNode n)
{
Data data = null;
switch (n.Type)
{
case Internal.ValueNodeType.Statement:
data = new Data();
DataGroup group = BuildGroup(n.Statement);
data.Group = group;
break;
case Internal.ValueNodeType.Integer:
data = new Data();
data.Integer = n.Integer;
break;
case Internal.ValueNodeType.Float:
data = new Data();
data.Float = n.Float;
break;
case Internal.ValueNodeType.Bool:
data = new Data();
data.Bool = n.Boolean;
break;
case Internal.ValueNodeType.String:
data = new Data();
data.String = n.String;
break;
case Internal.ValueNodeType.Array:
data = new Data();
data.Array = BuildArray(n.Array);
break;
}
return data;
}
示例3: Initialize
/// <summary>
/// Initializes the mechanism.
/// </summary>
/// <param name="connection">The connection.</param>
/// <param name="credentials">The credentials.</param>
/// <returns>The initial step.</returns>
public ISaslStep Initialize(Internal.MongoConnection connection, MongoCredentials credentials)
{
return new ManagedDigestMD5Implementation(
connection.ServerInstance.Address.Host,
credentials.Username,
((PasswordEvidence)credentials.Evidence).Password);
}
示例4: MPoolStats
internal MPoolStats(Internal.MempStatStruct stats) {
st = stats.st;
ci = new CacheInfo(st.st_gbytes, st.st_bytes, (int)st.st_max_ncache);
mempfiles = new List<MPoolFileStats>();
foreach (Internal.MPoolFileStatStruct file in stats.files)
mempfiles.Add(new MPoolFileStats(file));
}
示例5: Parse
public static void Parse(
CharStream stream, string identifier,
Internal.LocaleContext.Builder builder)
{
var startingPos = stream.Position;
try
{
// private identifiers start with an underscore
// and can only be referenced from within an l20n file
bool isPrivate = (identifier.IndexOf('_') == 0);
// an optional index is possible
AST.INode index = null;
Index.PeekAndParse(stream, out index);
// White Space is required
WhiteSpace.Parse(stream, false);
var valuePos = stream.Position;
// Now we need the actual value
var value = Value.Parse(stream);
if ((value as IO.AST.HashValue) == null && index != null)
{
string msg = String.Format(
"an index was given, but a stringValue was given, while a hashValue was expected",
stream.ComputeDetailedPosition(valuePos));
throw new Exceptions.ParseException(msg);
}
// an optional attributes collection is possible
AST.Attributes attributes;
Attributes.PeekAndParse(stream, out attributes);
// White Space is optional
WhiteSpace.Parse(stream, true);
stream.SkipCharacter('>');
var entityAST = new AST.Entity(identifier, isPrivate, index, value, attributes);
try
{
var entity = (Objects.Entity)entityAST.Eval();
builder.AddEntity(identifier, entity);
} catch (Exception e)
{
throw new Exceptions.EvaluateException(
String.Format("couldn't evaluate `{0}`", entityAST.Display()),
e);
}
} catch (Exception e)
{
string msg = String.Format(
"something went wrong parsing an <entity> starting at {0}",
stream.ComputeDetailedPosition(startingPos));
throw new Exceptions.ParseException(msg, e);
}
}
示例6: Parse
public static void Parse(
CharStream stream,
string identifier, Internal.LocaleContext.Builder builder)
{
var startingPos = stream.Position;
try
{
var macroAST = new AST.Macro(identifier);
stream.SkipCharacter('(');
WhiteSpace.Parse(stream, true);
// variables are optional,
// but we do have them, we need at least one (duh)
if (Expressions.Variable.Peek(stream))
{
macroAST.AddParameter(Macro.ParseVariable(stream));
// more than 1 is possible as well
while (stream.SkipIfPossible(','))
{
WhiteSpace.Parse(stream, true);
macroAST.AddParameter(Macro.ParseVariable(stream));
}
}
stream.SkipCharacter(')');
WhiteSpace.Parse(stream, false);
stream.SkipCharacter('{');
WhiteSpace.Parse(stream, true);
// Parse the Actual Macro Expression
macroAST.SetExpression(Expression.Parse(stream));
WhiteSpace.Parse(stream, true);
stream.SkipCharacter('}');
WhiteSpace.Parse(stream, true);
stream.SkipCharacter('>');
// return the fully parsed macro
try
{
var macro = (Objects.Macro)macroAST.Eval();
builder.AddMacro(identifier, macro);
} catch (Exception e)
{
throw new Exceptions.EvaluateException(
String.Format("couldn't evaluate `{0}`", macroAST.Display()),
e);
}
} catch (Exception e)
{
string msg = String.Format(
"something went wrong parsing a <macro> starting at {0}",
stream.ComputeDetailedPosition(startingPos));
throw new Exceptions.ParseException(msg, e);
}
}
示例7: BindEnumerableExpression
private static MemberAssignment BindEnumerableExpression(IMappingEngine mappingEngine, PropertyMap propertyMap,
ExpressionRequest request, ExpressionResolutionResult result,
Internal.IDictionary<ExpressionRequest, int> typePairCount)
{
MemberAssignment bindExpression;
Type destinationListType = GetDestinationListTypeFor(propertyMap);
Type sourceListType = null;
// is list
if (result.Type.IsArray)
{
sourceListType = result.Type.GetElementType();
}
else
{
sourceListType = result.Type.GetGenericArguments().First();
}
var listTypePair = new ExpressionRequest(sourceListType, destinationListType, request.IncludedMembers);
var selectExpression = result.ResolutionExpression;
if (sourceListType != destinationListType)
{
var transformedExpression = Extensions.CreateMapExpression(mappingEngine, listTypePair, typePairCount);
selectExpression = Expression.Call(
typeof (Enumerable),
"Select",
new[] {sourceListType, destinationListType},
result.ResolutionExpression,
transformedExpression);
}
if (typeof (IList<>).MakeGenericType(destinationListType)
.IsAssignableFrom(propertyMap.DestinationPropertyType)
||
typeof (ICollection<>).MakeGenericType(destinationListType)
.IsAssignableFrom(propertyMap.DestinationPropertyType))
{
// Call .ToList() on IEnumerable
var toListCallExpression = GetToListCallExpression(propertyMap, destinationListType, selectExpression);
bindExpression = Expression.Bind(propertyMap.DestinationProperty.MemberInfo, toListCallExpression);
}
else if (propertyMap.DestinationPropertyType.IsArray)
{
// Call .ToArray() on IEnumerable
MethodCallExpression toArrayCallExpression = Expression.Call(
typeof (Enumerable),
"ToArray",
new[] {destinationListType},
selectExpression);
bindExpression = Expression.Bind(propertyMap.DestinationProperty.MemberInfo, toArrayCallExpression);
}
else
{
// destination type implements ienumerable, but is not an ilist. allow deferred enumeration
bindExpression = Expression.Bind(propertyMap.DestinationProperty.MemberInfo, selectExpression);
}
return bindExpression;
}
示例8: gtk_application_new
public static IntPtr gtk_application_new(string application_id, Internal.GIO.Constants.GApplicationFlags flags)
{
if (LIBRARY_FILENAME == LIBRARY_FILENAME_V2) {
return IntPtr.Zero;
} else {
return gtk_application_new_v3 (application_id, flags);
}
}
示例9: TransactionStats
internal TransactionStats(Internal.TxnStatStruct stats) {
st = stats.st;
lastCkp = new LSN(st.st_last_ckp.file, st.st_last_ckp.offset);
txns = new List<ActiveTransaction>();
for (int i = 0; i < st.st_nactive; i++)
txns.Add(new ActiveTransaction(
stats.st_txnarray[i], stats.st_txngids[i], stats.st_txnnames[i]));
}
示例10: Build
internal void Build(Internal.SyntaxTree tree)
{
foreach(Internal.StatementNode n in tree.Nodes)
{
DataGroup group = BuildGroup(n);
_TopGroups.Add(group);
}
}
示例11: OnGetRootDirectoryFromCommandLineResult
private void OnGetRootDirectoryFromCommandLineResult(Internal.GetRootDirectoryFromCommandLineResult message)
{
var directory = message.RootDirectory;
if (directory != null)
{
SetRootDir(directory);
}
}
示例12: ReplicationStats
internal ReplicationStats(Internal.ReplicationStatStruct stats) {
st = stats;
next = new LSN(st.st_next_lsn.file, st.st_next_lsn.offset);
waiting = new LSN(st.st_waiting_lsn.file, st.st_waiting_lsn.offset);
maxPerm =
new LSN(st.st_max_perm_lsn.file, st.st_max_perm_lsn.offset);
winner = new LSN(st.st_election_lsn.file, st.st_election_lsn.offset);
}
示例13: MappingEngine
public MappingEngine(IMapperContext mapperContext,
Internal.IDictionary<TypePair, IObjectMapper> objectMapperCache,
Func<Type, object> serviceCtor)
{
/* Never, ever carry a previously configured engine forward:
that's the whole point of facilitating micro-mapping. */
_mapperContext = mapperContext;
ObjectMapperCache = objectMapperCache;
ServiceCtor = serviceCtor;
_mapperContext.ConfigurationProvider.TypeMapCreated += ClearTypeMap;
}
示例14: PeekAndParse
public static bool PeekAndParse(
CharStream stream,
string identifier, Internal.LocaleContext.Builder builder)
{
if (stream.PeekNext() != '(')
{
return false;
}
Macro.Parse(stream, identifier, builder);
return true;
}
示例15: BuildArray
private DataArray BuildArray(Internal.ArrayNode n)
{
DataArray array = new DataArray();
foreach(Internal.ValueNode v in n.Nodes)
{
Data data = BuildArrayValue(v);
if (data != null)
array.Add(data);
}
return array;
}