Example #1
0
def clipboard(doc, args):
    from System.Windows.Forms import Clipboard
    count = len(args)
    if count == 0:
        return Clipboard.GetText()
    elif count == 1:
        Clipboard.SetText(args[0])
Example #2
0
def main():
    # 解析战斗数据
    battleDataRaw = Clipboard.GetText()
    try:
        global battleData
        battleData = json.loads(battleDataRaw)
    except ValueError:
        print("无法解析战斗数据,请确认数据已经复制到剪贴板")
        return

    # 检查最后一个配置
    if Utility.Groups.Count == 0 or Utility.Groups[Utility.Groups.Count -
                                                   1].Count != 0:
        print("请先手动创建一个空配置并放置到配置列表的末尾"
              )  # Utility.Groups.Add方法受保护(否则付费功能就没意义了),外部无法调用。
        return
    group = Utility.Groups[Utility.Groups.Count - 1]

    # 构造备忘执行单元
    memo = createMemoWorkflow(battleData)
    Dispatcher.Invoke(lambda: group.Add(memo))  # 直接在独立线程添加执行单元会报错

    # 构造编成执行单元
    mainFleet = createBasicOrganizeFleetWorkflow(battleData["fleet"]["main"],
                                                 1)
    Dispatcher.Invoke(lambda: group.Add(mainFleet))
    if battleData["fleet"]["escort"] is not None:  # TODO:尚未测试
        # 添加伴随舰队
        escortFleet = createBasicOrganizeFleetWorkflow(
            battleData["fleet"]["escort"], 2)
        Dispatcher.Invoke(lambda: group.Add(escortFleet))
        # 添加组成联合舰队
        combine = createBasicCombinedFleetWorkflow(battleData["fleet"]["type"])
        Dispatcher.Invoke(lambda: group.Add(combine))

    # 构造改装执行单元
    mainRefit = createBasicRefitEquipmentWorkflow(battleData["fleet"]["main"],
                                                  1)
    Dispatcher.Invoke(lambda: group.Add(mainRefit))
    if battleData["fleet"]["escort"] is not None:  # TODO:尚未测试
        escortRefit = createBasicRefitEquipmentWorkflow(
            battleData["fleet"]["escort"], 2)
        Dispatcher.Invoke(lambda: group.Add(escortRefit))
Example #3
0
def GetClipboardText():
    text = ""
    if cb.ContainsText():
        text = cb.GetText()

    return text
import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import Clipboard
try:
    OUT = Clipboard.GetText()
except:
    OUT = 'Clipboard contents could not be retrieved'