本文整理汇总了C#中KacTalk.ktString类的典型用法代码示例。如果您正苦于以下问题:C# ktString类的具体用法?C# ktString怎么用?C# ktString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ktString类属于KacTalk命名空间,在下文中一共展示了ktString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ktRequestObject
public ktRequestObject(ktString obj, ktString memb, Dictionary<ktString, ktString> args, ktTalkFormat form = ktTalkFormat._DEFUALT)
{
Object = obj;
Member = memb;
Arguments = args;
Format = form;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:7,代码来源:ktTalker.cs
示例2: ktError
/// <summary>
/// Constructor for the error class (mostely used when throwing errors)
/// </summary>
/// <param name="Error">The error message</param>
/// <param name="ErrorNum">The error number</param>
/// <param name="LineNo">The line on which the error was thrown</param>
/// <param name="CharPos">The character by which the error was thrown</param>
public ktError(ktString Error, ktERR ErrorNum, int LineNo, int CharPos)
: base(Error)
{
m_Num = ErrorNum;
m_LineNo = LineNo;
m_CharPos = CharPos;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:14,代码来源:ktError.cs
示例3: SetVariable
public bool SetVariable(ktString Name, ktValue Value, bool Add, bool Copy, bool IgnoreConstant)
{
// Nothing to use??
if (Name.IsEmpty() || (Value == null) || (m_Block == null))
{
return false;
}
return m_Block.SetVariable(Name, Value, Add, Copy, IgnoreConstant);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:10,代码来源:ktRunStatement.cs
示例4: ktModule
public ktModule(ktString Name, ktString Filename, bool Load)
: base("ktIntObj", 0)
{
m_Name = Name;
m_Filename = Filename;
if (Load)
{
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:10,代码来源:ktModule.cs
示例5: ktContext
public ktContext(ktString Name)
: base("ktContext", 0)
{
m_Name = Name;
m_Parent = null;
m_Aliases = null;
m_Variables = null;
m_Functions = null;
m_AddIfNotSet = true;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:10,代码来源:ktContext.cs
示例6: 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
示例7: ktValue
public ktValue(ktString Name, ktString Type, ktIntObj Object,
bool HardType, bool Constant, ktClass CallbackClass)
: base("ktValue", 0)
{
m_Object = Object;
SetName(Name);
SetType(Type);
SetHardType(HardType);
SetConstant(Constant);
SetCallback(CallbackClass);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:12,代码来源:ktValue.cs
示例8: 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
示例9: Initiate
public override bool Initiate(ktString URI, ktString APIKey)
{
m_Initiated = true;
m_URI = URI;
m_Key = APIKey;
OpenConnection();
CheckVersion();
RequestAvailableObjects();
CloseConnection();
return true;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:15,代码来源:ktHttpTalker.cs
示例10: 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
示例11: ktTalker
public ktTalker( ktString InfoStr, ktTalkerChannel TalkerChannel = null )
: base("ktTalker", 0)
{
m_InfoMap = ParseInfoString(InfoStr);
m_APIKey = GetProperty("KEY");
m_URI = GetProperty("URI");
if (TalkerChannel != null)
{
m_Channel = TalkerChannel;
}
else
{
ktString Channel = "";
if (m_InfoMap.ContainsKey("CHANNEL")) Channel = m_InfoMap["CHANNEL"];
else if (m_InfoMap.ContainsKey("PROTO")) Channel = m_InfoMap["PROTO"];
else if (m_InfoMap.ContainsKey("PROTOCOL")) Channel = m_InfoMap["PROTOCOL"];
if (Channel.IsEmpty())
{
throw new ktError("ktTalker wasn't given a channel!");
}
try
{
Type type = Type.GetType("ktTalkers.ktTalker" + Channel.Capitalize() + "Channel");
object[] args = { this };
m_Channel = (ktTalkerChannel)Activator.CreateInstance(type,args);
}
catch (Exception Exc)
{
if ((Exc is ArgumentNullException) || (Exc is ArgumentException) || (Exc is NotSupportedException)
|| (Exc is InvalidComObjectException) || (Exc is TypeLoadException))
{
throw new ktError("ktTalker couldn't create a Channel object for '" + Channel + "'!");
}
else
{
throw Exc;
}
}
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:45,代码来源:ktTalker.cs
示例12: _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
示例13: SetProperty
public override ktValue SetProperty(ktString Name, ktValue Value)
{
if ((Name == "this") || (Name == "_this") ||
(Name == "object") || (Name == "_object") ||
(Name == "_") || (Name.IsEmpty()))
{
/*try {
m_Value = Convert.ToInt32( Value.ToString() );
} catch (Exception E) {
if (E.GetType() == typeof( System.FormatException )) {
throw new ktError( "kactalkClass::CreateObject: Cant make '" + Value + "' into an integer", ktERR.WRONGTYPE );
}
}*/
} /*else if (Name == "MathMode") {
// m_Value.MathMode = (((ktClass)Value.Value).ToString().ToLower() == "true");
m_Value.MathMode = Value.ToBool();
} */else
{
throw new ktError("Couldn't find the property '" +
Name + "' in class '" + m_Name + "'.", ktERR._404);
}
return GetProperty("_");
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:24,代码来源:ktRunStatement.cs
示例14: AddAvailableObject
internal void AddAvailableObject(ktString o)
{
if (m_AvailableObjects == null)
m_AvailableObjects = new ktList();
m_AvailableObjects.Add(o);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:7,代码来源:ktTalker.cs
示例15: AddExtraParameter
public void AddExtraParameter(ktString name, ktString value)
{
m_ExtraParams.Add(name, value);
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:4,代码来源:ktTalker.cs
示例16: GetProperty
public ktString GetProperty( ktString Key )
{
try
{
return m_InfoMap[Key];
} catch (Exception)
{
return "";
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:10,代码来源:ktTalker.cs
示例17: ToType
public object ToType(ktString Type)
{
if (m_Object == null)
{
return null;
}
try
{
ktClass Class = (ktClass)m_Object;
return Class.RunMethod("To" + Type).ToType(Type);
}
catch (Exception)
{
}
switch (Type.AsLower())
{
case "bool":
{
if (m_Object.GetType() == typeof(bool))
{
return m_Object;
}
else if (m_Object.GetType() == typeof(int))
{
return ((int)m_Object) != 0;
}
else if (m_Object.GetType() == typeof(float))
{
return ((float)m_Object) != 0.0f;
}
else if (m_Object.GetType() == typeof(double))
{
return ((double)m_Object) != 0.0;
}
else if (m_Object.GetType() == typeof(char))
{
return ((char)m_Object) != 0;
}
else if (m_Object.GetType() == typeof(string))
{
return ((string)m_Object) != "false";
}
else if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object) != "false";
}
else if (m_Object.GetType() == typeof(ktList))
{
return !((ktList)m_Object).IsEmpty();
}
else
{
return m_Object.ToString() != "false";
}
}
case "int":
case "integer":
{
try
{
if (m_Object.GetType() == typeof(bool))
{
return (((bool)m_Object) ? 1 : 0);
}
else if (m_Object.GetType() == typeof(int))
{
return m_Object;
}
else if (m_Object.GetType() == typeof(float))
{
return (int)((float)m_Object);
}
else if (m_Object.GetType() == typeof(double))
{
return (int)((double)m_Object);
}
else if (m_Object.GetType() == typeof(char))
{
return (int)((char)m_Object);
}
else if (m_Object.GetType() == typeof(string))
{
return Convert.ToInt32(((string)m_Object));
}
else if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object).ToInt();
}
else
{
return Convert.ToInt32(m_Object.ToString());
}
}
catch (Exception Err)
{
if (Err.GetType() == typeof(System.FormatException))
{
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktObject.cs
示例18: ParseInfoString
public static Dictionary<ktString, ktString> ParseInfoString( ktString InfoStr )
{
int p = 0, p2 = 0;
ktString property;
ktString prop_name, prop_value;
Dictionary<ktString, ktString> InfoMap = new Dictionary<ktString, ktString>();
while (!InfoStr.IsEmpty())
{
p = InfoStr.IndexOf(';');
if (p < 0)
{
property = InfoStr;
p = InfoStr.Length() - 1;
}
else
{
property = InfoStr.SubString(0, p).Trim();
}
p2 = property.IndexOf('=');
prop_name = property.SubString(0, p2).AsUpper();
prop_value = property.SubString(p2 + 1);
InfoMap.Add(prop_name, prop_value);
InfoStr.Remove(0, p + 1);
InfoStr = InfoStr.Trim();
}
return InfoMap;
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:32,代码来源:ktTalker.cs
示例19: CreateObject
public override ktClass CreateObject(ktString Value)
{
/*int I = 0;
try {
I = Value.ToInt();
} catch (Exception E) {
if (E.GetType() == typeof( System.FormatException )) {
throw new ktError( "kactalkClass::CreateObject: Cant make '" + Value + "' into an integer", ktERR.WRONGTYPE );
}
}*/
return new ktRunStatementClass(new ktRunStatement());
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:14,代码来源:ktRunStatement.cs
示例20: _RunMethod
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
if (Name.IsEmpty())
{
throw new ktError("Didn't get the name of the method to run in class '" +
m_Name + "'.", ktERR.NOTSET);
}
//ktDebug.Log( ";Name::"+ Name + ";;;;_\n" );
if (Name == "_PropertyChanged")
{
if ((Arguments == null) || (Arguments.GetCount() != 2))
{
throw new ktError("kactalk::_PropertyChanged() : Didn't get the two nnede arguments!",
ktERR.MISSING);
}
#if Debug
ktDebug.Log( "Args::" + Arguments.Get_R( "\t", true ) );
#endif
Name = Arguments.Get("Name").Node.Value.ToString();
ktValue Value = (ktValue)Arguments.Get("Value").Node.Value;
SetProperty(Name, Value);
return ktValue.Null;
}
else /*if (Name.StartsWith( "operator", out Name )) {
return HandleOperator( Name, Arguments );
} else */
{
throw new ktError("Couldn't find the method '" +
Name + "' in class '" + m_Name + "'.", ktERR._404);
}
}
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:34,代码来源:ktRunStatement.cs
注:本文中的KacTalk.ktString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论