示例#1
0
文件: test.py 项目: tungol/bplistlib
 def test_not_binary2(self):
     value = {'1': 2, '3': 4}
     fn = 'tmp'
     bp.writePlist(value, fn)
     result = bp.readPlist(fn, binary=False)
     self.assertIsInstance(result, type(value))
     self.assertEqual(value, result)
     remove('tmp')
示例#2
0
def autoAccount():
    if sys.platform.__contains__('darwin'):
        home = expanduser('~')
        if os.path.exists(home +
                          '/Library/Preferences/com.codestation.qcma.plist'):
            cmaFile = bplistlib.readPlist(
                home + '/Library/Preferences/com.codestation.qcma.plist')
            aid = cmaFile['lastAccountId']
            print 'AID: ' + aid
        else:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()

    if sys.platform.__contains__('linux'):
        home = expanduser('~')
        configParser = ConfigParser.RawConfigParser()
        configFilePath = home + '/.config/codestation/qcma.conf'
        configParser.read(configFilePath)
        if configParser.has_option("General", 'lastAccountId'):
            aid = configParser.get('General', 'lastAccountId')
            print 'AID: ' + aid
        else:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()

    if sys.platform.__contains__(
            'win') and not sys.platform.__contains__("darwin"):
        import _winreg
        try:
            qcma = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                   'Software\\codestation\\qcma')
            aid = _winreg.QueryValueEx(qcma, 'lastAccountId')
        except:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()
        aid = aid[0]
        print 'AID: ' + aid
        _winreg.CloseKey(qcma)
    if sys.platform.__contains__('darwin'):
        home = expanduser('~')
        if os.path.exists(home +
                          '/Library/Preferences/com.codestation.qcma.plist'):
            cmaFile = bplistlib.readPlist(
                home + '/Library/Preferences/com.codestation.qcma.plist')
            acc = cmaFile['lastAccountId']
            print 'Account Name: ' + acc
        else:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()
    if sys.platform.__contains__('linux'):
        home = expanduser('~')
        configParser = ConfigParser.RawConfigParser()
        configFilePath = home + '/.config/codestation/qcma.conf'
        configParser.read(configFilePath)
        if configParser.has_option("General", 'lastOnlineId'):
            acc = configParser.get('General', 'lastOnlineId')
            print 'Account Name: ' + acc
        else:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()
    if sys.platform.__contains__(
            'win') and not sys.platform.__contains__("darwin"):
        import _winreg
        qcma = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                               'Software\\codestation\\qcma')
        try:
            acc = _winreg.QueryValueEx(qcma, 'lastOnlineId')
            acc = acc[0]
        except:
            print "No Account Found!"
            showMessage(title='FAIL',
                        message='Count not find account automatically.')
            import account
            account.vp_start_gui()
        print 'Account Name: ' + acc
        _winreg.CloseKey(qcma)
    import urllib
    try:
        print 'Downloading Key From: ' + 'http://cma.henkaku.xyz/?aid=' + aid
        urllib.urlretrieve('http://cma.henkaku.xyz/?aid=' + aid,
                           'tempKey.html')
    except:
        print "Failed to connect to: " + 'http://cma.henkaku.xyz/?aid=' + aid
        print "Trying henkaku.me.."
        try:
            print 'Downloading Key From: ' + 'http://cma.henkaku.me/?aid=' + aid
            urllib.urlretrieve('http://cma.henkaku.me/?aid=' + aid,
                               'tempKey.html')
        except:
            print "Failed to connect to: " + 'http://cma.henkaku.me/?aid=' + aid
            print "Could Not Connect, Cannot find CMA Key!"
            window = Tkinter.Tk()
            window.wm_withdraw()
            tkMessageBox.showerror(
                title="Connection Error.",
                message=
                "Failed to connect to: \nhttp://cma.henkaku.xyz\nThus your CMA Key could not be determined,\nPSVIMGTOOLS will not work without your CMA Key, \nPlease check your connection and try again."
            )
            window.destroy()
            sys.exit()

    key = getKey()
    print 'CMA Key: ' + key
    text_file = open(getWorkingDir() + '/keys/' + acc, 'w+')
    text_file.write(key)
    text_file.close()
    text_file = open(getWorkingDir() + '/accounts/' + acc, 'w+')
    text_file.write(aid)
    text_file.close()
示例#3
0
def autoCMA():
    if sys.platform.__contains__('darwin'):
        home = expanduser('~')
        if os.path.exists(home +
                          '/Library/Preferences/com.codestation.qcma.plist'):
            cmaFile = bplistlib.readPlist(
                home + '/Library/Preferences/com.codestation.qcma.plist')
            text_file = open('cmadir.txt', 'w+')
            text_file.write(cmaFile['appsPath'])
            text_file.close()
            print 'CMA Dir: ' + cmaFile['appsPath']
        else:
            print "Cannot find CMADir..."
            showMessage(title="CMADIR",
                        message="Could not find the CMA Backups Directory.")
            import cmaDir
            cmaDir.vp_start_gui()
    if sys.platform.__contains__('linux'):
        home = expanduser('~')
        if os.path.exists(home + '/.config/codestation/qcma.conf'):
            configParser = ConfigParser.RawConfigParser()
            configFilePath = home + '/.config/codestation/qcma.conf'
            configParser.read(configFilePath)
            line = configParser.get('General', 'appsPath')
            text_file = open('cmadir.txt', 'w+')
            text_file.write(line)
            text_file.close()
            print 'CMA Dir: ' + line
        else:
            print "Cannot find CMADir..."
            showMessage(title="CMADIR",
                        message="Could not find the CMA Backups Directory.")
            import cmaDir
            cmaDir.vp_start_gui()

    if sys.platform.__contains__(
            'win') and not sys.platform.__contains__("darwin"):
        import _winreg
        try:
            global CMAFOLDER
            qcma = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                   'Software\\codestation\\qcma')
            path = _winreg.QueryValueEx(qcma, 'appsPath')
            CMAFOLDER = path[0]
            _winreg.CloseKey(qcma)
        except:
            print("QCMA Is Not Installed.")
            print "Checking Default Location " + getHomeDir(
            ) + "\Documents\PS Vita"
            if os.path.exists("Checking Default Location " + getHomeDir() +
                              "\Documents\PS Vita"):
                print "Directory Found! Setting As CMA APPS DIR "
                CMAFOLDER = getHomeDir() + "\My Documents\PS Vita"
            elif os.path.exists("Checking Default Location " + getHomeDir() +
                                "\My Documents\PS Vita"):
                print "Directory Found! Setting As CMA Apps DIR"
                CMAFOLDER = getHomeDir() + "\My Documents\PS Vita"
                print "Legacy OS Detected, Documents Folder Is Called 'My Documents' PSVIMGTOOLS may not work correctly!"
            else:
                print "Folder not found checking for SONY CMA..."
                try:
                    cma = _winreg.OpenKey(
                        _winreg.HKEY_CURRENT_USER,
                        'SOFTWARE\\Sony Corporation\\Content Manager Assistant\\Settings'
                    )
                    path = _winreg.QueryValueEx(cma, 'ApplicationHomePath')
                    CMAFOLDER = path[0]
                    _winreg.CloseKey(cma)
                    print "---------------------WARNING---------------------"
                    print "SONY CMA IS NOT FULLY SUPPORTED, \nAND IT ALSO REQUIRES THE LATEST FIRMWARE"
                    print "I HIGHLY RECOMMEND USING QCMA INSTEAD!"
                except:
                    print "Checking for DEVKITCMA"
                    try:
                        cma = _winreg.OpenKey(
                            _winreg.HKEY_CURRENT_USER,
                            'SOFTWARE\\SCE\\PSP2\\Services\\Content Manager Assistant for PlayStation(R)Vita DevKit\\Settings'
                        )
                        path = _winreg.QueryValueEx(cma, 'ApplicationHomePath')
                        CMAFOLDER = path[0]
                        _winreg.CloseKey(cma)
                        print "---------------------WARNING---------------------"
                        print "DEVKITCMA IS NOT FULLY SUPPORTED,"
                        print "I HIGHLY RECOMMEND USING QCMA INSTEAD!"
                    except:
                        print "Cannot find CMADir..."
                        showMessage(
                            title="CMADIR",
                            message="Could not find the CMA Backups Directory."
                        )
                        import cmaDir
                        cmaDir.vp_start_gui()

        print 'CMA Dir: ' + CMAFOLDER
        text_file = open(getWorkingDir() + '/cmadir.txt', 'w+')
        text_file.write(CMAFOLDER)
        text_file.close()
示例#4
0
def autoAccount():
    if sys.platform.__contains__('darwin'):
        home = expanduser('~')
        if os.path.exists(home +
                          '/Library/Preferences/com.codestation.qcma.plist'):
            cmaFile = bplistlib.readPlist(
                home + '/Library/Preferences/com.codestation.qcma.plist')
            aid = cmaFile['lastAccountId']
            print 'AID: ' + aid
        else:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()

    if sys.platform.__contains__('linux'):
        home = expanduser('~')
        configParser = ConfigParser.RawConfigParser()
        configFilePath = home + '/.config/codestation/qcma.conf'
        configParser.read(configFilePath)
        if configParser.has_option("General", 'lastAccountId'):
            aid = configParser.get('General', 'lastAccountId')
            print 'AID: ' + aid
        else:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()

    if sys.platform.__contains__(
            'win') and not sys.platform.__contains__("darwin"):
        import _winreg
        try:
            qcma = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                   'Software\\codestation\\qcma')
            aid = _winreg.QueryValueEx(qcma, 'lastAccountId')
        except:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()
        aid = aid[0]
        print 'AID: ' + aid
        _winreg.CloseKey(qcma)
    if sys.platform.__contains__('darwin'):
        home = expanduser('~')
        if os.path.exists(home +
                          '/Library/Preferences/com.codestation.qcma.plist'):
            cmaFile = bplistlib.readPlist(
                home + '/Library/Preferences/com.codestation.qcma.plist')
            acc = cmaFile['lastAccountId']
            print 'Account Name: ' + acc
        else:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()
    if sys.platform.__contains__('linux'):
        home = expanduser('~')
        configParser = ConfigParser.RawConfigParser()
        configFilePath = home + '/.config/codestation/qcma.conf'
        configParser.read(configFilePath)
        if configParser.has_option("General", 'lastOnlineId'):
            acc = configParser.get('General', 'lastOnlineId')
            print 'Account Name: ' + acc
        else:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()
    if sys.platform.__contains__(
            'win') and not sys.platform.__contains__("darwin"):
        import _winreg
        qcma = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                               'Software\\codestation\\qcma')
        try:
            acc = _winreg.QueryValueEx(qcma, 'lastOnlineId')
            acc = acc[0]
        except:
            print "No Account Found!"
            tkMessageBox.showinfo(
                title='FAIL', message='Count not find account automatically.')
            import account
            account.vp_start_gui()
        print 'Account Name: ' + acc
        _winreg.CloseKey(qcma)
    import urllib
    print 'Downloading Key From: ' + 'http://cma.henkaku.xyz/?aid=' + aid
    urllib.urlretrieve('http://cma.henkaku.xyz/?aid=' + aid, 'tempKey.html')
    key = getKey()
    print 'CMA Key: ' + key
    text_file = open(getWorkingDir() + '/keys/' + acc, 'w+')
    text_file.write(key)
    text_file.close()
    text_file = open(getWorkingDir() + '/accounts/' + acc, 'w+')
    text_file.write(aid)
    text_file.close()