本文整理汇总了C#中Messages.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Messages.Add方法的具体用法?C# Messages.Add怎么用?C# Messages.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
private static Response Process(string input, string[] args)
{
try
{
switch (args[0])
{
case "compile":
return Compiler.Compile(JsonConvert.DeserializeObject<CompileRequest>(input));
case "nunit":
return NUnitTester.Test(JsonConvert.DeserializeObject<TestRequest>(input));
case "nugetpack":
return NuGetter.Pack(JsonConvert.DeserializeObject<NuGetPackRequest>(input));
case "nugetpush":
return NuGetter.Push(JsonConvert.DeserializeObject<NuGetPushRequest>(input));
case "nugetrestore":
return NuGetter.Restore(JsonConvert.DeserializeObject<NuGetRestoreRequest>(input));
default:
throw new ApplicationException("Unsupported type '" + args[0] + "'");
}
}
catch (Exception e)
{
var messages = new Messages();
messages.Add(Message.CreateError(e.ToString()));
return new Response(messages);
}
}
示例2: ParseMsg
/// <summary>
/// Parse messages
/// </summary>
/// <param name="input">Data input</param>
/// <returns></returns>
public Messages ParseMsg(string input)
{
var messages = new Messages();
try
{
var r = new Regex(@"\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""\r\n(.+)\r\n");
var m = r.Match(input);
while (m.Success)
{
var msg = new Message
{
Index = m.Groups[1].Value,
Status = m.Groups[2].Value,
Sender = m.Groups[3].Value,
Alphabet = m.Groups[4].Value,
Sent = m.Groups[5].Value,
Content = m.Groups[6].Value
};
messages.Add(msg);
m = m.NextMatch();
}
}
catch (Exception ex) { throw ex; }
return messages;
}