Ejemplo n.º 1
0
        public void GetProductPic(ProductInfo productInfo)
        {
            productInfo.ProductPic = this.FileUploadProductPic.FilePath;
            string oldValue          = base.BasePath + SiteConfig.SiteOption.UploadDir;
            string originalImagePath = productInfo.ProductPic.Replace(oldValue, "");

            if (this.ChkThumb.Checked)
            {
                if (!string.IsNullOrEmpty(productInfo.ProductPic))
                {
                    try
                    {
                        string extension = Path.GetExtension(productInfo.ProductPic);
                        string str4      = productInfo.ProductPic.Replace(extension, "_S" + extension);
                        productInfo.ProductThumb = Thumbs.GetThumbsPath(originalImagePath, str4.Replace(oldValue, ""));
                    }
                    catch (ArgumentException)
                    {
                        BaseUserControl.WriteErrMsg("<li>生成缩略图的路径中具有非法字符!</li>");
                    }
                }
            }
            else
            {
                productInfo.ProductThumb = this.FileUploadProductThumb.FilePath;
            }
            if (this.ChkProductPicWatermark.Checked && !string.IsNullOrEmpty(productInfo.ProductPic))
            {
                WaterMark.AddWaterMark(originalImagePath);
            }
            if (((this.ChkProductPicWatermark.Checked && this.ChkThumb.Checked) || this.ChkProductThumbWatermark.Checked) && !string.IsNullOrEmpty(productInfo.ProductThumb))
            {
                WaterMark.AddWaterMark(productInfo.ProductThumb.Replace(oldValue, ""));
            }
        }
Ejemplo n.º 2
0
        protected void CreateThumb(string filePath, string fileName, string extension)
        {
            string str = this.m_CurrentDir + "/" + filePath + "/";

            if (this.IsPhoto(extension))
            {
                Thumbs.GetThumbsPath(str + fileName, str + Path.GetFileNameWithoutExtension(fileName) + "_S." + extension);
            }
        }
Ejemplo n.º 3
0
        public async Task <BeatmapThumb> GetThumb(Beatmap beatmap)
        {
            var thumb = await Thumbs
                        .AsNoTracking()
                        .Include(k => k.BeatmapStoryboard)
                        .FirstOrDefaultAsync(k => k.BeatmapId == beatmap.Id);

            return(thumb);
        }
Ejemplo n.º 4
0
 private void RenderThumbs()
 {
     for (var i = 0; i < PageCount; i++)
     {
         var thumbPath = Data.GetThumbFile(Data.Instance.Lesson.Name, i);
         var thumb     = BitmapHelper.Load(thumbPath);
         Thumbs.Add(new KeyValuePair <int, BitmapSource>(i, thumb));
     }
 }
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            var install = Windows.ApplicationModel.Package.Current.InstalledLocation;
            var images  = await install.GetFolderAsync("Images");

            var backgrounds = await images.GetFolderAsync("Backgrounds");

            var thumbs = await _fileService.ThumbnailsAsync(backgrounds, 300, ".jpg");

            Thumbs.AddRange(thumbs);
        }
Ejemplo n.º 6
0
        public IActionResult ThumbsConfig()
        {
            var    thumbsConfig = ConfigHelper.Get <ThumbsConfig>();
            string strMsg       = "AddBackColor:" + thumbsConfig.AddBackColor + " ";

            strMsg         += "ThumbsMode:" + thumbsConfig.ThumbsMode + " ";
            strMsg         += "ThumbsWidth:" + thumbsConfig.ThumbsWidth + " ";
            strMsg         += "ThumbsHeight:" + thumbsConfig.ThumbsHeight + " ";
            strMsg         += "静态文件目录路径:" + FileHelper.WebRootPath + " ";
            strMsg         += "静态文件目录名称:" + FileHelper.WebRootName + " ";
            ViewData["Msg"] = strMsg;

            var thumbUrl = Thumbs.GetThumbUrl(Utility.GetBasePath() + Utility.UploadDirPath() + "test.jpg", true);

            ViewData["ImageUrl"] = Url.Content(thumbUrl);

            var thumbPath = Thumbs.GetThumbPath(Utility.UploadDirPath(true) + "test1.jpg", true);

            ViewData["ImagePath"] = Url.Content(thumbPath);

            var    waterMarkConfig = ConfigHelper.Get <WaterMarkConfig>();
            string strWaterMarkMsg = "WaterMarkType:" + waterMarkConfig.WaterMarkType + " ";

            strWaterMarkMsg += "FoneBorder:" + waterMarkConfig.WaterMarkTextInfo.FoneBorder + " ";
            strWaterMarkMsg += "FoneBorderColor:" + waterMarkConfig.WaterMarkTextInfo.FoneBorderColor + " ";
            strWaterMarkMsg += "FoneColor:" + waterMarkConfig.WaterMarkTextInfo.FoneColor + " ";
            strWaterMarkMsg += "FoneSize:" + waterMarkConfig.WaterMarkTextInfo.FoneSize + " ";
            strWaterMarkMsg += "FoneStyle:" + waterMarkConfig.WaterMarkTextInfo.FoneStyle + " ";
            strWaterMarkMsg += "FoneType:" + waterMarkConfig.WaterMarkTextInfo.FoneType + " ";
            strWaterMarkMsg += "Text:" + waterMarkConfig.WaterMarkTextInfo.Text + " ";
            strWaterMarkMsg += "WaterMarkPosition:" + waterMarkConfig.WaterMarkTextInfo.WaterMarkPosition + " ";
            strWaterMarkMsg += "WaterMarkPositionX:" + waterMarkConfig.WaterMarkTextInfo.WaterMarkPositionX + " ";
            strWaterMarkMsg += "WaterMarkPositionY:" + waterMarkConfig.WaterMarkTextInfo.WaterMarkPositionY + " ";

            strWaterMarkMsg         += "ImagePath:" + waterMarkConfig.WaterMarkImageInfo.ImagePath + " ";
            strWaterMarkMsg         += "Transparence:" + waterMarkConfig.WaterMarkImageInfo.Transparence + " ";
            strWaterMarkMsg         += "WaterMarkPercent:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkPercent + " ";
            strWaterMarkMsg         += "WaterMarkPercentType:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkPercentType + " ";
            strWaterMarkMsg         += "WaterMarkPosition:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkPosition + " ";
            strWaterMarkMsg         += "WaterMarkPositionX:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkPositionX + " ";
            strWaterMarkMsg         += "WaterMarkPositionY:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkPositionY + " ";
            strWaterMarkMsg         += "WaterMarkThumbPercent:" + waterMarkConfig.WaterMarkImageInfo.WaterMarkThumbPercent + " ";
            ViewData["WaterMarkMsg"] = strWaterMarkMsg;

            WaterMark.AddWaterMark(FileHelper.WebRootName + FileHelper.DirectorySeparatorChar + Utility.UploadDirPath() + "test.jpg");
            ViewData["WaterUrl"] = Url.Content(Utility.GetBasePath() + Utility.UploadDirPath() + "test.jpg");

            waterMarkConfig.WaterMarkType          = 0;
            waterMarkConfig.WaterMarkTextInfo.Text = "asp.net core";
            ConfigHelper.Save(waterMarkConfig);

            return(View());
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create(Photo photo)
        {
            if (photo.CategoryID < 0)
            {
                ModelState.AddModelError("CategoryID", "Wybierz kategorię");
            }

            if (ModelState.IsValid)
            {
                //add category
                photo.Category = repository.Categories
                                 .Where(c => c.CategoryID == photo.CategoryID)
                                 .FirstOrDefault();

                //check flename
                int    i           = 1;
                string tmpFileName = photo.FileName;
                while (repository.CheckFileExist(photo.FileName))
                {
                    photo.FileName = "(" + i + ")" + tmpFileName;
                    ++i;
                }

                //remove spaces
                tmpFileName = photo.FileName.Replace(" ", "_");

                //upload file
                var filePath = Path.Combine(Directory.GetCurrentDirectory(),
                                            photosDirectory, tmpFileName);
                using (var stream = new FileStream(filePath, FileMode.Create)) {
                    await photo.FileToUpload.CopyToAsync(stream);
                }

                photo.FileName = tmpFileName;

                //create thumbs
                Thumbs.Create(photo.FileName, configuration);

                //save to database
                repository.SavePhoto(photo);
                TempData["message"] = $"Plik {photo.FileName} został zapisany";
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.Categories = categoryList;
                return(View(photo));
            }
        }
Ejemplo n.º 8
0
        public async Task AddOrUpdateThumbPath(Beatmap beatmap, string path)
        {
            var thumb = await Thumbs.FirstOrDefaultAsync(k => k.BeatmapId == beatmap.Id);

            if (thumb != null)
            {
                thumb.ThumbPath = path;
            }
            else
            {
                Thumbs.Add(new BeatmapThumb {
                    Beatmap = beatmap, ThumbPath = path, Id = Guid.NewGuid()
                });
            }

            await SaveChangesAsync();
        }
Ejemplo n.º 9
0
    public async void CreateThumbnail()
    {
        await Task.Run(() =>
        {
            if (File.Exists(BoxFrontPath))
            {
                try
                {
                    using System.Drawing.Image image = System.Drawing.Image.FromFile(BoxFrontPath);
#if DEBUG
                    Stopwatch Watch = Stopwatch.StartNew();
#endif
                    File.Delete(BoxFrontThumbPath);
#if DEBUG
                    Debug.WriteLine("Delete" + Watch.ElapsedMilliseconds);
                    Watch.Restart();
#endif
                    if (image.Width > 255)
                    {
                        System.Drawing.Image thumb = Thumbs.ResizeImage(image, 255);
                        thumb.Save(BoxFrontThumbPath);
                    }

                    else
                    {
                        File.Copy(BoxFrontPath, BoxFrontThumbPath);
                    }
#if DEBUG
                    Debug.WriteLine("Create" + Watch.ElapsedMilliseconds);
                    Watch.Restart();
#endif
                }
                catch (OutOfMemoryException)
                {
                    File.Delete(BoxFrontPath);
                    Reporter.Report("Bad image file: " + BoxFrontPath + " - " + Title + ", file deleted.");
                }
                OnPropertyChanged("BoxFrontThumbFile");
                OnPropertyChanged("MainDisplay");
                Game.OnPropertyChanged("BoxFrontThumbFile");
                Game.OnPropertyChanged("MainDisplay");
            }
        });
    }
Ejemplo n.º 10
0
        public void YouTubeVideoThumbnailGeneration()
        {
            ContentItem ci = new ContentItem("Cute Owls", @"http://www.youtube.com/watch?v=a-LIfVJus8w",
                                             "No more kittens on youtube, there's a desire for change. Now people prefer to upload videos of little funny owls.",
                                             MediaType.GetMediaGuid(MediaTypes.Video));

            ci.ID = new Guid();

            ctrl.MakeThumbsForItem(ci);

            foreach (Size s in Utils.GetSizes())
            {
                string p = @"http://czbeta.blob.core.windows.net/images/" +
                           Thumbs.GenerateThumbnailUrlString(ci.ID, s.Width.ToString());
                if (Utils.GetImage(new Uri(p)).PixelWidth != s.Width)
                {
                    Assert.Fail("Test image was not created properly");
                }
            }

            ctrl.DeleteThumbsForItemID(ci.ID);
        }
Ejemplo n.º 11
0
        public void VimeoVideoThumbnailGeneration()
        {
            ContentItem ci = new ContentItem("Windsurfing JAWS", @"http://player.vimeo.com/video/2696386",
                                             "Windsurf is life",
                                             MediaType.GetMediaGuid(MediaTypes.Video));

            ci.ID = new Guid();

            ctrl.MakeThumbsForItem(ci);

            foreach (Size s in Utils.GetSizes())
            {
                string p = @"http://czbeta.blob.core.windows.net/images/" +
                           Thumbs.GenerateThumbnailUrlString(ci.ID, s.Width.ToString());
                if (Utils.GetImage(new Uri(p)).PixelWidth != s.Width)
                {
                    Assert.Fail("Test image was not created properly");
                }
            }

            ctrl.DeleteThumbsForItemID(ci.ID);
        }
Ejemplo n.º 12
0
        public PointF GetJoystickRaw(Thumbs thumb)
        {
            switch (thumb)
            {
            case Thumbs.ThumbLeft:
                float xL = controller.GetState().Gamepad.LeftThumbX;
                float yL = controller.GetState().Gamepad.LeftThumbY;

                return(new PointF(xL, yL));

                break;

            case Thumbs.ThumbRight:
                float xR = controller.GetState().Gamepad.RightThumbX;
                float yR = controller.GetState().Gamepad.RightThumbY;
                return(new PointF(xR, yR));

                break;

            default:
                throw new System.ArgumentException("Passed value was not of either appropriate thumb type, could you perhaps have a special controller? Please file a issue report on https://github.com/CooperParlee/XbOneInterface.", "original");
            }
        }
Ejemplo n.º 13
0
        public void ImageThumbnailGeneration()
        {
            ContentItem ci = new ContentItem("Tamias striatus",
                                             @"http://upload.wikimedia.org/wikipedia/commons/f/f4/Tamias_striatus_CT.jpg",
                                             "The eastern chipmunk (Tamias striatus) is a chipmunk species native to eastern North America. Like other chipmunks, they transport food in pouches in their cheeks, as seen here. They eat bulbs, seeds, fruits, nuts, green plants, mushrooms, insects, worms, and bird eggs.",
                                             MediaType.GetMediaGuid(MediaTypes.Image));

            ci.ID = new Guid();

            ctrl.MakeThumbsForItem(ci);

            foreach (Size s in Utils.GetSizes())
            {
                string p = @"http://czbeta.blob.core.windows.net/images/" +
                           Thumbs.GenerateThumbnailUrlString(ci.ID, s.Width.ToString());
                if (Utils.GetImage(new Uri(p)).PixelWidth != s.Width)
                {
                    Assert.Fail("Test image was not created properly");
                }
            }

            ctrl.DeleteThumbsForItemID(ci.ID);
        }
Ejemplo n.º 14
0
        public PointF GetJoystick(Thumbs thumb) //Returns a point (x and a y) that the specified joystick is located at.
        {
            PointF buffer;

            buffer = GetJoystickRaw(thumb);

            buffer.X = buffer.X / xrange;
            buffer.Y = buffer.Y / yrange;

            if (Math.Abs(buffer.X) < deadzone)
            {
                buffer.X = 0;
            }
            Console.WriteLine(buffer.Y);
            if (Math.Abs(buffer.Y) < deadzone)
            {
                buffer.Y = 0;
            }



            return(buffer);
        }
Ejemplo n.º 15
0
        protected override void OnLoad(EventArgs e)
        {
            HttpPostedFile file              = base.Request.Files["NewFile"];
            string         str               = Path.GetExtension(file.FileName).ToLower();
            string         uploaderType      = base.Request.Form["UploaderType"];
            bool           flag              = DataConverter.CBoolean(base.Request.Form["IsWatermark"]);
            bool           flag2             = DataConverter.CBoolean(base.Request.Form["IsThumb"]);
            int            modelId           = DataConverter.CLng(base.Request.Form["ModelId"]);
            string         str3              = DataSecurity.FilterBadChar(base.Request.Form["FieldName"]);
            string         allowSuffix       = "";
            int            uploadFileMaxSize = 0;
            int            uploadSize        = 0;
            string         customMsg         = "请检查网站信息配置是否设置允许的上传文件大小!";

            if (!SiteConfig.SiteOption.EnableUploadFiles)
            {
                this.SendResults(0xcc);
            }
            else
            {
                if (!PEContext.Current.Admin.Identity.IsAuthenticated)
                {
                    if (!PEContext.Current.User.Identity.IsAuthenticated)
                    {
                        UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(-2);
                        if (string.IsNullOrEmpty(userGroupById.GroupSetting))
                        {
                            this.SendResults(1, "", "", "匿名会员组不存在!");
                            return;
                        }
                        UserPurviewInfo groupSetting = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
                        if (groupSetting.IsNull)
                        {
                            this.SendResults(1, "", "", "匿名会员组没有进行权限设置!");
                            return;
                        }
                        if (!groupSetting.EnableUpload)
                        {
                            this.SendResults(1, "", "", "匿名会员组没有开启上传权限!");
                            return;
                        }
                        uploadSize = groupSetting.UploadSize;
                    }
                    else
                    {
                        if (!PEContext.Current.User.UserInfo.UserPurview.EnableUpload)
                        {
                            this.SendResults(1, "", "", "所属会员组没有开启上传权限!");
                            return;
                        }
                        uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
                    }
                }
                if ((file == null) || (file.ContentLength == 0))
                {
                    this.SendResults(0xca);
                }
                else
                {
                    if ((modelId == 0) || string.IsNullOrEmpty(str3))
                    {
                        if (!ConfigurationManager.AppSettings["EasyOne:DefaultUploadSuffix"].ToLower().Contains(str))
                        {
                            this.SendResults(1, "", "", "不允许上传动态页文件!");
                            return;
                        }
                        uploadFileMaxSize = SiteConfig.SiteOption.UploadFileMaxSize;
                    }
                    else
                    {
                        IList <FieldInfo> fieldListByModelId = ModelManager.GetFieldListByModelId(modelId);
                        if ((fieldListByModelId != null) && (fieldListByModelId.Count > 0))
                        {
                            foreach (FieldInfo info3 in fieldListByModelId)
                            {
                                if (string.CompareOrdinal(info3.FieldName, str3) == 0)
                                {
                                    allowSuffix = GetAllowSuffix(info3, uploaderType);
                                    if (info3.Settings.Count > 7)
                                    {
                                        uploadFileMaxSize = DataConverter.CLng(info3.Settings[7]);
                                    }
                                    break;
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(allowSuffix))
                        {
                            this.SendResults(1, "", "", "字段内容控件没有填写允许上传的后缀!");
                            return;
                        }
                        if (!allowSuffix.Contains(str.Replace(".", "")))
                        {
                            this.SendResults(1, "", "", "这种文件类型不允许上传!只允许上传这几种文件类型:" + allowSuffix);
                            return;
                        }
                        customMsg = "请检查所属字段控件是否设置了允许上传文件大小!";
                    }
                    if (uploadFileMaxSize <= 0)
                    {
                        this.SendResults(1, "", "", customMsg);
                    }
                    else
                    {
                        if (!PEContext.Current.Admin.Identity.IsAuthenticated && (uploadFileMaxSize > uploadSize))
                        {
                            uploadFileMaxSize = uploadSize;
                        }
                        if (file.ContentLength > (uploadFileMaxSize * 0x400))
                        {
                            this.SendResults(1, "", "", "请上传小于" + uploadFileMaxSize.ToString() + "KB的文件!");
                        }
                        else
                        {
                            string str9;
                            int    errorNumber = 0;
                            string fileUrl     = "";
                            string str7        = DataSecurity.MakeFileRndName();
                            string str8        = str7 + str;
                            int    num5        = 0;
                            while (true)
                            {
                                str9 = Path.Combine(base.UserFilesDirectory, str8);
                                if (!File.Exists(str9))
                                {
                                    break;
                                }
                                num5++;
                                str8        = string.Concat(new object[] { Path.GetFileNameWithoutExtension(file.FileName), "(", num5, ")", Path.GetExtension(file.FileName) });
                                errorNumber = 0xc9;
                            }
                            file.SaveAs(str9);
                            fileUrl = base.UserFilesPath + str8;
                            if (!string.IsNullOrEmpty(uploaderType) && (string.CompareOrdinal(uploaderType, "Photo") == 0))
                            {
                                string oldValue = "";
                                if (base.Request.ApplicationPath.EndsWith("/", StringComparison.Ordinal))
                                {
                                    oldValue = ("/" + SiteConfig.SiteOption.UploadDir + "/").Replace("//", "/");
                                }
                                else
                                {
                                    oldValue = base.Request.ApplicationPath + "/" + SiteConfig.SiteOption.UploadDir;
                                }
                                if (flag2)
                                {
                                    string str11 = base.UserFilesPath + str7 + "_S" + str;
                                    Thumbs.GetThumbsPath(fileUrl.Replace(oldValue, ""), str11.Replace(oldValue, ""));
                                }
                                if (flag)
                                {
                                    WaterMark.AddWaterMark(fileUrl.Replace(oldValue, ""));
                                }
                            }
                            this.SendResults(errorNumber, fileUrl, str8);
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        public void Start()
        {
            //  If the application GUI shouldn't be loaded
            if (_preventGUILaunch)
            {
                return;
            }

            using (ProcessLock processLock = new ProcessLock(configMutex))
            {
                if (processLock.AlreadyExists)
                {
                    Log.Warn("Main: Configuration is already running");
                    Win32API.ActivatePreviousInstance();
                }

                // Check for a MediaPortal Instance running and don't allow Configuration to start
                using (ProcessLock mpLock = new ProcessLock(mpMutex))
                {
                    if (mpLock.AlreadyExists)
                    {
                        DialogResult dialogResult = MessageBox.Show(
                            "MediaPortal has to be closed for configuration.\nClose MediaPortal and start Configuration?",
                            "MediaPortal", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (dialogResult == DialogResult.Yes)
                        {
                            Util.Utils.KillProcess("Watchdog");
                            Util.Utils.KillProcess("MediaPortal");
                            Log.Info("MediaPortal closed, continue running Configuration.");
                        }
                        else
                        {
                            Log.Warn("Main: MediaPortal is running - start of Configuration aborted");
                            return;
                        }
                    }
                }

                string MpConfig = Assembly.GetExecutingAssembly().Location;
#if !DEBUG
                // Check TvPlugin version
                string tvPlugin = Config.GetFolder(Config.Dir.Plugins) + "\\Windows\\TvPlugin.dll";
                if (File.Exists(tvPlugin) && !_avoidVersionChecking)
                {
                    string tvPluginVersion = FileVersionInfo.GetVersionInfo(tvPlugin).ProductVersion;
                    string CfgVersion      = FileVersionInfo.GetVersionInfo(MpConfig).ProductVersion;
                    if (CfgVersion != tvPluginVersion)
                    {
                        string strLine = "TvPlugin and MediaPortal don't have the same version.\r\n";
                        strLine += "Please update the older component to the same version as the newer one.\r\n";
                        strLine += "MpConfig Version: " + CfgVersion + "\r\n";
                        strLine += "TvPlugin Version: " + tvPluginVersion;
                        MessageBox.Show(strLine, "MediaPortal", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Log.Info(strLine);
                        return;
                    }
                }
#endif

                FileInfo mpFi = new FileInfo(MpConfig);
                Log.Info("Assembly creation time: {0} (UTC)", mpFi.LastWriteTimeUtc.ToUniversalTime());

                Form applicationForm = null;

                Thumbs.CreateFolders();

                switch (startupMode)
                {
                case StartupMode.Normal:
                    Log.Info("Create new standard setup");
                    applicationForm = new SettingsForm(_debugOptions);
                    break;
                }

                if (applicationForm != null)
                {
                    Log.Info("start application");
                    Application.Run(applicationForm);
                }
            }
        }
Ejemplo n.º 17
0
        protected void BtnUpload_Click(object sender, EventArgs e)
        {
            if (!this.FupFile.HasFile)
            {
                this.ReturnManage("上传失败,重新上传。");
                return;
            }
            int  uploadFileMaxSize = 0;
            int  uploadSize        = 0;
            bool flag  = false;
            bool flag2 = false;

            if (!SiteConfig.SiteOption.EnableUploadFiles)
            {
                this.ReturnManage("权限错误:对不起网站没有开启上传权限。");
                return;
            }
            if (!PEContext.Current.Admin.Identity.IsAuthenticated)
            {
                if (!PEContext.Current.User.Identity.IsAuthenticated)
                {
                    UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(-2);
                    if (string.IsNullOrEmpty(userGroupById.GroupSetting))
                    {
                        this.ReturnManage("匿名会员组不存在!");
                        return;
                    }
                    UserPurviewInfo groupSetting = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
                    if (groupSetting.IsNull)
                    {
                        this.ReturnManage("匿名会员组没有进行权限设置!");
                        return;
                    }
                    if (!groupSetting.EnableUpload)
                    {
                        this.ReturnManage("匿名会员组没有开启上传权限!");
                        return;
                    }
                    uploadSize = groupSetting.UploadSize;
                }
                else
                {
                    if (!PEContext.Current.User.UserInfo.UserPurview.EnableUpload)
                    {
                        this.ReturnManage("所属会员组没有开启上传权限!");
                        return;
                    }
                    uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
                }
            }
            string str = Path.GetExtension(this.FupFile.FileName).ToLower();

            if (!this.CheckFilePostfix(str.Replace(".", "")))
            {
                this.ReturnManage("上传文件类型不对!必须上传" + this.m_FileExtArr + "的后缀名!");
                return;
            }
            if (string.Compare(this.m_ModuleName, "Node", StringComparison.OrdinalIgnoreCase) == 0)
            {
                FieldInfo           fieldInfoByFieldName = Field.GetFieldInfoByFieldName(this.m_ModelId, this.m_FieldName);
                Collection <string> settings             = fieldInfoByFieldName.Settings;
                switch (fieldInfoByFieldName.FieldType)
                {
                case FieldType.PictureType:
                    uploadFileMaxSize = DataConverter.CLng(settings[1]);
                    flag2             = DataConverter.CBoolean(settings[4]);
                    flag = DataConverter.CBoolean(settings[5]);
                    goto Label_01EA;

                case FieldType.FileType:
                    uploadFileMaxSize = DataConverter.CLng(settings[0]);
                    goto Label_01EA;
                }
            }
            else
            {
                uploadFileMaxSize = SiteConfig.SiteOption.UploadFileMaxSize;
            }
Label_01EA:
            if (!PEContext.Current.Admin.Identity.IsAuthenticated && (uploadFileMaxSize > uploadSize))
            {
                uploadFileMaxSize = uploadSize;
            }
            if (((int)this.FupFile.FileContent.Length) > (uploadFileMaxSize * 0x400))
            {
                this.ReturnManage("请上传小于" + uploadFileMaxSize.ToString() + "KB的文件!");
            }
            else
            {
                string str2     = DataSecurity.MakeFileRndName();
                string filename = FileSystemObject.CreateFileFolder((VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + this.FileSavePath()).Replace("//", "/"), HttpContext.Current) + str2 + str;
                this.FupFile.SaveAs(filename);
                string thumbnailPath = "";
                if (flag)
                {
                    thumbnailPath = this.m_ShowPath + str2 + "_S" + str;
                    Thumbs.GetThumbsPath(this.m_ShowPath + str2 + str, thumbnailPath);
                }
                else
                {
                    thumbnailPath = this.m_ShowPath + str2 + str;
                }
                if (flag2)
                {
                    WaterMark.AddWaterMark(this.m_ShowPath + str2 + str);
                }
                EasyOne.Model.Accessories.FileInfo fileInfo = new EasyOne.Model.Accessories.FileInfo();
                fileInfo.Name  = this.FupFile.FileName;
                fileInfo.Path  = thumbnailPath;
                fileInfo.Size  = (int)this.FupFile.FileContent.Length;
                fileInfo.Quote = 1;
                if (string.Compare(this.m_ModuleName, "soft", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    Files.Add(fileInfo);
                }
                this.GetScriptByModuleName(fileInfo);
                this.ReturnManage("上传成功!");
            }
        }
 protected void BtnUpload_Click(object sender, EventArgs e)
 {
     if (!SiteConfig.SiteOption.EnableUploadFiles)
     {
         this.LblMessage.Text = "权限错误:你当前的网站没有开启上传功能,请检查你的网站配置。";
     }
     else
     {
         string str = BasePage.RequestString("ReturnJSFunction");
         int    num = DataConverter.CLng(base.Request.Form["ThumbIndex"]);
         if (string.IsNullOrEmpty(str))
         {
             str = "DealwithUpload";
         }
         StringBuilder builder = new StringBuilder();
         builder.Append("<script language=\"javascript\" type=\"text/javascript\">");
         int           num2     = 0;
         StringBuilder builder2 = new StringBuilder();
         if (!PEContext.Current.Admin.Identity.IsAuthenticated)
         {
             int uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
             if (this.m_PhotoSize > uploadSize)
             {
                 this.m_PhotoSize = uploadSize;
             }
         }
         for (int i = 0; i < 10; i++)
         {
             num2++;
             System.Web.UI.WebControls.FileUpload upload = (System.Web.UI.WebControls.FileUpload) this.FindControl("FileUpload" + i.ToString());
             if (upload.HasFile)
             {
                 string str2 = Path.GetExtension(upload.FileName).ToLower();
                 if (!this.CheckFilePostfix(str2.Replace(".", "")))
                 {
                     builder2.Append("文件" + upload.FileName + "上传文件类型不对!必须上传" + this.m_FileExtArr + @"的后缀名!\n");
                 }
                 else if (((int)upload.FileContent.Length) > (this.m_PhotoSize * 0x400))
                 {
                     builder2.Append("文件" + upload.FileName + "请上传小于" + this.m_PhotoSize.ToString() + @"KB的文件!\n");
                 }
                 else
                 {
                     string str3     = DataSecurity.MakeFileRndName() + i.ToString();
                     string filename = FileSystemObject.CreateFileFolder((VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + this.FileSavePath(upload.FileName)).Replace("//", "/"), HttpContext.Current) + str3 + str2;
                     upload.SaveAs(filename);
                     Thumbs.GetThumbsPath(this.m_ShowPath + str3 + str2, this.m_ShowPath + str3 + "_S" + str2);
                     if (this.m_Watermark)
                     {
                         WaterMark.AddWaterMark(this.m_ShowPath + str3 + str2);
                     }
                     EasyOne.Model.Accessories.FileInfo fileInfo = new EasyOne.Model.Accessories.FileInfo();
                     fileInfo.Name  = upload.FileName;
                     fileInfo.Path  = this.m_ShowPath + str3 + str2;
                     fileInfo.Size  = (int)upload.FileContent.Length;
                     fileInfo.Quote = 1;
                     Files.Add(fileInfo);
                     if (i == num)
                     {
                         builder.Append("parent." + str + "ChangeThumbField(\"" + fileInfo.Path + "\",\"" + this.m_ShowPath + str3 + "_S" + str2 + "\");");
                     }
                     else
                     {
                         builder.Append("parent." + str + "DealwithUpload(\"" + fileInfo.Path + "\",\"" + fileInfo.Size.ToString() + "\",\"" + fileInfo.Id.ToString() + "\",\"" + this.m_ShowPath + str3 + "_S" + str2 + "\");");
                     }
                     builder2.Append("文件" + upload.FileName + @"上传成功!\n");
                 }
             }
         }
         if (builder2.Length > 0)
         {
             builder.Append("parent." + str + "ErrMessage(\"" + builder2.ToString() + "\");");
         }
         builder.Append("</script>");
         this.Page.ClientScript.RegisterStartupScript(base.GetType(), "UpdateParent", builder.ToString());
     }
 }