Пример #1
0
        public string UpdVideoUrl(int id, int state)
        {
            VideoUrl vu = ve.VideoUrl.Where(q => q.Vid == id).First();

            if (vu != null)
            {
                if (vu.State < state)
                {
                    //IParsing jx = null;
                    string TempPath = vu.Path;
                    TempPath = TempPath.Replace(" ", "");
                    TempPath = TempPath.Replace("\t", "");
                    TempPath = TempPath.Replace("\\t", "");
                    TempPath = TempPath.Replace("\\\t", "");
                    TempPath = TempPath.Replace("\\r", "");
                    TempPath = TempPath.Replace("\\n", "");
                    TempPath = TempPath.Replace("\\s", "");
                    switch (vu.Source.Trim())
                    {
                    //case "youku":
                    //    jx = new YouKu();
                    //    break;
                    //case "360":
                    //    jx = new Yun360();
                    //    break;
                    //case "qq":
                    //    jx = new QQ();
                    //    break;
                    //case "Ku6":
                    //    jx = new Ku6();
                    //    break;
                    case "QQYun":
                        TempPath = vu.Path.Replace(",", "/,");
                        break;

                    case "myfile":
                        TempPath = vu.Path.Replace(",", "/,");;
                        break;

                    case "AES_baby":
                        return(vu.TempPath);

                    default:
                        //TempPath = vu.Path;
                        break;
                    }
                    //if (jx != null)
                    //{
                    //    TempPath = jx.Parsing(vu.Path);
                    //}
                    vu.State   += 1;
                    vu.TempPath = EncryptHelper.Encrypt(TempPath);
                    ve.SaveChanges();
                }
            }
            return(vu.TempPath);
        }
Пример #2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Title != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Title.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Description != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Description.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (SlidesUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + SlidesUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (VideoUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + VideoUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (MeetupIds != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + MeetupIds.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (SpeakerIds != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + SpeakerIds.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }
Пример #3
0
        /// <inheritdoc />
        /// <summary>
        /// Returns true if UpdateTalkDraftParameters instances are equal
        /// </summary>
        /// <param name="other">Instance of UpdateTalkDraftParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UpdateTalkDraftParameters other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

#pragma warning disable CA1309                  // Use ordinal stringcomparison
#pragma warning disable CA1307                  // Specify StringComparison
#pragma warning disable SA1515                  // Single-line comment must be preceded by blank line
#pragma warning disable SA1009                  // Closing parenthesis must be spaced correctly
            return
                (#pragma warning disable SA1119 // Statement must not use unnecessary parenthesis
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Title, other.Title) ||
                     (Title != null && Title.Equals(other.Title))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Description, other.Description) ||
                     (Description != null && Description.Equals(other.Description))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(SlidesUrl, other.SlidesUrl) ||
                     (SlidesUrl != null && SlidesUrl.Equals(other.SlidesUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(VideoUrl, other.VideoUrl) ||
                     (VideoUrl != null && VideoUrl.Equals(other.VideoUrl))
                 ) &&
                 (
                     MeetupIds == other.MeetupIds ||
                     (MeetupIds != null && MeetupIds.SequenceEqual(other.MeetupIds))
                 ) &&
                 (
                     SpeakerIds == other.SpeakerIds ||
                     (SpeakerIds != null && SpeakerIds.SequenceEqual(other.SpeakerIds))
                 ));

#pragma warning restore SA1119 // Statement must not use unnecessary parenthesis
#pragma warning restore SA1009 // Closing parenthesis must be spaced correctly
#pragma warning restore SA1515 // Single-line comment must be preceded by blank line
#pragma warning restore CA1307 // Specify StringComparison
#pragma warning restore CA1309 // Use ordinal stringcomparison
        }
Пример #4
0
        /// <inheritdoc />
        /// <summary>
        /// Returns true if TalkRehearsal instances are equal
        /// </summary>
        /// <param name="other">Instance of TalkRehearsal to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TalkRehearsal other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

#pragma warning disable CA1309                  // Use ordinal stringcomparison
#pragma warning disable CA1307                  // Specify StringComparison
#pragma warning disable SA1515                  // Single-line comment must be preceded by blank line
#pragma warning disable SA1009                  // Closing parenthesis must be spaced correctly
            return
                (#pragma warning disable SA1119 // Statement must not use unnecessary parenthesis
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Id, other.Id) ||
                     (Id != null && Id.Equals(other.Id))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Time, other.Time) ||
                     (Time != null && Time.Equals(other.Time))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(SlidesUrl, other.SlidesUrl) ||
                     (SlidesUrl != null && SlidesUrl.Equals(other.SlidesUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(VideoUrl, other.VideoUrl) ||
                     (VideoUrl != null && VideoUrl.Equals(other.VideoUrl))
                 ) &&
                 (
                     // ReSharper disable once RedundantNameQualifier
                     string.Equals(Comment, other.Comment) ||
                     (Comment != null && Comment.Equals(other.Comment))
                 ));

#pragma warning restore SA1119 // Statement must not use unnecessary parenthesis
#pragma warning restore SA1009 // Closing parenthesis must be spaced correctly
#pragma warning restore SA1515 // Single-line comment must be preceded by blank line
#pragma warning restore CA1307 // Specify StringComparison
#pragma warning restore CA1309 // Use ordinal stringcomparison
        }
Пример #5
0
        private void _PrintUrl(VideoUrl videoUrl)
        {
            foreach (var dataUrl in videoUrl.Durl)
            {
                if (dataUrl.BackupUrl != null)
                {
                    foreach (var backupUrl in dataUrl.BackupUrl.Url)
                    {
                        Console.WriteLine(string.Format("[TEST] Got backup URL {0} for video av349183.", backupUrl));
                    }
                }

                Console.WriteLine(string.Format("[TEST] Got main URL {0} for video av349183.", dataUrl.Url));
            }
        }
Пример #6
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                var hashCode = 41;

                // Suitable nullity checks etc, of course :)
#pragma warning disable CA1307 // Specify StringComparison

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Id != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Id.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Time != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Time.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (SlidesUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + SlidesUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (VideoUrl != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + VideoUrl.GetHashCode();
                }

                // ReSharper disable once NonReadonlyMemberInGetHashCode
                if (Comment != null)
                {
                    // ReSharper disable once NonReadonlyMemberInGetHashCode
                    hashCode = (hashCode * 59) + Comment.GetHashCode();
                }
#pragma warning restore CA1307 // Specify StringComparison
                return(hashCode);
            }
        }
Пример #7
0
        public void TestTransformToExceptionModel()
        {
            WasteManagementEventEntity wasteManagementEventEntity = _testData.CreateWasteManagementEvent();

            WasteManagementEvent result = _transformer.TransformToExceptionModel(wasteManagementEventEntity);

            Assert.AreEqual(wasteManagementEventEntity.Vin, result.Vin);
            Assert.AreEqual(wasteManagementEventEntity.AccountId, result.AccountId);
            Assert.AreEqual(wasteManagementEventEntity.EventId, result.EventId);
            Assert.AreEqual(wasteManagementEventEntity.EventType, result.EventType);
            Assert.AreEqual(wasteManagementEventEntity.TransactionId, result.TransactionId);
            Assert.AreEqual(wasteManagementEventEntity.DateTime, result.DateTime);
            Assert.AreEqual(wasteManagementEventEntity.Longitude, result.Longitude);
            Assert.AreEqual(wasteManagementEventEntity.Latitude, result.Latitude);

            Assert.AreEqual(wasteManagementEventEntity.Street1, result.Address.Street1);
            Assert.AreEqual(wasteManagementEventEntity.Street2, result.Address.Street2);
            Assert.AreEqual(wasteManagementEventEntity.City, result.Address.City);
            Assert.AreEqual(wasteManagementEventEntity.State, result.Address.State);
            Assert.AreEqual(wasteManagementEventEntity.ZipCode, result.Address.ZipCode);
            Assert.AreEqual(wasteManagementEventEntity.Country, result.Address.Country);

            Assert.AreEqual(wasteManagementEventEntity.ExceptionDetails.Type, result.ExceptionDetails.Type);
            Assert.AreEqual(wasteManagementEventEntity.ContainerColor, result.ContainerColor);
            Assert.AreEqual(wasteManagementEventEntity.ContainerSize, result.ContainerSize);
            Assert.AreEqual(wasteManagementEventEntity.ExceptionDetails.Description, result.ExceptionDetails.Description);
            Assert.AreEqual(wasteManagementEventEntity.ExceptionDetails.Notes, result.ExceptionDetails.Notes);

            List <string> urls = new List <string>(result.ExceptionDetails.PictureUrls);

            Assert.IsTrue(urls.Any(item => item == TestDataCreator.Url1));
            Assert.IsTrue(urls.Any(item => item == TestDataCreator.Url2));

            VideoUrl    videoUrl       = result.VideoUrls.First();
            VideoEntity videoUrlEntity = wasteManagementEventEntity.Videos.First();

            Assert.AreEqual(videoUrl.Heading, videoUrlEntity.Heading);
            Assert.AreEqual(videoUrl.Latitude, videoUrlEntity.Latitude);
            Assert.AreEqual(videoUrl.Longitude, videoUrlEntity.Longitude);
            Assert.AreEqual(videoUrl.MDTUrl, videoUrlEntity.MDTUrl);
            Assert.AreEqual(videoUrl.Url, videoUrlEntity.VideoURL);
            Assert.AreEqual(videoUrl.Speed, videoUrlEntity.Speed);
            Assert.AreEqual(videoUrl.EndDateTime, videoUrlEntity.EndDateTime);
            Assert.AreEqual(videoUrl.StartDateTime, videoUrlEntity.StartDateTime);
            Assert.AreEqual(videoUrl.Camera, videoUrlEntity.CameraChannel);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (videoId_ != null)
            {
                hash ^= VideoId.GetHashCode();
            }
            if (timestamp_ != null)
            {
                hash ^= Timestamp.GetHashCode();
            }
            if (VideoUrl.Length != 0)
            {
                hash ^= VideoUrl.GetHashCode();
            }
            if (ThumbnailUrl.Length != 0)
            {
                hash ^= ThumbnailUrl.GetHashCode();
            }
            return(hash);
        }
Пример #9
0
        public object GetVideoUrl(int id, ref int count)
        {
            //UpdVideoUrl(id, 999);
            DataLog dl = new DataLog();

            dl.KeyId      = id;
            dl.Type       = (int)LogEnum.VIDEOLOG;
            dl.OpenId     = "";
            dl.Describe   = "";
            dl.CreateTime = DateTime.Now;
            var tempdata = from a in ve.VideoUrl
                           where a.Vid == id
                           orderby a.Sort ascending, a.Id ascending
                select new
            {
                a.Id,
                a.Source,
                a.Path,
                a.TempPath
            };

            foreach (var item in tempdata.ToList())
            {
                string TempPath = item.Path;
                TempPath = TempPath.Replace("\t", "");
                TempPath = TempPath.Replace("\\t", "");
                string encryptPath = EncryptHelper.Encrypt(TempPath);
                if (string.IsNullOrEmpty((item.TempPath + "").Trim()) ||
                    (item.TempPath + "").Trim() == "7NTyKCzlI8jyXd7WRF1wFA==" ||
                    !encryptPath.Equals((item.TempPath + "").Trim()))
                //if (string.IsNullOrEmpty((item.TempPath + "").Trim()) || (item.TempPath + "").Trim() == "7NTyKCzlI8jyXd7WRF1wFA==" || item.Source.Trim() == "youku")
                {
                    //IParsing jx = null;
                    switch (item.Source.Trim())
                    {
                    //case "youku":
                    //    jx = new YouKu();
                    //    break;
                    //case "360":
                    //    jx = new Yun360();
                    //    break;
                    //case "qq":
                    //    jx = new QQ();
                    //    break;
                    //case "Ku6":
                    //case "ku6":
                    //    jx = new Ku6();
                    //    break;
                    //case "QQYun":
                    //    TempPath = item.Path.Replace(",", "/,");
                    //    break;
                    //case "myfile":
                    //    TempPath = item.Path.Replace(",", "/,");
                    //    break;
                    case "AES_baby":
                        continue;
                        //return item.TempPath;
                    }

                    //if (jx != null)
                    //{
                    //    try
                    //    {
                    //        TempPath = jx.Parsing(item.Path);
                    //    }
                    //    catch
                    //    {
                    //        TempPath = item.Path;
                    //    }
                    //}
                    Models.VideoUrl model = new VideoUrl();
                    model.Id       = item.Id;
                    model.TempPath = EncryptHelper.Encrypt(TempPath);
                    DbEntityEntry <VideoUrl> entry = ve.Entry <VideoUrl>(model);
                    entry.State = EntityState.Unchanged;
                    entry.Property("TempPath").IsModified = true;
                    ve.SaveChanges();
                }
            }
            var data = from a in ve.VideoUrl
                       where a.Vid == id
                       orderby a.Sort ascending, a.Id ascending
                select new
            {
                a.Id,
                a.State,
                a.Source,
                a.Path,
                a.TempPath
            };

            count = data.Count();
            dlh.AddModel(dl);
            return(data);
        }
Пример #10
0
 public override int GetHashCode()
 {
     return(VideoUrl.GetHashCode());
 }