From: Bellai Ádám Date: Fri, 13 Oct 2017 09:16:00 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=ecd769ab5642d511ec90c575039e8525d64369b1;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30612 --- diff --git a/client/Maestro/Sources/NexioRESTSource.cs b/client/Maestro/Sources/NexioRESTSource.cs index 478fa0b6..6c218fb4 100644 --- a/client/Maestro/Sources/NexioRESTSource.cs +++ b/client/Maestro/Sources/NexioRESTSource.cs @@ -160,13 +160,14 @@ namespace Maestro.Sources { private void OnList(JToken l) { if (l == null) return; - l.Children().ToList().Select(t => CreateItem(t, false)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); + //l.Children().ToList().Select(t => CreateItem(t, false)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); + l.Children().ToList().Select(t => CreateItem(t, false)).Where(x => x.CanHandle(acceptableExtensions)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); } private void OnChanged(JToken token) { string id = token[ID].ToString(); var item = Items.Where(x => x.ID == id).SingleOrDefault(); - if (item != null) { + if (item != null && item.CanHandle(acceptableExtensions)) { SetItem(ref item, token); parent.SafeCall(() => { messageBus.Send(new ModifyFileActionMsg() { @@ -180,14 +181,16 @@ namespace Maestro.Sources { private void OnCreated(JToken token) { var item = CreateItem(token, true); - parent.SafeCall(() => { - Insert(0, item); - messageBus.Send(new CreateFileActionMsg() { - FileName = item.Name, - Source = parent + if (item.CanHandle(acceptableExtensions)) { + parent.SafeCall(() => { + Insert(0, item); + messageBus.Send(new CreateFileActionMsg() { + FileName = item.Name, + Source = parent + }); }); - }); - Debug.WriteLine(string.Format("Created {0}", item.Name)); + Debug.WriteLine(string.Format("Created {0}", item.Name)); + } } private void OnDeleted(JToken d) { diff --git a/client/Maestro/Sources/NexioSourceItem.cs b/client/Maestro/Sources/NexioSourceItem.cs index db9cbf07..d9fc2d5b 100644 --- a/client/Maestro/Sources/NexioSourceItem.cs +++ b/client/Maestro/Sources/NexioSourceItem.cs @@ -2,7 +2,7 @@ using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; - +using System.Collections.Generic; namespace Maestro.Sources { public class NexioSourceItem : ISourceItem { private bool isHighlighted; @@ -73,5 +73,13 @@ namespace Maestro.Sources { } } + public bool CanHandle(List extensions) { + if (extensions == null || extensions.Count < 1) + return true; + if (extensions.Contains(Name.Substring(Name.Length-3).ToLower()) || extensions.Contains(Name.Substring(Name.Length - 3).ToUpper())) + return true; + return false; + } + } } diff --git a/client/MediaCubeClient/MediaCubeApi.cs b/client/MediaCubeClient/MediaCubeApi.cs index beefbfb1..731efedb 100644 --- a/client/MediaCubeClient/MediaCubeApi.cs +++ b/client/MediaCubeClient/MediaCubeApi.cs @@ -44,7 +44,7 @@ namespace JobEngineClient { //Debug.WriteLine(body); request.AddParameter("application/json", body, ParameterType.RequestBody); var response = client.Execute(request); - if (response.StatusCode != HttpStatusCode.OK || response.ContentLength < 1) { + if (response.StatusCode != HttpStatusCode.OK && response.ErrorMessage != null) { ErrorReporter?.Invoke(DateTime.Now, "Error", String.Format("[MediaCube] {0}", response.ErrorMessage), Color.Red); return null; }