当前位置: 首页>>代码示例>>C#>>正文


C# Engine.Dispose方法代码示例

本文整理汇总了C#中Engine.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.Dispose方法的具体用法?C# Engine.Dispose怎么用?C# Engine.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Connect

 /// <summary>
 /// Connects to the configured backup archive
 /// </summary>
 static void Connect()
 {
     engine = new Engine()
      {
     Connection = new Connection(connectionString),
     Canceler = canceler.Token
      };
      try
      {
     engine.OnProgress += HandleProgress;
     engine.OnError += HandleError;
     engine.OpenArchive(archiveName, password);
     if (cleanupSessions)
     {
        Console.Write("   Deleting existing restore sessions...");
        foreach (var session in engine.Archive.Restores)
           engine.DeleteRestore(session);
        Console.WriteLine("done.");
     }
      }
      catch
      {
     engine.Dispose();
     throw;
      }
 }
开发者ID:bspell1,项目名称:SkyFloe,代码行数:29,代码来源:Program.cs

示例2: processBoard

        private static void processBoard(string[] boardParts, TextWriter output, NodeCounter counter)
        {
            // check params first
            if (boardParts.Length < 2) {
                output.Write("Error: not enough arguments supplied.\t");
                return;
            }
            Chess[,] board = parseBoard(boardParts[0]);
            if (board == null) {
                output.Write("Error: board not recognized.\t");
                return;
            }

            Chess mover = parseMover(boardParts[1]);
            if (mover == Chess.AVAILABLE) {
                output.Write("Error: mover not recognized.\t");
                return;
            }

            bool wld = false, warmup = false;
            int mid = 0;
            for (int i = 2; i < boardParts.Length; i++) {
                string option = boardParts[i].ToUpper();
                if (option == "WLD")
                    wld = true;
                else if (option == "WARMUP")
                    warmup = true;
                else if (option.StartsWith("MID")) {
                    Int32.TryParse(option.Substring(3), out mid);
                    if (mid < 0) mid = 0;
                }
            }

            Engine.clearCache();
            Engine engine = new Engine();
            engine.setBoard(board);

            DateTime timeStart = DateTime.Now;
            SearchResult res = (mid == 0) ? engine.solveExact(mover, wld) : engine.solve(mover, mid, false);
            TimeSpan timeSpan = DateTime.Now - timeStart;

            SearchStats stats = engine.getSearchStats();

            engine.Dispose();

            output.Write(resultString(res, wld, mid));
            output.Write("\t");
            output.Write(moveString(res));
            output.Write("\t");
            output.Write(nodesString(stats.EvaluationCount));
            output.Write("\t");
            output.Write(npsString(timeSpan, stats.EvaluationCount));
            output.Write("\t");
            output.Write(timeSpan.TotalSeconds.ToString("0.0") + " s");
            output.Write("\t");

            if (!warmup) {
                counter.totalNodes += stats.EvaluationCount;
                counter.totalTime += timeSpan;
            }
        }
开发者ID:patwonder,项目名称:craft-othello,代码行数:61,代码来源:ScriptRunner.cs


注:本文中的Engine.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。