Changeset 26935 for extensions/Picasa2Piwigo/Picasa2Piwigo/StatusForm.cs
- Timestamp:
- Jan 23, 2014, 10:49:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Picasa2Piwigo/Picasa2Piwigo/StatusForm.cs
r21241 r26935 616 616 617 617 //if it's a video file then skip it 618 if (photofilename. IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) == -1 &&619 photofilename. IndexOf(".gif", StringComparison.OrdinalIgnoreCase) == -1 &&620 photofilename. IndexOf(".png", StringComparison.OrdinalIgnoreCase) == -1 &&621 photofilename. IndexOf(".tga", StringComparison.OrdinalIgnoreCase) == -1 &&622 photofilename. IndexOf(".tif", StringComparison.OrdinalIgnoreCase) == -1 &&623 photofilename. IndexOf(".tiff", StringComparison.OrdinalIgnoreCase) == -1 &&624 photofilename. IndexOf(".psd", StringComparison.OrdinalIgnoreCase) == -1)618 if (photofilename.ToLower().IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) == -1 && 619 photofilename.ToLower().IndexOf(".gif", StringComparison.OrdinalIgnoreCase) == -1 && 620 photofilename.ToLower().IndexOf(".png", StringComparison.OrdinalIgnoreCase) == -1 && 621 photofilename.ToLower().IndexOf(".tga", StringComparison.OrdinalIgnoreCase) == -1 && 622 photofilename.ToLower().IndexOf(".tif", StringComparison.OrdinalIgnoreCase) == -1 && 623 photofilename.ToLower().IndexOf(".tiff", StringComparison.OrdinalIgnoreCase) == -1 && 624 photofilename.ToLower().IndexOf(".psd", StringComparison.OrdinalIgnoreCase) == -1) 625 625 { 626 626 return face_tag_list; … … 642 642 643 643 inifile = null; 644 try 645 { 646 inifile = new System.IO.StreamReader(filepath + "\\.picasa.ini"); 647 } 648 catch 649 { 650 if (face_tag_list.Length > 1) 651 { 652 face_tag_list = face_tag_list.Substring(0, face_tag_list.Length - 1); 653 } 654 return face_tag_list; 655 } 644 if (File.Exists(filepath + "\\.picasa.ini")) 645 { 646 try 647 { 648 inifile = new System.IO.StreamReader(filepath + "\\.picasa.ini"); 649 } 650 catch 651 { 652 if (face_tag_list.Length > 1) 653 { 654 face_tag_list = face_tag_list.Substring(0, face_tag_list.Length - 1); 655 } 656 return face_tag_list; 657 } 658 } 659 else if (File.Exists(filepath + "\\Picasa.ini")) 660 { 661 try 662 { 663 inifile = new System.IO.StreamReader(filepath + "\\Picasa.ini"); 664 } 665 catch 666 { 667 if (face_tag_list.Length > 1) 668 { 669 face_tag_list = face_tag_list.Substring(0, face_tag_list.Length - 1); 670 } 671 return face_tag_list; 672 } 673 } 674 656 675 k = 0; 657 676 found_photo = false; 658 while ((inidata = inifile.ReadLine()) != null) 659 { 660 if (inidata.Length > 4) 661 { 662 if (inidata.Substring(0, 1) == "[") 663 { 664 found_photo = false; 665 k = inidata.IndexOf("]"); 666 if (k != -1) 677 if (inifile != null) 678 { 679 while ((inidata = inifile.ReadLine()) != null) 680 { 681 if (inidata.Length > 4) 682 { 683 if (inidata.Substring(0, 1) == "[") 667 684 { 668 photo_file_name = inidata.Substring(1, k - 1); 669 } 670 if (photo_file_name != photofilename) 671 { 672 continue; 673 } 674 675 if (photo_file_name.IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) != -1 || 676 photo_file_name.IndexOf(".gif", StringComparison.OrdinalIgnoreCase) != -1 || 677 photo_file_name.IndexOf(".png", StringComparison.OrdinalIgnoreCase) != -1 || 678 photo_file_name.IndexOf(".tga", StringComparison.OrdinalIgnoreCase) != -1 || 679 photo_file_name.IndexOf(".tif", StringComparison.OrdinalIgnoreCase) != -1 || 680 photo_file_name.IndexOf(".tiff", StringComparison.OrdinalIgnoreCase) != -1 || 681 photo_file_name.IndexOf(".psd", StringComparison.OrdinalIgnoreCase) != -1) 682 { 683 found_photo = true; 684 } 685 } 686 else if (inidata.Substring(0, 6) == "faces=" && found_photo) 687 { 688 finished_faces = false; 689 k = 0; 690 do 691 { 692 k = inidata.IndexOf("),", k); 685 found_photo = false; 686 k = inidata.IndexOf("]"); 693 687 if (k != -1) 694 688 { 695 l = inidata.IndexOf(";", k); 696 if (l == -1) 689 photo_file_name = inidata.Substring(1, k - 1); 690 } 691 if (photo_file_name.ToUpper() != photofilename.ToUpper()) 692 { 693 continue; 694 } 695 696 if (photo_file_name.ToLower().IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) != -1 || 697 photo_file_name.ToLower().IndexOf(".gif", StringComparison.OrdinalIgnoreCase) != -1 || 698 photo_file_name.ToLower().IndexOf(".png", StringComparison.OrdinalIgnoreCase) != -1 || 699 photo_file_name.ToLower().IndexOf(".tga", StringComparison.OrdinalIgnoreCase) != -1 || 700 photo_file_name.ToLower().IndexOf(".tif", StringComparison.OrdinalIgnoreCase) != -1 || 701 photo_file_name.ToLower().IndexOf(".tiff", StringComparison.OrdinalIgnoreCase) != -1 || 702 photo_file_name.ToLower().IndexOf(".psd", StringComparison.OrdinalIgnoreCase) != -1) 703 { 704 found_photo = true; 705 } 706 } 707 else if (inidata.Substring(0, 6) == "faces=" && found_photo) 708 { 709 finished_faces = false; 710 k = 0; 711 do 712 { 713 k = inidata.IndexOf("),", k); 714 if (k != -1) 697 715 { 698 l = inidata.Length; 699 } 700 if (l != -1) 701 { 702 ini_unique_id = inidata.Substring(k + 2, l - k - 2); 703 704 //found face in a picture, but who? 705 l = 0; 706 found_person = false; 707 do 716 l = inidata.IndexOf(";", k); 717 if (l == -1) 708 718 { 709 if (GlobalClass.picasa_unique_id_arrary[l].unique_id == ini_unique_id) 719 l = inidata.Length; 720 } 721 if (l != -1) 722 { 723 ini_unique_id = inidata.Substring(k + 2, l - k - 2); 724 725 //found face in a picture, but who? 726 l = 0; 727 found_person = false; 728 do 710 729 { 711 //did we already find this person? 712 if (found_contact_in_photo_array[l] == false) 730 if (GlobalClass.picasa_unique_id_arrary[l].unique_id == ini_unique_id) 713 731 { 714 found_person = true; 715 break; 732 //did we already find this person? 733 if (found_contact_in_photo_array[l] == false) 734 { 735 found_person = true; 736 break; 737 } 738 } 739 l++; 740 } while (l < GlobalClass.unique_id_count); 741 742 //found person 743 if (found_person) 744 { 745 if (photo_file_name.Length > 3) 746 { 747 face_tag_list += GlobalClass.contact_array[l].name + ","; 716 748 } 717 749 } 718 l++;719 } while (l < GlobalClass.unique_id_count);720 721 //found person722 if (found_person)723 {724 if (photo_file_name.Length > 3)725 {726 face_tag_list += GlobalClass.contact_array[l].name + ",";727 }728 750 } 751 k++; 729 752 } 730 k++; 731 } 732 else 733 { 734 finished_faces = true; 735 } 736 } while (!finished_faces); 753 else 754 { 755 finished_faces = true; 756 } 757 } while (!finished_faces); 758 } 737 759 } 738 760 } … … 901 923 { 902 924 string WebResponse, WebRequest, xmlResponse; 903 904 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.categories.getList&fullname=\"true\"&recursive=\"false\""; 925 int piwigo_minor_version; 926 927 piwigo_minor_version = Convert.ToInt32(GlobalClass.PiwigoVersionNumber.Substring(2, 1)); 928 if (piwigo_minor_version >= 6) 929 { 930 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.categories.getList&fullname=true&recursive=true"; 931 } 932 else 933 { 934 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.categories.getList&fullname=\"true\"&recursive=\"false\""; 935 } 936 905 937 WriteLog(WebRequest); 906 938 … … 1409 1441 string strLogFile; 1410 1442 1411 strLogFile = " picasa2piwigo_log.txt";1443 strLogFile = "c:\\temp\\picasa2piwigo_log.txt"; 1412 1444 #pragma warning disable 0162 1413 1445 if (constants.DEBUG_LOG_ENABLED)
Note: See TracChangeset
for help on using the changeset viewer.