/// <summary>
        /// Initialize everything that needs to be initialized once we're logged in.
        /// </summary>
        /// <param name="login">The status of the login</param>
        /// <param name="message">Error message on failure, MOTD on success.</param>
        public void RegisterCommand(string name, Cogbot.Actions.Command live)
        {
            string orginalName = name;

            name = name.Replace(" ", "").ToLower();
            while (name.EndsWith("."))
            {
                name = name.Substring(0, name.Length - 1);
            }
            Monitor.Enter(Commands);
            live.TheBotClient = this;
            CommandInstance prev;

            if (!Commands.TryGetValue(name, out prev))
            {
                CommandInstance command = new CommandInstance(live);
                Commands.Add(name, command);
                command.Name = orginalName;
                if (command.IsStateFul)
                {
                    live.TheBotClient     = this;
                    command.WithBotClient = live;
                }
            }
            else
            {
                if (prev.CmdType != live.GetType())
                {
                    RegisterCommand("!" + orginalName, live);
                }
            }
            Monitor.Exit(Commands);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检索是否有TCP在线终端的命令待发送。
        /// 条件:
        /// 1、预定发送时间在30s以内
        /// 2、命令的状态为等待发送状态(等待发送或等待重发)
        /// 3、终端为TCP链接状态的
        /// </summary>
        /// <returns></returns>
        public void CheckCommand()
        {
            if (null == _server)
            {
                return;
            }

            var list = CommandInstance.FindList(f => f.ScheduleTime >= DateTime.Now.AddSeconds(-30) &&
                                                f.Status <= (byte)CommandStatus.ReSending &&
                                                f.TB_Terminal.OnlineStyle == (byte)LinkType.TCP).ToList();

            foreach (var cmd in list)
            {
                // 0==链接不存在1=发送成功2=网络处理错误
                var ret = _server.Send(cmd.TB_Terminal.Socket.Value, Wbs.Utilities.CustomConvert.GetBytes(cmd.Content));
                if (ret == 0)
                {
                    // TCP链接丢失,重新用SMS方式发送
                    CommandUtility.SendSMSCommand(cmd);
                }
                else
                {
                    UpdateCommand(cmd, (1 == ret ? CommandStatus.SentByTCP : CommandStatus.TCPNetworkError));
                }
            }
        }
Exemplo n.º 3
0
        public CommandExecutionResult ExecuteCommand(object message)
        {
            CommandInstance   command;
            AggregateModel    aggregate;
            AggregateInstance instance;

            if (Model.Factories.Any(c => c.TargetType == message.GetType()))
            {
                command = new CommandInstance(
                    Model.Factories.Single(c => c.TargetType == message.GetType()), message);
                aggregate = Model.Aggregates.Single(c => c.IsCreatedBy(command.Model));
                instance  = aggregate.CreateInstance(Services);
            }
            else
            {
                command = new CommandInstance(
                    Model.Commands.Single(c => c.TargetType == message.GetType()), message);
                aggregate = Model.Aggregates.Single(c => c.HandlesCommand(command.Model));
                instance  = aggregate.CreateInstance(Services);

                var events = Store.Load(aggregate.Name, command.AggregateId).OfType <object>().Select(c => new DomainEventInstance(c));
                instance.Apply(events);
            }

            var result = instance.Execute(command);

            Store.Save(aggregate.Name, instance.Id, result.DomainEvents.Select(c => c.Object));
            return(result);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 执行命令
 /// </summary>
 public override void ExecuteCommand()
 {
     try
     {
         CommandInstance.CommandText = SqlCommandText;
         CommandInstance.Connection  = ConnectionInstance;
         ConnectionInstance.Open();
         if (SqlParametersInstance != null && SqlParametersInstance.Count > 0)
         {
             foreach (SqlParameter parameter in SqlParametersInstance)
             {
                 SqlParameter copyParameter = (SqlParameter)((ICloneable)parameter).Clone();
                 CommandInstance.Parameters.Add(copyParameter);
             }
         }
         SqlDataOperationRecord = CommandInstance.ExecuteNonQuery();
         ConnectionInstance.Close();
     }
     catch (Exception exception)
     {
         base.SettingOperattionMessage(exception.Message);
     }
     SettingCommandText(string.Empty);
     CommandInstance.Parameters.Clear();
     SqlParametersInstance.Clear();
 }
Exemplo n.º 5
0
 /// <summary>
 /// 数据读取器
 /// </summary>
 /// <returns></returns>
 public override DbDataReader ExecuteReader()
 {
     try
     {
         CommandInstance.CommandText = SqlCommandText;
         CommandInstance.Connection  = ConnectionInstance;
         ConnectionInstance.Open();
         if (SqlParametersInstance != null)
         {
             if (SqlParametersInstance.Count > 0)
             {
                 CommandInstance.Parameters.AddRange(SqlParametersInstance.ToArray());
             }
         }
         this.reader = CommandInstance.ExecuteReader();
         ConnectionInstance.Close();
     }
     catch (Exception ex)
     {
         base.SettingOperattionMessage(ex.Message);
     }
     SettingCommandText(string.Empty);
     CommandInstance.Parameters.Clear();
     SqlParametersInstance.Clear();
     return(this.reader);
 }
Exemplo n.º 6
0
 public DataTable Execute()
 {
     if (SqlConnection == null)
     {
         return(null);
     }
     else if (CommandInstance == null)
     {
         return(null);
     }
     else
     {
         var reader = CommandInstance.ExecuteReader();
         if (reader.HasRows)
         {
             var dataTable = new DataTable();
             dataTable.Load(reader);
             reader.Close();
             return(dataTable);
         }
         else
         {
             reader.Close();
             return(null);
         }
     }
 }
Exemplo n.º 7
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     FormMain main = Controller.Explorer.TreeView.FindForm() as FormMain;
     if (main != null)
     {
         main.ShowInBrowser("$html/about.html");
     }
 }
Exemplo n.º 8
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     FormMain main = Controller.Explorer.TreeView.FindForm() as FormMain;
     if (main != null)
     {
         main.ShowInBrowser("http://sokosolve.sourceforge.net/VersionCurrent.xml");
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 处理命令回复状态
 /// </summary>
 /// <param name="tx300"></param>
 private void HandleCommandResponsed(TX300 tx300)
 {
     CommandInstance.Update(f => f.DestinationNo == tx300.TerminalID &&
                            f.Command == "0x" + CustomConvert.IntToDigit(tx300.CommandID, CustomConvert.HEX, 4) &&
                            f.ScheduleTime >= DateTime.Now.AddMinutes(-3) &&
                            f.Status >= (byte)CommandStatus.SentByTCP && f.Status <= (byte)CommandStatus.SentToDest,
                            act => { act.Status = (byte)CommandStatus.Returned; });
 }
Exemplo n.º 10
0
 /// <summary>
 /// 更新命令的发送状态
 /// </summary>
 /// <param name="obj"></param>
 private void UpdateCommand(TB_Command obj, CommandStatus status)
 {
     CommandInstance.Update(f => f.id == obj.id, act =>
     {
         act.Status = (byte)status;
         if (status == CommandStatus.SentByTCP)
         {
             act.ActualSendTime = DateTime.Now;
         }
     });
 }
Exemplo n.º 11
0
        public void ToMapWithMissingMethods()
        {
            var instance = new CommandInstance();

            var mapper = CommandMapper <ICommandInterface> .Create();

            mapper.From(c => c.InterfaceMethod())
            .To(() => instance.InstanceMethod());

            Assert.Throws <CommandMethodNotMappedException>(() => mapper.ToMap());
        }
Exemplo n.º 12
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     ItemSolution itemSolution = instance.Context[0] as ItemSolution;
     if (itemSolution != null)
     {
         FormMain form = Controller.Explorer.TreeView.FindForm() as FormMain;
         if (form != null)
         {
             Puzzle puz = itemSolution.DomainData.Map.Puzzle;
             PuzzleMap puzMap = itemSolution.DomainData.Map;
             form.StartGameSolution(puz, puzMap, itemSolution.DomainData, FormMain.Modes.Library);
         }
     }
 }
Exemplo n.º 13
0
 public int ExecuteNonQuery()
 {
     if (SqlConnection == null)
     {
         return(-1);
     }
     else if (CommandInstance == null)
     {
         return(-1);
     }
     else
     {
         return(CommandInstance.ExecuteNonQuery());
     }
 }
Exemplo n.º 14
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemPuzzle puz = instance.Context[0] as ItemPuzzle;
            if (puz != null)
            {
                Puzzle cloned = new Puzzle(puz.DomainData.Library);
                cloned.PuzzleID = puz.DomainData.Library.IdProvider.GetNextIDString("P{0}");
                cloned.Category = puz.DomainData.Category;
                cloned.Details = new GenericDescription(puz.DomainData.Details);
                cloned.MasterMap = new PuzzleMap(cloned);
                cloned.MasterMap.Details = new GenericDescription(puz.DomainData.MasterMap.Details);
                cloned.MasterMap.MapID = puz.DomainData.Library.IdProvider.GetNextIDString("M{0}");
                cloned.MasterMap.Map = new SokobanMap(puz.DomainData.MasterMap.Map);
                puz.DomainData.Library.Puzzles.Add(cloned);

                Controller.Explorer.Refresh();
            }
        }
Exemplo n.º 15
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemPuzzle delMe = instance.Context[0] as ItemPuzzle;
            if (delMe != null)
            {
                ExplorerItem parent = delMe.TreeNode.Parent.Data;

                Controller.Current.Puzzles.Remove(delMe.DomainData);

                parent.SyncDomain();
                parent.SyncUI();

                // Set selection as parent
                Controller.UpdateSelectionSingle(parent);

                // Refresh enture tree
                Controller.Explorer.SyncUI();
            }
        }
Exemplo n.º 16
0
    public void Undo()
    {
        if (undo.Count == 0)
        {
            Debug.LogError("Nothing to undo");
            return;
        }

        CommandInstance cmd = undo.Last.Value;

        undo.RemoveLast();
        // TODO
        // cmd.Undo();

        if (redo.Count == MaxSize)
        {
            redo.RemoveFirst();
        }

        redo.AddLast(cmd);
    }
Exemplo n.º 17
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory delMe = instance.Context[0] as ItemCategory;
            if (delMe != null)
            {
                DialogResult res = MessageBox.Show("This will delete the category, all sub categories and all puzzles. Are you sure?", "Confirm Delete?", MessageBoxButtons.OKCancel);
                if (res == DialogResult.OK)
                {
                    // Remove the category, etc
                    delMe.DomainData.Delete();

                    // Find parent, then remove current
                    TreeNode<ExplorerItem> parent = delMe.TreeNode.Parent;

                    // Set selection as parent
                    Controller.UpdateSelectionSingle(parent.Data);

                    // Refresh enture tree
                    Controller.Explorer.Refresh();
                }
            }
        }
Exemplo n.º 18
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory delMe = instance.Context[0] as ItemCategory;
            if (delMe != null)
            {
                // Find parent, then remove current
                TreeNode<ExplorerItem> parent = delMe.TreeNode.Parent;
                ItemCategory catParent = parent.Data as ItemCategory;
                if (catParent != null)
                {
                    catParent.DomainData.TreeNode.RemoveChild(delMe.DomainData);

                    // Refresh the UI model to updated domain data
                    catParent.SyncDomain();
                }

                // Set selection as parent
                Controller.UpdateSelectionSingle(catParent);

                // Refresh enture tree
                Controller.Explorer.SyncUI();
            }
        }
Exemplo n.º 19
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemSolution itemSolution = instance.Context[0] as ItemSolution;
            if (itemSolution != null)
            {
                FormMain form = Controller.Explorer.TreeView.FindForm() as FormMain;
                if (form != null)
                {
                    Puzzle puz = itemSolution.DomainData.Map.Puzzle;
                    PuzzleMap puzMap = itemSolution.DomainData.Map;
                    Game coreGame = new Game(puz, puzMap.Map);

                    string firstError = "";
                    if (coreGame.Test(itemSolution.DomainData, out firstError))
                    {
                        MessageBox.Show("Solution is valid");
                    }
                    else
                    {
                        MessageBox.Show("Solution is NOT valid. " + firstError);
                    }
                }
            }
        }
Exemplo n.º 20
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory category = instance.Context[0] as ItemCategory;
            if (category != null)
            {
                // Create a new puzzle with a valid number etc.
                CreateNewPuzzle(category, category.DomainData);
            }

            ItemLibrary library = instance.Context[0] as ItemLibrary;
            if (library != null)
            {
                CreateNewPuzzle(library, library.DomainData.CategoryTree.Root.Data);
            }
        }
Exemplo n.º 21
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            if (!instance.hasSelection) return;

            ExplorerItem item = instance.Context[0];

            if (instance.Status == ExecutionStatus.Working)
            {

                item.IsEditable = true;
                Control implUI = item.ShowDetail();

                // Wait for call-back
                instance.Status = ExecutionStatus.AwaitingCallback;

                // Register for the call-bak events
                ucGenericDescription details = implUI as ucGenericDescription;
                if (details != null)
                {
                    details.Tag = instance;
                    details.ButtonOK.Tag = instance;
                    details.ButtonOK.Click += new EventHandler(ButtonOK_Click);
                    details.ButtonCancel.Tag = instance;
                    details.ButtonCancel.Click += new EventHandler(ButtonCancel_Click);
                }
                return;
            }

            if (instance.Status == ExecutionStatus.AwaitingCallback)
            {
                if (instance.Param != null && instance.Param.ToString() == "Ok")
                {
                    ucGenericDescription editControl = item.ShowDetail() as ucGenericDescription;
                    if (editControl == null) throw new InvalidCastException("Detail should be ucGenericDescription");
                    // Replace details
                    Core.Model.Category category = (Core.Model.Category)item.DataUnTyped;
                    category.Details = editControl.Data;

                    item.IsEditable = false;
                    item.ShowDetail();
                }

                if (instance.Param != null && instance.Param.ToString() == "Cancel")
                {
                    item.IsEditable = false;
                    item.ShowDetail();
                    return;
                }
            }
        }
Exemplo n.º 22
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemPuzzle itemPuzzle = instance.Context[0] as ItemPuzzle;
            if (itemPuzzle != null)
            {
                Solution newSol = new Solution(itemPuzzle.DomainData.MasterMap, itemPuzzle.DomainData.MasterMap.Map.Player);
                newSol.Details = ProfileController.Current.GenericDescription;
                newSol.Details.Name = string.Format("Manual solution for {0}", newSol.Map.Puzzle.Details.Name);
                newSol.Steps = "";

                itemPuzzle.DomainData.MasterMap.Solutions.Add(newSol);

                // Sync UI
                itemPuzzle.SyncDomain();

                // Refresh enture tree
                Controller.Explorer.SyncUI();
            }
        }
Exemplo n.º 23
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory cat = instance.Context[0] as ItemCategory;
            if (cat != null)
            {
                Category newCat = new Category(cat.DomainData.Library);
                newCat.CategoryID = Controller.Current.IdProvider.GetNextIDString("C{0}");
                newCat.CategoryParentREF = cat.DomainData.CategoryID;
                newCat.Details = ProfileController.Current.GenericDescription;
                newCat.Details.Name = "New Category";
                newCat.Order = cat.DomainData.TreeNode.Tree.Nodes.Count + 1;
                cat.DomainData.TreeNode.Add(newCat);

                // Select new cat, set to edit...

                // Refresh the UI model to updated domain data
                cat.SyncDomain();

                // Refresh entire tree
                Controller.Explorer.SyncUI();
                return;
            }

            ItemLibrary lib = instance.Context[0] as ItemLibrary;
            if (lib != null)
            {
                Category newCat = new Category(lib.DomainData);
                newCat.CategoryID = Controller.Current.IdProvider.GetNextIDString("C{0}");
                newCat.CategoryParentREF = lib.DomainData.CategoryTree.Root.Data.CategoryID;
                newCat.Details = ProfileController.Current.GenericDescription;
                newCat.Details.Name = "New Category";
                newCat.Order = lib.DomainData.CategoryTree.Nodes.Count + 1;
                lib.DomainData.CategoryTree.Root.Add(newCat);

                // Select new cat, set to edit...

                // Refresh the UI model to updated domain data
                lib.SyncDomain();

                // Refresh entire tree
                Controller.Explorer.SyncUI();
                return;
            }
        }
Exemplo n.º 24
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            if (!instance.hasSelection) return;

            ExplorerItem item = instance.Context[0];

            if (instance.Status == ExecutionStatus.Working)
            {
                item.IsEditable = !item.IsEditable;
                Control implUI = item.ShowDetail();

                if (item.IsEditable)
                {
                    // Wait for call-back
                    instance.Status = ExecutionStatus.AwaitingCallback;

                    // Register for the call-bak events
                    Editor editor = implUI as Editor;
                    if (editor != null)
                    {
                        editor.Tag = instance;
                        editor.ClearCommandsEvents();
                        editor.Commands += new Editor.SimpleCommand(editor_Commands);
                        editor.Map = new SokobanMap((item.DataUnTyped as Puzzle).MasterMap.Map);
                    }
                }
                return;
            }

            if (instance.Status == ExecutionStatus.AwaitingCallback)
            {
                if (instance.Param != null && instance.Param.ToString() == "Editor.Save")
                {
                    Editor editor = item.ShowDetail() as Editor;
                    Puzzle puz = item.DataUnTyped as Puzzle;

                    puz.MasterMap.Map = editor.Map;

                    item.IsEditable = false;
                    item.ShowDetail();
                    return;
                }

                if (instance.Param != null && instance.Param.ToString() == "Editor.Cancel")
                {
                    item.IsEditable = false;
                    item.ShowDetail();
                    return;
                }

                if (instance.Param != null && instance.Param.ToString() == "Editor.Props")
                {
                    ItemPuzzle iPuz = item as ItemPuzzle;
                    iPuz.ShowProps = true;
                    item.IsEditable = true;
                    Control implUI = item.ShowDetail();
                    ucGenericDescription details = implUI as ucGenericDescription;
                    if (details != null)
                    {
                        details.Tag = instance;
                        details.ButtonOK.Tag = instance;
                        details.ButtonOK.Click += new EventHandler(ButtonOK_Click);
                        details.ButtonCancel.Tag = instance;
                        details.ButtonCancel.Click += new EventHandler(ButtonCancel_Click);
                    }
                    return;
                }

                if (instance.Param != null && instance.Param.ToString() == "Details.Cancel")
                {
                    ItemPuzzle iPuz = item as ItemPuzzle;
                    iPuz.ShowProps = false;
                    item.ShowDetail();
                    return;
                }

                if (instance.Param != null && instance.Param.ToString() == "Details.Ok")
                {
                    ucGenericDescription editControl = item.ShowDetail() as ucGenericDescription;
                    if (editControl == null) throw new InvalidCastException("Detail should be ucGenericDescription");

                    // Replace details
                    Puzzle puzMap = (Puzzle)item.DataUnTyped;
                    puzMap.Details = editControl.Data;

                    ItemPuzzle iPuz = item as ItemPuzzle;
                    iPuz.ShowProps = false;
                    iPuz.ShowDetail();
                    return;
                }
            }
        }
Exemplo n.º 25
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     FormMain main = Controller.Explorer.TreeView.FindForm() as FormMain;
     if (main != null)
     {
         main.Mode = FormMain.Modes.Welcome;
     }
 }
Exemplo n.º 26
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory category = instance.Context[0] as ItemCategory;
            if (category != null)
            {
                // Create a new puzzle with a valid number etc.
                Puzzle newPuz = new Puzzle(Controller.Current);
                newPuz.PuzzleID = Controller.Current.IdProvider.GetNextIDString("P{0}");
                newPuz.Details = new GenericDescription();
                newPuz.Details.Name = string.Format("New Puzzle #{0}", Controller.Current.Puzzles.Count+1);
                newPuz.Category = category.DomainData;
                newPuz.MasterMap = new PuzzleMap(newPuz);
                newPuz.MasterMap.MapID = Controller.Current.IdProvider.GetNextIDString("M{0}");

                Controller.Current.Puzzles.Add(newPuz);

                // Refresh the UI model to updated domain data
                category.SyncDomain();

                // Refresh enture tree
                Controller.Explorer.SyncUI();
            }
        }
Exemplo n.º 27
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     ItemPuzzle puz = instance.Context[0] as ItemPuzzle;
     if (puz != null)
     {
         FormMain form = Controller.Explorer.TreeView.FindForm() as FormMain;
         if (form != null)
         {
             form.Solve(puz.DomainData.MasterMap);
         }
     }
 }
Exemplo n.º 28
0
        protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
        {
            ItemCategory cat = instance.Context[0] as ItemCategory;
            if (cat != null)
            {
                Category newCat = new Category();
                newCat.Details = new GenericDescription();
                newCat.Details.Name = "New Category";
                cat.DomainData.TreeNode.Add(newCat);

                // Select new cat, set to edit...

                // Refresh the UI model to updated domain data
                cat.SyncDomain();

                // Refresh enture tree
                Controller.Explorer.SyncUI();
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// Initialize everything that needs to be initialized once we're logged in.
 /// </summary>
 /// <param name="login">The status of the login</param>
 /// <param name="message">Error message on failure, MOTD on success.</param>
 public void RegisterCommand(string name, Cogbot.Actions.Command live)
 {
     string orginalName = name;
     name = name.Replace(" ", "").ToLower();
     while (name.EndsWith(".")) name = name.Substring(0, name.Length - 1);
     Monitor.Enter(Commands);
     live.TheBotClient = this;
     CommandInstance prev;
     if (!Commands.TryGetValue(name, out prev))
     {
         CommandInstance command = new CommandInstance(live);
         Commands.Add(name, command);
         command.Name = orginalName;
         if (command.IsStateFul)
         {
             live.TheBotClient = this;
             command.WithBotClient = live;
         }
     }
     else
     {
         if (prev.CmdType != live.GetType())
         {
             RegisterCommand("!" + orginalName, live);
         }
     }
     Monitor.Exit(Commands);
 }
Exemplo n.º 30
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     FormMain main = Controller.Explorer.TreeView.FindForm() as FormMain;
     if (main != null)
     {
         main.ShowInBrowser("http://sourceforge.net/forum/forum.php?forum_id=765121");
     }
 }
Exemplo n.º 31
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     PerformVersionCheck(true);
 }
Exemplo n.º 32
0
 protected override void ExecuteImplementation(CommandInstance<ExplorerItem> instance)
 {
     FormMain main = Controller.Explorer.TreeView.FindForm() as FormMain;
     if (main != null)
     {
         main.ShowInBrowser("http://sourceforge.net/tracker/?group_id=85742&atid=577156");
     }
 }
Exemplo n.º 33
0
 public object ExecuteScalar()
 {
     return(SqlConnection == null || CommandInstance == null ? null : CommandInstance.ExecuteScalar());
 }
Exemplo n.º 34
0
        private static CommandMap CreateCommandMap()
        {
            var instance = new CommandInstance();

            var mapper = CommandMapper <ICommandInterface> .Create();

            mapper.From(c => c.InterfaceMethod())
            .To(() => instance.InstanceMethod());
            mapper.From <int>((c, p1) => c.InterfaceMethod(p1))
            .To <int>(p1 => instance.InstanceMethod(p1));
            mapper.From <int, int>((c, p1, p2) => c.InterfaceMethod(p1, p2))
            .To <int, int>((p1, p2) => instance.InstanceMethod(p1, p2));
            mapper.From <int, int, int>((c, p1, p2, p3) => c.InterfaceMethod(p1, p2, p3))
            .To <int, int, int>((p1, p2, p3) => instance.InstanceMethod(p1, p2, p3));
            mapper.From <int, int, int, int>((c, p1, p2, p3, p4) => c.InterfaceMethod(p1, p2, p3, p4))
            .To <int, int, int, int>((p1, p2, p3, p4) => instance.InstanceMethod(p1, p2, p3, p4));
            mapper.From <int, int, int, int, int>((c, p1, p2, p3, p4, p5) => c.InterfaceMethod(p1, p2, p3, p4, p5))
            .To <int, int, int, int, int>((p1, p2, p3, p4, p5) => instance.InstanceMethod(p1, p2, p3, p4, p5));
            mapper.From <int, int, int, int, int, int>((c, p1, p2, p3, p4, p5, p6) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6))
            .To <int, int, int, int, int, int>((p1, p2, p3, p4, p5, p6) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6));
            mapper.From <int, int, int, int, int, int, int>((c, p1, p2, p3, p4, p5, p6, p7) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7))
            .To <int, int, int, int, int, int, int>((p1, p2, p3, p4, p5, p6, p7) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7));
            mapper.From <int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8))
            .To <int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8));
            mapper.From <int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9))
            .To <int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9));
            mapper.From <int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
            .To <int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))
            .To <int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))
            .To <int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15));

            return(mapper.ToMap());
        }