本文整理汇总了C#中TType类的典型用法代码示例。如果您正苦于以下问题:C# TType类的具体用法?C# TType怎么用?C# TType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TType类属于命名空间,在下文中一共展示了TType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TMap
public TMap(TType keyType, TType valueType, int count)
:this()
{
this.keyType = keyType;
this.valueType = valueType;
this.count = count;
}
示例2: isUnknownType
public static bool isUnknownType(TType type)
{
var types = new HashSet<string>(new string[] {
"Boolean",
"int",
"uint",
"Object",
"Number",
"Array",
"String",
"void",
"*",
"Function"
});
string typeName = type.name;
//if (type.name == "sequence") typeName = "Vector.<" + type.genericType.name + ">";
if (types.Contains(typeName)) return false;
var fType = Generator.findFileType(type.name);
if ((fType != null) && fType.CheckExport())
{
return false;
}
return true;
}
示例3: TMap
public TMap(TType keyType, TType valueType, int count)
: this()
{
KeyType = keyType;
ValueType = valueType;
Count = count;
}
示例4: Trainer
public Trainer(IQuestion[] questions, TType trainingType)
{
_questions = new List<IQuestion>(questions);
_trainingType = trainingType;
_isFinished = false;
_isStarted = false;
}
示例5: Field
public Field(string name, TType type, short id)
: this()
{
this.name = name;
this.type = type;
this.id = id;
}
示例6: GetTypeNameForTypeID
private static byte[] GetTypeNameForTypeID(TType typeID)
{
switch (typeID)
{
case TType.Bool:
return NAME_BOOL;
case TType.Byte:
return NAME_BYTE;
case TType.I16:
return NAME_I16;
case TType.I32:
return NAME_I32;
case TType.I64:
return NAME_I64;
case TType.Double:
return NAME_DOUBLE;
case TType.String:
return NAME_STRING;
case TType.Struct:
return NAME_STRUCT;
case TType.Map:
return NAME_MAP;
case TType.Set:
return NAME_SET;
case TType.List:
return NAME_LIST;
default:
throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED,
"Unrecognized type");
}
}
示例7: Skip
public static void Skip(Serializer prot, TType type)
{
switch (type)
{
case TType.Bool:
prot.ReadBool();
break;
case TType.Byte:
prot.ReadByte();
break;
case TType.I16:
prot.ReadI16();
break;
case TType.I32:
prot.ReadI32();
break;
case TType.I64:
prot.ReadI64();
break;
case TType.Double:
prot.ReadDouble();
break;
case TType.String:
// Don't try to decode the string, just skip it.
prot.ReadBinary();
break;
case TType.DataObject:
prot.ReadDataObjectBegin();
while (true)
{
Field field = prot.ReadFieldBegin();
if (field.Type == TType.Stop)
{
break;
}
Skip(prot, field.Type);
prot.ReadFieldEnd();
}
prot.ReadDataObjectEnd();
break;
case TType.Map:
TMap map = prot.ReadMapBegin();
for (int i = 0; i < map.Count; i++)
{
Skip(prot, map.KeyType);
Skip(prot, map.ValueType);
}
prot.ReadMapEnd();
break;
case TType.List:
TList list = prot.ReadListBegin();
for (int i = 0; i < list.Count; i++)
{
Skip(prot, list.ElementType);
}
prot.ReadListEnd();
break;
}
}
示例8: Test
public Test(TType type, IQuestion[] questions, DateTime timeToStart, string description)
{
_type = type;
_questions=new List<IQuestion>(questions);
_isStarted = false;
_isFinished = false;
_timeToStart = timeToStart;
_description = description;
}
示例9: GetDMVinfo
public void GetDMVinfo(string GetQueryInfo,string Method, string parametrs, string Table, string Extra)
{
int StructCount = 0;
string connectionString = @"Data Source=(local)\SERVER2012;
Initial Catalog=AdventureWorks2012;
Integrated Security=True";
string DMVString = "SELECT query_hash, st.text,total_worker_time,cp.objtype,qs.execution_count,qp.query_plan,qs.query_hash FROM sys.dm_exec_query_stats qs " +
"CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st " +
"CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp " +
"JOIN sys.dm_exec_cached_plans cp " +
"ON cp.plan_handle = qs.plan_handle " +
"WHERE (st.text like'%" + Method + "%%"+ parametrs+"%%" + Table + "%%" + Extra + "%' AND st.text NOT like '%st.text%')";
//Console.WriteLine(DMVString);
using (SqlConnection connection = new SqlConnection(connectionString))
{
Console.WriteLine("GetDMVInfo Connection Success \n");
SqlCommand command = new SqlCommand(DMVString, connection);
try
{
connection.Open();
SqlDataReader reader = command.ExecuteReader();
Console.WriteLine("Select info from DMV");
Console.ForegroundColor = ConsoleColor.Cyan;
while (reader.Read())
{
TType newTType = new TType();
Console.WriteLine("---------------> New Query has been searshed <------------ \n");
Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", reader[0], reader[1], reader[2], reader[3]);
Console.WriteLine("");
newTType.query_hash = reader[0].ToString();
newTType.QueryText = reader[1].ToString();
newTType.CPUTime = Int32.Parse(reader[2].ToString());
newTType.ObjType = reader[3].ToString();
newTType.ExecCount = Int32.Parse(reader[4].ToString());
newTType.QueryPlan = reader[5].ToString();
newTType.QueryHash = (byte[])reader[6];
newTType.temp = reader[6].ToString();
if (newTType.ObjType != "Adhoc")
{
InfoStruct.Add(newTType);
StructCount++;
}
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("GetDMVinfo: Status -----> Complete \n");
Console.ForegroundColor = ConsoleColor.White;
reader.Close();
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Не удалось получить DMVinfo \n");
}
}
}
示例10: Tile
//advanced constructor
public Tile(Rectangle r, Texture2D asset, Int16 i)
{
dirt = asset;
rect = r;
switch (i)
{
default:
type = TType.air;
drawme = false;
break;
case 1:
type = TType.ground;
drawme = true;
break;
case 2:
type = TType.misha;
drawme = true;
break;
}
}
示例11: readType
private TType readType()
{
var type = new TType();
//Program.allTypes.Add(type);
type.name = currentToken.value;
if (type.name == "unsigned") type.name += " " + getNextToken().value;
getNextToken();
if (currentToken.value == "long")
{
type.name += " long";
getNextToken();
}
if (currentToken.token == ECodeToken.blLessThan)
{
getNextToken();
type.genericType = readType();
getNextToken();
}
if (currentToken.token == ECodeToken.brSmallBraceBegin)
{
type.isArray = true;
getNextToken();
getNextToken();
}
if (currentToken.token == ECodeToken.syQuestionmark)
{
type.isNullable = true;
getNextToken();
}
type.name = getTypeName(type.name);
return type;
}
示例12: TField
public TField(string name, TType type, short id)
{
Name = name;
Type = type;
ID = id;
}
示例13: isUnknownType
public static bool isUnknownType(TType type)
{
var types = new HashSet<string>(new string[] {
"bool",
"int",
"float",
"double",
"short",
"ushort",
"uint",
"long",
"ulong",
"object",
"Array",
"byte",
"JsString",
"string",
"JsObject",
"JsArray",
"void",
});
string typeName = type.name;
if (type.name == "sequence") typeName = type.genericType.name;
//if (typeName.EndsWith("Constructor")) return true;
if (types.Contains(typeName)) return false;
foreach (var pFile in Generator.parsedFiles)
{
foreach (var ns in pFile.nsList)
{
foreach (var t in ns.types)
{
if (t.name == typeName)
{
return false;
}
}
}
}
return true;
}
示例14: WriteCollectionBegin
//
// Internal writing methods
//
/**
* Abstract method for writing the start of lists and sets. List and sets on
* the wire differ only by the type indicator.
*/
protected void WriteCollectionBegin(TType elemType, int size)
{
if (size <= 14)
{
WriteByteDirect(size << 4 | getCompactType(elemType));
}
else
{
WriteByteDirect(0xf0 | getCompactType(elemType));
WriteVarint32((uint)size);
}
}
示例15: getCompactType
/**
* Given a TType value, find the appropriate TCompactProtocol.Types constant.
*/
private byte getCompactType(TType ttype)
{
return ttypeToCompactType[(int)ttype];
}