Changeset 30536


Ignore:
Timestamp:
Nov 19, 2014, 4:33:20 PM (9 years ago)
Author:
kenl
Message:

Version 1.4

Location:
extensions/Picasa2Piwigo/Picasa2Piwigo
Files:
4 added
23 edited

Legend:

Unmodified
Added
Removed
  • extensions/Picasa2Piwigo/Picasa2Piwigo/FormSettings.Designer.cs

    r26935 r30536  
    8383            }
    8484        }
     85       
     86        [global::System.Configuration.UserScopedSettingAttribute()]
     87        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     88        [global::System.Configuration.DefaultSettingValueAttribute("")]
     89        public string DebugFileLocation {
     90            get {
     91                return ((string)(this["DebugFileLocation"]));
     92            }
     93            set {
     94                this["DebugFileLocation"] = value;
     95            }
     96        }
     97       
     98        [global::System.Configuration.UserScopedSettingAttribute()]
     99        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     100        [global::System.Configuration.DefaultSettingValueAttribute("False")]
     101        public bool DebugEnabled {
     102            get {
     103                return ((bool)(this["DebugEnabled"]));
     104            }
     105            set {
     106                this["DebugEnabled"] = value;
     107            }
     108        }
    85109    }
    86110}
  • extensions/Picasa2Piwigo/Picasa2Piwigo/FormSettings.settings

    r21241 r30536  
    1818      <Value Profile="(Default)" />
    1919    </Setting>
     20    <Setting Name="DebugFileLocation" Type="System.String" Scope="User">
     21      <Value Profile="(Default)" />
     22    </Setting>
     23    <Setting Name="DebugEnabled" Type="System.Boolean" Scope="User">
     24      <Value Profile="(Default)">False</Value>
     25    </Setting>
    2026  </Settings>
    2127</SettingsFile>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/GlobalClass.cs

    r21241 r30536  
    77using System.Windows.Forms;
    88using System.Drawing;
     9using System.IO;
     10using Picasa2PiwigoConstants;
    911
    1012namespace Picasa2PiwigoCommonFunctions
    1113{
     14    public class logit
     15    {
     16        public static void WriteLog(string logMessage)
     17        {
     18            string strLogFile;
     19           
     20            strLogFile = FormSettings.Default.DebugFileLocation;
     21#pragma warning disable 0162
     22            if (constants.DEBUG_LOG_ENABLED &&
     23                FormSettings.Default.DebugEnabled &&
     24                FormSettings.Default.DebugFileLocation.Length > 3)
     25            {
     26                try
     27                {
     28#pragma warning restore 0162
     29                    StreamWriter swLog;
     30
     31                    logMessage = string.Format("{0}: {1}", DateTime.Now, logMessage);
     32
     33                    if (!File.Exists(strLogFile))
     34                    {
     35                        swLog = new StreamWriter(strLogFile);
     36                    }
     37                    else
     38                    {
     39                        swLog = File.AppendText(strLogFile);
     40                    }
     41
     42                    swLog.WriteLine(logMessage);
     43                    swLog.WriteLine();
     44
     45                    swLog.Close();
     46
     47                }
     48                catch
     49                {
     50                }
     51            }
     52        }
     53    }
    1254    public class LabelAdjust
    1355    {
     
    4688        public const bool DEBUG_LOCALE = false;
    4789        public const string SET_LOCALE = "es";
    48         public const bool DEBUG_LOG_ENABLED = false;
     90        public const bool DEBUG_LOG_ENABLED = true;
    4991
    5092        public const int COMMAND_START_UP = 1;
     
    5395
    5496        public const int MAX_DUPLICATE_FILENAMES = 10000;
    55         public const int MAX_NUMBER_OF_CONTACTS = 512;
     97        public const int MAX_NUMBER_OF_CONTACTS = 2000;
    5698        public struct PersonIDStruct
    5799        {
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.da.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Version 1,3 - KenL</value>
     204    <value>Picasa2Piwigo - Version 1,4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Fejl: Alt for mange mennesker tags i Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Log sti er ikke indstillet. Skal du indstille logsti ved at klikke på valgknappen .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Fejl: Kan ikke uploade foto. Foto kan være større end webserver tillader.</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.de.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Version 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Version 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Fehler: Zu viele Menschen Tags in Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Protokollpfad ist nicht gesetzt. Bitte stellen Sie den Protokollpfad , indem Sie auf das Optionsfeld .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Fehler: Unable to Foto hochladen. Foto kann größer sein als Webserver erlaubt.</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.fr.resx

    r26936 r30536  
    221221  </data>
    222222  <data name="MFVersionStrRes" xml:space="preserve">
    223     <value>Picasa2Piwigo - Version 1.3 - KenL</value>
     223    <value>Picasa2Piwigo - Version 1.4 - KenL</value>
    224224  </data>
    225225  <data name="OFCancelButtonStrRes" xml:space="preserve">
     
    287287    <comment>Error:  Unable to retrieve version number.</comment>
    288288  </data>
     289  <data name="TooManyPeopleTags" xml:space="preserve">
     290    <value>Erreur: trop de gens tags dans Picasa</value>
     291    <comment>Error:  Too many people tags in Picasa</comment>
     292  </data>
     293  <data name="LogPathErrStrRes" xml:space="preserve">
     294    <value>Chemin du journal est pas défini. Se il vous plaît définir le chemin de journal en cliquant sur le bouton d'option .</value>
     295    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     296  </data>
     297  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     298    <value>Erreur: Impossible de télécharger photos. Photo peut être plus grand que le serveur web permet .</value>
     299    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     300  </data>
    289301</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.hu.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - 1.3 verzió - KenL</value>
     204    <value>Picasa2Piwigo - 1.4 verzió - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Hiba: Túl sok ember címkék Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Log útvonal nincs beállítva . Állítsa be a log path kattintva opció gombra.</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Hiba: Nem sikerült feltölteni a képet. Photo nagyobb lehet , mint a web szerver lehetővé teszi .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.it.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Versione 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Versione 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Errore: troppe persone etichette in Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Percorso di registro non è impostato . Impostare il percorso del registro facendo clic sul pulsante di opzione .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Errore : Impossibile caricare foto . La foto potrebbe essere più grande di web server consente .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.nl.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Versie 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Versie 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Fout: Te veel mensen in Picasa codes</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Inloggen pad niet is ingesteld . Stel de log weg door te klikken op de optie knop .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Fout : Kan geen foto uploaden. Foto kan groter zijn dan de webserver kunt zijn.</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.pl.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Wersja 1.3 - KENL</value>
     204    <value>Picasa2Piwigo - Wersja 1.4 - KENL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Błąd: Zbyt wielu ludzi tagi w programie Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Ścieżka dziennika nie jest ustawiony . Proszę ustawić ścieżkę dziennika , klikając przycisk opcji .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Błąd : Nie można przesłać zdjęcie. Zdjęcie może być większa niż serwer WWW pozwala .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.ru.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Версия 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Версия 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Ошибка: слишком много людей теги в Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Путь Вход не установлен . Пожалуйста, установите путь к журналу , нажав на кнопку выбора .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Ошибка : Не удается загрузить фотографию. Фотография может быть больше, чем веб-сервер позволяет .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.tr.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Sürüm 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Sürüm 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Hata: Picasa çok sayıda kişi etiketleri</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Giriş yolu ayarlı değil . Seçenek düğmesine tıklayarakgünlük yolu ayarlayın.</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Hata: Fotoğraf yüklenemiyor. Fotoğraf web sunucusu izin verdiğinden daha büyük olabilir .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.zh.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - 1.3版 - KenL</value>
     204    <value>Picasa2Piwigo - 1.4版 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>错误:在Picasa太多人标签</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>日志路径没有设置。点击选项按钮,请设置日志路径。</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>错误:无法上传照片。照片可能会大于web服务器允许。</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Language/winFormStrings.es.resx

    r26936 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Versión 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Versión 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="TooManyPeopleTags" xml:space="preserve">
     336    <value>Error: Demasiados etiquetas de personas en Picasa</value>
     337    <comment>Error:  Too many people tags in Picasa</comment>
     338  </data>
     339  <data name="LogPathErrStrRes" xml:space="preserve">
     340    <value>Ruta de registro no está establecida. Por favor, establecer la ruta de registro haciendo clic en el botón de opción .</value>
     341    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     342  </data>
     343  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     344    <value>Error : No se puede cargar la foto . La foto puede ser más grande que el servidor web permite .</value>
     345    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     346  </data>
    335347</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/MainForm.cs

    r21241 r30536  
    5151        {
    5252            int command_length, i;
    53            
     53
     54            byte[] temp_array2 = new byte[2];
     55            string tempstr;
     56
     57            temp_array2[0] = 0xC3;
     58            temp_array2[1] = 0xAF;
     59            tempstr = Encoding.UTF8.GetString(temp_array2);
     60
     61
    5462            this.AddToAlbumGroupbox.Text = WinFormStrings.MFAddToAlbumGroupboxStrRes;
    5563            this.AddTopAlbumCheckbox.Text = WinFormStrings.MFAddTopAlbumCheckboxStrRes;
     
    8189            this.Refresh();
    8290
     91            logit.WriteLog("Program Start up");
     92
    8393            //if no arguments then exit
    8494            if (command_line_args.Length == 0)
     
    99109            }
    100110
     111            logit.WriteLog("Reading command line arguments. Length: " + command_length.ToString());
    101112            AccessComboBox.SelectedIndex = Form1Settings.Default.AccessSetting;
    102113            this.SyncButton.Enabled = true;
     
    107118            DescriptionTextBox.Text = DetermineAlbumDescription(command_line_args[0]);
    108119
    109             if (FormSettings.Default.PiwigoUrlSetting.Length == 0 ||
    110                 FormSettings.Default.PicasaContactsLocation.Length == 0)
    111             {
     120            if (FormSettings.Default.PiwigoUrlSetting.Length == 0)
     121            {
     122                logit.WriteLog("Piwigo URL must be configured.");
    112123                MessageBox.Show(WinFormStrings.SetUpConnStrRes, "Picasa2Piwigo");
     124                this.SyncButton.Enabled = false;
    113125                return;
    114126            }
    115 
     127            if (FormSettings.Default.PicasaContactsLocation.Length == 0)
     128            {
     129                logit.WriteLog("Picasa contacts not set");               
     130            }
     131
     132            if (FormSettings.Default.DebugEnabled)
     133            {
     134                if (FormSettings.Default.DebugFileLocation.Length < 4)
     135                {
     136                    MessageBox.Show( WinFormStrings.LogPathErrStrRes, "Picasa2Piwigo");                       
     137                }
     138            }   
     139
     140            logit.WriteLog("Going to log in to piwigo.");
    116141            //ok to try to login etc
    117142            LoginBuildAlbumList();
    118143
     144            logit.WriteLog("Populating album list box.");
    119145            //populate album listbox
    120146            PopulateAlbumListBox();
     
    154180                result = StatusForm.ShowDialog();
    155181                StatusForm.Close();
     182
     183                //bring window to front
     184                this.WindowState = FormWindowState.Minimized;
     185                this.Show();
     186                this.WindowState = FormWindowState.Normal;
     187
    156188                if (result == DialogResult.No)
    157189                {
     
    177209                result = StatusForm.ShowDialog();
    178210                StatusForm.Close();
     211
     212                //bring window to front
     213                this.WindowState = FormWindowState.Minimized;
     214                this.Show();
     215                this.WindowState = FormWindowState.Normal;
     216
    179217                if (result == DialogResult.No)
    180218                {
     
    200238            if (option_form_result == DialogResult.OK)
    201239            {
     240                if (FormSettings.Default.DebugEnabled)
     241                {
     242                    if (FormSettings.Default.DebugFileLocation.Length < 4)
     243                    {
     244                        MessageBox.Show(WinFormStrings.LogPathErrStrRes, "Picasa2Piwigo");
     245                    }
     246                }           
     247
    202248                if (FormSettings.Default.PiwigoUrlSetting.Length != 0 &&
    203249                    FormSettings.Default.PicasaContactsLocation.Length != 0)
     
    239285                MessageBox.Show(GlobalClass.StatusDialogErrorMessage, WinFormStrings.Picasa2PiwigoErrStrRes,
    240286                    MessageBoxButtons.OK, MessageBoxIcon.Error);
     287                this.SyncButton.Enabled = false;
    241288            }
    242289            AlbumList = GlobalClass.AlbumList;
  • extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.Designer.cs

    r21241 r30536  
    4141            this.PicasaContactsFileTextBox = new System.Windows.Forms.TextBox();
    4242            this.SetContactPathBtn = new System.Windows.Forms.Button();
     43            this.button1 = new System.Windows.Forms.Button();
     44            this.DebugtextBox = new System.Windows.Forms.TextBox();
     45            this.label4 = new System.Windows.Forms.Label();
     46            this.LogEnabled = new System.Windows.Forms.CheckBox();
    4347            this.SuspendLayout();
    4448            //
     
    112116            this.SetContactPathBtn.Click += new System.EventHandler(this.SetContactPathBtn_Click);
    113117            //
     118            // button1
     119            //
     120            resources.ApplyResources(this.button1, "button1");
     121            this.button1.MaximumSize = new System.Drawing.Size(54, 23);
     122            this.button1.Name = "button1";
     123            this.button1.UseVisualStyleBackColor = true;
     124            this.button1.Click += new System.EventHandler(this.SetDebugPathBtn_Click);
     125            //
     126            // DebugtextBox
     127            //
     128            resources.ApplyResources(this.DebugtextBox, "DebugtextBox");
     129            this.DebugtextBox.Name = "DebugtextBox";
     130            this.DebugtextBox.ReadOnly = true;
     131            //
     132            // label4
     133            //
     134            resources.ApplyResources(this.label4, "label4");
     135            this.label4.MaximumSize = new System.Drawing.Size(133, 16);
     136            this.label4.Name = "label4";
     137            //
     138            // LogEnabled
     139            //
     140            resources.ApplyResources(this.LogEnabled, "LogEnabled");
     141            this.LogEnabled.Name = "LogEnabled";
     142            this.LogEnabled.UseVisualStyleBackColor = true;
     143            //
    114144            // OptionsForm
    115145            //
    116146            resources.ApplyResources(this, "$this");
    117147            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     148            this.Controls.Add(this.LogEnabled);
     149            this.Controls.Add(this.label4);
    118150            this.Controls.Add(this.label8);
     151            this.Controls.Add(this.DebugtextBox);
    119152            this.Controls.Add(this.PicasaContactsFileTextBox);
     153            this.Controls.Add(this.button1);
    120154            this.Controls.Add(this.SetContactPathBtn);
    121155            this.Controls.Add(this.ACancelButton);
     
    147181        private System.Windows.Forms.TextBox PicasaContactsFileTextBox;
    148182        private System.Windows.Forms.Button SetContactPathBtn;
     183        private System.Windows.Forms.Button button1;
     184        private System.Windows.Forms.TextBox DebugtextBox;
     185        private System.Windows.Forms.Label label4;
     186        private System.Windows.Forms.CheckBox LogEnabled;
    149187    }
    150188}
  • extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.cs

    r21241 r30536  
    4545            PiwigoPasswordTextBox.Text = FormSettings.Default.PiwigoPassword;
    4646            PicasaContactsFileTextBox.Text = FormSettings.Default.PicasaContactsLocation;
     47            DebugtextBox.Text = FormSettings.Default.DebugFileLocation;
     48            LogEnabled.Checked = FormSettings.Default.DebugEnabled;
     49
    4750
    4851            LabelAdjust AdjustLabelClass = new LabelAdjust();
     
    6265            FormSettings.Default.PiwigoPassword = PiwigoPasswordTextBox.Text;
    6366            FormSettings.Default.PicasaContactsLocation = PicasaContactsFileTextBox.Text;
     67            FormSettings.Default.DebugFileLocation = DebugtextBox.Text;
     68            FormSettings.Default.DebugEnabled = LogEnabled.Checked;
    6469            FormSettings.Default.Save();
    6570            this.DialogResult = DialogResult.OK;
     
    8287            }
    8388        }
     89
     90        private void SetDebugPathBtn_Click(object sender, EventArgs e)
     91        {
     92            SaveFileDialog openFile1 = new SaveFileDialog();
     93            openFile1.Filter = "Text Files|*.txt";
     94            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     95            {
     96                DebugtextBox.Text = openFile1.FileName;
     97            }
     98
     99        }
    84100    }
    85101}
  • extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.resx

    r21241 r30536  
    142142  </data>
    143143  <data name="&gt;&gt;PiwigoURLTextbox.ZOrder" xml:space="preserve">
    144     <value>10</value>
     144    <value>14</value>
    145145  </data>
    146146  <data name="label1.Font" type="System.Drawing.Font, System.Drawing">
     
    169169  </data>
    170170  <data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
    171     <value>7</value>
     171    <value>11</value>
    172172  </data>
    173173  <data name="PiwigoUserNameTextBox.Font" type="System.Drawing.Font, System.Drawing">
     
    193193  </data>
    194194  <data name="&gt;&gt;PiwigoUserNameTextBox.ZOrder" xml:space="preserve">
    195     <value>9</value>
     195    <value>13</value>
    196196  </data>
    197197  <data name="label2.Font" type="System.Drawing.Font, System.Drawing">
     
    220220  </data>
    221221  <data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
    222     <value>6</value>
     222    <value>10</value>
    223223  </data>
    224224  <data name="PiwigoPasswordTextBox.Font" type="System.Drawing.Font, System.Drawing">
     
    247247  </data>
    248248  <data name="&gt;&gt;PiwigoPasswordTextBox.ZOrder" xml:space="preserve">
    249     <value>8</value>
     249    <value>12</value>
    250250  </data>
    251251  <data name="label3.Font" type="System.Drawing.Font, System.Drawing">
     
    274274  </data>
    275275  <data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
    276     <value>5</value>
     276    <value>9</value>
    277277  </data>
    278278  <data name="OKButton.Location" type="System.Drawing.Point, System.Drawing">
    279     <value>196, 176</value>
     279    <value>196, 269</value>
    280280  </data>
    281281  <data name="OKButton.Size" type="System.Drawing.Size, System.Drawing">
     
    298298  </data>
    299299  <data name="&gt;&gt;OKButton.ZOrder" xml:space="preserve">
    300     <value>4</value>
     300    <value>8</value>
    301301  </data>
    302302  <data name="ACancelButton.Location" type="System.Drawing.Point, System.Drawing">
    303     <value>334, 177</value>
     303    <value>334, 270</value>
    304304  </data>
    305305  <data name="ACancelButton.Size" type="System.Drawing.Size, System.Drawing">
     
    322322  </data>
    323323  <data name="&gt;&gt;ACancelButton.ZOrder" xml:space="preserve">
    324     <value>3</value>
     324    <value>7</value>
    325325  </data>
    326326  <data name="label8.Font" type="System.Drawing.Font, System.Drawing">
     
    349349  </data>
    350350  <data name="&gt;&gt;label8.ZOrder" xml:space="preserve">
    351     <value>0</value>
     351    <value>2</value>
    352352  </data>
    353353  <data name="PicasaContactsFileTextBox.Enabled" type="System.Boolean, mscorlib">
     
    376376  </data>
    377377  <data name="&gt;&gt;PicasaContactsFileTextBox.ZOrder" xml:space="preserve">
    378     <value>1</value>
     378    <value>4</value>
    379379  </data>
    380380  <data name="SetContactPathBtn.Font" type="System.Drawing.Font, System.Drawing">
     
    403403  </data>
    404404  <data name="&gt;&gt;SetContactPathBtn.ZOrder" xml:space="preserve">
    405     <value>2</value>
     405    <value>6</value>
     406  </data>
     407  <data name="button1.Font" type="System.Drawing.Font, System.Drawing">
     408    <value>Microsoft Sans Serif, 9.75pt</value>
     409  </data>
     410  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     411  <data name="button1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
     412    <value>NoControl</value>
     413  </data>
     414  <data name="button1.Location" type="System.Drawing.Point, System.Drawing">
     415    <value>538, 184</value>
     416  </data>
     417  <data name="button1.Size" type="System.Drawing.Size, System.Drawing">
     418    <value>54, 23</value>
     419  </data>
     420  <data name="button1.TabIndex" type="System.Int32, mscorlib">
     421    <value>4</value>
     422  </data>
     423  <data name="button1.Text" xml:space="preserve">
     424    <value>Set</value>
     425  </data>
     426  <data name="&gt;&gt;button1.Name" xml:space="preserve">
     427    <value>button1</value>
     428  </data>
     429  <data name="&gt;&gt;button1.Type" xml:space="preserve">
     430    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     431  </data>
     432  <data name="&gt;&gt;button1.Parent" xml:space="preserve">
     433    <value>$this</value>
     434  </data>
     435  <data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
     436    <value>5</value>
     437  </data>
     438  <data name="DebugtextBox.Enabled" type="System.Boolean, mscorlib">
     439    <value>False</value>
     440  </data>
     441  <data name="DebugtextBox.Font" type="System.Drawing.Font, System.Drawing">
     442    <value>Microsoft Sans Serif, 9.75pt</value>
     443  </data>
     444  <data name="DebugtextBox.Location" type="System.Drawing.Point, System.Drawing">
     445    <value>151, 184</value>
     446  </data>
     447  <data name="DebugtextBox.Size" type="System.Drawing.Size, System.Drawing">
     448    <value>381, 22</value>
     449  </data>
     450  <data name="DebugtextBox.TabIndex" type="System.Int32, mscorlib">
     451    <value>8</value>
     452  </data>
     453  <data name="&gt;&gt;DebugtextBox.Name" xml:space="preserve">
     454    <value>DebugtextBox</value>
     455  </data>
     456  <data name="&gt;&gt;DebugtextBox.Type" xml:space="preserve">
     457    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     458  </data>
     459  <data name="&gt;&gt;DebugtextBox.Parent" xml:space="preserve">
     460    <value>$this</value>
     461  </data>
     462  <data name="&gt;&gt;DebugtextBox.ZOrder" xml:space="preserve">
     463    <value>3</value>
     464  </data>
     465  <data name="label4.Font" type="System.Drawing.Font, System.Drawing">
     466    <value>Microsoft Sans Serif, 9.75pt</value>
     467  </data>
     468  <data name="label4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
     469    <value>NoControl</value>
     470  </data>
     471  <data name="label4.Location" type="System.Drawing.Point, System.Drawing">
     472    <value>12, 188</value>
     473  </data>
     474  <data name="label4.Size" type="System.Drawing.Size, System.Drawing">
     475    <value>133, 16</value>
     476  </data>
     477  <data name="label4.TabIndex" type="System.Int32, mscorlib">
     478    <value>22</value>
     479  </data>
     480  <data name="label4.Text" xml:space="preserve">
     481    <value>Log Path</value>
     482  </data>
     483  <data name="&gt;&gt;label4.Name" xml:space="preserve">
     484    <value>label4</value>
     485  </data>
     486  <data name="&gt;&gt;label4.Type" xml:space="preserve">
     487    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     488  </data>
     489  <data name="&gt;&gt;label4.Parent" xml:space="preserve">
     490    <value>$this</value>
     491  </data>
     492  <data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
     493    <value>1</value>
     494  </data>
     495  <data name="LogEnabled.AutoSize" type="System.Boolean, mscorlib">
     496    <value>True</value>
     497  </data>
     498  <data name="LogEnabled.Font" type="System.Drawing.Font, System.Drawing">
     499    <value>Microsoft Sans Serif, 9.75pt</value>
     500  </data>
     501  <data name="LogEnabled.Location" type="System.Drawing.Point, System.Drawing">
     502    <value>151, 221</value>
     503  </data>
     504  <data name="LogEnabled.Size" type="System.Drawing.Size, System.Drawing">
     505    <value>122, 20</value>
     506  </data>
     507  <data name="LogEnabled.TabIndex" type="System.Int32, mscorlib">
     508    <value>23</value>
     509  </data>
     510  <data name="LogEnabled.Text" xml:space="preserve">
     511    <value>Enable Logging</value>
     512  </data>
     513  <data name="&gt;&gt;LogEnabled.Name" xml:space="preserve">
     514    <value>LogEnabled</value>
     515  </data>
     516  <data name="&gt;&gt;LogEnabled.Type" xml:space="preserve">
     517    <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     518  </data>
     519  <data name="&gt;&gt;LogEnabled.Parent" xml:space="preserve">
     520    <value>$this</value>
     521  </data>
     522  <data name="&gt;&gt;LogEnabled.ZOrder" xml:space="preserve">
     523    <value>0</value>
    406524  </data>
    407525  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     
    412530  </data>
    413531  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
    414     <value>604, 229</value>
     532    <value>604, 327</value>
    415533  </data>
    416534  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
  • extensions/Picasa2Piwigo/Picasa2Piwigo/Picasa2Piwigo.csproj

    r26935 r30536  
    127127    <EmbeddedResource Include="StatusForm.resx">
    128128      <DependentUpon>StatusForm.cs</DependentUpon>
     129      <SubType>Designer</SubType>
    129130    </EmbeddedResource>
    130131    <EmbeddedResource Include="Language\WinFormStrings.ru.resx" />
  • extensions/Picasa2Piwigo/Picasa2Piwigo/StatusForm.cs

    r26935 r30536  
    7777            {
    7878                case constants.COMMAND_START_UP:
    79                     WriteLog("Start up");
     79                    logit.WriteLog("Start up");
    8080
    8181                    //1.  Reading Picasa contacts
     
    9191                    }
    9292
     93                    logit.WriteLog("Read picasa contacts");   
    9394                    //2.  Validate that server can be reached                   
    9495                    SetStatus(WinFormStrings.CheckServerConnStrRes);
     
    104105
    105106                    //3.  Login                   
     107                    logit.WriteLog("logging in");   
    106108                    SetStatus(WinFormStrings.LogInStrRes);
    107109                    step_passed = UpdateStatus(SyncPiwigoLogIn());
     
    117119                    //4.  Get Piwigo Version
    118120                    PiwigoVersionNumber = "";
     121                    logit.WriteLog("getting version number from piwigo");   
    119122                    SetStatus(WinFormStrings.GetPiwigoVersionStrRes);
    120123                    step_passed = UpdateStatus(SyncPiwigoGetVersion(ref PiwigoVersionNumber));
     
    126129
    127130                    //5.  Get list of albums
     131                    logit.WriteLog("getting list of albums from piwigo");   
    128132                    SetStatus(WinFormStrings.RetrieveAlbumListStRes);
    129133                    step_passed = UpdateStatus(SyncPiwigoGetAlbums(ref AlbumList));
     
    140144
    141145                case constants.COMMAND_ADD_TO_ALBUM:
    142                     WriteLog("Add to Album");
     146                    logit.WriteLog("Add to Album");
    143147
    144148                    //1.  Validate that server can be reached
     
    182186
    183187                case constants.COMMAND_NEW_ALBUM:
    184                     WriteLog("New Album");
     188                    logit.WriteLog("New Album");
    185189
    186190                    //1.  Validate that server can be reached
     
    482486                0x70, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x6D, 0x77, 0x67, 0x2D, 0x72, 0x73, 0x3A,
    483487                0x4E, 0x61, 0x6D, 0x65, 0x3D, 0x22 };
    484             int temp1, temp2, k, i, m;
     488            int temp1, temp2, k, l, i, m, LengthToConvert;
    485489            UInt16 signature, exif_length;
    486490            string name_from_photo, tempstr;
    487             byte[] temp_array = new byte[1];
     491            byte[] temp_array = new byte[4];
    488492
    489493            try
     
    517521                        {
    518522                            name_from_photo = "";
    519                             do
     523                            //found a name
     524                            if (k >= exif_length - 5)
    520525                            {
    521                                 //found a name
    522                                 temp_array[0] = filedata[k];
    523                                 tempstr = Encoding.Default.GetString(temp_array);
    524                                 if (tempstr != "\"")
     526                                //just in case we're trying to read beyond end of filedata
     527                                //probably will never happen
     528                                logit.WriteLog("Read to end of xml");
     529                                break;
     530                            }
     531                            temp_array[0] = filedata[k];
     532                            temp_array[1] = filedata[k + 1];
     533                            temp_array[2] = filedata[k + 2];
     534                            temp_array[3] = filedata[k + 3];
     535                            //tempstr = Encoding.UTF8.GetString(filedata);
     536                            if (exif_length - k > 1024)
     537                            {
     538                                LengthToConvert = 1024;
     539                            }
     540                            else
     541                            {
     542                                LengthToConvert = exif_length - k;
     543                            }
     544                            if (LengthToConvert < 3)
     545                            {
     546                                logit.WriteLog("Too close to end of xml");
     547                                break;
     548                            }
     549                            tempstr = Encoding.UTF8.GetString(filedata, k, LengthToConvert);
     550                            l = tempstr.IndexOf("\"");
     551                            if (l != -1)
     552                            {
     553                                tempstr = tempstr.Substring(0, l);
     554                                k += tempstr.Length;
     555                                name_from_photo = tempstr;
     556
     557                                if (name_from_photo.Substring(0, 1) == "0")
    525558                                {
    526                                     name_from_photo += tempstr;
     559                                    name_from_photo = name_from_photo.Substring(1);
    527560                                }
    528                                 else
     561                                //have name, search for it in array
     562                                for (i = 0; i < person_count; i++)
    529563                                {
    530                                     if (name_from_photo.Substring(0, 1) == "0")
     564                                    if (name_from_photo == contact_array[i].name)
    531565                                    {
    532                                         name_from_photo = name_from_photo.Substring(1);
     566                                        found_contact_in_photo_array[i] = true;
     567                                        break;
    533568                                    }
    534                                     //have name, search for it in array
    535                                     for (i = 0; i < person_count; i++)
    536                                     {
    537                                         if (name_from_photo == contact_array[i].name)
    538                                         {
    539                                             found_contact_in_photo_array[i] = true;
    540                                             break;
    541                                         }
    542                                     }
    543                                     break;
    544569                                }
    545                                 k++;
    546                             } while (tempstr != "\"");
     570                            }
     571                            else
     572                            {
     573                                //couldn't find end of name, abort
     574                                logit.WriteLog("couldn't find end of name: " + tempstr);
     575                                break;
     576                            }
    547577                        }
    548578                        k++;
     
    603633            string filepath, inidata, photofilename, photo_file_name, ini_unique_id;
    604634            string face_tag_list;
    605             bool[] found_contact_in_photo_array = new bool[256];
     635            bool[] found_contact_in_photo_array = new bool[Picasa2PiwigoConstants.constants.MAX_NUMBER_OF_CONTACTS];
    606636            bool found_photo;
    607637            bool finished_faces, found_person;
     
    616646
    617647            //if it's a video file then skip it
    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)
     648            if (!CheckFileNameExtension(photofilename.ToLower()))
    625649            {
    626650                return face_tag_list;
     
    636660            {
    637661                if (found_contact_in_photo_array[k])
    638                 {                   
     662                {
    639663                    face_tag_list += RemoveCommaFromContract(GlobalClass.contact_array[k].name) + ",";
    640664                }
     
    644668            if (File.Exists(filepath + "\\.picasa.ini"))
    645669            {
     670                logit.WriteLog("picasa.ini file exists");
    646671                try
    647672                {
     
    659684            else if (File.Exists(filepath + "\\Picasa.ini"))
    660685            {
     686                logit.WriteLog("Picasa.ini file exists");
    661687                try
    662688                {
     
    678704            {
    679705                while ((inidata = inifile.ReadLine()) != null)
    680                 {
     706                {                   
    681707                    if (inidata.Length > 4)
    682708                    {
     
    684710                        {
    685711                            found_photo = false;
    686                             k = inidata.IndexOf("]");
     712                            k = inidata.IndexOf("]");                           
    687713                            if (k != -1)
    688714                            {
     
    694720                            }
    695721
    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)
     722                            if (CheckFileNameExtension(photo_file_name.ToLower()))
    703723                            {
    704724                                found_photo = true;
     
    746766                                            {
    747767                                                face_tag_list += GlobalClass.contact_array[l].name + ",";
     768                                                logit.WriteLog("face_tag_list:  " + face_tag_list);
    748769                                            }
    749770                                        }
     
    763784            if (face_tag_list.Length > 1)
    764785            {
     786                logit.WriteLog("end face_tag_list:  " + face_tag_list);
    765787                face_tag_list = face_tag_list.Substring(0, face_tag_list.Length - 1);
    766788            }
     
    820842                        GlobalClass.picasa_unique_id_arrary[GlobalClass.unique_id_count].index = GlobalClass.person_count;
    821843                        GlobalClass.person_count++;
     844                        if (GlobalClass.person_count >= constants.MAX_NUMBER_OF_CONTACTS)
     845                        {
     846                            GlobalClass.StatusDialogErrorMessage = WinFormStrings.TooManyPeopleTags;
     847                            return false;   
     848                        }
    822849                    }
    823850                    else
     
    837864
    838865            WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.getStatus";
    839             WriteLog(WebRequest);
     866            logit.WriteLog(WebRequest);
    840867
    841868            WebResponse = SendWebGet(WebRequest);
    842             WriteLog(WebResponse);
     869            logit.WriteLog(WebResponse);
    843870
    844871            if (WebResponse.IndexOf("An error occurred:") != -1)
     
    865892            WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.login";           
    866893            PostData = "username=" + FormSettings.Default.PiwigoUserName + "&password=" + FormSettings.Default.PiwigoPassword;
    867             WriteLog(WebRequest);
    868             WriteLog(PostData);
     894            logit.WriteLog(WebRequest);
     895            logit.WriteLog("username=" + FormSettings.Default.PiwigoUserName + "&password=" + "*****");
    869896            response = SendWebPost(WebRequest, PostData, "application/x-www-form-urlencoded");           
    870897            if (!response)
    871898            {
    872                 WriteLog("Log In Post Fail.");
     899                logit.WriteLog("Log In Post Fail.");
    873900                return false;
    874901            }
    875902            WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.getStatus";
    876             WriteLog(WebRequest);
     903            logit.WriteLog(WebRequest);
    877904            WebResponse = SendWebGet(WebRequest);
    878             WriteLog(WebResponse);
     905            logit.WriteLog(WebResponse);
    879906            if (WebResponse.IndexOf("An error occurred:") != -1)
    880907            {
     
    896923
    897924            WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.getVersion";
    898             WriteLog(WebRequest);
     925            logit.WriteLog(WebRequest);
    899926
    900927            WebResponse = SendWebGet(WebRequest);
    901             WriteLog(WebResponse);
     928            logit.WriteLog(WebResponse);
    902929
    903930            PiwigoVersionNumber = "";
     
    935962            }
    936963
    937             WriteLog(WebRequest);
     964            logit.WriteLog(WebRequest);
    938965
    939966            WebResponse = SendWebGet(WebRequest);
    940             WriteLog(WebResponse);
     967            logit.WriteLog(WebResponse);
    941968
    942969            if (WebResponse.IndexOf("An error occurred:") != -1)
     
    959986
    960987            WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.tags.getList";
    961             WriteLog(WebRequest);
     988            logit.WriteLog(WebRequest);
    962989
    963990            WebResponse = SendWebGet(WebRequest);
    964             WriteLog(WebResponse);
     991            logit.WriteLog(WebResponse);
    965992
    966993            if (WebResponse.IndexOf("An error occurred:") != -1)
     
    10041031            }
    10051032
    1006             WriteLog(WebRequest);
     1033            logit.WriteLog(WebRequest);
    10071034
    10081035            WebResponse = SendWebGet(WebRequest);
    1009             WriteLog(WebResponse);
     1036            logit.WriteLog(WebResponse);
    10101037
    10111038            if (WebResponse.IndexOf("An error occurred:") != -1)
     
    10301057            string [] file_to_send = {local_command_line_args[0]};
    10311058            string[,] post_array = new string[10,2];
    1032             string image_id;
     1059            string image_id, filtered_xml;
    10331060            bool upload_failed, response;
    10341061            string face_tag_list, tag_list, comment_list, all_tags;
     
    10441071                SetStatus(WinFormStrings.UploadingPHotoStrRes + " " + (i + 1).ToString() + " " + WinFormStrings.ofStrREf + " " + local_command_line_args.Length.ToString() + "...");
    10451072
    1046                 face_tag_list = SyncPiwigoGetFaceTags(local_command_line_args[i]);
    1047 
    1048                 tag_list = "";
    1049                 comment_list = "";
    1050                 all_tags = "";
    1051                 SyncPiwigoGetTagsandComments(ref tag_list, ref comment_list, local_command_line_args[i]);
    1052 
    1053                 if (face_tag_list.Length != 0)
    1054                 {
    1055                     all_tags = face_tag_list;
    1056                 }
    1057                 if (tag_list.Length != 0)
    1058                 {
    1059                     if (all_tags.Length != 0)
    1060                     {
    1061                         all_tags += ",";
    1062                     }
    1063                     all_tags += tag_list;
    1064                 }
    1065 
    10661073                k = local_command_line_args[i].LastIndexOf("\\");
    10671074                filename = local_command_line_args[i].Substring(k + 1);
    1068                 PhotoFileContents = FileToByteArray(local_command_line_args[i]);
    1069 
    1070                 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.images.addSimple";
    1071 
    1072                 WebResponse = "";
    1073                 local_command_line_args[i] = local_command_line_args[i].Replace("\\","\\\\");
    1074                 post_array[0, 0] = "name=\"category\"";
    1075                 post_array[0, 1] = NewPiwigoAlbumId.ToString();
    1076                 post_array[1, 0] = "name=\"name\"" ;
    1077                 post_array[1, 1] = filename;
    1078                 k = 2;
    1079                 if (all_tags.Length != 0)
    1080                 {                   
    1081                     post_array[k, 0] = "name=\"tags\"";
    1082                     post_array[k, 1] = all_tags;
    1083                     k++;
    1084                 }
    1085                 if (comment_list.Length != 0)
    1086                 {
    1087                     post_array[k, 0] = "name=\"comment\"";
    1088                     post_array[k, 1] = "\"" + comment_list + "\"";
    1089                     k++;
    1090                 }
    1091                 post_array[k, 0] = "name=\"image\"" + ";filename=" + "\"" + local_command_line_args[i] + "\"";
    1092 
    1093                 WriteLog(WebRequest);
    1094                 for (di = 0; di < k; di++)
    1095                 {
    1096                     WriteLog(post_array[k, 0] + post_array[k, 1]);                   
    1097                 }
    1098                
    1099 
    1100                 response = SendWebPostMultipart(WebRequest, post_array, "multipart/form-data", PhotoFileContents,
    1101                     ref WebResponse);
    1102 
    1103                 WriteLog(WebResponse);
    1104 
    1105                 if (!response)
    1106                 {
    1107                     return false;
    1108                 }
    1109                 xmlResponse = XmlGetAttribute(FilterForXML(WebResponse), "stat");
    1110                 if (xmlResponse == "ok")
    1111                 {
    1112                     image_id = XmlGetElement(FilterForXML(WebResponse), "image_id");
    1113                 }
    1114                 else
    1115                 {
    1116                     upload_failed = true;
    1117                 }               
     1075                if (CheckFileNameExtension(filename.ToLower()))
     1076                {
     1077                    face_tag_list = SyncPiwigoGetFaceTags(local_command_line_args[i]);
     1078
     1079                    tag_list = "";
     1080                    comment_list = "";
     1081                    all_tags = "";
     1082                    SyncPiwigoGetTagsandComments(ref tag_list, ref comment_list, local_command_line_args[i]);
     1083
     1084                    if (face_tag_list.Length != 0)
     1085                    {
     1086                        all_tags = face_tag_list;
     1087                    }
     1088                    if (tag_list.Length != 0)
     1089                    {
     1090                        if (all_tags.Length != 0)
     1091                        {
     1092                            all_tags += ",";
     1093                        }
     1094                        all_tags += tag_list;
     1095                    }
     1096
     1097                    k = local_command_line_args[i].LastIndexOf("\\");
     1098                    filename = local_command_line_args[i].Substring(k + 1);
     1099                    PhotoFileContents = FileToByteArray(local_command_line_args[i]);
     1100
     1101                    WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.images.addSimple";
     1102
     1103                    WebResponse = "";
     1104                    local_command_line_args[i] = local_command_line_args[i].Replace("\\", "\\\\");
     1105                    post_array[0, 0] = "name=\"category\"";
     1106                    post_array[0, 1] = NewPiwigoAlbumId.ToString();
     1107                    post_array[1, 0] = "name=\"name\"";
     1108                    post_array[1, 1] = filename;
     1109                    k = 2;
     1110                    if (all_tags.Length != 0)
     1111                    {
     1112                        post_array[k, 0] = "name=\"tags\"";
     1113                        post_array[k, 1] = all_tags;
     1114                        k++;
     1115                    }
     1116                    if (comment_list.Length != 0)
     1117                    {
     1118                        post_array[k, 0] = "name=\"comment\"";
     1119                        post_array[k, 1] = "\"" + comment_list + "\"";
     1120                        k++;
     1121                    }
     1122                    post_array[k, 0] = "name=\"image\"" + ";filename=" + "\"" + local_command_line_args[i] + "\"";
     1123
     1124                    logit.WriteLog(WebRequest);
     1125                    for (di = 0; di < k; di++)
     1126                    {
     1127                        logit.WriteLog(post_array[di, 0] + " " + post_array[di, 1]);
     1128                    }
     1129
     1130
     1131                    response = SendWebPostMultipart(WebRequest, post_array, "multipart/form-data", PhotoFileContents,
     1132                        ref WebResponse);
     1133
     1134                    logit.WriteLog(WebResponse);
     1135
     1136                    GlobalClass.StatusDialogErrorMessage = WinFormStrings.UploadUnableToUploadStrRes;                   
     1137
     1138                    if (!response)
     1139                    {
     1140                        return false;
     1141                    }
     1142
     1143                    filtered_xml = FilterForXML(WebResponse);
     1144                    if (filtered_xml.Length == 0)
     1145                    {                       
     1146                        logit.WriteLog("No xml response after upload.");
     1147                        return false;
     1148                    }
     1149
     1150                    xmlResponse = XmlGetAttribute(filtered_xml, "stat");
     1151                    if (xmlResponse == "ok")
     1152                    {
     1153                        image_id = XmlGetElement(FilterForXML(WebResponse), "image_id");
     1154                    }
     1155                    else
     1156                    {
     1157                        upload_failed = true;
     1158                    }
     1159                }
    11181160            }
    11191161            return !upload_failed;
     
    11261168            try
    11271169            {
     1170                ServicePointManager.Expect100Continue = false;
    11281171                ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    11291172                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
     
    11331176                request.Timeout = 60000;
    11341177                request.Credentials = CredentialCache.DefaultCredentials;
     1178                request.Referer = "user-agent";
     1179                request.UserAgent = "Mozilla/5.0";
    11351180                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    11361181
     
    11541199            {
    11551200                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(webrequest);
     1201                ServicePointManager.Expect100Continue = false;
    11561202                ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    11571203                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
     
    11611207                request.Method = "POST";
    11621208                request.Credentials = CredentialCache.DefaultCredentials;
     1209                request.Referer = "user-agent";
     1210                request.UserAgent = "Mozilla/5.0";
    11631211
    11641212                // Create POST data and convert it to a byte array.
     
    12171265        {
    12181266            XmlDocument StatusResponse = new XmlDocument();
    1219             StatusResponse.LoadXml(xmlstring);
    1220             XmlNodeList nodelist = StatusResponse.GetElementsByTagName(element);
    1221             foreach (XmlNode anode in nodelist)
    1222             {
    1223                 return anode.ChildNodes[0].Value;
     1267
     1268            if (xmlstring.Length != 0)
     1269            {
     1270                StatusResponse.LoadXml(xmlstring);
     1271                XmlNodeList nodelist = StatusResponse.GetElementsByTagName(element);
     1272                foreach (XmlNode anode in nodelist)
     1273                {
     1274                    return anode.ChildNodes[0].Value;
     1275                }
    12241276            }
    12251277            return "";
     
    12841336        {
    12851337            int i;
     1338            ServicePointManager.Expect100Continue = false;
    12861339            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    12871340            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
     
    12981351            request.Credentials = CredentialCache.DefaultCredentials;
    12991352            request.KeepAlive = true;
     1353            request.Referer = "user-agent";
     1354            request.UserAgent = "Mozilla/5.0";
    13001355
    13011356            try
     
    14201475            return true;
    14211476        }
     1477        public bool CheckFileNameExtension(string photofilename)
     1478        {
     1479            if (photofilename.IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) == -1 &&
     1480                  photofilename.IndexOf(".jpeg", StringComparison.OrdinalIgnoreCase) == -1 &&
     1481                  photofilename.IndexOf(".gif", StringComparison.OrdinalIgnoreCase) == -1 &&
     1482                  photofilename.IndexOf(".png", StringComparison.OrdinalIgnoreCase) == -1 &&
     1483                  photofilename.IndexOf(".tga", StringComparison.OrdinalIgnoreCase) == -1 &&
     1484                  photofilename.IndexOf(".tif", StringComparison.OrdinalIgnoreCase) == -1 &&
     1485                  photofilename.IndexOf(".tiff", StringComparison.OrdinalIgnoreCase) == -1 &&
     1486                  photofilename.IndexOf(".psd", StringComparison.OrdinalIgnoreCase) == -1)
     1487            {
     1488                return false;
     1489            }
     1490            return true;
     1491        }
    14221492        public string FilterForXML(string input_xml)
    14231493        {
     
    14331503            else
    14341504            {
    1435                 WriteLog("No xml found in string");
     1505                logit.WriteLog("No xml found in string");
    14361506            }
    14371507            return xml_only_str;
    1438         }
    1439         public void WriteLog(string logMessage)
    1440         {
    1441             string strLogFile;
    1442 
    1443             strLogFile = "c:\\temp\\picasa2piwigo_log.txt";
    1444 #pragma warning disable 0162
    1445             if (constants.DEBUG_LOG_ENABLED)           
    1446             {             
    1447                 try
    1448                 {
    1449 #pragma warning restore 0162
    1450                     StreamWriter swLog;
    1451 
    1452                     logMessage = string.Format("{0}: {1}", DateTime.Now, logMessage);
    1453 
    1454                     if (!File.Exists(strLogFile))
    1455                     {
    1456                         swLog = new StreamWriter(strLogFile);
    1457                     }
    1458                     else
    1459                     {
    1460                         swLog = File.AppendText(strLogFile);
    1461                     }
    1462 
    1463                     swLog.WriteLine(logMessage);
    1464                     swLog.WriteLine();
    1465 
    1466                     swLog.Close();
    1467 
    1468                 }
    1469                 catch
    1470                 {
    1471                 }
    1472             }
    14731508        }
    14741509    }
  • extensions/Picasa2Piwigo/Picasa2Piwigo/WinFormStrings.Designer.cs

    r26939 r30536  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.2012
     4//     Runtime Version:4.0.30319.34209
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    170170       
    171171        /// <summary>
     172        ///   Looks up a localized string similar to Log path is not set.  Please set the log path by clicking the option button..
     173        /// </summary>
     174        internal static string LogPathErrStrRes {
     175            get {
     176                return ResourceManager.GetString("LogPathErrStrRes", resourceCulture);
     177            }
     178        }
     179       
     180        /// <summary>
    172181        ///   Looks up a localized string similar to Add To Album.
    173182        /// </summary>
     
    269278       
    270279        /// <summary>
    271         ///   Looks up a localized string similar to Picasa2Piwigo - Version 1.3 - KenL.
     280        ///   Looks up a localized string similar to Picasa2Piwigo - Version 1.4 - KenL.
    272281        /// </summary>
    273282        internal static string MFVersionStrRes {
     
    431440       
    432441        /// <summary>
     442        ///   Looks up a localized string similar to The path to the Picasa contacts file has not been set.  You will be able to upload files to Piwigo, but they will not contain people tags.  Click on the options button to set the Picasa contacts file..
     443        /// </summary>
     444        internal static string SetUpContactsStrRes {
     445            get {
     446                return ResourceManager.GetString("SetUpContactsStrRes", resourceCulture);
     447            }
     448        }
     449       
     450        /// <summary>
    433451        ///   Looks up a localized string similar to Stop.
    434452        /// </summary>
     
    467485       
    468486        /// <summary>
     487        ///   Looks up a localized string similar to Error:  Too many people tags in Picasa.
     488        /// </summary>
     489        internal static string TooManyPeopleTags {
     490            get {
     491                return ResourceManager.GetString("TooManyPeopleTags", resourceCulture);
     492            }
     493        }
     494       
     495        /// <summary>
    469496        ///   Looks up a localized string similar to Error:  Unable to contact Piwigo Server..
    470497        /// </summary>
     
    544571            get {
    545572                return ResourceManager.GetString("UploadPhotosStrRes", resourceCulture);
     573            }
     574        }
     575       
     576        /// <summary>
     577        ///   Looks up a localized string similar to Error:  Unable to upload photo.  Photo may be larger than web server allows..
     578        /// </summary>
     579        internal static string UploadUnableToUploadStrRes {
     580            get {
     581                return ResourceManager.GetString("UploadUnableToUploadStrRes", resourceCulture);
    546582            }
    547583        }
  • extensions/Picasa2Piwigo/Picasa2Piwigo/WinFormStrings.resx

    r26939 r30536  
    202202  </data>
    203203  <data name="MFVersionStrRes" xml:space="preserve">
    204     <value>Picasa2Piwigo - Version 1.3 - KenL</value>
     204    <value>Picasa2Piwigo - Version 1.4 - KenL</value>
    205205    <comment>Picasa2Piwigo - Version 1.1 - KenL</comment>
    206206  </data>
     
    333333    <comment>Error:  Unable to retrieve version number.</comment>
    334334  </data>
     335  <data name="SetUpContactsStrRes" xml:space="preserve">
     336    <value>The path to the Picasa contacts file has not been set.  You will be able to upload files to Piwigo, but they will not contain people tags.  Click on the options button to set the Picasa contacts file.</value>
     337    <comment>The path to the Picasa contacts file has not been set.  You will be able to upload files to Piwigo, but they will not contain people tags.  Click on the options button to set the Picasa contacts file.</comment>
     338  </data>
     339  <data name="TooManyPeopleTags" xml:space="preserve">
     340    <value>Error:  Too many people tags in Picasa</value>
     341    <comment>Error:  Too many people tags in Picasa</comment>
     342  </data>
     343  <data name="LogPathErrStrRes" xml:space="preserve">
     344    <value>Log path is not set.  Please set the log path by clicking the option button.</value>
     345    <comment>Log path is not set.  Please set the log path by clicking the option button.</comment>
     346  </data>
     347  <data name="UploadUnableToUploadStrRes" xml:space="preserve">
     348    <value>Error:  Unable to upload photo.  Photo may be larger than web server allows.</value>
     349    <comment>Error:  Unable to upload photo.  Photo may be larger than web server allows.</comment>
     350  </data>
    335351</root>
  • extensions/Picasa2Piwigo/Picasa2Piwigo/app.config

    r21241 r30536  
    3939                <value />
    4040            </setting>
     41            <setting name="DebugFileLocation" serializeAs="String">
     42                <value />
     43            </setting>
     44            <setting name="DebugEnabled" serializeAs="String">
     45                <value>False</value>
     46            </setting>
    4147        </Picasa2Piwigo.FormSettings>
    4248        <Picasa2Piwigo.Settings1>
Note: See TracChangeset for help on using the changeset viewer.