[21241] | 1 | using System; |
---|
| 2 | using System.Collections.Generic; |
---|
| 3 | using System.Linq; |
---|
| 4 | using System.Text; |
---|
| 5 | using System.Xml; |
---|
| 6 | using Picasa2Piwigo; |
---|
| 7 | using System.Windows.Forms; |
---|
| 8 | using System.Drawing; |
---|
[30536] | 9 | using System.IO; |
---|
| 10 | using Picasa2PiwigoConstants; |
---|
[21241] | 11 | |
---|
| 12 | namespace Picasa2PiwigoCommonFunctions |
---|
| 13 | { |
---|
[30536] | 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 | } |
---|
[21241] | 54 | public class LabelAdjust |
---|
| 55 | { |
---|
| 56 | public void AdjustLabelSize(Label labeltoadjust) |
---|
| 57 | { |
---|
| 58 | while (labeltoadjust.Width < System.Windows.Forms.TextRenderer.MeasureText(labeltoadjust.Text, |
---|
| 59 | new Font(labeltoadjust.Font.FontFamily, labeltoadjust.Font.Size, labeltoadjust.Font.Style)).Width) |
---|
| 60 | { |
---|
| 61 | labeltoadjust.Font = new Font(labeltoadjust.Font.FontFamily, labeltoadjust.Font.Size - 0.5f, labeltoadjust.Font.Style); |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | public void AdjustRadioButtonSize(RadioButton Radiotoadjust) |
---|
| 65 | { |
---|
| 66 | while (Radiotoadjust.Width < System.Windows.Forms.TextRenderer.MeasureText(Radiotoadjust.Text, |
---|
| 67 | new Font(Radiotoadjust.Font.FontFamily, Radiotoadjust.Font.Size, Radiotoadjust.Font.Style)).Width) |
---|
| 68 | { |
---|
| 69 | Radiotoadjust.Font = new Font(Radiotoadjust.Font.FontFamily, Radiotoadjust.Font.Size - 0.5f, Radiotoadjust.Font.Style); |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | public void AdjustButtonSize(Button ButtonToadjust) |
---|
| 73 | { |
---|
| 74 | while (ButtonToadjust.Width < System.Windows.Forms.TextRenderer.MeasureText(ButtonToadjust.Text, |
---|
| 75 | new Font(ButtonToadjust.Font.FontFamily, ButtonToadjust.Font.Size, ButtonToadjust.Font.Style)).Width) |
---|
| 76 | { |
---|
| 77 | ButtonToadjust.Font = new Font(ButtonToadjust.Font.FontFamily, ButtonToadjust.Font.Size - 0.5f, ButtonToadjust.Font.Style); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | namespace Picasa2PiwigoConstants |
---|
| 84 | { |
---|
| 85 | public class constants |
---|
| 86 | { |
---|
| 87 | //debug settings |
---|
| 88 | public const bool DEBUG_LOCALE = false; |
---|
| 89 | public const string SET_LOCALE = "es"; |
---|
[30536] | 90 | public const bool DEBUG_LOG_ENABLED = true; |
---|
[21241] | 91 | |
---|
| 92 | public const int COMMAND_START_UP = 1; |
---|
| 93 | public const int COMMAND_ADD_TO_ALBUM = 2; |
---|
| 94 | public const int COMMAND_NEW_ALBUM = 3; |
---|
| 95 | |
---|
| 96 | public const int MAX_DUPLICATE_FILENAMES = 10000; |
---|
[30536] | 97 | public const int MAX_NUMBER_OF_CONTACTS = 2000; |
---|
[21241] | 98 | public struct PersonIDStruct |
---|
| 99 | { |
---|
| 100 | public string name; |
---|
| 101 | public int index; |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | public struct UniqueIDStruct |
---|
| 105 | { |
---|
| 106 | public string unique_id; |
---|
| 107 | public int index; |
---|
| 108 | } |
---|
| 109 | } |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | namespace Picasa2Piwigo |
---|
| 113 | { |
---|
| 114 | using Picasa2PiwigoConstants; |
---|
| 115 | static class GlobalClass |
---|
| 116 | { |
---|
| 117 | private static constants.PersonIDStruct[] m_contact_array = new constants.PersonIDStruct[constants.MAX_NUMBER_OF_CONTACTS]; |
---|
| 118 | private static constants.UniqueIDStruct[] m_picasa_unique_id_arrary = new constants.UniqueIDStruct[constants.MAX_NUMBER_OF_CONTACTS]; |
---|
| 119 | private static XmlDocument m_AlbumList = new XmlDocument(); |
---|
| 120 | private static string m_NewAlbumName; |
---|
| 121 | private static int m_NewAlbumParentID; |
---|
| 122 | private static string m_StatusDialogErrorMessage; |
---|
| 123 | private static int m_AddAlbumCategoryID; |
---|
| 124 | private static int m_person_count; |
---|
| 125 | private static int m_unique_id_count; |
---|
| 126 | private static string m_PiwigoVersionNumber; |
---|
| 127 | private static string m_NewAlbumDescription; |
---|
| 128 | |
---|
| 129 | public static XmlDocument AlbumList |
---|
| 130 | { |
---|
| 131 | get { return m_AlbumList;} |
---|
| 132 | set {m_AlbumList = value;} |
---|
| 133 | } |
---|
| 134 | public static string NewAlbumName |
---|
| 135 | { |
---|
| 136 | get { return m_NewAlbumName; } |
---|
| 137 | set { m_NewAlbumName = value; } |
---|
| 138 | } |
---|
| 139 | public static int NewAlbumNameParentID |
---|
| 140 | { |
---|
| 141 | get { return m_NewAlbumParentID; } |
---|
| 142 | set { m_NewAlbumParentID = value; } |
---|
| 143 | } |
---|
| 144 | public static string StatusDialogErrorMessage |
---|
| 145 | { |
---|
| 146 | get { return m_StatusDialogErrorMessage; } |
---|
| 147 | set { m_StatusDialogErrorMessage = value; } |
---|
| 148 | } |
---|
| 149 | public static constants.PersonIDStruct[] contact_array |
---|
| 150 | { |
---|
| 151 | get { return m_contact_array; } |
---|
| 152 | set { m_contact_array = value; } |
---|
| 153 | } |
---|
| 154 | public static constants.UniqueIDStruct[] picasa_unique_id_arrary |
---|
| 155 | { |
---|
| 156 | get { return m_picasa_unique_id_arrary; } |
---|
| 157 | set { m_picasa_unique_id_arrary = value; } |
---|
| 158 | } |
---|
| 159 | public static int AddAlbumCategoryID |
---|
| 160 | { |
---|
| 161 | get { return m_AddAlbumCategoryID; } |
---|
| 162 | set { m_AddAlbumCategoryID = value; } |
---|
| 163 | } |
---|
| 164 | public static int person_count |
---|
| 165 | { |
---|
| 166 | get { return m_person_count; } |
---|
| 167 | set { m_person_count = value; } |
---|
| 168 | } |
---|
| 169 | public static int unique_id_count |
---|
| 170 | { |
---|
| 171 | get { return m_unique_id_count; } |
---|
| 172 | set { m_unique_id_count = value; } |
---|
| 173 | } |
---|
| 174 | public static string NewAlbumDescription |
---|
| 175 | { |
---|
| 176 | get { return m_NewAlbumDescription; } |
---|
| 177 | set { m_NewAlbumDescription = value; } |
---|
| 178 | } |
---|
| 179 | public static string PiwigoVersionNumber |
---|
| 180 | { |
---|
| 181 | get { return m_PiwigoVersionNumber; } |
---|
| 182 | set { m_PiwigoVersionNumber = value; } |
---|
| 183 | } |
---|
| 184 | } |
---|
| 185 | } |
---|