Update user agent setting
This commit is contained in:
Ryutaro Koma 2023-12-27 17:35:14 +09:00
Родитель 7669fbdf25
Коммит 7abb4f225c
7 изменённых файлов: 71 добавлений и 41 удалений

Просмотреть файл

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: AssemblyVersion("1.3.3.1")]
[assembly: AssemblyFileVersion("1.3.3.1")]

40
Office365APIEditor/UI/MailboxViewerForm.Designer.cs сгенерированный
Просмотреть файл

@ -53,6 +53,7 @@
this.contextMenuStrip_FolderTreeCalendarNode = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ToolStripMenuItem_Calendar_OpenContentTable = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem_Calendar_OpenCalendarView = new System.Windows.Forms.ToolStripMenuItem();
this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -149,14 +150,14 @@
// newSessionToolStripMenuItem
//
this.newSessionToolStripMenuItem.Name = "newSessionToolStripMenuItem";
this.newSessionToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.newSessionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.newSessionToolStripMenuItem.Text = "&New Session...";
this.newSessionToolStripMenuItem.Click += new System.EventHandler(this.newSessionToolStripMenuItem_Click);
//
// closeSessionToolStripMenuItem
//
this.closeSessionToolStripMenuItem.Name = "closeSessionToolStripMenuItem";
this.closeSessionToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.closeSessionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.closeSessionToolStripMenuItem.Text = "&Close Session";
this.closeSessionToolStripMenuItem.Click += new System.EventHandler(this.closeSessionToolStripMenuItem_Click);
//
@ -174,28 +175,28 @@
// newMessageToolStripMenuItem
//
this.newMessageToolStripMenuItem.Name = "newMessageToolStripMenuItem";
this.newMessageToolStripMenuItem.Size = new System.Drawing.Size(212, 22);
this.newMessageToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.newMessageToolStripMenuItem.Text = "New &Message...";
this.newMessageToolStripMenuItem.Click += new System.EventHandler(this.NewMessageToolStripMenuItem_Click);
//
// newEventToolStripMenuItem
//
this.newEventToolStripMenuItem.Name = "newEventToolStripMenuItem";
this.newEventToolStripMenuItem.Size = new System.Drawing.Size(212, 22);
this.newEventToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.newEventToolStripMenuItem.Text = "New &Event...";
this.newEventToolStripMenuItem.Click += new System.EventHandler(this.newEventToolStripMenuItem_Click);
//
// focusedInboxOverridesToolStripMenuItem
//
this.focusedInboxOverridesToolStripMenuItem.Name = "focusedInboxOverridesToolStripMenuItem";
this.focusedInboxOverridesToolStripMenuItem.Size = new System.Drawing.Size(212, 22);
this.focusedInboxOverridesToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.focusedInboxOverridesToolStripMenuItem.Text = "&Focused Inbox Overrides...";
this.focusedInboxOverridesToolStripMenuItem.Click += new System.EventHandler(this.FocusedInboxOverridesToolStripMenuItem_Click);
//
// calendarViewToolStripMenuItem
//
this.calendarViewToolStripMenuItem.Name = "calendarViewToolStripMenuItem";
this.calendarViewToolStripMenuItem.Size = new System.Drawing.Size(212, 22);
this.calendarViewToolStripMenuItem.Size = new System.Drawing.Size(213, 22);
this.calendarViewToolStripMenuItem.Text = "&Calendar View...";
this.calendarViewToolStripMenuItem.Click += new System.EventHandler(this.CalendarViewToolStripMenuItem_Click);
//
@ -203,22 +204,23 @@
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newEditorToolStripMenuItem,
this.accessTokenViewerToolStripMenuItem});
this.accessTokenViewerToolStripMenuItem,
this.optionToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
this.toolsToolStripMenuItem.Text = "&Tools";
//
// newEditorToolStripMenuItem
//
this.newEditorToolStripMenuItem.Name = "newEditorToolStripMenuItem";
this.newEditorToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.newEditorToolStripMenuItem.Size = new System.Drawing.Size(194, 22);
this.newEditorToolStripMenuItem.Text = "New &Editor...";
this.newEditorToolStripMenuItem.Click += new System.EventHandler(this.newEditorToolStripMenuItem_Click);
//
// accessTokenViewerToolStripMenuItem
//
this.accessTokenViewerToolStripMenuItem.Name = "accessTokenViewerToolStripMenuItem";
this.accessTokenViewerToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.accessTokenViewerToolStripMenuItem.Size = new System.Drawing.Size(194, 22);
this.accessTokenViewerToolStripMenuItem.Text = "&Generic Token Viewer...";
this.accessTokenViewerToolStripMenuItem.Click += new System.EventHandler(this.accessTokenViewerToolStripMenuItem_Click);
//
@ -234,14 +236,14 @@
// checkForUpdatesToolStripMenuItem
//
this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
this.checkForUpdatesToolStripMenuItem.Text = "&Check for updates...";
this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
//
// versionInformationToolStripMenuItem
//
this.versionInformationToolStripMenuItem.Name = "versionInformationToolStripMenuItem";
this.versionInformationToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.versionInformationToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
this.versionInformationToolStripMenuItem.Text = "&Version Information";
this.versionInformationToolStripMenuItem.Click += new System.EventHandler(this.versionInformationToolStripMenuItem_Click);
//
@ -252,22 +254,29 @@
this.ToolStripMenuItem_Calendar_OpenContentTable,
this.ToolStripMenuItem_Calendar_OpenCalendarView});
this.contextMenuStrip_FolderTreeCalendarNode.Name = "contextMenuStrip_FolderTreeNode";
this.contextMenuStrip_FolderTreeCalendarNode.Size = new System.Drawing.Size(181, 70);
this.contextMenuStrip_FolderTreeCalendarNode.Size = new System.Drawing.Size(179, 48);
//
// ToolStripMenuItem_Calendar_OpenContentTable
//
this.ToolStripMenuItem_Calendar_OpenContentTable.Name = "ToolStripMenuItem_Calendar_OpenContentTable";
this.ToolStripMenuItem_Calendar_OpenContentTable.Size = new System.Drawing.Size(180, 22);
this.ToolStripMenuItem_Calendar_OpenContentTable.Size = new System.Drawing.Size(178, 22);
this.ToolStripMenuItem_Calendar_OpenContentTable.Text = "Open content table";
this.ToolStripMenuItem_Calendar_OpenContentTable.Click += new System.EventHandler(this.ToolStripMenuItem_Calendar_OpenContentTable_Click);
//
// ToolStripMenuItem_Calendar_OpenCalendarView
//
this.ToolStripMenuItem_Calendar_OpenCalendarView.Name = "ToolStripMenuItem_Calendar_OpenCalendarView";
this.ToolStripMenuItem_Calendar_OpenCalendarView.Size = new System.Drawing.Size(180, 22);
this.ToolStripMenuItem_Calendar_OpenCalendarView.Size = new System.Drawing.Size(178, 22);
this.ToolStripMenuItem_Calendar_OpenCalendarView.Text = "Open calendar view";
this.ToolStripMenuItem_Calendar_OpenCalendarView.Click += new System.EventHandler(this.ToolStripMenuItem_Calendar_OpenCalendarView_Click);
//
// optionToolStripMenuItem
//
this.optionToolStripMenuItem.Name = "optionToolStripMenuItem";
this.optionToolStripMenuItem.Size = new System.Drawing.Size(194, 22);
this.optionToolStripMenuItem.Text = "&Option..";
this.optionToolStripMenuItem.Click += new System.EventHandler(this.optionToolStripMenuItem_Click);
//
// MailboxViewerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -320,5 +329,6 @@
private System.Windows.Forms.ContextMenuStrip contextMenuStrip_FolderTreeCalendarNode;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Calendar_OpenContentTable;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Calendar_OpenCalendarView;
private System.Windows.Forms.ToolStripMenuItem optionToolStripMenuItem;
}
}

Просмотреть файл

@ -784,6 +784,12 @@ namespace Office365APIEditor
};
tokenView.Show(this);
}
private void optionToolStripMenuItem_Click(object sender, EventArgs e)
{
// Open the Option window
RequestFormOptionForm optionForm = new RequestFormOptionForm();
optionForm.ShowDialog();
}
private void NewMessageToolStripMenuItem_Click(object sender, EventArgs e)
{

Просмотреть файл

@ -298,7 +298,7 @@
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(725, 281);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Encode";
this.tabPage2.Text = "Editor - Encode";
this.tabPage2.UseVisualStyleBackColor = true;
//
// checkBox_ReplaceSharpSignInTheRequestURL

Просмотреть файл

@ -54,7 +54,7 @@ namespace Office365APIEditor
checkBox_AllowAutoRedirect.Checked = Properties.Settings.Default.AllowAutoRedirect;
comboBox_CustomUserAgentStyle.Items.Add("Use system default UserAgent");
comboBox_CustomUserAgentStyle.Items.Add("Use default UserAgent");
comboBox_CustomUserAgentStyle.Items.Add("Use custom UserAgent");
//comboBox_CustomUserAgentStyle.Items.Add("Add custom UserAgent value as prefix");
//comboBox_CustomUserAgentStyle.Items.Add("Add custom UserAgent value as suffix");
@ -81,7 +81,7 @@ namespace Office365APIEditor
textBox_CustomUserAgent.Text = Properties.Settings.Default.CustomUserAgent;
//
// Load Encode tab.
// Load Editor - Encode tab.
//
checkBox_ReplacePlusSignInTheRequestURL.Checked = Properties.Settings.Default.ReplacePlusSignInTheRequestURL;

Просмотреть файл

@ -17,25 +17,7 @@ namespace Office365APIEditor.UI
{
Icon = Properties.Resources.DefaultIcon;
Version productVersion = Version.Parse(Application.ProductVersion);
string friendlyVersion = "";
if (productVersion.Revision == 0)
{
friendlyVersion = productVersion.ToString(3);
}
else
{
friendlyVersion = productVersion.ToString(4);
}
string debugIndicator = "";
#if DEBUG
debugIndicator += " (DEBUG)";
#endif
label_Version.Text += friendlyVersion + debugIndicator;
label_Version.Text += Util.VersionString;
// Read "3rd party notice.txt".
richTextBox_3rdPartyNotice.Text = Properties.Resources._3rd_party_notice;

Просмотреть файл

@ -260,6 +260,7 @@ namespace Office365APIEditor
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.AllowAutoRedirect = true;
request.UserAgent = Util.CustomUserAgent;
request.ContentType = "application/json";
request.Headers.Add("Authorization:Bearer " + AccessToken);
@ -293,6 +294,7 @@ namespace Office365APIEditor
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.AllowAutoRedirect = true;
request.UserAgent = Util.CustomUserAgent;
request.ContentType = "application/json";
request.Headers.Add("Authorization:Bearer " + AccessToken);
@ -336,6 +338,7 @@ namespace Office365APIEditor
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.AllowAutoRedirect = true;
request.UserAgent = Util.CustomUserAgent;
request.ContentType = "application/json";
request.Headers.Add("Authorization:Bearer " + AccessToken);
@ -369,6 +372,7 @@ namespace Office365APIEditor
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.AllowAutoRedirect = true;
request.UserAgent = Util.CustomUserAgent;
request.ContentType = "application/json";
request.Headers.Add("Authorization:Bearer " + AccessToken);
@ -457,9 +461,11 @@ namespace Office365APIEditor
// Custom UserAgent is a preview feature.
// We don't change all of UserAgent because we don't want to use urlmon.dll or ActiveX to change UserAgent of WebBrowser control.
string defaultUserAgent = "Office365APIEditor/" + VersionString;
if (Properties.Settings.Default.CustomUserAgentMode == 0)
{
return "";
return defaultUserAgent;
}
else if (Properties.Settings.Default.CustomUserAgentMode == 1)
{
@ -467,7 +473,7 @@ namespace Office365APIEditor
}
else
{
return "";
return defaultUserAgent;
}
}
}
@ -613,6 +619,32 @@ namespace Office365APIEditor
};
return errorForm.ShowDialog();
}
public static string VersionString
{
get
{
Version productVersion = Version.Parse(Application.ProductVersion);
string friendlyVersion = "";
if (productVersion.Revision == 0)
{
friendlyVersion = productVersion.ToString(3);
}
else
{
friendlyVersion = productVersion.ToString(4);
}
string debugIndicator = "";
#if DEBUG
debugIndicator += " (DEBUG)";
#endif
return friendlyVersion + debugIndicator;
}
}
}
public enum Resources