mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Don't use _ prefix for variables
This commit is contained in:
parent
25afbce774
commit
ac14199044
8 changed files with 106 additions and 106 deletions
|
@ -67,15 +67,15 @@ public static class Helpers
|
|||
|
||||
public static readonly Version OSVersion = Environment.OSVersion.Version;
|
||||
|
||||
private static Cursor[] _cursorList;
|
||||
private static Cursor[] cursorList;
|
||||
|
||||
public static Cursor[] CursorList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cursorList == null)
|
||||
if (cursorList == null)
|
||||
{
|
||||
_cursorList = new Cursor[] {
|
||||
cursorList = new Cursor[] {
|
||||
Cursors.AppStarting, Cursors.Arrow, Cursors.Cross, Cursors.Default, Cursors.Hand, Cursors.Help,
|
||||
Cursors.HSplit, Cursors.IBeam, Cursors.No, Cursors.NoMove2D, Cursors.NoMoveHoriz, Cursors.NoMoveVert,
|
||||
Cursors.PanEast, Cursors.PanNE, Cursors.PanNorth, Cursors.PanNW, Cursors.PanSE, Cursors.PanSouth,
|
||||
|
@ -84,7 +84,7 @@ public static Cursor[] CursorList
|
|||
};
|
||||
}
|
||||
|
||||
return _cursorList;
|
||||
return cursorList;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,15 +171,6 @@ public void Dispose()
|
|||
/// </summary>
|
||||
internal class WindowWrapper : IWin32Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to wrap</param>
|
||||
public WindowWrapper(IntPtr handle)
|
||||
{
|
||||
_hwnd = handle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Original ptr
|
||||
/// </summary>
|
||||
|
@ -187,11 +178,20 @@ public IntPtr Handle
|
|||
{
|
||||
get
|
||||
{
|
||||
return _hwnd;
|
||||
return hwnd;
|
||||
}
|
||||
}
|
||||
|
||||
private IntPtr _hwnd;
|
||||
private IntPtr hwnd;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to wrap</param>
|
||||
public WindowWrapper(IntPtr handle)
|
||||
{
|
||||
hwnd = handle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -78,51 +78,51 @@ private class CTaskbarList
|
|||
{
|
||||
}
|
||||
|
||||
private static readonly object _syncLock = new object();
|
||||
private static readonly object syncLock = new object();
|
||||
|
||||
private static ITaskbarList4 _taskbarList;
|
||||
private static ITaskbarList4 taskbarList;
|
||||
|
||||
private static ITaskbarList4 TaskbarList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_taskbarList == null)
|
||||
if (taskbarList == null)
|
||||
{
|
||||
lock (_syncLock)
|
||||
lock (syncLock)
|
||||
{
|
||||
if (_taskbarList == null)
|
||||
if (taskbarList == null)
|
||||
{
|
||||
_taskbarList = (ITaskbarList4)new CTaskbarList();
|
||||
_taskbarList.HrInit();
|
||||
taskbarList = (ITaskbarList4)new CTaskbarList();
|
||||
taskbarList.HrInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _taskbarList;
|
||||
return taskbarList;
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr _mainWindowHandle;
|
||||
private static IntPtr mainWindowHandle;
|
||||
|
||||
private static IntPtr MainWindowHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mainWindowHandle == IntPtr.Zero)
|
||||
if (mainWindowHandle == IntPtr.Zero)
|
||||
{
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
|
||||
if (currentProcess == null || currentProcess.MainWindowHandle == IntPtr.Zero)
|
||||
{
|
||||
_mainWindowHandle = IntPtr.Zero;
|
||||
mainWindowHandle = IntPtr.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mainWindowHandle = currentProcess.MainWindowHandle;
|
||||
mainWindowHandle = currentProcess.MainWindowHandle;
|
||||
}
|
||||
}
|
||||
|
||||
return _mainWindowHandle;
|
||||
return mainWindowHandle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ internal partial class TextDrawingInputBox : Form
|
|||
public string InputText { get; private set; }
|
||||
public TextDrawingOptions Options { get; private set; }
|
||||
|
||||
private int _processKeyCount;
|
||||
private int processKeyCount;
|
||||
|
||||
public TextDrawingInputBox(string text, TextDrawingOptions options, bool supportGradient)
|
||||
{
|
||||
|
@ -246,11 +246,11 @@ private void tsmiAlignmentBottom_Click(object sender, EventArgs e)
|
|||
|
||||
private void txtInput_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// if we get VK_PROCESSKEY, the next KeyUp event will be fired by the IME
|
||||
// If we get VK_PROCESSKEY, the next KeyUp event will be fired by the IME
|
||||
// we should ignore these when checking if enter is pressed (GH-3621)
|
||||
if (e.KeyCode == Keys.ProcessKey)
|
||||
{
|
||||
_processKeyCount += 1;
|
||||
processKeyCount += 1;
|
||||
}
|
||||
|
||||
if (e.KeyData == Keys.Enter || e.KeyData == Keys.Escape)
|
||||
|
@ -261,9 +261,9 @@ private void txtInput_KeyDown(object sender, KeyEventArgs e)
|
|||
|
||||
private void txtInput_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
// if _processKeyCount != 0, then this KeyUp event was fired by the
|
||||
// If processKeyCount != 0, then this KeyUp event was fired by the
|
||||
// IME suggestion box, not by the user intentionally pressing Enter
|
||||
if (_processKeyCount == 0)
|
||||
if (processKeyCount == 0)
|
||||
{
|
||||
if (e.KeyData == Keys.Enter)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ private void txtInput_KeyUp(object sender, KeyEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
_processKeyCount = Math.Max(0, _processKeyCount - 1);
|
||||
processKeyCount = Math.Max(0, processKeyCount - 1);
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -69,15 +69,17 @@ public class Jira : FileUploader, IOAuth
|
|||
private const string PathBrowseIssue = "/browse/{0}";
|
||||
private const string PathIssueAttachments = PathApi + "/issue/{0}/attachments";
|
||||
|
||||
private static readonly X509Certificate2 _jiraCertificate;
|
||||
private static readonly X509Certificate2 jiraCertificate;
|
||||
|
||||
private readonly string _jiraBaseAddress;
|
||||
private readonly string _jiraIssuePrefix;
|
||||
public OAuthInfo AuthInfo { get; set; }
|
||||
|
||||
private Uri _jiraRequestToken;
|
||||
private Uri _jiraAuthorize;
|
||||
private Uri _jiraAccessToken;
|
||||
private Uri _jiraPathSearch;
|
||||
private readonly string jiraBaseAddress;
|
||||
private readonly string jiraIssuePrefix;
|
||||
|
||||
private Uri jiraRequestToken;
|
||||
private Uri jiraAuthorize;
|
||||
private Uri jiraAccessToken;
|
||||
private Uri jiraPathSearch;
|
||||
|
||||
#region Keypair
|
||||
|
||||
|
@ -91,7 +93,7 @@ static Jira()
|
|||
{
|
||||
byte[] pfx = new byte[stream.Length];
|
||||
stream.Read(pfx, 0, pfx.Length);
|
||||
_jiraCertificate = new X509Certificate2(pfx, "", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
|
||||
jiraCertificate = new X509Certificate2(pfx, "", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +101,7 @@ internal static string PrivateKey
|
|||
{
|
||||
get
|
||||
{
|
||||
return _jiraCertificate.PrivateKey.ToXmlString(true);
|
||||
return jiraCertificate.PrivateKey.ToXmlString(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +111,7 @@ internal static string PublicKey
|
|||
{
|
||||
const int LineBreakIdx = 50;
|
||||
|
||||
string publicKey = Convert.ToBase64String(ExportPublicKey(_jiraCertificate.PublicKey));
|
||||
string publicKey = Convert.ToBase64String(ExportPublicKey(jiraCertificate.PublicKey));
|
||||
int idx = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (char c in publicKey)
|
||||
|
@ -171,15 +173,13 @@ private static void CalculateAndAppendLength(ref List<byte> binaryData)
|
|||
|
||||
public Jira(string jiraBaseAddress, OAuthInfo oauth, string jiraIssuePrefix = null)
|
||||
{
|
||||
_jiraBaseAddress = jiraBaseAddress;
|
||||
this.jiraBaseAddress = jiraBaseAddress;
|
||||
AuthInfo = oauth;
|
||||
_jiraIssuePrefix = jiraIssuePrefix;
|
||||
this.jiraIssuePrefix = jiraIssuePrefix;
|
||||
|
||||
InitUris();
|
||||
}
|
||||
|
||||
public OAuthInfo AuthInfo { get; set; }
|
||||
|
||||
public string GetAuthorizationURL()
|
||||
{
|
||||
using (new SSLBypassHelper())
|
||||
|
@ -187,13 +187,13 @@ public string GetAuthorizationURL()
|
|||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args[OAuthManager.ParameterCallback] = "oob"; // Request activation code to validate authentication
|
||||
|
||||
string url = OAuthManager.GenerateQuery(_jiraRequestToken.ToString(), args, HttpMethod.POST, AuthInfo);
|
||||
string url = OAuthManager.GenerateQuery(jiraRequestToken.ToString(), args, HttpMethod.POST, AuthInfo);
|
||||
|
||||
string response = SendRequest(HttpMethod.POST, url);
|
||||
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
{
|
||||
return OAuthManager.GetAuthorizationURL(response, AuthInfo, _jiraAuthorize.ToString());
|
||||
return OAuthManager.GetAuthorizationURL(response, AuthInfo, jiraAuthorize.ToString());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -206,7 +206,7 @@ public bool GetAccessToken(string verificationCode)
|
|||
{
|
||||
AuthInfo.AuthVerifier = verificationCode;
|
||||
|
||||
NameValueCollection nv = GetAccessTokenEx(_jiraAccessToken.ToString(), AuthInfo, HttpMethod.POST);
|
||||
NameValueCollection nv = GetAccessTokenEx(jiraAccessToken.ToString(), AuthInfo, HttpMethod.POST);
|
||||
|
||||
return nv != null;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
{
|
||||
using (new SSLBypassHelper())
|
||||
{
|
||||
using (JiraUpload up = new JiraUpload(_jiraIssuePrefix, GetSummary))
|
||||
using (JiraUpload up = new JiraUpload(jiraIssuePrefix, GetSummary))
|
||||
{
|
||||
if (up.ShowDialog() == DialogResult.Cancel)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
};
|
||||
}
|
||||
|
||||
Uri uri = Combine(_jiraBaseAddress, string.Format(PathIssueAttachments, up.IssueId));
|
||||
Uri uri = Combine(jiraBaseAddress, string.Format(PathIssueAttachments, up.IssueId));
|
||||
string query = OAuthManager.GenerateQuery(uri.ToString(), null, HttpMethod.POST, AuthInfo);
|
||||
|
||||
NameValueCollection headers = new NameValueCollection();
|
||||
|
@ -244,7 +244,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
var anonType = new[] { new { thumbnail = "" } };
|
||||
var anonObject = JsonConvert.DeserializeAnonymousType(res.Response, anonType);
|
||||
res.ThumbnailURL = anonObject[0].thumbnail;
|
||||
res.URL = Combine(_jiraBaseAddress, string.Format(PathBrowseIssue, up.IssueId)).ToString();
|
||||
res.URL = Combine(jiraBaseAddress, string.Format(PathBrowseIssue, up.IssueId)).ToString();
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -260,7 +260,7 @@ private string GetSummary(string issueId)
|
|||
args["jql"] = string.Format("issueKey='{0}'", issueId);
|
||||
args["maxResults"] = "10";
|
||||
args["fields"] = "summary";
|
||||
string query = OAuthManager.GenerateQuery(_jiraPathSearch.ToString(), args, HttpMethod.GET, AuthInfo);
|
||||
string query = OAuthManager.GenerateQuery(jiraPathSearch.ToString(), args, HttpMethod.GET, AuthInfo);
|
||||
|
||||
string response = SendRequest(HttpMethod.GET, query);
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
|
@ -279,10 +279,10 @@ private string GetSummary(string issueId)
|
|||
|
||||
private void InitUris()
|
||||
{
|
||||
_jiraRequestToken = Combine(_jiraBaseAddress, PathRequestToken);
|
||||
_jiraAuthorize = Combine(_jiraBaseAddress, PathAuthorize);
|
||||
_jiraAccessToken = Combine(_jiraBaseAddress, PathAccessToken);
|
||||
_jiraPathSearch = Combine(_jiraBaseAddress, PathSearch);
|
||||
jiraRequestToken = Combine(jiraBaseAddress, PathRequestToken);
|
||||
jiraAuthorize = Combine(jiraBaseAddress, PathAuthorize);
|
||||
jiraAccessToken = Combine(jiraBaseAddress, PathAccessToken);
|
||||
jiraPathSearch = Combine(jiraBaseAddress, PathSearch);
|
||||
}
|
||||
|
||||
private Uri Combine(string path1, string path2)
|
||||
|
|
|
@ -65,21 +65,21 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer
|
|||
|
||||
public sealed class MediaFire : FileUploader
|
||||
{
|
||||
private static readonly string _apiUrl = "https://www.mediafire.com/api/";
|
||||
private static readonly int _pollInterval = 1000;
|
||||
private readonly string _appId, _apiKey, _user, _pasw;
|
||||
private string _sessionToken, _signatureTime;
|
||||
private int _signatureKey;
|
||||
|
||||
public string UploadPath { get; set; }
|
||||
public bool UseLongLink { get; set; }
|
||||
|
||||
private static readonly string apiUrl = "https://www.mediafire.com/api/";
|
||||
private static readonly int pollInterval = 1000;
|
||||
private readonly string appId, apiKey, user, pasw;
|
||||
private string sessionToken, signatureTime;
|
||||
private int signatureKey;
|
||||
|
||||
public MediaFire(string appId, string apiKey, string user, string pasw)
|
||||
{
|
||||
_appId = appId;
|
||||
_apiKey = apiKey;
|
||||
_user = user;
|
||||
_pasw = pasw;
|
||||
this.appId = appId;
|
||||
this.apiKey = apiKey;
|
||||
this.user = user;
|
||||
this.pasw = pasw;
|
||||
}
|
||||
|
||||
public override UploadResult Upload(Stream stream, string fileName)
|
||||
|
@ -90,37 +90,37 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
string key = SimpleUpload(stream, fileName);
|
||||
AllowReportProgress = false;
|
||||
string url = null;
|
||||
while ((url = PollUpload(key, fileName)) == null) Thread.Sleep(_pollInterval);
|
||||
while ((url = PollUpload(key, fileName)) == null) Thread.Sleep(pollInterval);
|
||||
return new UploadResult() { IsSuccess = true, URL = url };
|
||||
}
|
||||
|
||||
private void GetSessionToken()
|
||||
{
|
||||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args.Add("email", _user);
|
||||
args.Add("password", _pasw);
|
||||
args.Add("application_id", _appId);
|
||||
args.Add("email", user);
|
||||
args.Add("password", pasw);
|
||||
args.Add("application_id", appId);
|
||||
args.Add("token_version", "2");
|
||||
args.Add("response_format", "json");
|
||||
args.Add("signature", GetInitSignature());
|
||||
string respStr = SendRequestMultiPart(_apiUrl + "user/get_session_token.php", args);
|
||||
string respStr = SendRequestMultiPart(apiUrl + "user/get_session_token.php", args);
|
||||
GetSessionTokenResponse resp = DeserializeResponse<GetSessionTokenResponse>(respStr);
|
||||
EnsureSuccess(resp);
|
||||
if (resp.session_token == null || resp.time == null || resp.secret_key == null)
|
||||
throw new IOException("Invalid response");
|
||||
_sessionToken = resp.session_token;
|
||||
_signatureTime = resp.time;
|
||||
_signatureKey = (int)resp.secret_key;
|
||||
sessionToken = resp.session_token;
|
||||
signatureTime = resp.time;
|
||||
signatureKey = (int)resp.secret_key;
|
||||
}
|
||||
|
||||
private string SimpleUpload(Stream stream, string fileName)
|
||||
{
|
||||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args.Add("session_token", _sessionToken);
|
||||
args.Add("session_token", sessionToken);
|
||||
args.Add("path", UploadPath);
|
||||
args.Add("response_format", "json");
|
||||
args.Add("signature", GetSignature("upload/simple.php", args));
|
||||
string url = URLHelpers.CreateQuery(_apiUrl + "upload/simple.php", args);
|
||||
string url = URLHelpers.CreateQuery(apiUrl + "upload/simple.php", args);
|
||||
UploadResult res = SendRequestFile(url, stream, fileName, "Filedata");
|
||||
if (!res.IsSuccess) throw new IOException(res.ErrorsToString());
|
||||
SimpleUploadResponse resp = DeserializeResponse<SimpleUploadResponse>(res.Response);
|
||||
|
@ -132,12 +132,12 @@ private string SimpleUpload(Stream stream, string fileName)
|
|||
private string PollUpload(string uploadKey, string fileName)
|
||||
{
|
||||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args.Add("session_token", _sessionToken);
|
||||
args.Add("session_token", sessionToken);
|
||||
args.Add("key", uploadKey);
|
||||
args.Add("filename", fileName);
|
||||
args.Add("response_format", "json");
|
||||
args.Add("signature", GetSignature("upload/poll_upload.php", args));
|
||||
string respStr = SendRequestMultiPart(_apiUrl + "upload/poll_upload.php", args);
|
||||
string respStr = SendRequestMultiPart(apiUrl + "upload/poll_upload.php", args);
|
||||
PollUploadResponse resp = DeserializeResponse<PollUploadResponse>(respStr);
|
||||
EnsureSuccess(resp);
|
||||
if (resp.doupload.result == null || resp.doupload.status == null) throw new IOException("Invalid response");
|
||||
|
@ -165,7 +165,7 @@ private void EnsureSuccess(MFResponse resp)
|
|||
|
||||
private string GetInitSignature()
|
||||
{
|
||||
string signatureStr = _user + _pasw + _appId + _apiKey;
|
||||
string signatureStr = user + pasw + appId + apiKey;
|
||||
byte[] signatureBytes = Encoding.ASCII.GetBytes(signatureStr);
|
||||
SHA1 sha1Gen = SHA1.Create();
|
||||
byte[] sha1Bytes = sha1Gen.ComputeHash(signatureBytes);
|
||||
|
@ -174,9 +174,9 @@ private string GetInitSignature()
|
|||
|
||||
private string GetSignature(string urlSuffix, Dictionary<string, string> args)
|
||||
{
|
||||
string keyStr = (_signatureKey % 256).ToString(CultureInfo.InvariantCulture);
|
||||
string keyStr = (signatureKey % 256).ToString(CultureInfo.InvariantCulture);
|
||||
string urlStr = CreateNonEscapedQuery("/api/" + urlSuffix, args);
|
||||
string signatureStr = keyStr + _signatureTime + urlStr;
|
||||
string signatureStr = keyStr + signatureTime + urlStr;
|
||||
byte[] signatureBytes = Encoding.ASCII.GetBytes(signatureStr);
|
||||
MD5 md5gen = MD5.Create();
|
||||
byte[] md5Bytes = md5gen.ComputeHash(signatureBytes);
|
||||
|
@ -185,7 +185,7 @@ private string GetSignature(string urlSuffix, Dictionary<string, string> args)
|
|||
|
||||
private void NextSignatureKey()
|
||||
{
|
||||
_signatureKey = (int)(((long)_signatureKey * 16807) % 2147483647);
|
||||
signatureKey = (int)(((long)signatureKey * 16807) % 2147483647);
|
||||
}
|
||||
|
||||
private T DeserializeResponse<T>(string s) where T : new()
|
||||
|
|
|
@ -63,9 +63,9 @@ public sealed class Mega : FileUploader, IWebClient
|
|||
// It allows to have a consistent upload progression in ShareX
|
||||
private const int UploadChunksPackSize = -1;
|
||||
|
||||
private readonly MegaApiClient _megaClient;
|
||||
private readonly MegaApiClient.AuthInfos _authInfos;
|
||||
private readonly string _parentNodeId;
|
||||
private readonly MegaApiClient megaClient;
|
||||
private readonly MegaApiClient.AuthInfos authInfos;
|
||||
private readonly string parentNodeId;
|
||||
|
||||
public Mega() : this(null, null)
|
||||
{
|
||||
|
@ -79,9 +79,9 @@ public Mega(MegaApiClient.AuthInfos authInfos, string parentNodeId)
|
|||
{
|
||||
AllowReportProgress = false;
|
||||
Options options = new Options(chunksPackSize: UploadChunksPackSize);
|
||||
_megaClient = new MegaApiClient(options, this);
|
||||
_authInfos = authInfos;
|
||||
_parentNodeId = parentNodeId;
|
||||
megaClient = new MegaApiClient(options, this);
|
||||
this.authInfos = authInfos;
|
||||
this.parentNodeId = parentNodeId;
|
||||
}
|
||||
|
||||
public bool TryLogin()
|
||||
|
@ -99,19 +99,19 @@ public bool TryLogin()
|
|||
|
||||
private void Login()
|
||||
{
|
||||
if (_authInfos == null)
|
||||
if (authInfos == null)
|
||||
{
|
||||
_megaClient.LoginAnonymous();
|
||||
megaClient.LoginAnonymous();
|
||||
}
|
||||
else
|
||||
{
|
||||
_megaClient.Login(_authInfos);
|
||||
megaClient.Login(authInfos);
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<DisplayNode> GetDisplayNodes()
|
||||
{
|
||||
IEnumerable<INode> nodes = _megaClient.GetNodes().Where(n => n.Type == NodeType.Directory || n.Type == NodeType.Root).ToArray();
|
||||
IEnumerable<INode> nodes = megaClient.GetNodes().Where(n => n.Type == NodeType.Directory || n.Type == NodeType.Root).ToArray();
|
||||
List<DisplayNode> displayNodes = new List<DisplayNode>();
|
||||
|
||||
foreach (INode node in nodes)
|
||||
|
@ -127,23 +127,23 @@ internal IEnumerable<DisplayNode> GetDisplayNodes()
|
|||
|
||||
public INode GetParentNode()
|
||||
{
|
||||
if (_authInfos == null || _parentNodeId == null)
|
||||
if (authInfos == null || parentNodeId == null)
|
||||
{
|
||||
return _megaClient.GetNodes().SingleOrDefault(n => n.Type == NodeType.Root);
|
||||
return megaClient.GetNodes().SingleOrDefault(n => n.Type == NodeType.Root);
|
||||
}
|
||||
|
||||
return _megaClient.GetNodes().SingleOrDefault(n => n.Id == _parentNodeId);
|
||||
return megaClient.GetNodes().SingleOrDefault(n => n.Id == parentNodeId);
|
||||
}
|
||||
|
||||
public override UploadResult Upload(Stream stream, string fileName)
|
||||
{
|
||||
Login();
|
||||
|
||||
INode createdNode = _megaClient.Upload(stream, fileName, GetParentNode());
|
||||
INode createdNode = megaClient.Upload(stream, fileName, GetParentNode());
|
||||
|
||||
UploadResult res = new UploadResult();
|
||||
res.IsURLExpected = true;
|
||||
res.URL = _megaClient.GetDownloadLink(createdNode).ToString();
|
||||
res.URL = megaClient.GetDownloadLink(createdNode).ToString();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ public partial class JiraUpload : Form
|
|||
{
|
||||
public delegate string GetSummaryHandler(string issueId);
|
||||
|
||||
private readonly string _issuePrefix;
|
||||
private readonly GetSummaryHandler _getSummary;
|
||||
private readonly string issuePrefix;
|
||||
private readonly GetSummaryHandler getSummary;
|
||||
|
||||
public string IssueId
|
||||
{
|
||||
|
@ -60,15 +60,15 @@ public JiraUpload(string issuePrefix, GetSummaryHandler getSummary) : this()
|
|||
{
|
||||
throw new ArgumentNullException("getSummary");
|
||||
}
|
||||
_issuePrefix = issuePrefix;
|
||||
_getSummary = getSummary;
|
||||
this.issuePrefix = issuePrefix;
|
||||
this.getSummary = getSummary;
|
||||
}
|
||||
|
||||
private void JiraUpload_Load(object sender, EventArgs e)
|
||||
{
|
||||
UpdateSummary(null);
|
||||
|
||||
txtIssueId.Text = _issuePrefix;
|
||||
txtIssueId.Text = issuePrefix;
|
||||
txtIssueId.SelectionStart = txtIssueId.Text.Length;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ private void btnSend_Click(object sender, EventArgs e)
|
|||
|
||||
private void ValidateIssueId(string issueId)
|
||||
{
|
||||
Task.Run(() => _getSummary(issueId)).ContinueWith(UpdateSummaryAsync);
|
||||
Task.Run(() => getSummary(issueId)).ContinueWith(UpdateSummaryAsync);
|
||||
}
|
||||
|
||||
private void UpdateSummaryAsync(Task<string> task)
|
||||
|
|
Loading…
Reference in a new issue