示例#1
0
        public static LogInfo FromDataString(string s)
        {
            LogInfo result = new LogInfo();

            try
            {
                string[] parts = s.Split(new char[] { '|' });
                result.GeocacheCode      = parts[0];
                result.LogText           = parts[3].Replace("<!br!>", "\r\n").Replace("(!-!)", "|");
                result.VisitDate         = DateTime.Parse(parts[2]);
                result.LogType           = Utils.DataAccess.GetLogType(int.Parse(parts[1]));
                result.TrackableDrop     = bool.Parse(parts[4]);
                result.TrackableRetrieve = parts[5];
                result.AddToFavorites    = bool.Parse(parts[6]);
                for (int i = 7; i < parts.Length; i++)
                {
                    if (parts[i].Length > 0)
                    {
                        ImageInfo ii = ImageInfo.FromDataString(parts[i].Replace("(!-!)", "|"));
                        if (ii != null)
                        {
                            result.Images.Add(ii);
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }