public FormServer(ServerDescription description) { Init(); textName.Text = description.Name; checkVideo.Checked = (description.Types & DlnaMediaTypes.Video) == DlnaMediaTypes.Video; checkAudio.Checked = (description.Types & DlnaMediaTypes.Audio) == DlnaMediaTypes.Audio; checkImages.Checked = (description.Types & DlnaMediaTypes.Image) == DlnaMediaTypes.Image; foreach (var i in comboOrder.Items) { if (((IItemComparer)i).Name == description.Order) { comboOrder.SelectedItem = i; break; } } checkOrderDescending.Checked = description.OrderDescending; foreach (var v in description.Views) { var i = new ListViewItem(new string[] { v, ViewRepository.Lookup(v).Description }); listViews.Items.Add(i); } foreach (var d in description.Directories) { var i = new ListViewItem(d); listDirectories.Items.Add(i); } SizeDirectoryColumn(); SizeViewsColumns(); }
public FormServer(ServerDescription description) { Init(); textName.Text = description.Name; checkVideo.Checked = (description.Types & DlnaMediaTypes.Video) == DlnaMediaTypes.Video; checkAudio.Checked = (description.Types & DlnaMediaTypes.Audio) == DlnaMediaTypes.Audio; checkImages.Checked = (description.Types & DlnaMediaTypes.Image) == DlnaMediaTypes.Image; foreach (var i in comboOrder.Items) { if (((IItemComparer)i).Name == description.Order) { comboOrder.SelectedItem = i; break; } } foreach (var i in comboCache.Items) { if ((i is IFileStore) && (((IFileStore)i).Name == description.FileStore)) { comboCache.SelectedItem = i; break; } } checkOrderDescending.Checked = description.OrderDescending; foreach (var v in description.Views) { var i = new ListViewItem(new string[] { v, ViewRepository.Lookup(v).Description }); listViews.Items.Add(i); } foreach (var d in description.Directories) { var i = new ListViewItem(d); listDirectories.Items.Add(i); } var t = comboNewRestriction.Items[0].ToString(); foreach (var r in description.Macs) { var i = listRestrictions.Items.Add(r); i.Tag = 0; i.SubItems.Add(t); } t = comboNewRestriction.Items[1].ToString(); foreach (var r in description.Ips) { var i = listRestrictions.Items.Add(r); i.Tag = 1; i.SubItems.Add(t); } t = comboNewRestriction.Items[2].ToString(); foreach (var r in description.UserAgents) { var i = listRestrictions.Items.Add(r); i.Tag = 2; i.SubItems.Add(t); } SizeDirectoryColumn(); SizeColumns(listViews); }
public void AdoptInfo(ServerDescription other) { Directories = other.Directories; Name = other.Name; Order = other.Order; OrderDescending = other.OrderDescending; Types = other.Types; Views = other.Views; }
public FormServer(ServerDescription description) { Init(); textName.Text = description.Name; checkVideo.Checked = (description.Types & DlnaMediaTypes.Video) == DlnaMediaTypes.Video; checkAudio.Checked = (description.Types & DlnaMediaTypes.Audio) == DlnaMediaTypes.Audio; checkImages.Checked = (description.Types & DlnaMediaTypes.Image) == DlnaMediaTypes.Image; foreach (var i in comboOrder.Items) { if (((IItemComparer)i).Name == description.Order) { comboOrder.SelectedItem = i; break; } } checkOrderDescending.Checked = description.OrderDescending; foreach (var v in description.Views) { var i = new ListViewItem(new string[] { v, ViewRepository.Lookup(v).Description }); listViews.Items.Add(i); } foreach (var d in description.Directories) { var i = new ListViewItem(d); listDirectories.Items.Add(i); } var t = comboNewRestriction.Items[0].ToString(); foreach (var r in description.Macs) { var i = listRestrictions.Items.Add(r); i.Tag = 0; i.SubItems.Add(t); } t = comboNewRestriction.Items[1].ToString(); foreach (var r in description.Ips) { var i = listRestrictions.Items.Add(r); i.Tag = 1; i.SubItems.Add(t); } t = comboNewRestriction.Items[2].ToString(); foreach (var r in description.UserAgents) { var i = listRestrictions.Items.Add(r); i.Tag = 2; i.SubItems.Add(t); } SizeDirectoryColumn(); SizeColumns(listViews); }
public ServerListViewItem(HttpServer server, FileInfo cacheFile, ServerDescription description) { this.server = server; this.cacheFile = cacheFile; Description = description; Text = Description.Name; SubItems.Add(Description.Directories.Length.ToString()); ImageIndex = 0; }
public void AdoptInfo(ServerDescription other) { if (other == null) { throw new ArgumentNullException("other"); } Directories = other.Directories; Name = other.Name; Order = other.Order; OrderDescending = other.OrderDescending; Types = other.Types; Views = other.Views; }
public void AdoptInfo(ServerDescription other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } Directories = other.Directories; Name = other.Name; Order = other.Order; OrderDescending = other.OrderDescending; Types = other.Types; Views = other.Views; Macs = other.Macs; Ips = other.Ips; UserAgents = other.UserAgents; }
public void AdoptInfo(ServerDescription other) { if (other == null) { throw new ArgumentNullException("other"); } Directories = other.Directories; Name = other.Name; Order = other.Order; OrderDescending = other.OrderDescending; Types = other.Types; Views = other.Views; Macs = other.Macs; Ips = other.Ips; UserAgents = other.UserAgents; }
public void ServerDescription_AdoptInfo_Test() { var data = new ServerDescription { Directories = new [] { "dir1", "dir2" }, Name = "data", Order = "Order", FileStore = "FileStore", OrderDescending = false, Types = DlnaMediaTypes.All, Views = new [] { "Views1", "Views2" }, Macs = new [] { "Mac1", "Mac2" }, Ips = new [] { "IP1", "IP2" }, UserAgents = new [] { "UserAgent1", "UserAgent2" } }; var data2 = new ServerDescription(); data2.AdoptInfo(data); Assert.AreEqual(data.Directories, data2.Directories); Assert.AreEqual(data.Name, data2.Name); Assert.AreEqual(data.Order, data2.Order); Assert.AreEqual(data.FileStore, data2.FileStore); Assert.AreEqual(data.OrderDescending, data2.OrderDescending); Assert.AreEqual(data.Types, data2.Types); Assert.AreEqual(data.Views, data2.Views); Assert.AreEqual(data.Macs, data2.Macs); Assert.AreEqual(data.Ips, data2.Ips); Assert.AreEqual(data.UserAgents, data2.UserAgents); var filenames = new[] { "ServerDescription.tmp1", "ServerDescription.tmp2" }; try { XmlHelper.ToFile(data, filenames[0]); XmlHelper.ToFile(data2, filenames[1]); Assert.AreEqual(File.ReadAllText(filenames[0]), File.ReadAllText(filenames[1])); } finally { if (File.Exists(filenames[0])) File.Delete(filenames[0]); if (File.Exists(filenames[1])) File.Delete(filenames[1]); } }
internal void UpdateInfo(ServerDescription description) { StopFileServer(); Description.AdoptInfo(description); StartFileServer(); }
public void UpdateInfo(ServerDescription description) { StopFileServer(); Description.AdoptInfo(description); StartFileServer(); }