protected bool SaveSettings() { AuthorCreationProject authorCreationProject; bool flag; Stream stream = this.GetStream(true, "dat.asc", out authorCreationProject); if (stream == null) { return(false); } try { using (JSONStream jSONStream = JSONStream.CreateWriter(stream)) { jSONStream.WriteObjectStart(); jSONStream.WriteObjectStart("project"); jSONStream.WriteText("guid", AuthorShared.PathToGUID(AuthorShared.GetAssetPath(authorCreationProject))); jSONStream.WriteText("name", authorCreationProject.project); jSONStream.WriteText("author", authorCreationProject.authorName); jSONStream.WriteText("scene", authorCreationProject.scene); jSONStream.WriteText("folder", authorCreationProject.folder); jSONStream.WriteObjectEnd(); jSONStream.WriteProperty("settings"); this.SaveSettings(jSONStream); jSONStream.WriteObjectEnd(); } flag = true; } finally { stream.Dispose(); } return(flag); }
/// <summary> /// Runs the JSON topic client example. /// </summary> /// <param name="cancellationToken">A token used to end the client example.</param> /// <param name="args">A single string should be used for the server url.</param> public async Task Run(CancellationToken cancellationToken, string[] args) { var serverUrl = args[0]; // Connect anonymously var session = Diffusion.Sessions.Open(serverUrl); // Get the Topics feature to subscribe to topics var topics = session.Topics; var topic = "random/JSON"; // Add a topic stream for 'random/JSON' var jsonStream = new JSONStream(); topics.AddStream(topic, jsonStream); try { // Subscribe to 'random/JSON' topic await topics.SubscribeAsync(topic, cancellationToken); // Run until user requests ending of example await Task.Delay(Timeout.Infinite, cancellationToken); } catch (TaskCanceledException) { //Task was canceled; close stream and unsubscribe topics.RemoveStream(jsonStream); await topics.UnsubscribeAsync(topic); } finally { // Note that closing the session, will automatically unsubscribe from all topics the client is // subscribed to. session.Close(); } }
protected bool LoadSettings() { AuthorCreationProject authorCreationProject; string str; int num; bool flag; Stream stream = this.GetStream(true, "dat.asc", out authorCreationProject); if (stream == null) { return(false); } try { using (JSONStream jSONStream = JSONStream.CreateWriter(stream)) { while (jSONStream.Read()) { if (jSONStream.token == JSONToken.ObjectStart) { while (jSONStream.ReadNextProperty(out str)) { string str1 = str; if (str1 == null) { continue; } if (AuthorCreation.< > f__switch$map0 == null) { Dictionary <string, int> strs = new Dictionary <string, int>(2) { { "project", 0 }, { "settings", 1 } }; AuthorCreation.< > f__switch$map0 = strs; } if (!AuthorCreation.< > f__switch$map0.TryGetValue(str1, out num)) { continue; } if (num == 0) { jSONStream.ReadSkip(); } else if (num == 1) { this.LoadSettings(jSONStream); } } } } } flag = true; } finally { stream.Dispose(); } return(flag); }
// Token: 0x060001D0 RID: 464 RVA: 0x00007EC4 File Offset: 0x000060C4 public override void SaveJsonProperties(JSONStream stream) { base.SaveJsonProperties(stream); stream.WriteText("bone", base.FromRootBonePath(this.bone)); stream.WriteEnum("bonepart", this.bodyPart); stream.WriteBoolean("mirror", this.isMirror); stream.WriteText("mirrorbone", base.FromRootBonePath(this.mirrored)); stream.WriteEnum("mirrorbonepart", this.mirroredBodyPart); stream.WriteArrayStart("mirrorboneflip"); stream.WriteBoolean(this.mirrorX); stream.WriteBoolean(this.mirrorY); stream.WriteBoolean(this.mirrorZ); stream.WriteArrayEnd(); stream.WriteEnum("kind", this.kind); stream.WriteVector3("center", this.center); stream.WriteVector3("size", this.size); stream.WriteNumber("radius", this.radius); stream.WriteNumber("height", this.height); stream.WriteInteger("capsuleaxis", this.capsuleAxis); stream.WriteNumber("damagemul", this.damageMultiplier); stream.WriteInteger("hitpriority", this.hitPriority); stream.WriteNumber("mass", this.mass); stream.WriteNumber("drag", this.drag); stream.WriteNumber("adrag", this.angularDrag); }
static void Main(string[] args) { // Connect anonymously var session = Diffusion.Sessions.Open("ws://localhost:8080"); // Get the Topics feature to subscribe to topics var topics = session.Topics; var topic = ">foo/counter"; // Add a topic stream for 'random/JSON' and request subscription var jsonStream = new JSONStream(); topics.AddStream(topic, jsonStream); topics.SubscribeAsync(topic).Wait(); //Stay connected for 10 minutes Thread.Sleep(TimeSpan.FromMinutes(10)); session.Close(); }
// Token: 0x0600008B RID: 139 RVA: 0x000037AC File Offset: 0x000019AC public virtual void SaveJsonProperties(JSONStream stream) { }
protected abstract void SaveSettings(JSONStream stream);
protected abstract void LoadSettings(JSONStream stream);
// Token: 0x06000043 RID: 67 RVA: 0x00002CC0 File Offset: 0x00000EC0 protected bool LoadSettings() { global::AuthorCreationProject authorCreationProject; Stream stream = this.GetStream(true, "dat.asc", out authorCreationProject); if (stream != null) { try { using (JSONStream jsonstream = JSONStream.CreateWriter(stream)) { while (jsonstream.Read()) { JSONToken token = jsonstream.token; if (token == 1) { string text; while (jsonstream.ReadNextProperty(ref text)) { string text2 = text; if (text2 != null) { if (global::AuthorCreation.< > f__switch$map0 == null) { global::AuthorCreation.< > f__switch$map0 = new Dictionary <string, int>(2) { { "project", 0 }, { "settings", 1 } }; } int num; if (global::AuthorCreation.< > f__switch$map0.TryGetValue(text2, out num)) { if (num != 0) { if (num == 1) { this.LoadSettings(jsonstream); } } else { jsonstream.ReadSkip(); } } } } } } } return(true); } finally { stream.Dispose(); } return(false); } return(false); }
public virtual void SaveJsonProperties(JSONStream stream) { }