Continue with implementing QCue

This commit is contained in:
Joel Wetzell
2020-06-13 17:31:02 -05:00
parent befb8a5534
commit f80d1e2ee9
7 changed files with 270 additions and 108 deletions
+27 -17
View File
@@ -4,16 +4,18 @@ VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSharp", "QSharp\QSharp.csproj", "{51CD2579-79C9-49A9-B68D-93CBE878BAA1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSharp", "QSharp\QSharp.csproj", "{51CD2579-79C9-49A9-B68D-93CBE878BAA1}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSharpDemo", "QSharpDemo\QSharpDemo.csproj", "{8518D042-D511-4DBB-8406-5B11B2777ED2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QSharpDemoApp", "QSharpDemoApp\QSharpDemoApp.csproj", "{734E00A0-31BC-4ED8-BC29-FE7649FD2089}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
@@ -22,6 +24,8 @@ Global
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM.ActiveCfg = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM.ActiveCfg = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM.Build.0 = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM.Build.0 = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|ARM64.Build.0 = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x64.ActiveCfg = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x64.ActiveCfg = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x64.Build.0 = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x64.Build.0 = Debug|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x86.ActiveCfg = Debug|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -30,26 +34,32 @@ Global
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|Any CPU.Build.0 = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|Any CPU.Build.0 = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM.ActiveCfg = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM.ActiveCfg = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM.Build.0 = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM.Build.0 = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM64.ActiveCfg = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|ARM64.Build.0 = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x64.ActiveCfg = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x64.ActiveCfg = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x64.Build.0 = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x64.Build.0 = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x86.ActiveCfg = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x86.ActiveCfg = Release|Any CPU
{51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x86.Build.0 = Release|Any CPU {51CD2579-79C9-49A9-B68D-93CBE878BAA1}.Release|x86.Build.0 = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|Any CPU.Build.0 = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|ARM.ActiveCfg = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|ARM.ActiveCfg = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|ARM.Build.0 = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|ARM.Build.0 = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|x64.ActiveCfg = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|x64.Build.0 = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|ARM64.Build.0 = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|x86.ActiveCfg = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|x64.ActiveCfg = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Debug|x86.Build.0 = Debug|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|x64.Build.0 = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|Any CPU.ActiveCfg = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|x86.ActiveCfg = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|Any CPU.Build.0 = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Debug|x86.Build.0 = Debug|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|ARM.ActiveCfg = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|ARM.Build.0 = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|Any CPU.Build.0 = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|x64.ActiveCfg = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|ARM.ActiveCfg = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|x64.Build.0 = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|ARM.Build.0 = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|x86.ActiveCfg = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|ARM64.ActiveCfg = Release|Any CPU
{8518D042-D511-4DBB-8406-5B11B2777ED2}.Release|x86.Build.0 = Release|Any CPU {734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|ARM64.Build.0 = Release|Any CPU
{734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|x64.ActiveCfg = Release|Any CPU
{734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|x64.Build.0 = Release|Any CPU
{734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|x86.ActiveCfg = Release|Any CPU
{734E00A0-31BC-4ED8-BC29-FE7649FD2089}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+9 -1
View File
@@ -8,6 +8,12 @@ namespace QSharp
{ {
public QServer server { get; set; } public QServer server { get; set; }
} }
public class QServerUpdatedArgs : EventArgs
{
public QServer server { get; set; }
}
public class QWorkspacesUpdatedArgs : EventArgs public class QWorkspacesUpdatedArgs : EventArgs
{ {
public List<QWorkspaceInfo> Workspaces { get; set; } public List<QWorkspaceInfo> Workspaces { get; set; }
@@ -51,7 +57,8 @@ namespace QSharp
public class QCueUpdatedArgs : EventArgs public class QCueUpdatedArgs : EventArgs
{ {
public string cueID { get; set; }
public JToken data { get; set; }
} }
public class QCueListsUpdatedArgs : EventArgs public class QCueListsUpdatedArgs : EventArgs
@@ -66,6 +73,7 @@ namespace QSharp
public class QCueListChangedPlaybackPositionArgs : EventArgs public class QCueListChangedPlaybackPositionArgs : EventArgs
{ {
public string cueListID { get; set; }
public string cueID { get; set; } public string cueID { get; set; }
} }
} }
+1
View File
@@ -2,6 +2,7 @@
namespace QSharp namespace QSharp
{ {
public delegate void QServerFoundHandler(object source, QServerFoundArgs args); public delegate void QServerFoundHandler(object source, QServerFoundArgs args);
public delegate void QServerUpdatedHandler(object source, QServerUpdatedArgs args);
public delegate void QWorkspacesUpdatedHandler(object source, QWorkspacesUpdatedArgs args); public delegate void QWorkspacesUpdatedHandler(object source, QWorkspacesUpdatedArgs args);
+218 -75
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Serilog;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
@@ -21,7 +22,6 @@ namespace QSharp
public bool ignoreUpdates; public bool ignoreUpdates;
public QCue() public QCue()
{ {
init(); init();
@@ -45,15 +45,15 @@ namespace QSharp
/*JToken children = dict[QOSCKey.Cues]; /*JToken children = dict[QOSCKey.Cues];
if(children != null && children.Type == JTokenType.Array) if(children != null && children.Type == JTokenType.Array)
{ {
Console.WriteLine($"[cue] new cue being created with {children.Count()} childCues"); Log.Debug($"[cue] new cue being created with {children.Count()} childCues");
foreach (var aChildDict in children) foreach (var aChildDict in children)
{ {
string uid = (string)aChildDict[QOSCKey.UID]; string uid = (string)aChildDict[QOSCKey.UID];
//Console.WriteLine($"[cue] childDict with uid: {uid} being processed"); //Log.Debug($"[cue] childDict with uid: {uid} being processed");
if (uid == null) if (uid == null)
continue; continue;
string name = dict[QOSCKey.UID].ToString(); string name = dict[QOSCKey.UID].ToString();
Console.WriteLine($"[cue] calling new cue from {name}"); Log.Debug($"[cue] calling new cue from {name}");
//QCue child = new QCue(aChildDict, workspace); //QCue child = new QCue(aChildDict, workspace);
@@ -130,15 +130,9 @@ namespace QSharp
//implemented: no //implemented: no
#region Class Methods #region Class Methods
public string iconForType(string type) { throw new NotImplementedException(); } public string iconForType(string type) { throw new NotImplementedException(); }
public bool cueTypeIsAudio(string type) { throw new NotImplementedException(); }
public bool cueTypeIsVideo(string type) { throw new NotImplementedException(); }
public bool cueTypeIsGroup(string type) { throw new NotImplementedException(); }
public bool cueTypeIsCueList(string type) { throw new NotImplementedException(); }
public List<string> fadeModeTitles() { throw new NotImplementedException(); } public List<string> fadeModeTitles() { throw new NotImplementedException(); }
#endregion #endregion
//KVC Compliance... do I need this?
//copied: yes //copied: yes
//implemented: not all //implemented: not all
#region Convenience Accessors #region Convenience Accessors
@@ -151,6 +145,11 @@ namespace QSharp
return new List<QCue>(); return new List<QCue>();
return cues; return cues;
} }
set
{
setProperty(value, QOSCKey.Cues);
}
} }
public string parentID public string parentID
{ {
@@ -159,13 +158,29 @@ namespace QSharp
return propertyForKey(QOSCKey.Parent).ToString(); return propertyForKey(QOSCKey.Parent).ToString();
} }
} }
public string playbackPositionID() { throw new NotImplementedException(); } public string playbackPositionID {
get {
if (propertyForKey(QOSCKey.PlaybackPositionId) == null)
return null;
else
return propertyForKey(QOSCKey.PlaybackPositionId).ToString();
}
set
{
setProperty(value, QOSCKey.PlaybackPositionId);
}
}
public string name public string name
{ {
get get
{ {
return propertyForKey(QOSCKey.Name).ToString(); return propertyForKey(QOSCKey.Name).ToString();
} }
set
{
setProperty(value, QOSCKey.Name);
}
} }
public string number public string number
{ {
@@ -177,6 +192,10 @@ namespace QSharp
else else
return ""; return "";
} }
set
{
setProperty(value, QOSCKey.Number);
}
} }
public string uid public string uid
{ {
@@ -184,6 +203,10 @@ namespace QSharp
{ {
return propertyForKey(QOSCKey.UID).ToString(); return propertyForKey(QOSCKey.UID).ToString();
} }
set
{
setProperty(value, QOSCKey.UID);
}
} }
public string listName public string listName
{ {
@@ -191,6 +214,10 @@ namespace QSharp
{ {
return propertyForKey(QOSCKey.ListName).ToString(); return propertyForKey(QOSCKey.ListName).ToString();
} }
set
{
setProperty(value, QOSCKey.ListName);
}
} }
public string type public string type
{ {
@@ -198,6 +225,10 @@ namespace QSharp
{ {
return propertyForKey(QOSCKey.Type).ToString(); return propertyForKey(QOSCKey.Type).ToString();
} }
set
{
setProperty(value, QOSCKey.Type);
}
} }
public string notes public string notes
{ {
@@ -205,48 +236,109 @@ namespace QSharp
{ {
return propertyForKey(QOSCKey.Notes).ToString(); return propertyForKey(QOSCKey.Notes).ToString();
} }
set
{
setProperty(value, QOSCKey.Notes);
}
} }
//Check the bool casting on these?
public bool IsFlagged public bool IsFlagged
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.Flagged); return (bool)propertyForKey(QOSCKey.Flagged);
} }
set
{
setProperty(value, QOSCKey.Flagged);
}
} }
public bool IsOverridden public bool IsOverridden
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.IsOverridden); if (workspace.connectedToQLab3 || workspace.isOlderThanVersion("4.2.0"))
return false;
bool overridden = (bool)propertyForKey(QOSCKey.IsOverridden);
if (overridden)
return true;
foreach (var cue in cues)
{
if (cue.IsOverridden)
return true;
}
return false;
} }
} }
public bool IsBroken public bool IsBroken
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.IsBroken); if ((bool)propertyForKey(QOSCKey.IsBroken))
return true;
foreach(var cue in cues)
{
if (cue.IsBroken)
return true;
}
return false;
} }
} }
public bool IsRunning public bool IsRunning
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.IsRunning); bool running = (bool)propertyForKey(QOSCKey.IsRunning);
if (running)
return true;
foreach(var cue in cues)
{
if (cue.IsRunning)
return true;
}
return false;
} }
} }
public bool IsTailingOut public bool IsTailingOut
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.IsTailingOut); if (workspace.connectedToQLab3)
return false;
bool tailingOut = (bool)propertyForKey(QOSCKey.IsTailingOut);
if (tailingOut)
return true;
foreach(var cue in cues)
{
if (cue.IsTailingOut)
return true;
}
return false;
} }
} }
public bool IsPanicking public bool IsPanicking
{ {
get get
{ {
return (bool)propertyForKey(QOSCKey.IsPanicking); if (workspace.connectedToQLab3)
return false;
bool panicking = (bool)propertyForKey(QOSCKey.IsPanicking);
if (panicking)
return true;
foreach (var cue in cues)
{
if (cue.IsPanicking)
return true;
}
return false;
} }
} }
public bool IsGroup public bool IsGroup
@@ -291,7 +383,6 @@ namespace QSharp
{ {
get get
{ {
//TODO
string nonEmptyName; string nonEmptyName;
if (name != null && !name.Equals("")) if (name != null && !name.Equals(""))
nonEmptyName = name; nonEmptyName = name;
@@ -337,27 +428,55 @@ namespace QSharp
return null; return null;
} }
} }
public string surfaceName{ get { return propertyForKey("surfaceName").ToString(); } } public string surfaceName{
get {
object property = propertyForKey("surfaceName");
if (property == null)
return null;
else
return propertyForKey("surfaceName").ToString();
}
}
public string patchName public string patchName
{ {
get get
{ {
//TODO object property = propertyForKey("patchDescription");
return propertyForKey("patchDecription").ToString(); if (property == null)
return null;
else
return propertyForKey("patchDecription").ToString();
} }
} }
//TODO: THIS IS WHERE THINGS START TO GET TRICKY! public QColor color {
//TODO add object color method
public string color {
get { get {
return new QColor(colorName);
}
set
{
colorName = value.name;
}
}
public string colorName
{
get
{
object col = propertyForKey(QOSCKey.ColorName); object col = propertyForKey(QOSCKey.ColorName);
if (col != null) if (col != null)
return col.ToString(); return col.ToString();
else else
return "none"; return "none";
} }
set
{
if (value == null)
setProperty("none", QOSCKey.ColorName);
else
setProperty(value, QOSCKey.ColorName);
}
} }
//TODO add quaternion property and setter //TODO add quaternion property and setter
@@ -369,7 +488,6 @@ namespace QSharp
{ {
get get
{ {
//TODO add null check?
return cueData.Keys.ToList(); return cueData.Keys.ToList();
} }
} }
@@ -407,27 +525,12 @@ namespace QSharp
if (!this.ignoreUpdates) if (!this.ignoreUpdates)
{ {
//TODO: update local with QLab //TODO: Send Cue Needs Updated
} }
} }
} }
#endregion #endregion
//Copied: Yes
//Implemented: Not all
#region Mutators
public void setCues(List<QCue> cues)
{
}
public void setName() { }
public void setNumber() { }
public void setUid() { }
public void setListName() { }
public void setType() { }
public void setFlagged() { }
#endregion
//Copied: Yes //Copied: Yes
//Implemented: Not all //Implemented: Not all
#region Update Methods #region Update Methods
@@ -439,7 +542,6 @@ namespace QSharp
JObject dictObj = (JObject)dict; JObject dictObj = (JObject)dict;
foreach (var obj in dictObj) foreach (var obj in dictObj)
{ {
//Console.WriteLine($"[cue] found property {obj.Key} ");
JToken value = obj.Value; JToken value = obj.Value;
if (obj.Key.Equals(QOSCKey.Cues)) if (obj.Key.Equals(QOSCKey.Cues))
{ {
@@ -458,7 +560,7 @@ namespace QSharp
if (!cueUpdated) if (!cueUpdated)
return false; return false;
Console.WriteLine($"[cue] {nonEmptyName} has been updated."); Log.Debug($"[cue] <{nonEmptyName}> has been updated.");
//something about notifying cueUpdated ? OnCueUpdated event handler maybe? //something about notifying cueUpdated ? OnCueUpdated event handler maybe?
return true; return true;
@@ -511,7 +613,6 @@ namespace QSharp
index++; index++;
} }
return needsNotifyCueUpdated; return needsNotifyCueUpdated;
//TODO: TEST?!
} }
#endregion #endregion
@@ -523,13 +624,13 @@ namespace QSharp
public List<string> allChildCueUids() public List<string> allChildCueUids()
{ {
List<string> uids = new List<string>(childCuesUIDMap.Keys); List<string> uids = new List<string>(childCuesUIDMap.Keys);
//TODO
return uids; return uids;
} }
public QCue cueAtIndex(int index) public QCue cueAtIndex(int index)
{ {
//TODO if (index < 0 || index >= cues.Count)
return new QCue(); return null;
return cues[index];
} }
public QCue cueWithID(string uid) public QCue cueWithID(string uid)
{ {
@@ -537,7 +638,6 @@ namespace QSharp
} }
public QCue cueWithID(string uid, bool includeChildren) public QCue cueWithID(string uid, bool includeChildren)
{ {
//Console.WriteLine($"[cue] searching for cue with id: {uid} - includeChildren: {includeChildren}");
if(childCuesUIDMap.ContainsKey(uid)) if(childCuesUIDMap.ContainsKey(uid))
return childCuesUIDMap[uid]; return childCuesUIDMap[uid];
@@ -552,13 +652,22 @@ namespace QSharp
if (childCue != null) if (childCue != null)
return childCue; return childCue;
} }
return null; return null;
} }
public QCue cueWithNumber(string number) public QCue cueWithNumber(string number)
{ {
//TODO foreach(var cue in cues)
return new QCue(); {
if (cue.number.Equals(number))
return cue;
if (cue.IsGroup)
{
QCue childCue = cue.cueWithNumber(number);
if (childCue != null)
return childCue;
}
}
return null;
} }
public object propertyForKey(string key) public object propertyForKey(string key)
{ {
@@ -567,7 +676,15 @@ namespace QSharp
{ {
return childCues; return childCues;
} }
if (cueData.ContainsKey(key)) else if (key.Equals("surfaceName"))
{
//TODO
}
else if (key.Equals("patchDescription"))
{
//TODO
}
else if (cueData.ContainsKey(key))
{ {
return cueData[key]; return cueData[key];
} }
@@ -581,7 +698,6 @@ namespace QSharp
public bool setProperty(object value, string key, bool osc) public bool setProperty(object value, string key, bool osc)
{ {
//TODO:
object existingValue = null; object existingValue = null;
if(cueData.ContainsKey(key)) if(cueData.ContainsKey(key))
existingValue = cueData[key]; existingValue = cueData[key];
@@ -589,21 +705,15 @@ namespace QSharp
if(existingValue != null) if(existingValue != null)
{ {
if (existingValue == value || existingValue.Equals(value)) if (existingValue == value || existingValue.Equals(value))
return false;
if (workspace.connectedToQLab3 && key.Equals(QOSCKey.Type) && existingValue.Equals(QCueType.CueList) && value.Equals(QCueType.Group))
{ {
return false; return false;
} }
} }
//Console.WriteLine($"[cue] attempting set property: {key} with type: {value.GetType()} and value: {value}");
if (workspace.connectedToQLab3 && key.Equals(QOSCKey.Type) && existingValue.Equals(QCueType.CueList) && value.Equals(QCueType.Group))
{
return false;
}
if (key.Equals(QOSCKey.Cues)) if (key.Equals(QOSCKey.Cues))
{ {
if (value.GetType() != typeof(List<QCue>)) if (value.GetType() != typeof(List<QCue>))
@@ -641,6 +751,8 @@ namespace QSharp
else else
cueData.Remove(key); cueData.Remove(key);
//TODO: Cuelistchangedplaybackpositionid?
} }
else else
{ {
@@ -650,22 +762,46 @@ namespace QSharp
cueData.Remove(key); cueData.Remove(key);
} }
//Console.WriteLine($"[cue] set property: {key} with type: {value.GetType()} and value: {value}");
//check for type key and update icon? do I want to do this here? if (key.Equals(QOSCKey.Type))
{
//TODO: something icon related?
}
if (osc)
{
if (playbackPositionID == null && key.Equals(QOSCKey.PlaybackPositionId) && workspace.isOlderThanVersion("4.2.0"))
value = "none";
workspace.updatePropertySend(this, value, key);
}
return true; return true;
} }
#endregion #endregion
//TODO public void sendAllPropertiesToQLab() {
public void sendAllPropertiesToQLab() { } List<string> allProperties = propertyKeys;
foreach(var key in allProperties)
{
object property = propertyForKey(key);
if (key.Equals(QOSCKey.Cues))
{
foreach(var cue in (List<QCue>)property)
{
cue.sendAllPropertiesToQLab();
}
}
else
{
workspace.updatePropertySend(this, property, key);
}
}
}
//TODO: I don't think I'll do this one //TODO: I don't think I'll do this one
public void pullDownPropertyForKey(string key) { } public void pullDownPropertyForKey(string key) { }
public void setPlaybackPositionID(string cueID, bool osc) {
setProperty(cueID, QOSCKey.PlaybackPositionId, osc);
}
//Methods Copied: Yes //Methods Copied: Yes
//Methods Implemented: Yes //Methods Implemented: Yes
@@ -685,17 +821,24 @@ namespace QSharp
#region Printing #region Printing
//this still needs fixing
public void Print() public void Print()
{ {
Console.WriteLine($"{displayName} : {color}"); Print(0);
}
public void Print(int level)
{
string indent = new string(' ', level*2);
Log.Information($"{indent}\u00b7{displayName}");
if (IsGroup) if (IsGroup)
{ {
level++;
if (cues.Count() > 0) if (cues.Count() > 0)
{ {
foreach (var cue in cues) foreach (var cue in cues)
{ {
cue.Print(); cue.Print(level);
} }
} }
} }
-8
View File
@@ -115,14 +115,6 @@ namespace QSharp
public string replyAddress { get{ return IsReply ? address.Substring("/reply".Length) : address; } } public string replyAddress { get{ return IsReply ? address.Substring("/reply".Length) : address; } }
public string addressWithoutWorkspace
{
get
{
//TODO
return "";
}
}
public string[] AddressParts { get { return address.Split("/",StringSplitOptions.RemoveEmptyEntries); } } public string[] AddressParts { get { return address.Split("/",StringSplitOptions.RemoveEmptyEntries); } }
+3
View File
@@ -2,9 +2,12 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Joel Wetzell</Authors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Zeroconf" Version="3.3.16" /> <PackageReference Include="Zeroconf" Version="3.3.16" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
+12 -7
View File
@@ -58,7 +58,7 @@ namespace SharpOSC
} }
catch (Exception e) catch (Exception e)
{ {
//Console.WriteLine(e.Message); Console.WriteLine(e.Message);
return false; return false;
} }
@@ -81,7 +81,10 @@ namespace SharpOSC
{ {
get get
{ {
return client.Connected; if (client == null)
return false;
else
return client.Connected;
} }
} }
@@ -98,9 +101,9 @@ namespace SharpOSC
{ {
Random random = new Random(); Random random = new Random();
int num = random.Next(1000); int num = random.Next(1000);
NetworkStream netStream = client.GetStream();
try try
{ {
NetworkStream netStream = client.GetStream();
netStream.ReadTimeout = 250; netStream.ReadTimeout = 250;
List<byte> responseData = new List<byte>(); List<byte> responseData = new List<byte>();
if (netStream.CanRead) if (netStream.CanRead)
@@ -161,14 +164,16 @@ namespace SharpOSC
public void Close() public void Close()
{ {
client.GetStream().Close(); if(client != null || !client.Connected)
client.Close(); {
client.GetStream().Close();
client.Close();
}
} }
protected virtual void OnMessageReceived(OscMessage msg) protected virtual void OnMessageReceived(OscMessage msg)
{ {
if (MessageReceived != null) MessageReceived?.Invoke(this, new MessageEventArgs() { Message = msg });
MessageReceived(this, new MessageEventArgs() { Message = msg });
} }
} }
} }