Changeset 30536
- Timestamp:
- Nov 19, 2014, 4:33:20 PM (9 years ago)
- Location:
- extensions/Picasa2Piwigo/Picasa2Piwigo
- Files:
-
- 4 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Picasa2Piwigo/Picasa2Piwigo/FormSettings.Designer.cs
r26935 r30536 83 83 } 84 84 } 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 } 85 109 } 86 110 } -
extensions/Picasa2Piwigo/Picasa2Piwigo/FormSettings.settings
r21241 r30536 18 18 <Value Profile="(Default)" /> 19 19 </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> 20 26 </Settings> 21 27 </SettingsFile> -
extensions/Picasa2Piwigo/Picasa2Piwigo/GlobalClass.cs
r21241 r30536 7 7 using System.Windows.Forms; 8 8 using System.Drawing; 9 using System.IO; 10 using Picasa2PiwigoConstants; 9 11 10 12 namespace Picasa2PiwigoCommonFunctions 11 13 { 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 } 12 54 public class LabelAdjust 13 55 { … … 46 88 public const bool DEBUG_LOCALE = false; 47 89 public const string SET_LOCALE = "es"; 48 public const bool DEBUG_LOG_ENABLED = false;90 public const bool DEBUG_LOG_ENABLED = true; 49 91 50 92 public const int COMMAND_START_UP = 1; … … 53 95 54 96 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; 56 98 public struct PersonIDStruct 57 99 { -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.da.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Version 1, 3- KenL</value>204 <value>Picasa2Piwigo - Version 1,4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.de.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Version 1. 3- KenL</value>204 <value>Picasa2Piwigo - Version 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.fr.resx
r26936 r30536 221 221 </data> 222 222 <data name="MFVersionStrRes" xml:space="preserve"> 223 <value>Picasa2Piwigo - Version 1. 3- KenL</value>223 <value>Picasa2Piwigo - Version 1.4 - KenL</value> 224 224 </data> 225 225 <data name="OFCancelButtonStrRes" xml:space="preserve"> … … 287 287 <comment>Error: Unable to retrieve version number.</comment> 288 288 </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> 289 301 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.hu.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - 1. 3verzió - KenL</value>204 <value>Picasa2Piwigo - 1.4 verzió - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.it.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Versione 1. 3- KenL</value>204 <value>Picasa2Piwigo - Versione 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.nl.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Versie 1. 3- KenL</value>204 <value>Picasa2Piwigo - Versie 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.pl.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Wersja 1. 3- KENL</value>204 <value>Picasa2Piwigo - Wersja 1.4 - KENL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.ru.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Версия 1. 3- KenL</value>204 <value>Picasa2Piwigo - Версия 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.tr.resx
r26936 r30536 202 202 </data> 203 203 <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> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/WinFormStrings.zh.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - 1. 3版 - KenL</value>204 <value>Picasa2Piwigo - 1.4版 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/Language/winFormStrings.es.resx
r26936 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Versión 1. 3- KenL</value>204 <value>Picasa2Piwigo - Versión 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 347 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/MainForm.cs
r21241 r30536 51 51 { 52 52 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 54 62 this.AddToAlbumGroupbox.Text = WinFormStrings.MFAddToAlbumGroupboxStrRes; 55 63 this.AddTopAlbumCheckbox.Text = WinFormStrings.MFAddTopAlbumCheckboxStrRes; … … 81 89 this.Refresh(); 82 90 91 logit.WriteLog("Program Start up"); 92 83 93 //if no arguments then exit 84 94 if (command_line_args.Length == 0) … … 99 109 } 100 110 111 logit.WriteLog("Reading command line arguments. Length: " + command_length.ToString()); 101 112 AccessComboBox.SelectedIndex = Form1Settings.Default.AccessSetting; 102 113 this.SyncButton.Enabled = true; … … 107 118 DescriptionTextBox.Text = DetermineAlbumDescription(command_line_args[0]); 108 119 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."); 112 123 MessageBox.Show(WinFormStrings.SetUpConnStrRes, "Picasa2Piwigo"); 124 this.SyncButton.Enabled = false; 113 125 return; 114 126 } 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."); 116 141 //ok to try to login etc 117 142 LoginBuildAlbumList(); 118 143 144 logit.WriteLog("Populating album list box."); 119 145 //populate album listbox 120 146 PopulateAlbumListBox(); … … 154 180 result = StatusForm.ShowDialog(); 155 181 StatusForm.Close(); 182 183 //bring window to front 184 this.WindowState = FormWindowState.Minimized; 185 this.Show(); 186 this.WindowState = FormWindowState.Normal; 187 156 188 if (result == DialogResult.No) 157 189 { … … 177 209 result = StatusForm.ShowDialog(); 178 210 StatusForm.Close(); 211 212 //bring window to front 213 this.WindowState = FormWindowState.Minimized; 214 this.Show(); 215 this.WindowState = FormWindowState.Normal; 216 179 217 if (result == DialogResult.No) 180 218 { … … 200 238 if (option_form_result == DialogResult.OK) 201 239 { 240 if (FormSettings.Default.DebugEnabled) 241 { 242 if (FormSettings.Default.DebugFileLocation.Length < 4) 243 { 244 MessageBox.Show(WinFormStrings.LogPathErrStrRes, "Picasa2Piwigo"); 245 } 246 } 247 202 248 if (FormSettings.Default.PiwigoUrlSetting.Length != 0 && 203 249 FormSettings.Default.PicasaContactsLocation.Length != 0) … … 239 285 MessageBox.Show(GlobalClass.StatusDialogErrorMessage, WinFormStrings.Picasa2PiwigoErrStrRes, 240 286 MessageBoxButtons.OK, MessageBoxIcon.Error); 287 this.SyncButton.Enabled = false; 241 288 } 242 289 AlbumList = GlobalClass.AlbumList; -
extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.Designer.cs
r21241 r30536 41 41 this.PicasaContactsFileTextBox = new System.Windows.Forms.TextBox(); 42 42 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(); 43 47 this.SuspendLayout(); 44 48 // … … 112 116 this.SetContactPathBtn.Click += new System.EventHandler(this.SetContactPathBtn_Click); 113 117 // 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 // 114 144 // OptionsForm 115 145 // 116 146 resources.ApplyResources(this, "$this"); 117 147 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 148 this.Controls.Add(this.LogEnabled); 149 this.Controls.Add(this.label4); 118 150 this.Controls.Add(this.label8); 151 this.Controls.Add(this.DebugtextBox); 119 152 this.Controls.Add(this.PicasaContactsFileTextBox); 153 this.Controls.Add(this.button1); 120 154 this.Controls.Add(this.SetContactPathBtn); 121 155 this.Controls.Add(this.ACancelButton); … … 147 181 private System.Windows.Forms.TextBox PicasaContactsFileTextBox; 148 182 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; 149 187 } 150 188 } -
extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.cs
r21241 r30536 45 45 PiwigoPasswordTextBox.Text = FormSettings.Default.PiwigoPassword; 46 46 PicasaContactsFileTextBox.Text = FormSettings.Default.PicasaContactsLocation; 47 DebugtextBox.Text = FormSettings.Default.DebugFileLocation; 48 LogEnabled.Checked = FormSettings.Default.DebugEnabled; 49 47 50 48 51 LabelAdjust AdjustLabelClass = new LabelAdjust(); … … 62 65 FormSettings.Default.PiwigoPassword = PiwigoPasswordTextBox.Text; 63 66 FormSettings.Default.PicasaContactsLocation = PicasaContactsFileTextBox.Text; 67 FormSettings.Default.DebugFileLocation = DebugtextBox.Text; 68 FormSettings.Default.DebugEnabled = LogEnabled.Checked; 64 69 FormSettings.Default.Save(); 65 70 this.DialogResult = DialogResult.OK; … … 82 87 } 83 88 } 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 } 84 100 } 85 101 } -
extensions/Picasa2Piwigo/Picasa2Piwigo/OptionForm.resx
r21241 r30536 142 142 </data> 143 143 <data name=">>PiwigoURLTextbox.ZOrder" xml:space="preserve"> 144 <value>1 0</value>144 <value>14</value> 145 145 </data> 146 146 <data name="label1.Font" type="System.Drawing.Font, System.Drawing"> … … 169 169 </data> 170 170 <data name=">>label1.ZOrder" xml:space="preserve"> 171 <value> 7</value>171 <value>11</value> 172 172 </data> 173 173 <data name="PiwigoUserNameTextBox.Font" type="System.Drawing.Font, System.Drawing"> … … 193 193 </data> 194 194 <data name=">>PiwigoUserNameTextBox.ZOrder" xml:space="preserve"> 195 <value> 9</value>195 <value>13</value> 196 196 </data> 197 197 <data name="label2.Font" type="System.Drawing.Font, System.Drawing"> … … 220 220 </data> 221 221 <data name=">>label2.ZOrder" xml:space="preserve"> 222 <value> 6</value>222 <value>10</value> 223 223 </data> 224 224 <data name="PiwigoPasswordTextBox.Font" type="System.Drawing.Font, System.Drawing"> … … 247 247 </data> 248 248 <data name=">>PiwigoPasswordTextBox.ZOrder" xml:space="preserve"> 249 <value> 8</value>249 <value>12</value> 250 250 </data> 251 251 <data name="label3.Font" type="System.Drawing.Font, System.Drawing"> … … 274 274 </data> 275 275 <data name=">>label3.ZOrder" xml:space="preserve"> 276 <value> 5</value>276 <value>9</value> 277 277 </data> 278 278 <data name="OKButton.Location" type="System.Drawing.Point, System.Drawing"> 279 <value>196, 176</value>279 <value>196, 269</value> 280 280 </data> 281 281 <data name="OKButton.Size" type="System.Drawing.Size, System.Drawing"> … … 298 298 </data> 299 299 <data name=">>OKButton.ZOrder" xml:space="preserve"> 300 <value> 4</value>300 <value>8</value> 301 301 </data> 302 302 <data name="ACancelButton.Location" type="System.Drawing.Point, System.Drawing"> 303 <value>334, 177</value>303 <value>334, 270</value> 304 304 </data> 305 305 <data name="ACancelButton.Size" type="System.Drawing.Size, System.Drawing"> … … 322 322 </data> 323 323 <data name=">>ACancelButton.ZOrder" xml:space="preserve"> 324 <value> 3</value>324 <value>7</value> 325 325 </data> 326 326 <data name="label8.Font" type="System.Drawing.Font, System.Drawing"> … … 349 349 </data> 350 350 <data name=">>label8.ZOrder" xml:space="preserve"> 351 <value> 0</value>351 <value>2</value> 352 352 </data> 353 353 <data name="PicasaContactsFileTextBox.Enabled" type="System.Boolean, mscorlib"> … … 376 376 </data> 377 377 <data name=">>PicasaContactsFileTextBox.ZOrder" xml:space="preserve"> 378 <value> 1</value>378 <value>4</value> 379 379 </data> 380 380 <data name="SetContactPathBtn.Font" type="System.Drawing.Font, System.Drawing"> … … 403 403 </data> 404 404 <data name=">>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=">>button1.Name" xml:space="preserve"> 427 <value>button1</value> 428 </data> 429 <data name=">>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=">>button1.Parent" xml:space="preserve"> 433 <value>$this</value> 434 </data> 435 <data name=">>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=">>DebugtextBox.Name" xml:space="preserve"> 454 <value>DebugtextBox</value> 455 </data> 456 <data name=">>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=">>DebugtextBox.Parent" xml:space="preserve"> 460 <value>$this</value> 461 </data> 462 <data name=">>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=">>label4.Name" xml:space="preserve"> 484 <value>label4</value> 485 </data> 486 <data name=">>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=">>label4.Parent" xml:space="preserve"> 490 <value>$this</value> 491 </data> 492 <data name=">>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=">>LogEnabled.Name" xml:space="preserve"> 514 <value>LogEnabled</value> 515 </data> 516 <data name=">>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=">>LogEnabled.Parent" xml:space="preserve"> 520 <value>$this</value> 521 </data> 522 <data name=">>LogEnabled.ZOrder" xml:space="preserve"> 523 <value>0</value> 406 524 </data> 407 525 <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> … … 412 530 </data> 413 531 <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> 414 <value>604, 229</value>532 <value>604, 327</value> 415 533 </data> 416 534 <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 127 127 <EmbeddedResource Include="StatusForm.resx"> 128 128 <DependentUpon>StatusForm.cs</DependentUpon> 129 <SubType>Designer</SubType> 129 130 </EmbeddedResource> 130 131 <EmbeddedResource Include="Language\WinFormStrings.ru.resx" /> -
extensions/Picasa2Piwigo/Picasa2Piwigo/StatusForm.cs
r26935 r30536 77 77 { 78 78 case constants.COMMAND_START_UP: 79 WriteLog("Start up");79 logit.WriteLog("Start up"); 80 80 81 81 //1. Reading Picasa contacts … … 91 91 } 92 92 93 logit.WriteLog("Read picasa contacts"); 93 94 //2. Validate that server can be reached 94 95 SetStatus(WinFormStrings.CheckServerConnStrRes); … … 104 105 105 106 //3. Login 107 logit.WriteLog("logging in"); 106 108 SetStatus(WinFormStrings.LogInStrRes); 107 109 step_passed = UpdateStatus(SyncPiwigoLogIn()); … … 117 119 //4. Get Piwigo Version 118 120 PiwigoVersionNumber = ""; 121 logit.WriteLog("getting version number from piwigo"); 119 122 SetStatus(WinFormStrings.GetPiwigoVersionStrRes); 120 123 step_passed = UpdateStatus(SyncPiwigoGetVersion(ref PiwigoVersionNumber)); … … 126 129 127 130 //5. Get list of albums 131 logit.WriteLog("getting list of albums from piwigo"); 128 132 SetStatus(WinFormStrings.RetrieveAlbumListStRes); 129 133 step_passed = UpdateStatus(SyncPiwigoGetAlbums(ref AlbumList)); … … 140 144 141 145 case constants.COMMAND_ADD_TO_ALBUM: 142 WriteLog("Add to Album");146 logit.WriteLog("Add to Album"); 143 147 144 148 //1. Validate that server can be reached … … 182 186 183 187 case constants.COMMAND_NEW_ALBUM: 184 WriteLog("New Album");188 logit.WriteLog("New Album"); 185 189 186 190 //1. Validate that server can be reached … … 482 486 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x6D, 0x77, 0x67, 0x2D, 0x72, 0x73, 0x3A, 483 487 0x4E, 0x61, 0x6D, 0x65, 0x3D, 0x22 }; 484 int temp1, temp2, k, i, m;488 int temp1, temp2, k, l, i, m, LengthToConvert; 485 489 UInt16 signature, exif_length; 486 490 string name_from_photo, tempstr; 487 byte[] temp_array = new byte[ 1];491 byte[] temp_array = new byte[4]; 488 492 489 493 try … … 517 521 { 518 522 name_from_photo = ""; 519 do 523 //found a name 524 if (k >= exif_length - 5) 520 525 { 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") 525 558 { 526 name_from_photo += tempstr;559 name_from_photo = name_from_photo.Substring(1); 527 560 } 528 else 561 //have name, search for it in array 562 for (i = 0; i < person_count; i++) 529 563 { 530 if (name_from_photo .Substring(0, 1) == "0")564 if (name_from_photo == contact_array[i].name) 531 565 { 532 name_from_photo = name_from_photo.Substring(1); 566 found_contact_in_photo_array[i] = true; 567 break; 533 568 } 534 //have name, search for it in array535 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;544 569 } 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 } 547 577 } 548 578 k++; … … 603 633 string filepath, inidata, photofilename, photo_file_name, ini_unique_id; 604 634 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]; 606 636 bool found_photo; 607 637 bool finished_faces, found_person; … … 616 646 617 647 //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())) 625 649 { 626 650 return face_tag_list; … … 636 660 { 637 661 if (found_contact_in_photo_array[k]) 638 { 662 { 639 663 face_tag_list += RemoveCommaFromContract(GlobalClass.contact_array[k].name) + ","; 640 664 } … … 644 668 if (File.Exists(filepath + "\\.picasa.ini")) 645 669 { 670 logit.WriteLog("picasa.ini file exists"); 646 671 try 647 672 { … … 659 684 else if (File.Exists(filepath + "\\Picasa.ini")) 660 685 { 686 logit.WriteLog("Picasa.ini file exists"); 661 687 try 662 688 { … … 678 704 { 679 705 while ((inidata = inifile.ReadLine()) != null) 680 { 706 { 681 707 if (inidata.Length > 4) 682 708 { … … 684 710 { 685 711 found_photo = false; 686 k = inidata.IndexOf("]"); 712 k = inidata.IndexOf("]"); 687 713 if (k != -1) 688 714 { … … 694 720 } 695 721 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())) 703 723 { 704 724 found_photo = true; … … 746 766 { 747 767 face_tag_list += GlobalClass.contact_array[l].name + ","; 768 logit.WriteLog("face_tag_list: " + face_tag_list); 748 769 } 749 770 } … … 763 784 if (face_tag_list.Length > 1) 764 785 { 786 logit.WriteLog("end face_tag_list: " + face_tag_list); 765 787 face_tag_list = face_tag_list.Substring(0, face_tag_list.Length - 1); 766 788 } … … 820 842 GlobalClass.picasa_unique_id_arrary[GlobalClass.unique_id_count].index = GlobalClass.person_count; 821 843 GlobalClass.person_count++; 844 if (GlobalClass.person_count >= constants.MAX_NUMBER_OF_CONTACTS) 845 { 846 GlobalClass.StatusDialogErrorMessage = WinFormStrings.TooManyPeopleTags; 847 return false; 848 } 822 849 } 823 850 else … … 837 864 838 865 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.getStatus"; 839 WriteLog(WebRequest);866 logit.WriteLog(WebRequest); 840 867 841 868 WebResponse = SendWebGet(WebRequest); 842 WriteLog(WebResponse);869 logit.WriteLog(WebResponse); 843 870 844 871 if (WebResponse.IndexOf("An error occurred:") != -1) … … 865 892 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.login"; 866 893 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=" + "*****"); 869 896 response = SendWebPost(WebRequest, PostData, "application/x-www-form-urlencoded"); 870 897 if (!response) 871 898 { 872 WriteLog("Log In Post Fail.");899 logit.WriteLog("Log In Post Fail."); 873 900 return false; 874 901 } 875 902 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.session.getStatus"; 876 WriteLog(WebRequest);903 logit.WriteLog(WebRequest); 877 904 WebResponse = SendWebGet(WebRequest); 878 WriteLog(WebResponse);905 logit.WriteLog(WebResponse); 879 906 if (WebResponse.IndexOf("An error occurred:") != -1) 880 907 { … … 896 923 897 924 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.getVersion"; 898 WriteLog(WebRequest);925 logit.WriteLog(WebRequest); 899 926 900 927 WebResponse = SendWebGet(WebRequest); 901 WriteLog(WebResponse);928 logit.WriteLog(WebResponse); 902 929 903 930 PiwigoVersionNumber = ""; … … 935 962 } 936 963 937 WriteLog(WebRequest);964 logit.WriteLog(WebRequest); 938 965 939 966 WebResponse = SendWebGet(WebRequest); 940 WriteLog(WebResponse);967 logit.WriteLog(WebResponse); 941 968 942 969 if (WebResponse.IndexOf("An error occurred:") != -1) … … 959 986 960 987 WebRequest = FormSettings.Default.PiwigoUrlSetting + "/ws.php?method=pwg.tags.getList"; 961 WriteLog(WebRequest);988 logit.WriteLog(WebRequest); 962 989 963 990 WebResponse = SendWebGet(WebRequest); 964 WriteLog(WebResponse);991 logit.WriteLog(WebResponse); 965 992 966 993 if (WebResponse.IndexOf("An error occurred:") != -1) … … 1004 1031 } 1005 1032 1006 WriteLog(WebRequest);1033 logit.WriteLog(WebRequest); 1007 1034 1008 1035 WebResponse = SendWebGet(WebRequest); 1009 WriteLog(WebResponse);1036 logit.WriteLog(WebResponse); 1010 1037 1011 1038 if (WebResponse.IndexOf("An error occurred:") != -1) … … 1030 1057 string [] file_to_send = {local_command_line_args[0]}; 1031 1058 string[,] post_array = new string[10,2]; 1032 string image_id ;1059 string image_id, filtered_xml; 1033 1060 bool upload_failed, response; 1034 1061 string face_tag_list, tag_list, comment_list, all_tags; … … 1044 1071 SetStatus(WinFormStrings.UploadingPHotoStrRes + " " + (i + 1).ToString() + " " + WinFormStrings.ofStrREf + " " + local_command_line_args.Length.ToString() + "..."); 1045 1072 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 1066 1073 k = local_command_line_args[i].LastIndexOf("\\"); 1067 1074 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 } 1118 1160 } 1119 1161 return !upload_failed; … … 1126 1168 try 1127 1169 { 1170 ServicePointManager.Expect100Continue = false; 1128 1171 ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 1129 1172 ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; … … 1133 1176 request.Timeout = 60000; 1134 1177 request.Credentials = CredentialCache.DefaultCredentials; 1178 request.Referer = "user-agent"; 1179 request.UserAgent = "Mozilla/5.0"; 1135 1180 HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 1136 1181 … … 1154 1199 { 1155 1200 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(webrequest); 1201 ServicePointManager.Expect100Continue = false; 1156 1202 ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 1157 1203 ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; … … 1161 1207 request.Method = "POST"; 1162 1208 request.Credentials = CredentialCache.DefaultCredentials; 1209 request.Referer = "user-agent"; 1210 request.UserAgent = "Mozilla/5.0"; 1163 1211 1164 1212 // Create POST data and convert it to a byte array. … … 1217 1265 { 1218 1266 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 } 1224 1276 } 1225 1277 return ""; … … 1284 1336 { 1285 1337 int i; 1338 ServicePointManager.Expect100Continue = false; 1286 1339 ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; 1287 1340 ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; … … 1298 1351 request.Credentials = CredentialCache.DefaultCredentials; 1299 1352 request.KeepAlive = true; 1353 request.Referer = "user-agent"; 1354 request.UserAgent = "Mozilla/5.0"; 1300 1355 1301 1356 try … … 1420 1475 return true; 1421 1476 } 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 } 1422 1492 public string FilterForXML(string input_xml) 1423 1493 { … … 1433 1503 else 1434 1504 { 1435 WriteLog("No xml found in string");1505 logit.WriteLog("No xml found in string"); 1436 1506 } 1437 1507 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 01621445 if (constants.DEBUG_LOG_ENABLED)1446 {1447 try1448 {1449 #pragma warning restore 01621450 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 else1459 {1460 swLog = File.AppendText(strLogFile);1461 }1462 1463 swLog.WriteLine(logMessage);1464 swLog.WriteLine();1465 1466 swLog.Close();1467 1468 }1469 catch1470 {1471 }1472 }1473 1508 } 1474 1509 } -
extensions/Picasa2Piwigo/Picasa2Piwigo/WinFormStrings.Designer.cs
r26939 r30536 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 20124 // Runtime Version:4.0.30319.34209 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 170 170 171 171 /// <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> 172 181 /// Looks up a localized string similar to Add To Album. 173 182 /// </summary> … … 269 278 270 279 /// <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. 272 281 /// </summary> 273 282 internal static string MFVersionStrRes { … … 431 440 432 441 /// <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> 433 451 /// Looks up a localized string similar to Stop. 434 452 /// </summary> … … 467 485 468 486 /// <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> 469 496 /// Looks up a localized string similar to Error: Unable to contact Piwigo Server.. 470 497 /// </summary> … … 544 571 get { 545 572 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); 546 582 } 547 583 } -
extensions/Picasa2Piwigo/Picasa2Piwigo/WinFormStrings.resx
r26939 r30536 202 202 </data> 203 203 <data name="MFVersionStrRes" xml:space="preserve"> 204 <value>Picasa2Piwigo - Version 1. 3- KenL</value>204 <value>Picasa2Piwigo - Version 1.4 - KenL</value> 205 205 <comment>Picasa2Piwigo - Version 1.1 - KenL</comment> 206 206 </data> … … 333 333 <comment>Error: Unable to retrieve version number.</comment> 334 334 </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> 335 351 </root> -
extensions/Picasa2Piwigo/Picasa2Piwigo/app.config
r21241 r30536 39 39 <value /> 40 40 </setting> 41 <setting name="DebugFileLocation" serializeAs="String"> 42 <value /> 43 </setting> 44 <setting name="DebugEnabled" serializeAs="String"> 45 <value>False</value> 46 </setting> 41 47 </Picasa2Piwigo.FormSettings> 42 48 <Picasa2Piwigo.Settings1>
Note: See TracChangeset
for help on using the changeset viewer.