Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint64 jpWindow::GetVRCDSize()
- {
- char command[1024];
- char buffer[1024], buf[1024];
- uint32 i;
- uint64 tempas = 0;
- if (IMAGE_TYPE == 0) {
- FILE* f1;
- sprintf(command, "mkisofs -print-size %s %s -gui -f -V \"%s\" -C %s \"%s\" 2>&1", DATA_STRING, BOOTSTRING, VOL_NAME, fBurnDevice->scsiid, BURN_DIR);
- printf("com: %s\n",command);
- f1 = popen(command, "r");
- while (!feof(f1) && !ferror(f1)) {
- buffer[0] = 0;
- fgets(buffer, 1024, f1); //printf("# %s",buffer);
- if (!strncmp("Total extents scheduled to be written = ", &buffer[0], 40)) {
- for (i = 0; i < strlen(&buffer[40]); i++) {
- if ((buffer[i + 40] != '\n') || (buffer[i + 41] != '\0'))
- buf[i] = buffer[i + 40];
- }
- }
- }
- pclose(f1);
- tempas = atol(buf) * 2048;
- } else if (IMAGE_TYPE == 1)
- tempas = GetBFSSize();
- return tempas;
- }
- void jpWindow::CalculateSize()
- {
- BFile f1;
- char temp_char[1024];
- char what[100];
- uint32 angle_temp[100];
- uint32 tracks, i;
- off_t temp, total_audio, total, total_iso, total_vrcd;
- total_audio = 0;
- total = 0;
- total_iso = 0;
- total_vrcd = 0;
- temp = 0; nrtracks = 0;
- if (BURN_TYPE == 0) {
- sprintf(what, "DataCD");
- total_vrcd = total = total_iso = total_audio = 0;
- fStatusBar->SetBarColor(blue);
- if (fLeftList->CountItems() > 0) {
- LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
- if (item1->fIconBitmap == fLeftList->fISOBitmap) {
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_iso += temp;
- angle_temp[0] = temp / 1024 / 1024;
- nrtracks = 1;
- } else if (item1->fIconBitmap == fLeftList->fVRCDBitmap) {
- nrtracks = 1;
- total_vrcd = temp = GetVRCDSize();
- angle_temp[0] = temp / 1024 / 1024;
- }
- }
- } else if (BURN_TYPE == 1) {
- sprintf(what, "AudioCD");
- total_vrcd = total = total_iso = total_audio = temp = 0;
- fStatusBar->SetBarColor(green);
- if (fLeftList->CountItems() > 0) {
- LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
- LeftListItem* item2 = (LeftListItem*)fLeftList->ItemAt(1);
- if (item1->fIconBitmap == fLeftList->fAudioBitmap) {
- tracks = fLeftList->CountItems();
- for (i = 0; i < tracks; i++) {
- item1 = (LeftListItem*)fLeftList->ItemAt(i);
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_audio += temp;
- angle_temp[i] = temp / 1024 / 1024;
- nrtracks++;
- }
- } else if (fLeftList->CountItems() > 1) {
- if (item2->fIconBitmap == fLeftList->fAudioBitmap) {
- tracks = fLeftList->CountItems();
- for (i = 1; i < tracks; i++) {
- item1 = (LeftListItem*)fLeftList->ItemAt(i);
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_audio += temp;
- angle_temp[i - 1] = temp / 1024 / 1024;
- nrtracks++;
- }
- }
- }
- }
- } else if (BURN_TYPE == 2) {
- sprintf(what, "MixCD");
- total_vrcd = total = total_iso = total_audio = 0;
- fStatusBar->SetBarColor(greenblue);
- if (fLeftList->CountItems() > 0) {
- LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
- LeftListItem* item2 = (LeftListItem*)fLeftList->ItemAt(1);
- if (item1->fIconBitmap == fLeftList->fISOBitmap) {
- nrtracks = 1;
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_iso = temp;
- angle_temp[nrtracks - 1] = temp / 1024 / 1024;
- } else if (item1->fIconBitmap == fLeftList->fVRCDBitmap) {
- nrtracks = 1;
- total_vrcd = temp = GetVRCDSize();
- angle_temp[nrtracks - 1] = temp / 1024 / 1024;
- }
- if (item1->fIconBitmap == fLeftList->fAudioBitmap) {
- tracks = fLeftList->CountItems();
- for (i = 0; i < tracks; i++) {
- item1 = (LeftListItem*)fLeftList->ItemAt(i);
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_audio += temp;
- nrtracks++;
- angle_temp[nrtracks - 1] = temp / 1024 / 1024;
- }
- }
- else if (fLeftList->CountItems() > 1)
- if (item2->fIconBitmap == fLeftList->fAudioBitmap) {
- tracks = fLeftList->CountItems();
- for (i = 1; i < tracks; i++) {
- item1 = (LeftListItem*)fLeftList->ItemAt(i);
- f1.SetTo(&item1->fRef, B_READ_ONLY);
- f1.GetSize(&temp);
- total_audio += temp;
- nrtracks++;
- angle_temp[nrtracks - 1] = temp / 1024 / 1024;
- }
- }
- }
- }
- total = total_audio + total_iso + total_vrcd;
- sprintf(temp_char, "%s - [%lld of 698 Mb]", what, total / 1024 / 1024);
- fStatusBar->Reset();
- fStatusBar->SetMaxValue(CDSIZE);
- fStatusBar->Update((total / 1024 / 1024), temp_char);
- for (i = 0; i < nrtracks; i++) {
- if (i == 0)
- angles[i] = ((float)360 / (float)(total / 1024 / 1024)) * (float)angle_temp[i];
- else
- angles[i] = ((float)360 / (float)(total / 1024 / 1024)) * (float)angle_temp[i] + angles[i - 1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement