コード例 #1
0
        /// <summary>
        /// データ文字列を読み取り各値を設定する。
        /// </summary>
        /// <param name="dataString">データ文字列</param>
        private void InterpretDataString(string dataString)
        {
            try
            {
                DataStringDictionary dsd = new DataStringDictionary(dataString);

                this.author       = dsd["Author"];
                this.id           = dsd["ID"];
                this.serialNumber = long.Parse(dsd["SerialNumber"]);
                this.date         = new DateTime(long.Parse(dsd["Ticks"]));
                this.proximity    = dsd.GetValue("Proximity", string.Empty);
                this.infoText     = author + date.ToString(PhotoChat.DateFormat);
                SetPhotoName();

                // GPS座標の読み取り
                string str   = dsd.GetValue("Geo", "200,200");
                int    index = str.IndexOf(',');
                this.latitude  = double.Parse(str.Substring(0, index));
                this.longitude = double.Parse(str.Substring(index + 1));
            }
            catch (Exception e)
            {
                throw new UnsupportedDataException(e.Message);
            }
        }
コード例 #2
0
ファイル: Thumbnail.cs プロジェクト: matsumur/PhotoChat
        /// <summary>
        /// データ文字列を読み取り各フィールドを設定する。
        /// </summary>
        /// <param name="dataString">データ文字列</param>
        private void InterpretDataString(string dataString)
        {
            try
            {
                DataStringDictionary dsd = new DataStringDictionary(dataString);

                this.author       = dsd["Author"];
                this.id           = dsd["ID"];
                this.serialNumber = long.Parse(dsd["SerialNumber"]);
                this.date         = new DateTime(long.Parse(dsd["Ticks"]));
                AddTag(PhotoChat.StringToArray(dsd.GetValue("TagList", string.Empty)));
                this.proximity       = dsd.GetValue("Proximity", string.Empty);
                this.noteCount       = int.Parse(dsd.GetValue("NoteCount", "0"));
                this.unread          = bool.Parse(dsd.GetValue("Unread", "false"));
                this.updated         = bool.Parse(dsd.GetValue("Updated", "false"));
                this.marked          = bool.Parse(dsd.GetValue("Marked", "false"));
                this.attentionFlag   = bool.Parse(dsd.GetValue("AttentionFlag", "false"));
                this.needImageUpdate = int.Parse(dsd.GetValue("NeedImageUpdate", "0"));

                // GPS座標の読み取り
                string str   = dsd.GetValue("Geo", "200,200");
                int    index = str.IndexOf(',');
                this.latitude  = double.Parse(str.Substring(0, index));
                this.longitude = double.Parse(str.Substring(index + 1));
            }
            catch (Exception e)
            {
                throw new UnsupportedDataException(e.Message);
            }
        }
コード例 #3
0
ファイル: Thumbnail.cs プロジェクト: matsumur/PhotoChat
 /// <summary>
 /// 写真に付けられたタグをコンマ区切りで取得する。
 /// インスタンスが存在する場合はTagsプロパティから取得したほうが速い。
 /// </summary>
 /// <param name="photoName">写真名</param>
 /// <returns>写真に付けられたタグのコンマ区切り文字列</returns>
 public static string GetTags(string photoName)
 {
     try
     {
         string filePath = GetDataFilePath(photoName);
         if (File.Exists(filePath))
         {
             string line;
             using (StreamReader sr = new StreamReader(filePath))
             {
                 line = sr.ReadLine();
             }
             DataStringDictionary dsd = new DataStringDictionary(line);
             return(dsd.GetValue("TagList", string.Empty));
         }
     }
     catch (Exception e)
     {
         PhotoChat.WriteErrorLog(e.ToString());
     }
     return(string.Empty);
 }