(self, source_name, destination, outbyte, start, end)
Generates the test cases
Generates the test cases
Generates the test cases
def generate_files(self, source_name, destination, outbyte, start, end):
        '''
        Generates the test cases
        '''
        self.byte_length, rem = divmod(len(outbyte) - 2, 2)
        if rem:
            self.byte_length += 1
        
        current_file = 1
        
        # Update gauge
        self.progress_text_label.SetLabel("File: %d / %d" % (current_file, ((end - start) / self.byte_length) + 1))
        
        # Get progress bar range
        self.progress_gauge_control.SetValue(0)
        
        extension = source_name.split(".")[-1]
        infile = open(source_name, 'rb')
        
        contents = infile.read()
        
        for byte in xrange(start, end+1, self.byte_length):
            newcontents = ""
            
            newfile = str(byte) + "." + extension
            
            # Set the current file
            self.progress_text_label.SetLabel("File: %d / %d" % (current_file, ((end - start) / self.byte_length) + 1))
            
            # Open new file
            outfile = open(destination + "\\" + newfile, 'wb')
            
            # Write up to byte
            newcontents = contents[0:byte]
            # Write byte/s
            if self.byte_length <= 1:
                newcontents += struct.pack(">B", int(outbyte, 16))
            elif self.byte_length <= 2:
                newcontents += struct.pack(">H", int(outbyte, 16))
            elif self.byte_length <= 4:
                newcontents += struct.pack(">L", int(outbyte, 16))
            elif self.byte_length <= 8:
                newcontents += struct.pack(">Q", int(outbyte, 16))
            
            # Write from byte on
            newcontents += contents[byte+self.byte_length:]
            
            outfile.write(newcontents)
            outfile.close
            
            self.file_list_box_control.Append(destination + "\\" + newfile)
            self.progress_gauge_control.SetValue(int((float(current_file) / float(((end - start) / self.byte_length) + 1)) * 100))
            current_file += 1
                
        self.file_list_pos = self.file_list_box_control.GetCount() - 1
            
            
        infile.close()
        
        self.msg("File Generation Completed Successfully!")
def generate_files ( self , source_name , destination , outbyte , start , end ) : self . byte_length , rem = divmod ( len ( outbyte ) - 2 , 2 ) if rem : self . byte_length += 1 current_file = 1 # Update gauge self . progress_text_label . SetLabel ( "File: %d / %d" % ( current_file , ( ( end - start ) / self . byte_length ) + 1 ) ) # Get progress bar range self . progress_gauge_control . SetValue ( 0 ) extension = source_name . split ( "." ) [ - 1 ] infile = open ( source_name , 'rb' ) contents = infile . read ( ) for byte in xrange ( start , end + 1 , self . byte_length ) : newcontents = "" newfile = str ( byte ) + "." + extension # Set the current file self . progress_text_label . SetLabel ( "File: %d / %d" % ( current_file , ( ( end - start ) / self . byte_length ) + 1 ) ) # Open new file outfile = open ( destination + "\\" + newfile , 'wb' ) # Write up to byte newcontents = contents [ 0 : byte ] # Write byte/s if self . byte_length <= 1 : newcontents += struct . pack ( ">B" , int ( outbyte , 16 ) ) elif self . byte_length <= 2 : newcontents += struct . pack ( ">H" , int ( outbyte , 16 ) ) elif self . byte_length <= 4 : newcontents += struct . pack ( ">L" , int ( outbyte , 16 ) ) elif self . byte_length <= 8 : newcontents += struct . pack ( ">Q" , int ( outbyte , 16 ) ) # Write from byte on newcontents += contents [ byte + self . byte_length : ] outfile . write ( newcontents ) outfile . close self . file_list_box_control . Append ( destination + "\\" + newfile ) self . progress_gauge_control . SetValue ( int ( ( float ( current_file ) / float ( ( ( end - start ) / self . byte_length ) + 1 ) ) * 100 ) ) current_file += 1 self . file_list_pos = self . file_list_box_control . GetCount ( ) - 1 infile . close ( ) self . msg ( "File Generation Completed Successfully!" )