Пример #1
0
 private string GetViewerLink(string DocType)
 {
     if (!string.IsNullOrEmpty(DocDescription))
     {
         if (DocType.Equals("FileLink"))                                                          //for file link
         {
             if (DocDescription.Contains("google.com") && DocDescription.Contains("usp=sharing")) //if it is google share link
             {
                 return(string.Concat(DocDescription.Substring(0, DocDescription.LastIndexOf("/")), "/preview"));
             }
             else if (DocDescription.Contains("youtube.com")) //if it is utube share link
             {
                 return(DocDescription.Replace("watch?v=", "embed/"));
             }
             else // if it is any other web link
             {
                 return(DocDescription);
             }
         }
         else  // for phsical file
         {
             return(string.Format("https://docs.google.com/gview?url={0}&embedded=true", DocDescription));
         }
     }
     else
     {
         return(string.Format("https://docs.google.com/gview?url={0}&embedded=true", string.Empty));
     }
 }
Пример #2
0
        /// <summary>
        /// 传参数处理
        /// </summary>
        /// <param name="parameter"></param>
        protected override void OnParameterChanged(object parameter)
        {
            var menuDescription = parameter as MenuDescription;

            if (menuDescription != null)
            {
                DocDescription docDesc = new DocDescription();
                base.Icon     = menuDescription.Icon;
                base.DocTitle = menuDescription.MenuTitle;
            }
            base.OnParameterChanged(parameter);
        }
Пример #3
0
 /// <summary>
 /// Write comments if not empty
 /// </summary>
 private void CreateComments(DocDescription description, string originalJavaName)
 {
     if (description == null)
     {
         if (!string.IsNullOrEmpty(originalJavaName))
         {
             var builder = new CommentBuilder();
             builder.JavaName.Write(originalJavaName);
             builder.WriteTo(writer, indent);
         }
         return;
     }
     description.WriteAsCode(writer, indent, resolver, originalJavaName);
 }