Example #1
0
 def service_remove_book(self, bookID) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     books = RepoBook.get_all_books(self.__RepoBook)
     try :
         self.__validations.Validations.valid_existent_BookID(self.__validations, bookID, books)
         self.__RepoBook.remove_book(bookID)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #2
0
 def service_remove_client(self, clientID) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     clients = RepoClients.get_all_clients(self.__RepoClient)
     try :
         self.__validations.Validations.valid_existent_clientID(self.__validations, clientID, clients)
         self.__RepoClient.remove_client(clientID)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #3
0
 def service_add_client(self, clientID, name) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     client = domain.Client(clientID, name)
     clients = RepoClients.get_all_clients(self.__RepoClient)
     try :
         self.__validations.Validations.validate_client(self.__validations, clientID, client, clients)
         self.__RepoClient.add_client(client)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #4
0
 def service_add_return(self, rid, bid, cid, returnDate) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     rentals = RepoRental.get_rentals(self.__RepoRental)
     try :
         self.__validations.Validations.valid_existent_rentalID(self.__validations, rid, rentals)
         self.__validations.Validations.valid_rental_for_return(self.__validations, rid, bid, cid,rentals)
         self.__RepoRental.update_for_return(rid, returnDate)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #5
0
 def service_add_book(self, bookID, title, author) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     book = domain.Book(bookID, title, author)
     books = RepoBook.get_all_books(self.__RepoBook)
     try :
         self.__validations.Validations.validate_book(self.__validations, bookID, book, books)
         self.__RepoBook.add_book(book)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #6
0
 def service_add_rental(self, rentalID, bookID, clientID, rentedDate, returnDate) :
     x = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     x.setUndoOpMan(self.__operationManager.getUndoOpMan())
     rental = domain.Rental(rentalID, bookID, clientID, rentedDate, returnDate)
     rentals = RepoRental.get_rentals(self.__RepoRental)
     books = RepoBook.get_all_books(self.__RepoBook)
     try :
         self.__validations.Validations.validate_rental(self.__validations, rentalID, bookID, rental, rentals)
         self.__RepoRental.add_rental(rental)
         self.addTimesRented(bookID)
         self.addTimesRentedAut(bookID)
     except Exception as ex :
         print(str(ex))
     y = OperationManager.OperationManager(self.__RepoBook, self.__RepoClient, self.__RepoRental)
     y.setUndoOpMan(x)
     x.setRedoOpMan(self.__operationManager)
     self.__operationManager = y
Example #7
0
 def __init__(self, RepoBook, RepoClient, RepoRental, validations) :
     self.__RepoBook = RepoBook
     self.__RepoClient = RepoClient
     self.__RepoRental = RepoRental
     self.__validations = validations
     self.__operationManager = OperationManager.OperationManager(RepoBook, RepoClient, RepoRental)
def prepare_config():
    Config.BASE_APK_PATH = sys.argv[1]
    Config.OUTPUT_SIGNED_FLODER = sys.argv[2]
    Config.BASE_APK_NAME = os.path.basename(Config.BASE_APK_PATH)
    Config.BASE_APK_COMPILE_FLODER = Config.BASE_APK_NAME.replace('.apk', '')
    Config.NEW_UNSIGNED_APK_PATH = './{0}/dist/{1}'.format(
        Config.BASE_APK_COMPILE_FLODER, Config.BASE_APK_NAME)
    Config.CONFIG_PATH = './{0}/assets/Configs/config.json'.format(
        Config.BASE_APK_COMPILE_FLODER)


if __name__ == '__main__':
    start_time = datetime.datetime.now()

    prepare_config()
    OperationManager.remove_useless()
    OperationManager.check_output_floder()
    channel_list = OperationManager.get_channel_list()
    for target_channel in channel_list:
        OperationManager.remove_useless()
        OperationManager.copy_base_apk()
        CompileSignManager.decompile_base_apk()
        # CompileSignManager.dex2jar() # 不需要改jar里面的脚本,所以省略
        AlterManager.change_config(target_channel)
        AlterManager.change_apktool_yml()
        CompileSignManager.compile_base_apk()
        CompileSignManager.resign_new_apk(target_channel)
    OperationManager.remove_useless()

    end_time = datetime.datetime.now()
    print('==================================================================')