示例#1
0
    def CaptureLiveImg2(self,FileName,Cam='X'):
        
        #CAN LOOP THROUGH THE BYTE ARRAY
        
        b = splicer.usb.CommandAndReceiveBinary('=IMGH-LIVE-%s'%Cam,1000)

        try:
            os.makedirs(os.path.dirname(FileName))
        except OSError:
            pass

        File.WriteAllBytes(os.path.normpath(FileName),b)
示例#2
0
 def CaptureLiveImg(self,FileName):
     
     
     for Cam in 'X','Y':
         b = splicer.usb.CommandAndReceiveBinary('=IMGH-LIVE-%s'%Cam,1000)
 
         try:
             os.makedirs(os.path.dirname(FileName))
         except OSError:
             pass
         print(('SAVING TO PATH',os.path.normpath(FileName+Cam+'.bmp')))
         File.WriteAllBytes(os.path.normpath(FileName+Cam+'.bmp'),b)
示例#3
0
def create_mfg_bdl_file(support_key, formatter_sn, bdl_data_code):
    '''
    It creates a creates Manufacturing BDL
    <Product>\bin\Tools is the location where it will Tools
    '''
    temp_dir = tempfile.mkdtemp()
    payLoadData = _CreateSignAndEncryptedData(support_key, formatter_sn,
                                              bdl_data_code)
    payload_path = os.path.join(temp_dir, "SecurePayload.dat")
    log.debug("Save Secure Payload to " + payload_path)
    File.WriteAllBytes(payload_path, payLoadData)
    #File.WriteAllBytes(payload_path,payLoadData)
    # Check existence of each path
    log.debug("Save Secure Manufacturing BDL to " + temp_dir)
    tool_bin = globals.BIN_DIRECTORY
    log.debug("Bin Directory = {}".format(tool_bin))
    return _CreateBdlFile(tool_bin, payload_path, temp_dir)
示例#4
0
    def run(self, Mml2vgmInfo, index):
        
        #設定値の読み込み
        Mml2vgmInfo.loadSetting()

        #ファイル選択
        xgmFn = Mml2vgmInfo.fileSelect("xgmファイルの選択")
        if xgmFn is None:
            return None

        if not File.Exists(xgmFn):
            Mml2vgmInfo.msg("ファイルが見つかりません")
            return None

        if Path.GetExtension(xgmFn).ToLower() != ".xgm":
            Mml2vgmInfo.msg("拡張子が.xgmではありません")
            return None

        #ファイル読み込み
        xgmDat = File.ReadAllBytes(xgmFn)

        #FCCチェック
        if xgmDat[0]!=88 or xgmDat[1]!=71 or xgmDat[2]!=77:
            Mml2vgmInfo.msg("FCCがXGMではありません")
            return None

        sampleDataBlockSize = xgmDat[0x100] + xgmDat[0x101] * 0x100
        #Mml2vgmInfo.msg(sampleDataBlockSize.ToString())
        
        versionInformation = xgmDat[0x102];
        #Mml2vgmInfo.msg(versionInformation.ToString())
        
        dataInformation = xgmDat[0x103];
        #Mml2vgmInfo.msg(dataInformation.ToString())
        
        isNTSC = (dataInformation & 0x1) == 0;
        #Mml2vgmInfo.msg(isNTSC.ToString())
        
        existGD3 = (dataInformation & 0x2) != 0;
        #Mml2vgmInfo.msg(existGD3.ToString())
        
        multiTrackFile = (dataInformation & 0x4) != 0;
        #Mml2vgmInfo.msg(multiTrackFile.ToString())

        sampleDataBlockAddr = 0x104;
        #Mml2vgmInfo.msg(sampleDataBlockAddr.ToString())

        adr = sampleDataBlockAddr + sampleDataBlockSize * 256
        musicDataBlockSize = xgmDat[adr] + xgmDat[adr+1]*0x100 + xgmDat[adr+2]*0x10000 + xgmDat[adr+3]*0x1000000
        #Mml2vgmInfo.msg(musicDataBlockSize.ToString())

        musicDataBlockAddr = sampleDataBlockAddr + sampleDataBlockSize * 256 + 4;
        #Mml2vgmInfo.msg(musicDataBlockAddr.ToString())

        gd3InfoStartAddr = musicDataBlockAddr + musicDataBlockSize;
        #Mml2vgmInfo.msg(gd3InfoStartAddr.ToString())

        #PCMテーブルを取得&出力
        lst = List[Byte]()
        n = 0
        while n < 63*4:
            ind=n+4
            if ind == xgmDat.Length:
                break
            lst.Add(xgmDat[ind])
            n+=1
        File.WriteAllBytes( xgmFn + ".pcmTable.bin" , lst.ToArray() )
        lst.Clear();

        #PCMデータを取得&出力
        if sampleDataBlockSize > 0:
            n=0
            while n < sampleDataBlockSize * 256:
                ind=n + sampleDataBlockAddr
                if ind == xgmDat.Length:
                    break
                lst.Add(xgmDat[ind])
                n+=1
            File.WriteAllBytes( xgmFn + ".pcmData.bin" , lst.ToArray() )
            lst.Clear();

        #SEQデータを取得&出力
        if musicDataBlockSize > 0:
            n=0
            while n<musicDataBlockSize:
                ind=n + musicDataBlockAddr
                if ind == xgmDat.Length:
                    break
                lst.Add(xgmDat[ind])
                n+=1
            File.WriteAllBytes( xgmFn + ".seqData.bin" , lst.ToArray() )
            lst.Clear();

        #GD3データを取得&出力
        if existGD3:
            n=0
            while n < xgmDat.Length - gd3InfoStartAddr:
                ind=n + gd3InfoStartAddr
                lst.Add(xgmDat[ind])
                n+=1
            File.WriteAllBytes( xgmFn + ".gd3.bin" , lst.ToArray() )
            lst.Clear();


        Mml2vgmInfo.msg("xgmファイルを分割しました")


        #戻り値を生成(何もしないけど念のため)
        si = ScriptInfo()
        si.responseMessage = ""
        
        return si
示例#5
0
def DecodeBase64File(Data, FileName, FilePath="C:\\WINDOWS\\Temp\\"):
    path = "{}{}".format(FilePath, FileName)
    File.WriteAllBytes(path, Convert.FromBase64String(Data))
    return 'File copied to: {}'.format(path)