本文整理汇总了C#中KacTalk.ktList类的典型用法代码示例。如果您正苦于以下问题:C# ktList类的具体用法?C# ktList怎么用?C# ktList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ktList类属于KacTalk命名空间,在下文中一共展示了ktList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ktXML
public ktXML(ktList List)
: this()
{
if (List == null)
{
return;
}
if (List.Node != null)
{
m_Node = new ktXMLNode(List.Node);
}
else
{
m_Node = new ktXMLNode("post");
}
//ktDebug.Log( "POST:" + List.Get_R( "\t", true ) + "=###=#==#=#==##==#=#=#=");
List.Reset();
foreach (ktList L in List)
{
if (L != null)
{
AddList(new ktXML(L));
}
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:27,代码来源:ktXML.cs
示例2: Add
/// <summary>
/// Add values to the integer (changes the value of the object)
/// </summary>
/// <param name="Arguments">A list of values to add to the integer</param>
/// <returns>The sum of all the arguments and the internal integer</returns>
public ktValue Add(ktList Arguments)
{
ktValue Value = ktValue.Null;
// Check so we actually got some arguments
if (Arguments.IsEmpty())
{
throw new ktError("Can't add nothing (null) to an integer!", ktERR.NOTDEF);
}
// Go through the list of arguments
foreach (ktList L in Arguments)
{
// If there's nothing in this argument
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
// Try to convert the argument to an int and add it to the internal integer
m_value += GetAsInt((ktValue)L.Node.Value);
}
// Wrap this object in a ktValue ...
Value = new ktValue("return", "ktInt", this, m_HardType, true);
// ... and return it
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:33,代码来源:ktInt.cs
示例3: Run
public ktValue Run(ktList Arguments)
{
if (m_function == null)
{
throw new ktError("No function defined in ktFunction wrapper class!", ktERR.NOTDEF);
}
return m_function.Run(Arguments);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:9,代码来源:ktFunctionClass.cs
示例4: Compare
public override int Compare(ktString op, ktList arguments)
{
if (arguments.Count == 1)
{
return Compare(op, (ktValue)arguments.FirstNode.Value);
}
else
{
throw new ktError("Compare for more than 1 value is not implemented in '" + this.m_Name + "'!");
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:11,代码来源:ktBool.cs
示例5: ktClass
public ktClass(ktString Name, ktClass Parent, ktList Properties, ktList Methods,
bool AddIfNotSet, bool IsClass_, bool HardType = false, bool IsConstant = false)
: base("ktClass", 0)
{
m_Name = Name;
m_Parent = Parent;
m_Properties = Properties;
m_Methods = Methods;
m_AddIfNotSet = AddIfNotSet;
m_IsClass = IsClass_;
m_HardType = HardType;
m_IsConstant = IsConstant;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:13,代码来源:ktClass.cs
示例6: ktBlock
}/*
public ktBlock( ktBlock Block ) : this()
{
SetBlock( Block );
}*/
public bool SetLines(ktList Lines)
{
if (Lines == null)
{
return false;
}
/* * /
m_Lines = new ktList( Lines );/*/
m_Lines = Lines;/* */
return true;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:20,代码来源:ktBlock.cs
示例7: AddContext
public bool AddContext(ktContext Context)
{
if (Context == null)
{
return false;
}
if (m_Contexts == null)
{
m_Contexts = new ktList();
}
return m_Contexts.Add(Context.Name, Context);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:14,代码来源:ktModule.cs
示例8: Assign
/// <summary>
/// Assign a value to the float
/// </summary>
/// <param name="Arguments">The value to assign</param>
/// <returns>ktValue with the current object</returns>
public ktValue Assign(ktList Arguments)
{
ktValue Value = ktValue.Null;
// Can't assign nothing..
if ((Arguments.IsEmpty()) || ((ktValue)Arguments.First.Node.Value).IsNull())
{
throw new ktError("Can't assign nothing (null) to a float!", ktERR.NOTDEF);
}
// Store the first value given as argument (ignore the rest)
m_value = GetAsFloat((ktValue)Arguments.First.Node.Value);
// Return this object wrapped in a ktValue
return new ktValue(this.Name, "ktFloat", this, m_HardType, false);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:21,代码来源:ktFloat.cs
示例9: ktDelegateFunction
public ktDelegateFunction(ktString Name, ktFunction_Double_Delegate Delegate)
: base(Name, null, null, ktValue.Null)
{
m_Arguments = new ktList();
m_Arguments.Add(new ktValue("D", "double",
kacTalk.Main.GetClass("double"),
true, true));
m_Delegate = delegate(ktList Args)
{
if ((Args == null) || (Args.FirstNode == null) ||
(Args.FirstNode.Value == null))
{
throw new ktError("Didn't get an argument for '" +
Name + "'!", ktERR.MISSING);
}
//ktDebug.Log( "ktDF::DOUBLE(" +Args.FirstNode.Value.ToString() + ")" );
ktString S_In = new ktString(Args.FirstNode.Value.ToString());
double D_In = 0.0;
double D_Out = 0.0;
try
{
if (System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator == ",")
{
S_In.Replace(".", ",", true);
}
D_In = S_In.ToDouble();
}
catch (Exception E)
{
if (E.GetType() == typeof(System.FormatException) && !S_In.IsEmpty())
{
throw new ktError("ktDouble::CreateObject: Cant make '" + S_In + "' into an double", ktERR.WRONGTYPE);
}
}
ktDebug.Log("D_In: " + D_In.ToString());
D_Out = Delegate(D_In);
ktDebug.Log("D_Out: " + D_Out.ToString());
return new ktValue("return", "double",
kacTalk.Main.MakeObjectOf("double", D_Out),
true, true);
};
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:46,代码来源:ktFunction.cs
示例10: Output
public static ktValue Output( ktList Arguments )
{
string str, ret = "";
foreach (ktList L in Arguments)
{
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
str = L.Node.ValueToString();
ret += str;
Console.WriteLine("OUTPUT:" + str );
try
{
Form1.LogText( str );
} catch (Exception) {}
}
return new ktValue("return", "ktString", new ktStringClass(ret), true, true);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:22,代码来源:ktIDEContext.cs
示例11: _RunMethod
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
switch (Name.AsLower())
{
case "run":
case "_run":
case "execute":
case "_execute":
case "_func_call":
{
Value = Run( Arguments );
break;
}
default:
{
throw new ktError("Couldn't find the method '" +
Name + "' in class '" + m_Name + "'.", ktERR._404);
}
}
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:24,代码来源:ktFunctionClass.cs
示例12: ktRunStatement
public ktRunStatement(ktList Statement, ktBlock Block)
: base("ktRunStatement", 0)
{
m_Statement = Statement;
m_Block = Block;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:6,代码来源:ktRunStatement.cs
示例13: _RunMethod
/// <summary>
/// Run a method
/// </summary>
/// <param name="Name"></param>
/// <param name="Arguments"></param>
/// <returns></returns>
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
//ktDebug.Log("ktInt::" + Name);
// Check the name of the method to call and call appropriate method
switch (Name.AsLower())
{
case "_add":
case "op+":
case "operator+":
{
Value = _Add(Arguments);
break;
}
case "add":
case "op+=":
case "operator+=":
case "_append":
{
CheckIfConstant(Name);
Value = Add(Arguments);
break;
}
case "increase":
case "op++":
case "operator++":
case "_increase":
{
CheckIfConstant(Name);
Value = Increase();
break;
}
case "_subtract":
case "op-":
case "operator-":
{
Value = _Subtract(Arguments);
break;
}
case "op-=":
case "operator-=":
case "subtract":
{
CheckIfConstant(Name);
Value = Subtract(Arguments);
break;
}
case "decrease":
case "op--":
case "operator--":
case "_decrease":
{
CheckIfConstant(Name);
Value = Decrease();
break;
}
case "_multiply":
case "_times":
case "op*":
case "operator*":
{
Value = _Multiply(Arguments);
break;
}
case "multiply":
case "times":
case "op*=":
case "operator*=":
{
CheckIfConstant(Name);
Value = Multiply(Arguments);
break;
}
case "_divide":
case "op/":
case "operator/":
{
Value = _Divide(Arguments);
break;
}
case "op/=":
case "operator/=":
case "divide":
{
CheckIfConstant(Name);
Value = Divide(Arguments);
break;
}
case "_mod":
case "_modulus":
case "op%":
case "operator%":
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktInt.cs
示例14: _Power
/// <summary>
/// Calculate the value of the integer raised to the power of the arguments (doesn't change the value of the object)
/// </summary>
/// <param name="Arguments">A list of values to raise the integer with</param>
/// <returns>The value of the internal integer to the power of the arguments</returns>
public ktValue _Power(ktList Arguments)
{
ktValue Value = ktValue.Null;
int res = m_value;
int a = 1;
// Check so we actually got some arguments
if (Arguments.IsEmpty())
{
throw new ktError("Can't raise an integer with nothing (null)!", ktERR.NOTDEF);
}
// Go through the list of arguments
foreach (ktList L in Arguments)
{
// If there's nothing in this argument
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
// Get the argument as an integer
a = GetAsInt((ktValue)L.Node.Value);
// Raise it to the power of the argument
res = (int)Math.Pow((double)res,(double)a);
}
// Create a new ktInt and wrap it in a ktValue
Value = new ktValue("return", "ktInt", new ktInt(res), true, true);
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:36,代码来源:ktInt.cs
示例15: _Multiply
/// <summary>
/// Multiply values with the integer (doesn't change the value of the object)
/// </summary>
/// <param name="Arguments">A list of values to multiply with the integer</param>
/// <returns>The product of all the arguments and the internal integer</returns>
public ktValue _Multiply(ktList Arguments)
{
ktValue Value = ktValue.Null;
int res = m_value;
// Check so we actually got some arguments
if (Arguments.IsEmpty())
{
throw new ktError("Can't multiply nothing (null) to an integer!", ktERR.NOTDEF);
}
// Go through the list of arguments
foreach (ktList L in Arguments)
{
// If there's nothing in this argument
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
// Multiply with the current argument
res *= GetAsInt((ktValue)L.Node.Value);
}
// Create a new ktInt and wrap it in a ktValue
Value = new ktValue("return", "ktInt", new ktInt(res), true, true);
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:32,代码来源:ktInt.cs
示例16: _Modulus
/// <summary>
/// Calculate the modulus of the integer and the arguments (doesn't change the value of the object)
/// </summary>
/// <param name="Arguments">A list of values to multiply with the integer</param>
/// <returns>The product of all the arguments and the internal integer</returns>
public ktValue _Modulus(ktList Arguments)
{
ktValue Value = ktValue.Null;
ktValue Arg = ktValue.Null;
int res = m_value;
int a = 1;
// Check so we actually got some arguments
if (Arguments.IsEmpty())
{
throw new ktError("Can't divide an integer with nothing (null)!", ktERR.NOTDEF);
}
// Go through the list of arguments
foreach (ktList L in Arguments)
{
// If there's nothing in this argument
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
// Get the argument as an integer
a = GetAsInt((ktValue)L.Node.Value);
// Do modulus with the current argument
res %= a;
}
// Create a new ktInt and wrap it in a ktValue
Value = new ktValue("return", "ktInt", new ktInt(res), true, true);
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:37,代码来源:ktInt.cs
示例17: _ExclusiveOr
/// <summary>
/// Calculate the value of the integer XOR with the power of the arguments (doesn't change the value of the object)
/// </summary>
/// <param name="Arguments">A list of values to XOR the integer with</param>
public ktValue _ExclusiveOr(ktList Arguments)
{
ktValue Value = ktValue.Null;
int res = m_value;
int a = 1;
// Check so we actually got some arguments
if (Arguments.IsEmpty())
{
throw new ktError("Can't divide an integer with nothing (null)!", ktERR.NOTDEF);
}
// Go through the list of arguments
foreach (ktList L in Arguments)
{
if ((L.Node == null) || (L.Node.Value == null))
{
continue;
}
// Get the argument as an integer
a = GetAsInt((ktValue)L.Node.Value);
// Perform an XOR-operation
res ^= a;
}
// Create a new ktInt and wrap it in a ktValue
Value = new ktValue("return", "ktInt", new ktInt(res), false, true);
return Value;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:34,代码来源:ktInt.cs
示例18: Initiate
public void Initiate()
{
if (m_Channel == null)
{
throw new ktError("ktTalker::Initiate failed due to the lack of a Channel!");
}
m_AvailableObjects = new ktList();
m_Channel.Initiate( m_URI, m_APIKey );
Console.WriteLine(m_AvailableObjects.Get_R());
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:12,代码来源:ktTalker.cs
示例19: GetMethods
public override ktList GetMethods()
{
ktList List = new ktList();
List.Add("Export", CreateObject("0"));
return List;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:8,代码来源:ktRunStatement.cs
示例20: GetProperties
public override ktList GetProperties()
{
ktValue This = new ktValue(m_Name, "int", this, true, false);
ktList List = new ktList();
List.Add("_", This);
List.Add("this", This);
List.Add("_this", This);
List.Add("object", This);
List.Add("_object", This);
List.Add("MathMode", This);
return List;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:15,代码来源:ktRunStatement.cs
注:本文中的KacTalk.ktList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论