Exemplo n.º 1
0
        /// <summary>
        /// Возвращает страницы Wiki по запросу
        /// </summary>
        /// <returns></returns>
        protected override object MainProcess()
        {
            var page = new WikiPage {
                Code = Code, Title = Title ?? "", Text = Text ?? ""
            };

            foreach (var parameter in Context.Parameters)
            {
                if (
                    parameter.Key.ToUpper() != "CODE" &&
                    parameter.Key.ToUpper() != "TEXT" &&
                    parameter.Key.ToUpper() != "TITLE"
                    )
                {
                    page.Propeties[parameter.Key] = parameter.Value;
                }
            }
            var success = WikiSource.Save(page);

            if (!success)
            {
                throw new Exception("Вы не имеет прав на редактирование страницы. Страница заблокирована.");
            }

            return(WikiSource.Get(null, Code).First());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Возвращает страницы Wiki по запросу
        /// </summary>
        /// <returns></returns>
        protected override object MainProcess()
        {
            if (PageVersion != null)
            {
                return(WikiSource.GetWikiPageByVersion(Code, PageVersion));
            }

            return(WikiSource.Get(Usage, Code.SmartSplit(false, true, ',').ToArray()).ToArray());
        }
Exemplo n.º 3
0
        /// <summary>
        ///     processing of execution - main method of action
        /// </summary>
        /// <returns> </returns>
        protected override object MainProcess()
        {
            var file = WikiSource.LoadBinary(Code, WithData);

            if (null == file)
            {
                throw new Exception("file not found");
            }
            var filedesc = new FileDescriptor();

            filedesc.NeedDisposition = AsFile;
            filedesc.LastWriteTime   = file.LastWriteTime;
            filedesc.MimeType        = file.MimeType;
            filedesc.Data            = file.Data;
            filedesc.Length          = (int)file.Size;
            return(filedesc);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Возвращает найденные дескрипторы
        /// </summary>
        /// <returns></returns>
        protected override object MainProcess()
        {
            var type = WikiObjectType.None;

            if (Files)
            {
                type = type | WikiObjectType.File;
            }
            if (Pages)
            {
                type = type | WikiObjectType.Page;
            }
            if (string.IsNullOrEmpty(Search))
            {
                Search = "*";
            }
            return(WikiSource.Find(Search, Start, Count, type).ToArray()
                   );
        }
Exemplo n.º 5
0
        /// <summary>
        /// Сохраняет файл в Wiki
        /// </summary>
        /// <returns></returns>
        protected override object MainProcess()
        {
            var srcname = _file.FileName;
            var ext     = Path.GetExtension(srcname);
            var mime    = MimeHelper.GetMimeByExtension(ext);
            var binobj  = new WikiBinary();

            binobj.Code     = Code;
            binobj.Title    = string.IsNullOrWhiteSpace(Title) ? Code : Title;
            binobj.MimeType = mime;
            var data = new byte[_file.ContentLength];

            using (var s = _file.InputStream) {
                s.Read(data, 0, (int)s.Length);
            }
            binobj.Data = data;
            WikiSource.SaveBinary(binobj);
            return(true);
        }
 /// <summary>
 /// Возвращает страницы Wiki по запросу
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.CreateVersion(Code, Comment));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Играет роль хэш-функции для определенного типа.
 /// </summary>
 /// <returns>
 /// Хэш-код для текущего объекта <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     return(WikiRenderVersion * 10000 + WikiSerializer.GetHashCode() * 100 + WikiSource.GetHashCode() * 10);
 }
 /// <summary>
 /// Возвращает страницы Wiki по запросу
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.RestoreVersion(Code, Version));
 }
Exemplo n.º 9
0
 /// <summary>
 ///     override if Yr action provides 304 state  and return Last-Modified-State header
 /// </summary>
 /// <returns> </returns>
 protected override DateTime EvalLastModified()
 {
     return(WikiSource.GetVersion(Code, WikiObjectType.File));
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.GetLock(Code));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Возвращает страницы Wiki по запросу
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.GetVersionsList(Code));
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.Releaselock(Code));
 }
Exemplo n.º 13
0
 /// <summary>
 /// ¬озвращает страницы Wiki по запросу
 /// </summary>
 /// <returns></returns>
 protected override object MainProcess()
 {
     return(WikiSource.Exists(Code.SmartSplit(false, true, ',').ToArray()).ToArray());
 }