updating playlist listbox working, added playlist form
This commit is contained in:
parent
af57a4519d
commit
b840f2658f
@ -5,7 +5,7 @@
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6DD4019E-F67C-4CA3-90FF-BDAEF775F1D1}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Sarsoo.Alchemy.Forms</RootNamespace>
|
||||
<AssemblyName>Alchemy</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
@ -67,6 +67,12 @@
|
||||
<Compile Include="ConfigForm.Designer.cs">
|
||||
<DependentUpon>ConfigForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PlaylistForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlaylistForm.Designer.cs">
|
||||
<DependentUpon>PlaylistForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -81,6 +87,9 @@
|
||||
<EmbeddedResource Include="ConfigForm.resx">
|
||||
<DependentUpon>ConfigForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PlaylistForm.resx">
|
||||
<DependentUpon>PlaylistForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
68
Alchemy.Forms/Main.Designer.cs
generated
68
Alchemy.Forms/Main.Designer.cs
generated
@ -33,12 +33,12 @@
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aPIKeysToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.spotifyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.refreshPlaylistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.playlistRefreshButton = new System.Windows.Forms.Button();
|
||||
this.playlistListBox = new System.Windows.Forms.ListBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.messageLabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.RefreshPlaylists = new System.ComponentModel.BackgroundWorker();
|
||||
@ -49,8 +49,10 @@
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.spotifyToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
@ -70,17 +72,32 @@
|
||||
// aPIKeysToolStripMenuItem
|
||||
//
|
||||
this.aPIKeysToolStripMenuItem.Name = "aPIKeysToolStripMenuItem";
|
||||
this.aPIKeysToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.aPIKeysToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
|
||||
this.aPIKeysToolStripMenuItem.Text = "Config";
|
||||
this.aPIKeysToolStripMenuItem.Click += new System.EventHandler(this.aPIKeysToolStripMenuItem_Click);
|
||||
//
|
||||
// closeToolStripMenuItem
|
||||
//
|
||||
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
||||
this.closeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.closeToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
|
||||
this.closeToolStripMenuItem.Text = "Close";
|
||||
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
|
||||
//
|
||||
// spotifyToolStripMenuItem
|
||||
//
|
||||
this.spotifyToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.refreshPlaylistsToolStripMenuItem});
|
||||
this.spotifyToolStripMenuItem.Name = "spotifyToolStripMenuItem";
|
||||
this.spotifyToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||
this.spotifyToolStripMenuItem.Text = "Spotify";
|
||||
//
|
||||
// refreshPlaylistsToolStripMenuItem
|
||||
//
|
||||
this.refreshPlaylistsToolStripMenuItem.Name = "refreshPlaylistsToolStripMenuItem";
|
||||
this.refreshPlaylistsToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.refreshPlaylistsToolStripMenuItem.Text = "Refresh Playlists";
|
||||
this.refreshPlaylistsToolStripMenuItem.Click += new System.EventHandler(this.refreshPlaylistsToolStripMenuItem_Click);
|
||||
//
|
||||
// helpToolStripMenuItem
|
||||
//
|
||||
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@ -101,54 +118,36 @@
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.playlistRefreshButton);
|
||||
this.groupBox1.Controls.Add(this.playlistListBox);
|
||||
this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 27);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(289, 316);
|
||||
this.groupBox1.Size = new System.Drawing.Size(610, 316);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Playlists";
|
||||
//
|
||||
// playlistRefreshButton
|
||||
//
|
||||
this.playlistRefreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.playlistRefreshButton.Location = new System.Drawing.Point(6, 287);
|
||||
this.playlistRefreshButton.Name = "playlistRefreshButton";
|
||||
this.playlistRefreshButton.Size = new System.Drawing.Size(277, 23);
|
||||
this.playlistRefreshButton.TabIndex = 1;
|
||||
this.playlistRefreshButton.Text = "Refresh";
|
||||
this.playlistRefreshButton.UseVisualStyleBackColor = true;
|
||||
this.playlistRefreshButton.Click += new System.EventHandler(this.playlistRefreshButton_Click);
|
||||
//
|
||||
// playlistListBox
|
||||
//
|
||||
this.playlistListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.playlistListBox.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.playlistListBox.DisplayMember = "Name";
|
||||
this.playlistListBox.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.playlistListBox.FormattingEnabled = true;
|
||||
this.playlistListBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.playlistListBox.Name = "playlistListBox";
|
||||
this.playlistListBox.Size = new System.Drawing.Size(277, 264);
|
||||
this.playlistListBox.Size = new System.Drawing.Size(598, 290);
|
||||
this.playlistListBox.TabIndex = 0;
|
||||
this.playlistListBox.ValueMember = "Name";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Location = new System.Drawing.Point(307, 27);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(315, 316);
|
||||
this.groupBox2.TabIndex = 1;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Scrobbles";
|
||||
this.playlistListBox.ValueMember = "Id";
|
||||
this.playlistListBox.DoubleClick += new System.EventHandler(this.playlistListBox_DoubleClick);
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.messageLabel});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 346);
|
||||
@ -159,6 +158,7 @@
|
||||
//
|
||||
// messageLabel
|
||||
//
|
||||
this.messageLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.messageLabel.Name = "messageLabel";
|
||||
this.messageLabel.Size = new System.Drawing.Size(81, 22);
|
||||
this.messageLabel.Text = "messageLabel";
|
||||
@ -172,9 +172,9 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.ClientSize = new System.Drawing.Size(634, 371);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
@ -203,12 +203,12 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem aPIKeysToolStripMenuItem;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Button playlistRefreshButton;
|
||||
private System.Windows.Forms.ListBox playlistListBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripLabel messageLabel;
|
||||
private System.ComponentModel.BackgroundWorker RefreshPlaylists;
|
||||
private System.Windows.Forms.ToolStripMenuItem spotifyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem refreshPlaylistsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@ namespace Sarsoo.Alchemy.Forms
|
||||
Stream stream = new FileStream("config.bin", FileMode.Open, FileAccess.Read);
|
||||
config = (Config)formatter.Deserialize(stream);
|
||||
stream.Close();
|
||||
|
||||
// TODO load playlists if available
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -50,24 +52,7 @@ namespace Sarsoo.Alchemy.Forms
|
||||
keys.Show();
|
||||
}
|
||||
|
||||
private void playlistRefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(config.SpotifyAccess.Length == 0)
|
||||
{
|
||||
SetMessage("No Spotify Access Token Provided");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RefreshPlaylists.IsBusy)
|
||||
{
|
||||
RefreshPlaylists.RunWorkerAsync();
|
||||
} else
|
||||
{
|
||||
SetMessage("Already Refreshing");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMessage(String message)
|
||||
private void SetMessage(string message)
|
||||
{
|
||||
messageLabel.Text = message;
|
||||
messageLabel.Visible = true;
|
||||
@ -83,22 +68,33 @@ namespace Sarsoo.Alchemy.Forms
|
||||
TokenType = "Bearer"
|
||||
};
|
||||
|
||||
var _playlists = spot.GetUserPlaylists(config.spotifyID);
|
||||
if(_playlists.HasError())
|
||||
{
|
||||
SetMessage($"Playlist Refresh Error: {_playlists.Error.Status} {_playlists.Error.Message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
playlistListBox.Items.Clear();
|
||||
//_playlists.Items.ForEach((playlist) => { playlistListBox.Items.Add(playlist); });
|
||||
playlistListBox.Refresh();
|
||||
playlists.Clear();
|
||||
Paging<SimplePlaylist> _playlistsPagers = spot.GetUserPlaylists(config.spotifyID);
|
||||
while(true) {
|
||||
if (_playlistsPagers.HasError())
|
||||
{
|
||||
SetMessage($"Playlist Refresh Error: {_playlistsPagers.Error.Status} {_playlistsPagers.Error.Message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
playlists.AddRange(_playlistsPagers.Items);
|
||||
if (!_playlistsPagers.HasNextPage()) break;
|
||||
_playlistsPagers = spot.GetNextPage(_playlistsPagers);
|
||||
}
|
||||
}
|
||||
|
||||
playlistListBox.Invoke((MethodInvoker)delegate {
|
||||
playlistListBox.DataSource = playlists
|
||||
.OrderBy(playlist => playlist.Name.ToLower())
|
||||
.ToList();
|
||||
});
|
||||
|
||||
// TODO dump playlists to binary
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
playlistListBox.DataSource = playlists;
|
||||
|
||||
}
|
||||
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
@ -108,6 +104,40 @@ namespace Sarsoo.Alchemy.Forms
|
||||
Stream stream = new FileStream("config.bin", FileMode.Create, FileAccess.Write);
|
||||
formatter.Serialize(stream, config);
|
||||
stream.Close();
|
||||
|
||||
// TODO dump playlists
|
||||
}
|
||||
|
||||
private void playlistListBox_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if(playlistListBox.SelectedItem != null)
|
||||
{
|
||||
if (playlistListBox.SelectedItem is SimplePlaylist playlist)
|
||||
{
|
||||
PlaylistForm form = new PlaylistForm(playlist);
|
||||
form.Show();
|
||||
}
|
||||
else
|
||||
SetMessage("Couldn't cast selected playlist");
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshPlaylistsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (config.SpotifyAccess.Length == 0)
|
||||
{
|
||||
SetMessage("No Spotify Access Token Provided");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RefreshPlaylists.IsBusy)
|
||||
{
|
||||
RefreshPlaylists.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMessage("Already Refreshing");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,9 @@
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolStrip1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RefreshPlaylists.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>237, 17</value>
|
||||
</metadata>
|
||||
|
83
Alchemy.Forms/PlaylistForm.Designer.cs
generated
Normal file
83
Alchemy.Forms/PlaylistForm.Designer.cs
generated
Normal file
@ -0,0 +1,83 @@
|
||||
namespace Sarsoo.Alchemy.Forms
|
||||
{
|
||||
partial class PlaylistForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlaylistForm));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.trackListBox = new System.Windows.Forms.ListBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.trackListBox);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 268);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(765, 159);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Tracks";
|
||||
//
|
||||
// trackListBox
|
||||
//
|
||||
this.trackListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.trackListBox.DisplayMember = "Name";
|
||||
this.trackListBox.FormattingEnabled = true;
|
||||
this.trackListBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.trackListBox.Name = "trackListBox";
|
||||
this.trackListBox.Size = new System.Drawing.Size(753, 134);
|
||||
this.trackListBox.TabIndex = 0;
|
||||
this.trackListBox.ValueMember = "Name";
|
||||
//
|
||||
// PlaylistForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(789, 439);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(805, 478);
|
||||
this.Name = "PlaylistForm";
|
||||
this.Text = "Playlist";
|
||||
this.Load += new System.EventHandler(this.Playlist_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ListBox trackListBox;
|
||||
}
|
||||
}
|
28
Alchemy.Forms/PlaylistForm.cs
Normal file
28
Alchemy.Forms/PlaylistForm.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using SpotifyAPI.Web.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sarsoo.Alchemy.Forms
|
||||
{
|
||||
public partial class PlaylistForm : Form
|
||||
{
|
||||
private readonly SimplePlaylist playlist;
|
||||
public PlaylistForm(SimplePlaylist _playlist)
|
||||
{
|
||||
InitializeComponent();
|
||||
playlist = _playlist;
|
||||
}
|
||||
|
||||
private void Playlist_Load(object sender, EventArgs e)
|
||||
{
|
||||
Text = playlist.Name;
|
||||
}
|
||||
}
|
||||
}
|
143
Alchemy.Forms/PlaylistForm.resx
Normal file
143
Alchemy.Forms/PlaylistForm.resx
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAIAA
|
||||
AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/
|
||||
AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAVVUAAAAAAFVVVVUAAAAFVd1VVVAAAFVd1VVV
|
||||
VQAAVd3VVf9VAABV3dVV/1UAAAVd3V/1UAAAAFVVVVUAAAAAAFVVAAAAAAAAVVUAAAAAAABVVQAAAAAA
|
||||
AzMzMAAAAAAzMzMzAAAAAAMzMzAAAAAAAAAAAAAA//8AAPw/AADwDwAA4AcAAMADAADAAwAAwAMAAOAH
|
||||
AADwDwAA/D8AAPw/AAD8PwAA+B8AAPAPAAD4HwAA//8AACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAA
|
||||
AAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/
|
||||
/wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVVVQ
|
||||
AAAAAAAAAAAAAABVVVVVVVUAAAAAAAAAAABVVVVVVVVVVQAAAAAAAABVVVVd3VVVVVVVAAAAAAAAVVVd
|
||||
3d3VVVVVVQAAAAAABVVV3d3d1VVVVVVQAAAAAFVVXd3d3VVVVVVVVQAAAABVVV3d3dVVVVVVVVUAAAAF
|
||||
VVXd3dVVVVVVVVVVUAAABVVV3d3VVVVVVVVVVVAAAAVVVd3d1VVVVVVVVVVQAAAFVVXd3dVVVVVf9VVV
|
||||
UAAAAFVV3d3dVVVV//9VVQAAAABVVV3d3VVV////VVUAAAAABVVV3d3VX////1VQAAAAAABVVd3d1f//
|
||||
//VVAAAAAAAAVVVd3VX///9VVQAAAAAAAABVVVVVX/9VVQAAAAAAAAAAAFVVVVVVVQAAAAAAAAAAAAAF
|
||||
VVVVVVAAAAAAAAAAAAAABVVVVVVQAAAAAAAAAAAAAAVVVVVVUAAAAAAAAAAAAAAFVVVVVVAAAAAAAAAA
|
||||
AAAABVVVVVVQAAAAAAAAAAAAMzMzMzMzMzMwAAAAAAAAAzMzMzMzMzMzMwAAAAAAAAMzMzMzMzMzMzMA
|
||||
AAAAAAAAMzMzMzMzMzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////4
|
||||
H///wAP//wAA//wAAD/8AAA/+AAAH/AAAA/wAAAP4AAAB+AAAAfgAAAH4AAAB/AAAA/wAAAP+AAAH/wA
|
||||
AD/8AAA//wAA///AA///4Af//+AH///gB///4Af//+AH//8AAH/+AAA//gAAP/8AAH///////////w==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user