bool mmHomePagePanel::Create(wxWindow *parent , wxWindowID winid , const wxPoint& pos , const wxSize& size , long style , const wxString& name) { SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); wxPanel::Create(parent, winid, pos, size, style, name); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); createHTML(); return TRUE; }
//------------------------------------------main function-------------------------------------- int main(int argc, char **argv) { //--------------------------Usage Test-------------------------------------------- if (argc != 4) { fprintf (stderr, "Usage: ./test output_dir input_dir logfile\n"); fprintf (stderr, "For example: $ ./test output_dir input_dir logfile\n"); return 1; } //--------------------------initiating variables-------------------------------------------- /* argc = 3, * argv[0] = test: name of final executable file * argv[1] = Input_directory * argv[2] = Output_directory * argv[3] = Log_filename */ char inputdir[100]; char outputdir[100]; char log_filename[100]; //pid_t childpid; strcpy(inputdir, argv[1]); strcpy(outputdir, argv[2]); strcpy(log_filename, argv[3]); //printf("inputdir name: %s\n", inputdir); // ################# //printf("outputdir name: %s\n", outputdir); // ################# //printf("Log_filename, : %s\n\n", log_filename); // ################# /* 1) Your program will take as input the name of the input_directory, an output_directory and a log_filename. * a) Intput_directory – Check if it exists, if it doesn’t, you should exit with appropriate error message. * b) Output_directory – Check if it exists, if it does, use that, if it doesn’t, create one. * c) Log_filename – Check if it exists, if it does, remove and create a new one. */ //---------------------------------------Initilize filesystem---------------------------------------- if (Initialize_Filesystem(log_filename)) // something wrong with initialization { return -1; } //---------------------------------------Output directory---------------------------------------- DIR * output = NULL; printf("\n---------------create output dir-----------------\n"); if ((output = opendir(outputdir)) == NULL){ char out[200]; sprintf(out, "%s/%s", getcwd(NULL, 0), outputdir); mkdir(out, 0700); printf("Outputdir: %s\n\n", out); // ################# } closedir(output); //---------------------------------------Input directory reading and Creating---------------------------------------- int numberOfFile = ReadDir(inputdir), i = 0; printf("\nThe number of file in inputdir: %d\n\n---------------------------------\n", numberOfFile); // ################# for (i = 0; i < numberOfFile; i++) { printInode(Inode_List[i]); printf("\n"); } //---------------------------------------Open file copy to output dir------------------------------------------- for (i = 0; i < Superblock.next_free_inode ; i++) { fprintf(stderr, "--------------START--------------\n"); writefileback (i, outputdir); fprintf(stderr, "---------------END---------------\n"); } //----------------------------------Delete extra generated file-------------------------------------- if (!(deleteENCD(outputdir))) { //add success deleting all encd file information here }else{ //add error information here } //----------------------------------Create thumbnails------------------------------------------ genThumbs(outputdir); //---------------------------------------Create html------------------------------------------- createHTML(outputdir); //---------------------------------------------test every function------------------------------------------ /* --------------search_Directory pass test, should print 0------------ char *b = "test_search"; strcpy(Directory_Structure[0].Filename,b); printf("Directory_Structure[0].Filename: %s\n", Directory_Structure[0].Filename); int a2 = Search_Directory(b); printf("Search_Directory return value: %d\n", a2);*/ /* --------------Add_to_Directory pass test---------------------------- char *b = "nihaoma"; int k = 15; Add_to_Directory(b, k); */ /* --------------Inode_Read pass test---------------------------------- Inode_List[12].Inode_Number = 15; Inode_List[12].User_Id = 15; Inode_List[12].Group_Id = 15; Inode_List[12].File_Size = 15; Inode_List[12].Start_Block = 15; Inode_List[12].End_Block = 15; Inode_List[12].Flag = 15; Inode test = Inode_Read(12); printInode(test); Inode test2 = Inode_Read(128); printInode(test2);*/ /* --------------Inode_write pass test----------------------------------- Inode b = { .Inode_Number = 15, .User_Id = 15, .Group_Id = 15, .File_Size = 15, .Start_Block = 15, .End_Block = 15, .Flag = 15}; Inode_Write(5,b); printInode(5); printf("Inode does not exist situation return: %d\n", Inode_Write(129,b));*/ /* --------------Block_Read pass test------- still have problem unsolved Disk_Blocks[5] = (char *)calloc(1, 512); strcpy(Disk_Blocks[5], "test for read block!!"); printBlock(Disk_Blocks[5]); char nihao[22]; printf("nihao : %d\n", sizeof(nihao)); int k = Block_Read(5 , 22, nihao); printf("Number of bytes read: %d\n", k); printf("information in the test char array: %s\n", nihao);*/ /* --------------Block_Write pass test-------------------------------------- Disk_Blocks[5] = (char *)calloc(1, 512); char *test = "test for Block_Write!"; int k = Block_Write(5, test); printf("Bytes written: %d\n", k); printBlock(Disk_Blocks[5]);*/ /* --------------SuperBlock_Write pass test-------------------------------------- Super_block new1 = { .next_free_block = 12, .next_free_inode = 12 }; int k1 = Superblock_Write(new1); printf("Status of SuperBlock wirte k1: %d\n", k1); printSuperBlock(); Super_block new2 = { .next_free_block = -1, .next_free_inode = 12 }; int k2 = Superblock_Write(new2); printf("Status of SuperBlock wirte k1: %d\n", k2); printSuperBlock();*/ /* --------------Create_File pass test-------------------------------------- char *testname = "test_filename"; printSuperBlock(); int k = Create_File(testname); printf("After creating file......\n"); printSuperBlock(); printf("\n"); printDirectory(Directory_Structure[0]); printf("\n"); printInode(Inode_List[0]);*/ /* --------------Open_File pass test-------------------------------------- char *testname = "test_filename"; Create_File(testname); int k = Open_File(testname); printf("Opened File inode number is: %d\n", k); printInode(Inode_List[0]);*/ /* --------------Read_File not pass test--------------------------------------*/ /* --------------Write_File ---------------------------------------------------- Inode testInode = { .Inode_Number = 15, .User_Id = 0, .Group_Id = 0, .File_Size = 512, .Start_Block = 0, .End_Block = 0, .Flag = 0 }; Inode_Write(15, testInode); printInode(Inode_List[15]); printf("\n"); char *testwrite = "liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabiliyangyunshishabiliyangyunshishabiliyangyunshishabi,liyangyunshishabiliyangyunshishabiliyangyunshishabi,liyangyunshishabiliyangyunshishabiliyangyunshishabiliyangyunshishabiliyangyunshishabiliyangyunshishabi,liyangyunshishabiliyangyunshishabiliyangyunshishabiliyangyunshishabi,liyangyunshishabi,liyangyunshishabi,liyangyunshishabi----\0"; printf("Length of test write array: %d\n\n", strlen(testwrite)); Write_File(15, 0, testwrite); printInode(Inode_List[15]); char * testwrite2 = "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------test write2---------------------------------------------------------------------------"; printf("Length of test write2 array: %d\n\n", strlen(testwrite2)); Write_File(15, 0, testwrite2); printInode(Inode_List[15]);*/ fprintf(stderr, "\nCount: %d\n", Count); fcloseall(); //close all return 0; }