我安装了FirebirdSql.Data.FirebirdClient v4.6.4.0(来自msi) 然后DDEX提供程序3.0.1(来自msi)通过VS进行数据操作。
我在位置 C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ FirebirdSql.Data.FirebirdClient \ v4.0_4.6.4.0__3750abcc3150b00c 中检查了GAC
并且预期有import win32api, win32con
import time
import ImageGrab
import ImageOps
import os
from numpy import *
from PIL import Image
x_pad = 148
y_pad = 27
def start():
#Clicks the random number generator's "Again!" button
mousePos((1153, 404))
leftClick()
print "Click: 'generate random number' button"
print "Wait for 'random number' to load..."
print
time.sleep(4)
detectNum():
#Detects the colour of a pixel which is different for
#each number: 1, 2 or 3
def detectNum():
b1 = (x_pad + 1,y_pad+1,x_pad+640,y_pad+480)
im = ImageGrab.grab()
#im.save(os.getcwd() + '\\Snap__' + str(int(time.time())) +'.png', 'PNG')
#print im
im = im
pixelLocation = 1312,371
pixelColour = im.getpixel(pixelLocation)
print pixelColour
if pixelColour == (167, 79, 0):
print "1: rock"
print
mousePos((64, 310))
leftClick()
print"Click: 'rock' button"
time.sleep(.1)
elif pixelColour == (239, 199, 135):
print "2: paper"
print
mousePos((175, 313))
leftClick()
print"Click: 'paper' button"
time.sleep(.1)
elif pixelColour == (255, 255, 255):
print "3: scissors"
print
mousePos((377, 317))
leftClick()
print"Click: 'scissors' button"
time.sleep(.1)
#Clicks the "bet amount" field
mousePos((348, 180))
leftClick()
print "Click: 'bet amount' field"
time.sleep(.1)
#Type in bet amount
#Clicks "create battle" button
mousePos((195, 429))
leftClick()
print "Click: 'create battle' button"
print
print "Wait for 'success' popup to appear..."
print
time.sleep(1)
#Click the cross on "success" message
mousePos((477, 306))
leftClick()
print "Click: 'success' popup cross"
time.sleep(.1)
#Clicks the second tab (shows "your battles")
mousePos((119, 2))
leftClick()
print "Click: second tab"
print
time.sleep(.1)
isBtnPrsnt()
#Checks if the "remove" button is present
#Thereby checking if the game is present
def isBtnPrsnt():
box = (383,331,481,370)
im = ImageOps.grayscale(ImageGrab.grab(box))
a = array(im.getcolors())
a = a.sum()
print a
#im.save(os.getcwd() + '\\button__' + str(int(time.time())) + '.png', 'PNG')
#return a
#The button is present
if a == 19984:
print "Button? Yes. Game is active."
#Checks again if the button is no longer present
time.sleep(.1)
isBtnPrsnt()
#The button is not present
elif a == 4547:
print "Button? No. Game is over."
print
#Clicks chrome on windows task bar
mousePos((62, 716))
leftClick()
print "Click: chrome on task bar"
time.sleep(.1)
#Clicks second window (shows "recent wins")
mousePos((190, 615))
leftClick()
print "Click: second window"
time.sleep(.1)
#Right clicks the page
mousePos((201, 198))
rightClick()
print "RightClick: page"
time.sleep(.1)
#Clicks reload to update results
mousePos((311, 259))
leftClick()
print "Click: 'reload' button"
time.sleep(10)
result()
def result():
count = 0
box = (380,200,760,230)
image = ImageGrab.grab(box)
for x in range(1,380):
for y in range(1,30):
px = image.getpixel((x, y))
if px[1] == 118:
count = count + 1
#print count
if x == 379:
if count >= 20:
return "win"
else:
#print
count = 0
box = (380,200,760,230)
image = ImageGrab.grab(box)
for x in range(1,380):
for y in range(1,30):
px = image.getpixel((x, y))
if px[1] == 68:
count = count + 1
#print count
if x == 379:
if count >= 20:
return "loose"
else:
return "draw"
def leftClick():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
def rightClick():
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,0,0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,0,0)
def leftDown():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
print 'left Down'
def leftUp():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(.1)
print 'left release'
def mousePos(cord):
win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]))
#Enter "get_cords()" into the shell to print the cords of the mouse
def getCords():
x,y = win32api.GetCursorPos()
x = x - x_pad
y = y - y_pad
print x,y
def main():
pass
if __name__ == '__main__':
main()
。
不幸的是,在服务器资源管理器中尝试设置新数据连接时,我收到错误FirebirdSql.Data.FirebirdClient.dll
。
我多次尝试安装和卸载提供程序,没有帮助。
以下是我的machine.config文件中的代码: C:\的Windows \ Microsoft.NET \框架\ v4.0.30319 \配置
"Unable to find the requested .NET Framework Data Provider. It may not be installed"
C:\的Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \配置
<system.data>
<DbProviderFactories><add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/><add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=4.6.4.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/><add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=4.6.4.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/></DbProviderFactories>
</system.data>
任何帮助都将非常感激。
答案 0 :(得分:1)
您收到错误"Unable to find the requested .NET Framework Data Provider. It may not be installed"
,因为您在machine.config
中有第二个firebird条目。这发生在to a bug in the installer,但仍未解决。
使用Firebird 3.0时会发生"connection rejected by remote interface"
错误,可能是因为3.0的新身份验证。在这里,你必须降级到2.5.4,enable the old legacy authentication或等待.Net提供商的更新,以完全支持Firebird 3.0,包括新的身份验证。