Exemplo n.º 1
0
        private static bool _SaveMovieProfileToJSON(MovieProfile profile, string filePath)
        {
            string hashKey = profile.Hash;

            if (profile.Hash.Length != 32)
            {
                that.DebugAndLog("_SaveMovieProfileToJSON()! profile.Hash.Length <> 32");
                return(false);
            }

            _MovieProfile clone    = profile.ExportProfile();
            string        jsonData = "";

            try
            {
                zLog.Write("SaveMovieProfileToJSON->Convert Profile to JSON");
                jsonData = JsonConvert.SerializeObject(clone, Formatting.Indented);
            }
            catch (Exception ex)
            {
                that.DebugAndLog("Exception Error: " + ex.Message);
                return(false);
            }
            string[] arrLines = jsonData.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            // Return WriteResult as main result
            that.DebugAndLog("Begin ptkTextFile.WriteStringArray(" + filePath + ")");
            return(ptkTextFile.WriteStringArray(filePath, arrLines));
        }
Exemplo n.º 2
0
        public bool ImportProfile(_MovieProfile clone)
        {
            if (null == clone)
            {
                return(false);
            }

            Country = clone.Country;
            Rating  = clone.Rating;
            Type    = clone.Type;
            Code    = clone.Code;
            Title   = clone.Title;

            _Actress.Clear();
            for (int i = 0; i < clone.Actress.Length; i++)
            {
                _Actress.Add(clone.Actress[i]);
                if (!MovieProfile.ListActress.Contains(clone.Actress[i]))
                {
                    MovieProfile.ListActress.Add(clone.Actress[i]);
                }
            }

            _Tag.Clear();
            for (int i = 0; i < clone.Tag.Length; i++)
            {
                _Tag.Add(clone.Tag[i]);
                if (!MovieProfile.ListTag.Contains(clone.Tag[i]))
                {
                    MovieProfile.ListTag.Add(clone.Tag[i]);
                }
            }

            Hash = clone.Hash;
            if (!Hash.Length.Equals(32))
            {
                return(false);
            }

            _CreatedTime  = ptkConvert.SqlFormatToDateTime(clone.CreatedTime);
            _ModifiedTime = ptkConvert.SqlFormatToDateTime(clone.ModifiedTime);
            _ViewTime     = ptkConvert.SqlFormatToDateTime(clone.ViewTime);

            _FilePath.Clear();
            for (int i = clone.FilePath.Length - 1; i >= 0; i--)
            {
                _FilePath.Push(clone.FilePath[i]);
            }

            FileSize = clone.FileSize;
            Story    = clone.Story;
            try { CountPlay = int.Parse(clone.CountPlay); }
            catch { CountPlay = 0; }

            // Everything OK
            return(true);
        }
Exemplo n.º 3
0
        public _MovieProfile ExportProfile()
        {
            _MovieProfile clone = new _MovieProfile();

            clone.Country      = _Country;
            clone.Rating       = _Rating;
            clone.Type         = _Type;
            clone.Code         = _Code;
            clone.Title        = _Title;
            clone.Actress      = _Actress.ToArray();
            clone.Tag          = _Tag.ToArray();
            clone.Hash         = _Hash;
            clone.CreatedTime  = ptkConvert.DateTimeToSqlFormat(_CreatedTime);
            clone.ModifiedTime = ptkConvert.DateTimeToSqlFormat(_ModifiedTime);
            clone.ViewTime     = ptkConvert.DateTimeToSqlFormat(_ViewTime);
            clone.FilePath     = _FilePath.ToArray();
            clone.FileSize     = _FileSize;
            clone.Story        = _Story;
            clone.CountPlay    = _CountPlay.ToString();

            return(clone);
        }