本文整理汇总了C#中Dict.Val方法的典型用法代码示例。如果您正苦于以下问题:C# Dict.Val方法的具体用法?C# Dict.Val怎么用?C# Dict.Val使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dict
的用法示例。
在下文中一共展示了Dict.Val方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: V_VNA
public static void V_VNA(NetwRunnable nr, ExecHm rc, Bys m, out string name, out IDictionary<string, Object> args)
{
var res = new Dict(m.V<Dictionary<string, object>>());
name = res.Val("name", "");
var obj = res["args"];
args = res["args"] as IDictionary<string,object>;
}
示例2: TestDoWord
public void TestDoWord()
{
TaskPool.Shared.MaximumConcurrency = 3;
FCfg cfg = new FCfg();
DocCovT cov;
cov = new DocCovT("DocCov", cfg);
cov.DoCmd("a1", cfg, "Word test\\xx.docx docx_00-{0}.jpg 768 1024");
while (cov.done == null)
{
Thread.Sleep(500);
}
var data_ = cov.done as IDictionary<string, object>;
var data = new Dict(data_);
Assert.AreEqual(0, data.Val("code", -1));
Assert.AreEqual("a1", data.Val("tid", ""));
var res = data["data"] as CovRes;
Assert.AreEqual(true, res.Count > 0 && res.Count == res.Files.Count);
Assert.AreNotEqual(0, cov.rate);
//
cov = new DocCovT("DocCov", cfg);
cov.DoCmd("a2", cfg, "Word test\\xx.docxx docx_00-{0}.jpg 768 1024");
while (cov.done == null)
{
Thread.Sleep(500);
}
data_ = cov.done as IDictionary<string, object>;
data = new Dict(data_);
Assert.AreNotEqual(0, data.Val("code", 0));
Assert.AreEqual("a2", data.Val("tid", ""));
var err = data["err"] as String;
Assert.AreNotEqual(0, err.Length);
//
//
cov = new DocCovT("DocCov", cfg);
cov.error = true;
cov.DoCmd("a2", cfg, "Word test\\xx.docx docx_01-{0}.jpg 768 1024");
while (!cov.do_err)
{
Thread.Sleep(500);
}
}
示例3: TestDoPowerPoint
public void TestDoPowerPoint()
{
FCfg cfg = new FCfg();
DocCovT cov = new DocCovT("DocCov", cfg);
cov.DoCmd("a1", cfg, "PowerPoint test\\xx.pptx pptx_00-{0}.jpg");
while (cov.done == null)
{
Thread.Sleep(500);
}
var data_ = cov.done as IDictionary<string, object>;
var data = new Dict(data_);
Assert.AreEqual(0, data.Val("code", -1));
Assert.AreEqual("a1", data.Val("tid", ""));
var res = data["data"] as CovRes;
Assert.AreEqual(true, res.Count > 0 && res.Count == res.Files.Count);
Assert.AreNotEqual(0, cov.rate);
//
cov = new DocCovT("DocCov", cfg);
cov.DoCmd("a2", cfg, "PowerPoint test\\xx.pptxx pptxx_00-{0}.jpg 768 1024");
while (cov.done == null)
{
Thread.Sleep(500);
}
data_ = cov.done as IDictionary<string, object>;
data = new Dict(data_);
Assert.AreNotEqual(0, data.Val("code", 0));
Assert.AreEqual("a2", data.Val("tid", ""));
var err = data["err"] as String;
Assert.AreNotEqual(0, err.Length);
}
示例4: TestNormal
public void TestNormal()
{
FCfg cfg = new FCfg();
DocCovT cov = new DocCovT("DocCov", cfg);
cov.DoCmd("a1", cfg, "test\\dtm_json.bat");
while (cov.done == null)
{
Thread.Sleep(500);
}
var data_ = cov.done as IDictionary<string, object>;
var data = new Dict(data_);
Assert.AreEqual(0, data.Val("code", -1));
Assert.AreEqual("a1", data.Val("tid", ""));
var res = data["data"] as IDictionary<string, object>;
Assert.AreEqual(true, res.Count > 0);
}
示例5: TestStartDTM_C
public void TestStartDTM_C()
{
var cfg = new FCfg();
cfg["proc_env"] = "a=1,b=2";
var dtmc = new DTM_C_t("c", cfg);
var args = Util.NewDict();
var res = Util.NewDict();
var tres = new Dict();
var tid = "xx1";
args["tid"] = tid;
args["cmds"] = "test/dtm_json.bat abc";
//
var bs = new PrintStream();
RCM_Cmd cmd;
//
cmd = new RCM_Cmd(null, "", args);
res = dtmc.StartTask(cmd) as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreEqual(0, tres.Val("code", -1));
while (dtmc.Tasks.Count > 0)
{
Thread.Sleep(500);
}
Assert.AreNotEqual(null, dtmc.Done);
res = dtmc.Done as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreEqual(0, tres.Val("code", -1));
Assert.AreEqual(tid, tres.Val("tid", ""));
//
args["cmds"] = "test/dtm_json_err.bat abc";
res = dtmc.StartTask(cmd) as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreEqual(0, tres.Val("code", -1));
while (dtmc.Tasks.Count > 0)
{
Thread.Sleep(500);
}
Assert.AreNotEqual(null, dtmc.Done);
res = dtmc.Done as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreNotEqual(0, tres.Val("code", 0));
Assert.AreEqual(tid, tres.Val("tid", ""));
//
//
args["cmds"] = "sdfkfk";
res = dtmc.StartTask(cmd) as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreNotEqual(0, tres.Val("code", 0));
//Assert.AreEqual(tid, tres.Val("tid", ""));
//
args["cmds"] = "";
res = dtmc.StartTask(cmd) as Dictionary<String, object>;
tres = new Dict(res);
Console.WriteLine(Json.stringify(res));
Assert.AreNotEqual(0, tres.Val("code", 0));
//Assert.AreEqual(tid, tres.Val("tid", ""));
Console.WriteLine("Done...");
}
示例6: OnFfProc
public virtual HResult OnFfProc(Request r)
{
var args = HttpUtility.ParseQueryString(r.req.Url.Query);
var tid = args.Get("tid");
var duration_ = args.Get("duration");
if (String.IsNullOrWhiteSpace(tid) || String.IsNullOrWhiteSpace(duration_))
{
r.res.StatusCode = 400;
r.WriteLine("the tid/duration is required");
return HResult.HRES_RETURN;
}
float duration = 0;
if (!float.TryParse(duration_, out duration))
{
r.res.StatusCode = 400;
r.WriteLine("the duration must be float");
return HResult.HRES_RETURN;
}
StreamReader reader = new StreamReader(r.req.InputStream);
String line = null;
var frame = new Dict();
while ((line = reader.ReadLine()) != null)
{
line = line.Trim();
if (line.Length < 1)
{
continue;
}
var kvs = line.Split(new char[] { '=' }, 2);
var key = kvs[0].Trim();
if (kvs.Length < 2)
{
frame[key] = "";
}
else
{
frame[key] = kvs[1].Trim();
}
if (key != "progress")
{
continue;
}
var ms = frame.Val<float>("out_time_ms", 0);
this.DTMC.NotifyProc(tid, ms / duration);
}
r.res.StatusCode = 200;
r.WriteLine("OK");
r.Flush();
return HResult.HRES_RETURN;
}