public string GenerateMetadataHtml(bool editMode)
        {
            StringBuilder metadataHtml = new StringBuilder();

            string editModeAttributes = string.Format(CultureInfo.InvariantCulture, " contentEditable=\"true\" maxCharactersAccepted=\"{0}\" class=\"{1}\" defaultText=\"{2}\" wlPropertyPath=\"{3}\" ",
                                                      Res.Get(StringId.VideoCaptionMaxCharactersAccepted),
                                                      InlineEditField.EDIT_FIELD,
                                                      Res.Get(StringId.VideoCaptionDefaultText),
                                                      HtmlUtils.EscapeEntities(VIDEO_CAPTION)
                                                      );

            if (Caption.Trim() != String.Empty)
            {
                metadataHtml.Append(string.Format(CultureInfo.InvariantCulture, "<div style=\"width:{0}px;clear:both;font-size:{1}\"{2}>", HtmlSize.Width, Res.Get(StringId.Plugin_Video_Caption_Size), editMode ? editModeAttributes : string.Empty));
                metadataHtml.Append(Caption.Trim());
                metadataHtml.Append("</div>");

                return(metadataHtml.ToString());
            }

            if (editMode)
            {
                metadataHtml.Append(string.Format(CultureInfo.InvariantCulture, "<div style=\"width:{0}px;clear:both;font-size:{1};\"{2}></div>", HtmlSize.Width, Res.Get(StringId.Plugin_Video_Caption_Size), editModeAttributes));
            }

            return(metadataHtml.ToString());
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Id.GetHashCode();
         result = (result * 397) ^ (Urn != null ? Urn.GetHashCode() : 0);
         result = (result * 397) ^ UserId.GetHashCode();
         result = (result * 397) ^ DateAdded.GetHashCode();
         result = (result * 397) ^ DateModified.GetHashCode();
         result = (result * 397) ^ (TargetUserId.HasValue ? TargetUserId.Value.GetHashCode() : 0);
         result = (result * 397) ^ (ForwardedPostId.HasValue ? ForwardedPostId.Value.GetHashCode() : 0);
         result = (result * 397) ^ OriginUserId.GetHashCode();
         result = (result * 397) ^ (OriginUserName != null ? OriginUserName.GetHashCode() : 0);
         result = (result * 397) ^ SourceUserId.GetHashCode();
         result = (result * 397) ^ (SourceUserName != null ? SourceUserName.GetHashCode() : 0);
         result = (result * 397) ^ (SubjectUrn != null ? SubjectUrn.GetHashCode() : 0);
         result = (result * 397) ^ (ContentUrn != null ? ContentUrn.GetHashCode() : 0);
         result = (result * 397) ^ (TrackUrns != null ? TrackUrns.GetHashCode() : 0);
         result = (result * 397) ^ (Caption != null ? Caption.GetHashCode() : 0);
         result = (result * 397) ^ CaptionUserId.GetHashCode();
         result = (result * 397) ^ (CaptionSourceName != null ? CaptionSourceName.GetHashCode() : 0);
         result = (result * 397) ^ (ForwardedPostUrn != null ? ForwardedPostUrn.GetHashCode() : 0);
         result = (result * 397) ^ PostType.GetHashCode();
         result = (result * 397) ^ (OnBehalfOfUserId.HasValue ? OnBehalfOfUserId.Value.GetHashCode() : 0);
         return(result);
     }
 }
        public override void LayoutSubviews()
        {
            const int ThinPad    = 3;
            const int ThickPad   = 10;
            const int LineHeight = 1;

            var w = Frame.Width;
            var h = Frame.Height;

            SignaturePrompt.SizeToFit();
            ClearLabel.SizeToFit();

            var captionHeight     = Caption.SizeThatFits(Caption.Frame.Size).Height;
            var clearButtonHeight = (int)ClearLabel.Font.LineHeight + 1;

            var rect = new CGRect(0, 0, w, h);

            SignaturePadCanvas.Frame  = rect;
            BackgroundImageView.Frame = rect;

            var top = h;

            top           = top - ThinPad - captionHeight;
            Caption.Frame = new CGRect(ThickPad, top, w - ThickPad - ThickPad, captionHeight);

            top = top - ThinPad - SignatureLine.Frame.Height;
            SignatureLine.Frame = new CGRect(ThickPad, top, w - ThickPad - ThickPad, LineHeight);

            top = top - ThinPad - SignaturePrompt.Frame.Height;
            SignaturePrompt.Frame = new CGRect(ThickPad, top, SignaturePrompt.Frame.Width, SignaturePrompt.Frame.Height);

            ClearLabel.Frame = new CGRect(w - ThickPad - ClearLabel.Frame.Width, ThickPad, ClearLabel.Frame.Width, clearButtonHeight);
        }
Example #4
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate barcode object
            BarCodeBuilder barCodeBuilder = new BarCodeBuilder();

            // Set the Code text for the barcode
            barCodeBuilder.CodeText = "1234567";

            // Set the symbology type to Code128
            barCodeBuilder.SymbologyType = Symbology.Code128;

            // Create caption object. Set its text and text alignment & also make it visible
            Caption caption = new Caption();

            caption.Text      = "Aspose.BarCode";
            caption.TextAlign = System.Drawing.StringAlignment.Center;
            caption.Visible   = true;

            // Assign caption object to be displayed above and below the barcode
            barCodeBuilder.CaptionAbove = caption;
            barCodeBuilder.CaptionBelow = caption;

            // Save the image to your system and set its image format to Jpeg
            barCodeBuilder.Save(dataDir + "ManageCaption_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir);
        }
Example #5
0
        private async void AugmentCaption(Caption caption, object payload, TimeSpan startTime, TimeSpan endTime)
        {
            if (caption != null)
            {
                string result = null;
                if (payload is byte[])
                {
                    var byteArray = (byte[])payload;
#if SILVERLIGHT && !WINDOWS_PHONE || WINDOWS_PHONE7
                    result = await TaskEx.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#else
                    result = await Task.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#endif
                    //result = System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length);
                }
                else if (payload is string)
                {
                    result = (string)payload;
                }
                if (result != null)
                {
                    allTasks = EnqueueTask(() => AugmentWebVTT(result, startTime, endTime), allTasks);
                    await allTasks;
                }
            }
        }
 private static void PlayVoice(LoadAudioBase __instance)
 {
     if (SubtitleDictionary.TryGetValue(__instance.assetName, out string text))
     {
         Caption.DisplaySubtitle(__instance.gameObject, text);
     }
 }
Example #7
0
        public int CompareTo(object obj)
        {
            ColumnProperties column = obj as ColumnProperties;

            if (column == null)
            {
                return(0);
            }
            if (visibleIndex < 0 && column.VisibleIndex >= 0)
            {
                return(1);
            }
            if (visibleIndex >= 0 && column.VisibleIndex < 0)
            {
                return(-1);
            }
            if (visibleIndex < 0 && column.VisibleIndex < 0)
            {
                return(Caption.CompareTo(column.Caption));
            }
            if (VisibleIndex > column.VisibleIndex)
            {
                return(1);
            }
            else if (VisibleIndex < column.VisibleIndex)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
Example #8
0
        protected override void WriteSelfStart(System.IO.TextWriter writer)
        {
            var responsive = false;

            endTag = "</table>";

#if BOOTSTRAP4
            responsive = (Style & TableStyles.Responsive) == TableStyles.Responsive;
#endif
            if (responsive)
            {
                writer.Write("<div class=\"table-responsive\">");
                endTag += "</div>";
            }

            var tb = Helper.CreateTagBuilder("table");
            tb.AddCssClass(Style.ToCssClass());

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (Caption != null)
            {
                Caption.WriteTo(writer);
            }
            if (Header != null)
            {
                Header.WriteTo(writer);
            }
        }
        /// <summary>
        /// Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both.
        /// Documentation https://developers.google.com/youtube/v3/reference/captions/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Youtube service.</param>
        /// <param name="part">The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the property value to snippet if you are updating the track's draft status. Otherwise, set the property value to id.</param>
        /// <param name="body">A valid Youtube v3 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>CaptionResponse</returns>
        public static Caption Update(YoutubeService service, string part, Caption body, CaptionsUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (part == null)
                {
                    throw new ArgumentNullException(part);
                }

                // Building the initial request.
                var request = service.Captions.Update(body, part);

                // Applying optional parameters to the request.
                request = (CaptionsResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Captions.Update failed.", ex);
            }
        }
Example #10
0
        public static Dictionary <string, object> GenerateProperties(
            FieldType fieldType,
            Label label             = Label.Min,
            OptionCount optionCount = OptionCount.Zero,
            string optionAlias      = "",
            Caption caption         = Caption.Missing,
            Search search           = Search.Missing,
            Match match             = Match.Missing,
            Web web             = Web.Missing,
            Highlight highlight = Highlight.Missing,
            Require require     = Require.Missing,
            SelectionDefault selectionDefault = SelectionDefault.Missing)
        {
            var optionInfos = GetOptionInfos(optionAlias);
            var properties  = new Dictionary <string, object>
            {
                [PropertyName.SType.GetEnumStringValue()] = (int)fieldType,
                [PropertyName.Label.GetEnumStringValue()] = LabelMapperValue[label],
                [PropertyName.Id.GetEnumStringValue()]    = optionInfos.FirstOrDefault().Key,
                [PropertyName.DType.GetEnumStringValue()] = (int)DTypeMapper[fieldType],
                [PropertyName.Count.GetEnumStringValue()] = (int)optionCount
            };

            CaptionMapperValue[caption](properties);
            SearchMapperValue[search](properties);
            MatchMapperValue[match](properties);
            WebMapperValue[web](properties);
            HighlightMapperValue[highlight](properties);
            RequireMapperValue[require](properties);
            SelectionDefaultMapper[selectionDefault](optionInfos.FirstOrDefault().Value, properties);
            return(properties);
        }
Example #11
0
 public virtual void FillMissingAttributes()
 {
     if (string.IsNullOrEmpty(RouteValues) && !string.IsNullOrEmpty(Caption))
     {
         RouteValues = Caption.ToFormattedID();
     }
 }
Example #12
0
        public virtual void FillMissingAttributes()
        {
            if (string.IsNullOrEmpty(RouteValues) && !string.IsNullOrEmpty(Caption))
            {
                RouteValues = Caption.ToFormattedID();
            }

            if (InnerContent == null || !InnerContent.Any())
            {
                return;
            }

            foreach (var sub in InnerContent)
            {
                if (string.IsNullOrEmpty(sub.Controller))
                {
                    sub.Controller = Controller;
                }
                if (string.IsNullOrEmpty(sub.Action))
                {
                    sub.Action = Action;
                }
                sub.ParentContent = this;
            }
        }
Example #13
0
        internal List <Caption> GetSubtitles(BaseItemDto item)
        {
            var list = new List <Caption>();

            if (item.MediaStreams == null)
            {
                return(list);
            }
            foreach (var caption in item.MediaStreams.Where(s => s.Type == MediaStreamType.Subtitle))
            {
                var menuItem = new Caption
                {
                    Id = caption.Index.ToString(CultureInfo.InvariantCulture),
                    //Language = caption.Language,
                    //Name = caption.Language,
                    Description = caption.Language
                };

                if (caption.IsTextSubtitleStream)
                {
                    var source = item.MediaSources.FirstOrDefault();
                    var id     = source != null ? source.Id : string.Empty;
                    menuItem.Source = new Uri(string.Format("{0}/mediabrowser/Videos/{1}/{2}/Subtitles/{3}/Stream.vtt", ApiClient.ServerAddress, item.Id, id, caption.Index));
                }

                list.Add(menuItem);
            }
            return(list);
        }
Example #14
0
        public int compareTo(Game s, GameComparer.ComparisonType comparisonMethod)
        {
            switch (comparisonMethod)
            {
            case GameComparer.ComparisonType.Caption:
                return(String.Compare(Caption, s.Caption));

            case GameComparer.ComparisonType.Viewers:
                if (Viewers != "" && s.Viewers != "")
                {
                    return(Convert.ToUInt64(s.Viewers).CompareTo(Convert.ToUInt64(Viewers)));
                }
                else if (Viewers == "" && s.Viewers != "")
                {
                    return(1);
                }
                else if (s.Viewers == "" && Viewers != "")
                {
                    return(-1);
                }
                else
                {
                    return(Caption.CompareTo(s.Caption));
                }

            default:
                return(Caption.CompareTo(s.Caption));
            }
        }
Example #15
0
        public virtual nfloat GetHeight(UITableView tableView, NSIndexPath indexPath)
        {
            var size = new CGSize(280, float.MaxValue);

            using (var font = UIFont.FromName("Helvetica", 17f))
                return(Caption.StringSize(font, size, UILineBreakMode.WordWrap).Height + 10);
        }
Example #16
0
        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        ///// Append a picture to the end of the paragraph using the given writing system.
        ///// </summary>
        ///// <param name="ws">given writing system</param>
        ///// <param name="strBldr">The string builder for the paragraph being composed</param>
        ///// ------------------------------------------------------------------------------------
        //public void AppendPicture(int ws, ITsStrBldr strBldr)
        //{
        //    // Make a TsTextProps with the relevant object data and the same ws as its
        //    // context.
        //    byte[] objData = MiscUtils.GetObjData(this.Guid,
        //        (byte)FwObjDataTypes.kodtGuidMoveableObjDisp);
        //    ITsPropsBldr propsBldr = TsStringUtils.MakePropsBldr();
        //    propsBldr.SetStrPropValueRgch((int)FwTextPropType.ktptObjData,
        //        objData, objData.Length);
        //    propsBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, ws);

        //    // Insert the orc with the resulting properties.
        //    strBldr.Replace(strBldr.Length, strBldr.Length,
        //        new string(TsStringUtils.kChObject, 1), propsBldr.GetTextProps());
        //}

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Update the properties of a CmPicture with the given file, caption, and folder.
        /// </summary>
        /// <param name="srcFilename">The full path to the filename (this might be an "internal"
        /// copy of the original the user chose)</param>
        /// <param name="captionTss">The caption</param>
        /// <param name="sFolder">The name of the CmFolder where picture should be stored</param>
        /// <param name="ws">The WS for the location in the caption MultiUnicode to put the
        /// caption</param>
        /// ------------------------------------------------------------------------------------
        public void UpdatePicture(string srcFilename, ITsString captionTss, string sFolder, int ws)
        {
            // Set the caption first since creating the CmFile will throw if srcFilename is empty.
            if (ws != 0)
            {
                Caption.set_String(ws, captionTss);
            }

            ICmFile file = PictureFileRA;

            if (file == null)
            {
                ICmFolder folder = DomainObjectServices.FindOrCreateFolder(m_cache, LangProjectTags.kflidPictures, sFolder);
                PictureFileRA = DomainObjectServices.FindOrCreateFile(folder, srcFilename);
            }
            else
            {
                Debug.Assert(sFolder == CmFolderTags.LocalPictures,
                             "TODO: If we ever actually support use of different folders, we need to handle folder changes.");
                if (srcFilename != null && !FileUtils.PathsAreEqual(srcFilename, file.AbsoluteInternalPath))
                {
                    file.InternalPath = srcFilename;
                }
            }
            // We shouldn't need to this in the new LCM.
            //m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, Hvo,
            //    (int)CmPicture.CmPictureTags.kflidCaption, ws, 0 , 0);
            //m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, file.Hvo,
            //    (int)CmFile.CmFileTags.kflidInternalPath, 0, 1, 1);
        }
Example #17
0
        public void CaptionWordIndeciesTest()
        {
            //Arrange
            string s = "Hello how are you?";

            int[] sBegin = { 0, 6, 10, 14 };
            int[] sEnd   = { 5, 9, 13, 18 };

            string s2 = "Hello  how  are  you?";

            int[] s2Begin = { 0, 7, 12, 17 };
            int[] s2End   = { 5, 10, 15, 21 };

            //Act
            Caption c  = new Caption(s, new Speaker(), NoTimeStamp, NoTimeStamp, 1);
            Caption c2 = new Caption(s2, new Speaker(), NoTimeStamp, NoTimeStamp, 1);

            //Assert
            for (int i = 0; i < c.Words.Count; i++)
            {
                Assert.AreEqual(sBegin[i], c.Words[i].BeginIndex);
                Assert.AreEqual(sEnd[i], c.Words[i].EndIndex);
            }

            for (int i = 0; i < c2.Words.Count; i++)
            {
                Assert.AreEqual(s2Begin[i], c2.Words[i].BeginIndex);
                Assert.AreEqual(s2End[i], c2.Words[i].EndIndex);
            }
        }
Example #18
0
        public async Task Get_Caption_Not_Found()
        {
            var result = await _controller.GetCaption("none", 0);

            Assert.IsType <NotFoundResult>(result.Result);

            result = await _controller.GetCaption(null, -1);

            Assert.IsType <NotFoundResult>(result.Result);

            var caption = new Caption
            {
                TranscriptionId = "001",
                Index           = 0,
                Text            = "foo bar",
                CaptionType     = CaptionType.TextCaption
            };

            _context.Captions.Add(caption);
            _context.SaveChanges();

            result = await _controller.GetCaption(caption.TranscriptionId, caption.Index + 1);

            Assert.IsType <NotFoundResult>(result.Result);
        }
        //----- End of the codes.
        #region Method
        //-----
        #region ShowAlert
        /// <summary>
        /// A function that displays a notification with three message inputs, caption, and photos.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="caption"></param>
        /// <param name="picture"></param>
        public void ShowAlert(string message, Caption caption, string picture)
        {
            this.Opacity       = 0.0;
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

            string name;

            for (int i = 1; i < 10; i++)
            {
                name = "alert" + i.ToString();

                PopupNotificationForm popupNotification = (PopupNotificationForm)System.Windows.Forms.Application.OpenForms[name];

                if (popupNotification == null)
                {
                    this.Name     = name;
                    this.x        = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15;
                    this.y        = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i;
                    this.Location = new System.Drawing.Point(this.x, this.y);
                    break;
                }
            }

            this.x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5;

            switch (caption)
            {
            case Caption.موفقیت:
                alertIconPicturBox.Image = Resturant.Properties.Resources.succes_512;
                BackColor         = System.Drawing.Color.SeaGreen;
                captionLabel.Text = Caption.موفقیت.ToString();
                break;

            case Caption.اخطار:
                alertIconPicturBox.Image = Resturant.Properties.Resources.warning_512;
                BackColor         = System.Drawing.Color.DarkOrange;
                captionLabel.Text = Caption.اخطار.ToString();
                break;

            case Caption.خطا:
                alertIconPicturBox.Image = Resturant.Properties.Resources.error_512;
                BackColor         = System.Drawing.Color.DarkRed;
                captionLabel.Text = Caption.خطا.ToString();
                break;

            case Caption.اطلاع:
                alertIconPicturBox.Image = Resturant.Properties.Resources.info_512;
                BackColor         = System.Drawing.Color.RoyalBlue;
                captionLabel.Text = Caption.اطلاع.ToString();
                break;
            }

            this.objectpicturBox.Image  = System.Drawing.Image.FromFile(picture);
            this.alertMessageLabel.Text = message;

            this.Show();
            this.action          = Action.start;
            this.timer1.Interval = 1;
            this.timer1.Start();
        }
Example #20
0
 /// <summary>
 /// Constructs a TImelineMouseSelection with an Action, a selected Caption and a
 /// time difference.
 /// </summary>
 /// <param name="action">The TimelineMouseAction that is being performed.</param>
 /// <param name="mouseClickTimeDifference">The caption selected for this
 /// TimelineMouseAction.</param>
 /// <param name="selectedCaptionTimeDifference">The time difference.</param>
 public TimelineMouseSelection(TimelineMouseAction action, Caption mouseClickTimeDifference,
                               double selectedCaptionTimeDifference)
 {
     this.Action  = action;
     this.Caption = mouseClickTimeDifference;
     this.MouseClickTimeDifference = selectedCaptionTimeDifference;
 }
        public ActionResult UpdateImageDescriptionAll(string id, string language, string db, int threshold, bool overwrite)
        {
            IEnumerable <MediaItem> fullList = DataService
                                               .GetMediaFileDescendents(id, db)
                                               .ToList();

            IEnumerable <MediaItem> list = fullList
                                           .Where(a => !string.IsNullOrEmpty(a.Alt) && !overwrite)
                                           .ToList();

            if (!list.Any())
            {
                return(Json(SetAltTagsAllFactory.Create(id, db, language, 0, 0, 50, false)));
            }

            var thresholdDouble = (double)threshold / 100;

            foreach (var m in list)
            {
                Caption cap = SearchService.GetTopImageCaption(m, language, thresholdDouble);
                if (cap != null)
                {
                    DataService.SetImageDescription(m, cap.Text);
                }
            }

            var result = SetAltTagsAllFactory.Create(id, db, language, fullList.Count(), list.Count(), threshold, overwrite);

            return(Json(result));
        }
Example #22
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (FontTextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)NextAvailableId;
         hashCode = (hashCode * 397) ^ (BooleanProperties?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ GroupCount;
         hashCode = (hashCode * 397) ^ (int)Cycle;
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)Zoom;
         hashCode = (hashCode * 397) ^ (int)PictureAlignment;
         hashCode = (hashCode * 397) ^ (int)PictureSizeMode;
         hashCode = (hashCode * 397) ^ (int)ShapeCookie;
         hashCode = (hashCode * 397) ^ (int)DrawBuffer;
         hashCode = (hashCode * 397) ^ (DisplayedSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (LogicalSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ScrollPosition?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ FontIsStdFont.GetHashCode();
         hashCode = (hashCode * 397) ^ (FontStdFont?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
            private static void DisplayHSubtitle(Manager.Voice.Loader loader, AudioSource audioSource)
            {
                Dictionary <int, Dictionary <int, HVoiceCtrl.VoiceList> >[] dicdiclstVoiceList = (Dictionary <int, Dictionary <int, HVoiceCtrl.VoiceList> >[])Traverse.Create(HSceneInstance.ctrlVoice).Field("dicdiclstVoiceList").GetValue();

                foreach (Dictionary <int, Dictionary <int, HVoiceCtrl.VoiceList> > a in dicdiclstVoiceList)
                {
                    foreach (Dictionary <int, HVoiceCtrl.VoiceList> b in a.Values)
                    {
                        foreach (HVoiceCtrl.VoiceList c in b.Values)
                        {
                            foreach (Dictionary <int, HVoiceCtrl.VoiceListInfo> d in c.dicdicVoiceList)
                            {
                                foreach (var e in d.Values)
                                {
                                    if (e.nameFile == loader.asset && e.pathAsset == loader.bundle)
                                    {
                                        Caption.DisplaySubtitle(audioSource, e.nameFile, e.word);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
Example #24
0
    // Use this for initialization
    void Start()
    {
        post po = new post();

        Caption caption = new Caption();

        caption.text       = "23";
        caption.confidence = 22.22f;
        Caption caption1 = new Caption();

        caption1.text       = "24";
        caption1.confidence = 99.99f;
        Description d = new Description();

        d.tags = new List <string>();
        d.tags.Add("Arpit");
        d.tags.Add("Arpit");
        d.captions = new List <Caption>();
        d.captions.Add(caption);
        d.captions.Add(caption1);
        string json = JsonWriter.Serialize(d);

        print(json);

        //List<Caption> jsono = JsonReader.Deserialize<List<Caption>>(po.result);
        print(po.result);
    }
Example #25
0
        override public void paint(SdlDotNet.Graphics.Surface surface, bool focused, Point offset)
        {
            Caption.SizeWithIcon = false;

            Point dest = new Point((Width - Caption.Width) / 2 + offset.X,
                                   (Height - Caption.Height) / 2 + offset.Y);

            Rectangle rect = new Rectangle(offset, Dimensions);

            surface.Fill(rect, DisplaySettings.atomForeground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;
            surface.Fill(rect, pressed ? DisplaySettings.atomBackgroundDimmed : DisplaySettings.atomBackground);
            rect.Width  -= Compound.BorderPadding.Width * 2;
            rect.Height -= Compound.BorderPadding.Height * 2;
            rect.X      += Compound.BorderPadding.Width;
            rect.Y      += Compound.BorderPadding.Height;

            Rectangle oldClipper = surface.ClipRectangle;

            surface.ClipRectangle = rect;

            Caption.Blit(surface, dest);

            surface.ClipRectangle = oldClipper;
        }
Example #26
0
        void CreateComponents()
        {
            rootGroup = new GraphicGroup("root");
            rootGroup.Debug = true;
            AddGraphic(rootGroup);

            // Use a layout handler so all our graphics line up vertically
            rootGroup.LayoutHandler = new LinearLayout(rootGroup, 4, 4, Orientation.Vertical);

            StringLabel lookLabel = new StringLabel("Look Here:", 0, 0);

            StringLabel boxLabel = new StringLabel("Box", 0, 0);

            Caption cap = new Caption(lookLabel, boxLabel, Position.Right, 4);
            rootGroup.AddGraphic(cap, null);


        //    Switch aSwitch = new Switch("switch1", 100, 200, 100, 20, "Big Switch");
        //    aSwitch.Debug = true;
        //    rootGroup.AddGraphic(aSwitch);

            GraphicGroup controlGroup = new GraphicGroup("controlGroup", 10, 300, 400, 20);
            controlGroup.LayoutHandler = new LinearLayout(controlGroup, 4, 0, Orientation.Vertical);

            GraphicGroup layout1 = new GraphicGroup("layout1", 0, 0, 400, 40);
            layout1.LayoutHandler = new LinearLayout(layout1, 2, 0, Orientation.Horizontal);

            PushButton button1 = new PushButton("Pushy1", 0, 0, 100, 24, new StringLabel("Button1", 0, 0));
            button1.MouseUpEvent += new MouseEventHandler(this.ButtonActivity);
            layout1.AddGraphic(button1);

            PushButton button2 = new PushButton("Play", 104, 0, 100, 24, new StringLabel("Button2", 0, 0));
            button2.MouseDownEvent += new MouseEventHandler(this.PlayActivity);
            layout1.AddGraphic(button2);


            TrackSlider slider = new TrackSlider("slider",
                new GrayTrack("track", 0, 0, 200, 20),
                new GrayBox("box", 0, 0, 20, 16),
                Orientation.Horizontal,
                0, 255, 255);
            slider.PositionChangedEvent += new EventHandler(slider_PositionChangedEvent);

            controlGroup.AddGraphic(slider);
            controlGroup.AddGraphic(layout1);

            rootGroup.AddGraphic(controlGroup);

        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ProgrammingBarCode();
            string dst = dataDir + "barcode-caption.jpg";

            //Instantiate barcode object
            BarCodeBuilder bb = new BarCodeBuilder();

            //Set the Code text for the barcode
            bb.CodeText = "1234567";

            //Set the symbology type to Code128
            bb.SymbologyType = Symbology.Code128;

            bb.CaptionAbove.Visible = false;

            //Create caption object. Set its text and text alignment & also make it visible
            Caption caption = new Caption();
            caption.Text = "Aspose";
            caption.TextAlign = System.Drawing.StringAlignment.Center;
            caption.Visible = true;
            caption.Font = new System.Drawing.Font("Pristina", 14f);
            caption.ForeColor = System.Drawing.Color.Red;

            //Assign caption object to be displayed above the barcode
            bb.CaptionAbove = caption;

            Caption captionBelow = new Caption();
            captionBelow.Text = "Aspose.BarCode Caption Below";
            captionBelow.TextAlign = System.Drawing.StringAlignment.Center;
            captionBelow.Visible = true;
            captionBelow.Font = new System.Drawing.Font("Pristina", 14f);
            captionBelow.ForeColor = System.Drawing.Color.OrangeRed;

            //Assign caption object to be displayed below the barcode
            bb.CaptionBelow = captionBelow;

            //Save the image to your system and set its image format to Jpeg
            bb.Save(dst, System.Drawing.Imaging.ImageFormat.Jpeg);

            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dst);
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128)
            {
                CaptionAbove = {Visible = false}
            };

            // Create caption object. Set its text and text alignment & also make it visible
            Caption caption = new Caption
            {
                Text = "Aspose",
                TextAlign = StringAlignment.Center,
                Visible = true,
                Font = new Font("Pristina", 14f),
                ForeColor = Color.Red
            };

            // Assign caption object to be displayed above the barcode
            barCodeBuilder.CaptionAbove = caption;
            Caption captionBelow = new Caption
            {
                Text = "Aspose.BarCode Caption Below",
                TextAlign = StringAlignment.Center,
                Visible = true,
                Font = new Font("Pristina", 14f),
                ForeColor = Color.OrangeRed
            };

            // Assign caption object to be displayed below the barcode
            barCodeBuilder.CaptionBelow = captionBelow;

            // Save the image to your system and set its image format to Jpeg
            barCodeBuilder.Save(dataDir + "barcode-caption_out.jpg", ImageFormat.Jpeg);

        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);

            // Create caption object. Set its text and text alignment & also make it visible
            Caption caption = new Caption
            {
                Text = "Aspose.BarCode",
                TextAlign = StringAlignment.Center,
                Visible = true
            };

            // Assign caption object to be displayed above and below the barcode
            barCodeBuilder.CaptionAbove = caption;
            barCodeBuilder.CaptionBelow = caption;

            // Save the image to your system and set its image format to Jpeg
            barCodeBuilder.Save(dataDir + "ManageCaption_out.jpg", ImageFormat.Jpeg);
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir);
        }
Example #30
0
        /// <summary>
        /// インスタンスを Caption 値に変換する。
        /// </summary>
        /// <param name="outputSize">出力スクリーンサイズ。</param>
        /// <param name="screenSize">編集スクリーンサイズ。</param>
        /// <returns>Caption 値。</returns>
        public Caption ToCaption(Size outputSize, Size screenSize)
        {
            if (outputSize.Width <= 0 || outputSize.Height <= 0)
            {
                throw new ArgumentOutOfRangeException(
                    "outputSize",
                    outputSize,
                    "出力スクリーンサイズ値が不正です。");
            }

            float rateX = (float)screenSize.Width / outputSize.Width;
            float rateY = (float)screenSize.Height / outputSize.Height;

            var dest = new Caption(string.Empty);

            dest.Location = new Vector3(this.X * rateX, this.Y * rateY, this.Z);
            dest.Rotate = this.Angle;
            dest.HorizontalAlignment = this.HorizontalAlignment;
            dest.LineSpace = this.LineSpace * rateY;
            dest.LetterSpace = this.LetterSpace * rateX;
            dest.FontFamily = new FontFamily(this.FontName);
            dest.FontSize = CalcCaptionFontSize(this.FontSize * rateY);
            dest.FontStyle =
                (this.FontBold ? FontStyle.Bold : 0) |
                (this.FontItalic ? FontStyle.Italic : 0) |
                (this.FontUnderline ? FontStyle.Underline : 0) |
                (this.FontStrike ? FontStyle.Strikeout : 0);
            dest.TextColor = this.TextColor;
            dest.Alpha = this.Alpha;
            dest.DrawTextBorder = this.EdgeEnabled;
            dest.TextBorderColor = this.EdgeColor;
            dest.TextBorderWeight = this.EdgeWidth * rateY;
            dest.DrawShadow = this.ShadowEnabled;
            dest.ShadowDistance = this.ShadowDistance * rateY;

            return dest;
        }
        private async void AugmentCaption(Caption caption, object payload, TimeSpan startTime, TimeSpan endTime)
        {
            if (caption != null)
            {
                string result = null;
                if (payload is byte[])
                {
                    var byteArray = (byte[])payload;
#if SILVERLIGHT && !WINDOWS_PHONE || WINDOWS_PHONE7
                    result = await TaskEx.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#else
                    result = await Task.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#endif
                    //result = System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length);
                }
                else if (payload is string)
                {
                    result = (string)payload;
                }
                if (result != null)
                {
                    allTasks = EnqueueTask(() => AugmentWebVTT(result, startTime, endTime), allTasks);
                    await allTasks;
                }
            }
        }
 void OnSelectedCaptionChanged(Caption caption)
 {
     if (CaptionsList != null) CaptionsList.SelectedItem = caption;
 }
Example #33
0
        private void MediaPlayer_SelectedCaptionChanged(object sender, RoutedPropertyChangedEventArgs<PlayerFramework.Caption> e)
        {
            // this value could be null, but we still want to set it to turn off the captions
            CurrentTrack = e.NewValue as Caption;

            // temporary test data!
            //controller.InjectTestData();
        }
        internal List<Caption> GetSubtitles(BaseItemDto item)
        {
            var list = new List<Caption>();
            if (item.MediaStreams == null)
                return list;
            foreach (var caption in item.MediaStreams.Where(s => s.Type == MediaStreamType.Subtitle))
            {
                var menuItem = new Caption
                {
                    Id = caption.Index.ToString(CultureInfo.InvariantCulture),
                    //Language = caption.Language,
                    //Name = caption.Language,
                    Description = caption.Language
                };

                if (caption.IsTextSubtitleStream)
                {
                    var source = item.MediaSources.FirstOrDefault();
                    var id = source != null ? source.Id : string.Empty;
                    menuItem.Source = new Uri(string.Format("{0}/mediabrowser/Videos/{1}/{2}/Subtitles/{3}/Stream.vtt", ApiClient.ServerAddress, item.Id, id, caption.Index));
                }

                list.Add(menuItem);
            }
            return list;
        }
 /// <summary>
 /// Updates the current caption track.
 /// Will cause the caption source to download and get parsed, and will will start playing.
 /// </summary>
 /// <param name="caption">The caption track to use.</param>
 public void UpdateCaption(Caption caption)
 {
     markerManager.Clear();
     captionsPanel.Clear();
     RefreshCaption(caption);
 }
        private async void RefreshCaption(Caption caption)
        {
            if (caption != null)
            {
                string result = null;
                if (caption.Payload is Uri)
                {
                    try
                    {
                        result = await ((Uri)caption.Payload).LoadToString();
                    }
                    catch
                    {
                        // TODO: expose event to log errors
                        return;
                    }
                }
                else if (caption.Payload is byte[])
                {
                    var byteArray = (byte[])caption.Payload;
#if SILVERLIGHT && !WINDOWS_PHONE || WINDOWS_PHONE7
                    result = await TaskEx.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#else
                    result = await Task.Run(() => System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length));
#endif
                    //result = System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length);
                }
                else if (caption.Payload is string)
                {
                    result = (string)caption.Payload;
                }

                if (result != null)
                {
                    allTasks = EnqueueTask(() => LoadWebVTT(result), allTasks);
                    await allTasks;
                    IsSourceLoaded = true;

                    // refresh the caption based on the current position. Fixes issue where caption is changed while paused.
                    if (IsLoaded) // make sure we didn't get unloaded by the time this completed.
                    {
                        captionsPanel.UpdatePosition(MediaPlayer.Position);
                    }
                }
            }
        }