Skip to content

Commit

Permalink
Clean up warnings in CKEditorProvider
Browse files Browse the repository at this point in the history
26 obsolete warnings remain

Co-authored-by: Daniel Valadas <info@danielvaladas.com>
  • Loading branch information
bdukes and valadas committed Dec 17, 2020
1 parent d7ebd22 commit 75c116e
Show file tree
Hide file tree
Showing 44 changed files with 8,236 additions and 8,458 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Script.Serialization;

using DNNConnect.CKEditorProvider.Objects;
using DNNConnect.CKEditorProvider.Utilities;
using DotNetNuke.Entities.Users;
using DotNetNuke.Services.FileSystem;

namespace DNNConnect.CKEditorProvider.Browser
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Script.Serialization;

using DNNConnect.CKEditorProvider.Objects;
using DNNConnect.CKEditorProvider.Utilities;
using DotNetNuke.Entities.Users;
using DotNetNuke.Services.FileSystem;

/// <summary>
/// The File Upload Handler.
Expand Down Expand Up @@ -211,10 +209,9 @@ private void UploadWholeFile(HttpContext context, List<FilesUploadStatus> status
}
}

var fileManager = FileManager.Instance;
var contentType = fileManager.GetContentType(Path.GetExtension(fileName));
var contentType = FileContentTypeManager.Instance.GetContentType(Path.GetExtension(fileName));
var userId = UserController.Instance.GetCurrentUserInfo().UserID;
fileManager.AddFile(this.StorageFolder, fileName, file.InputStream, this.OverrideFiles, true, contentType, userId);
FileManager.Instance.AddFile(this.StorageFolder, fileName, file.InputStream, this.OverrideFiles, true, contentType, userId);

var fullName = Path.GetFileName(fileName);
statuses.Add(new FilesUploadStatus(fullName, file.ContentLength));
Expand Down Expand Up @@ -244,4 +241,4 @@ private void WriteJsonIframeSafe(HttpContext context, List<FilesUploadStatus> st
context.Response.Write(jsonObj);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Web;

using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Security.Permissions;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.FileSystem;

namespace DNNConnect.CKEditorProvider.Browser
{
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Web;

using DotNetNuke.Entities.Portals;
using DotNetNuke.Security.Permissions;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.FileSystem;

/// <summary>
/// The process image.
/// </summary>
public class ProcessImage : IHttpHandler
{
#region Properties

/// <summary>
/// Gets a value indicating whether IsReusable.
/// </summary>
Expand All @@ -35,10 +30,6 @@ public bool IsReusable
}
}

#endregion

#region Public Methods

/// <summary>
/// The get thumb abort.
/// </summary>
Expand All @@ -50,12 +41,6 @@ public bool GetThumbAbort()
return false;
}

#endregion

#region Implemented Interfaces

#region IHttpHandler

/// <summary>
/// The process request.
/// </summary>
Expand Down Expand Up @@ -102,7 +87,6 @@ public void ProcessRequest(HttpContext context)
if (file == null)
{
return;

}

Bitmap img = (Bitmap)Image.FromStream(FileManager.Instance.GetFileContent(file));
Expand Down Expand Up @@ -180,27 +164,15 @@ public void ProcessRequest(HttpContext context)
img.Dispose();
}

private bool HasWritePermission(string relativePath)
{
var portalId = PortalSettings.Current.PortalId;
return FolderPermissionController.HasFolderPermission(portalId, relativePath, "WRITE");
}

#endregion

#endregion

#region Methods

/// <summary>
/// Generats the New File Path.
/// Generates the New File Path.
/// </summary>
/// <param name="file">
/// The Original Image.
/// </param>
/// <param name="sNewFileName">
/// New File Name for the Image.
/// </param>
/// <param name="sSourceFullPath">
/// The Full Path of the Original Image.
/// </param>
/// <returns>
/// The generate name.
/// </returns>
Expand Down Expand Up @@ -290,11 +262,28 @@ private static Image RotateImage(Image img, double rotationAngle)
g.RotateTransform((float)rotationAngle);
g.TranslateTransform(-(float)img.Width / 2, -(float)img.Height / 2);

g.DrawImage(img, img.Width / 2 - img.Height / 2, img.Height / 2 - img.Width / 2, img.Height, img.Width);
g.DrawImage(img, (img.Width / 2) - (img.Height / 2), (img.Height / 2) - (img.Width / 2), img.Height, img.Width);

return returnBitmap;
}

private static string CleanName(string name)
{
name = name.Replace("\\", "/");
if (name.Contains("/"))
{
name = name.Substring(name.LastIndexOf('/') + 1);
}

return name;
}

private bool HasWritePermission(string relativePath)
{
var portalId = PortalSettings.Current.PortalId;
return FolderPermissionController.HasFolderPermission(portalId, relativePath, "WRITE");
}

/// <summary>
/// The resize image.
/// </summary>
Expand All @@ -315,18 +304,5 @@ private Bitmap ResizeImage(Image img, int width, int height)
Image.GetThumbnailImageAbort callback = this.GetThumbAbort;
return (Bitmap)img.GetThumbnailImage(width, height, callback, IntPtr.Zero);
}

private static string CleanName(string name)
{
name = name.Replace("\\", "/");
if (name.Contains("/"))
{
name = name.Substring(name.LastIndexOf('/') + 1);
}

return name;
}

#endregion
}
}
}
Loading

0 comments on commit 75c116e

Please sign in to comment.