public string EnumerateNodes() { Dictionary <String, System.Collections.IEnumerable> result = new Dictionary <string, System.Collections.IEnumerable>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.EnumerateNodes()); return(result.ToJSON()); }
public static string BuildSemantics(IDictionary <string, object> semantics) { var strings = new Dictionary <string, string>(); foreach (var entry in semantics) { if (entry.Value == null) { continue; } var type = entry.Value.GetType(); if (type == typeof(string)) { strings.Add(entry.Key, entry.Value as string); } #if NETFX else if (type.IsEnum) #elif UNIVERSAL else if (type.GetTypeInfo().IsEnum) #endif { strings.Add(entry.Key, ((int)entry.Value).ToStringInvariant()); } else if (type.IsNumber()) { strings.Add(entry.Key, entry.ToStringInvariant()); } else { strings.Add(entry.Key, entry.Value.ToJSON()); } } return(strings.ToJSON(HtmlEncode: false)); }
public static string ToJSON() { var json = new Dictionary <string, object>(); var statusJSON = new Dictionary <string, object>(); statusJSON.Add("running", running); statusJSON.Add("mX", mX); statusJSON.Add("mY", mY); statusJSON.Add("mZ", mZ); statusJSON.Add("wX", wX); statusJSON.Add("wY", wY); statusJSON.Add("wZ", wZ); statusJSON.Add("motionBuffer", motionBuffer); statusJSON.Add("rxBuffer", rxBuffer); statusJSON.Add("runTime", runTime); statusJSON.Add("commandsTotal", CommandsTotal); statusJSON.Add("commandsComplete", CommandsCompleted); json.Add("status", statusJSON); if (currentCommand != null) { json.Add("currentCommand", currentCommand.NamedParameters); } return(json.ToJSON()); }
static bool WriteConfig() { try { var config = new Dictionary <Type, ThingConfig>(); foreach (var kv in Lookup) { var pinConf = kv.Key.Config.Find(cp => cp.Name == "Pin").Value; var sensor = kv.Value; config.Add(sensor.GetType(), new ThingConfig() { Pin = pinConf, Period = (int)sensor.Watcher.SamplingPeriod }); } File.WriteAllText(ThingsConfFileName, config.ToJSON()); return(true); } catch (Exception ex) { DebugEx.TraceErrorException(ex); return(false); } }
private void HandleStatistic(string action, Dictionary <string, string> value) { try { if (action == null || value == null) { throw new ArgumentNullException(); } var license = AppLicenseController.Instance.ActiveLicense; var statistic = new Statistic { License = license.Key, TimeStamp = GeneralUtility.DateTime ?? DateTime.Now, Action = action, Value = value.ToJSON(), Synced = null }; StatisticController.Instance.Insert(statistic); } catch (Exception ex) { LogUtility.Log(LogUtility.LogType.SystemError, MethodBase.GetCurrentMethod().Name, ex.Message); throw; } }
void Button6Click(object sender, EventArgs e) { var data = @"\tC:\\test\\ \n"; data = Regex.Replace(data, @"([^\\]|^)([\\][n])", m => m.Groups[1].Value + "\n"); data = Regex.Replace(data, @"([^\\]|^)([\\][t])", m => m.Groups[1].Value + "\t"); data = Regex.Replace(data, @"([^\\]|^)([\\][\\])", m => m.Groups[1].Value + "\\"); System.Diagnostics.Debug.WriteLine(data); var json = new Dictionary <string, object>(); json.Add("test", @"c:\test\ 102/103 ""abc efg"""); var jsonString = json.ToJSON(); var decodeJsonString = jsonString.GetJSON("test", "abc"); json = new Dictionary <string, object>(); json.Add("test", decodeJsonString); var jsonString2 = json.ToJSON(); System.Diagnostics.Debug.WriteLine(jsonString); System.Diagnostics.Debug.WriteLine(jsonString2); }
void LoginPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList) { Dictionary <string, string> _dataDict = new Dictionary <string, string>(); _dataDict[kButtonPressed] = _selectedButton; //Adding some default text here _dataDict[kUserName] = ""; _dataDict[kPassword] = ""; if (_inputList != null) { if (_inputList[0] != null) { _dataDict[kUserName] = _inputList[0].GetCurrentText(); } if (_inputList[1] != null) { _dataDict[kPassword] = _inputList[1].GetCurrentText(); } } if (NPBinding.UI != null) { NPBinding.UI.InvokeMethod(kLoginPromptDialogClosedEvent, _dataDict.ToJSON()); } }
public string DefaultWorkspaceTimeout() { Dictionary <String, long> result = new Dictionary <string, long>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.DefaultWorkspaceTimeout.Ticks); return(result.ToJSON()); }
public string SnapshotIsolationEnabled() { Dictionary <String, Boolean> result = new Dictionary <string, Boolean>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.SnapshotIsolationEnabled); return(result.ToJSON()); }
public string LastSnapshotId() { Dictionary <String, Guid> result = new Dictionary <string, Guid>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.LastSnapshotId()); return(result.ToJSON()); }
public ActionResult GetCurrentUser() { Dictionary <string, object> result = new Dictionary <string, object>(); result["Id"] = SessionHelper.Data <Guid>(SessionKey.UserId); result["Name"] = SessionHelper.Data <string>(SessionKey.UserName); return(result.ToJSON()); }
private void SendConfigInfoToNative(string[] _senderIDs, Dictionary <string, string> _customKeysInfo, bool _needsBigStyle, Texture2D _whiteSmallNotificationIcon, bool _allowVibration) { List <string> list = new List <string>(_senderIDs); bool _usesExternalRemoteNotificationService = NPSettings.Application.SupportedAddonServices.UsesOneSignal; //Pass this to android Plugin.Call(NativeInfo.Methods.INITIALIZE, list.ToJSON(), _customKeysInfo.ToJSON(), _whiteSmallNotificationIcon == null ? false : true, _allowVibration, _usesExternalRemoteNotificationService); }
public string GetRootObjectId(string snapshotId) { Guid snapshotIdParsed = Guid.Parse(snapshotId); Guid rootId = ServerContextSingleton.Instance.ServerContext.GetRootObjectId(snapshotIdParsed); Dictionary <String, Guid> result = new Dictionary <string, Guid>(); result.Add(RESULT, rootId); return(result.ToJSON()); }
/// <summary> /// Constructor con la identidad del usuario /// </summary> /// <param name="identity">Identidad del Usuario</param> public NucleoPrincipal(NucleoIdentity identity) { NucleoIdentity = identity; var principalClaims = new Dictionary <string, object>(identity.Claims); principalClaims["SessionStartTime"] = DateTime.UtcNow; principalClaims["LastAccessTime"] = DateTime.Parse(principalClaims["SessionStartTime"].ToString()); Ticket = CryptoHelper.Encrypt(principalClaims.ToJSON()); }
public string Contains(string identifier) { Guid id = Guid.Parse(identifier); Dictionary <String, Boolean> result = new Dictionary <string, Boolean>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.Contains(id)); return(result.ToJSON()); }
public string GetRootType() { Type rootType = ServerContextSingleton.Instance.ServerContext.GetRootType(); TypeMetadata root = TypeSingleton.ExtractTypeMetadata(rootType); Dictionary <String, TypeMetadata> result = new Dictionary <string, TypeMetadata>(); result.Add(RESULT, root); return(result.ToJSON()); }
public string GetNode(string nodeId, int access) { Guid nodeGuid = Guid.Parse(nodeId); NodeAccess nodeAccess = (NodeAccess)access; Dictionary <String, NodeWrapper> result = new Dictionary <string, NodeWrapper>(); var node = ServerContextSingleton.Instance.ServerContext.GetNode(nodeGuid, nodeAccess); var nodeWraped = NodeWrapper.TransformeNode(node); result.Add(RESULT, nodeWraped); return(result.ToJSON()); }
protected void SendConfigInfoToNative(string[] _senderIDs, Dictionary <string, string> _customKeysInfo, bool _needsBigStyle, bool _allowCustomIcon) { if (_senderIDs.Length == 0) { Console.LogError(Constants.kDebugTag, "Add senderid list for notifications to work"); } List <string> list = new List <string>(_senderIDs); //Pass this to android Plugin.Call(NativeInfo.Methods.INITIALIZE, list.ToJSON(), _customKeysInfo.ToJSON(), _needsBigStyle, _allowCustomIcon); }
public string ChangesBetween(string oldSnapshotId, string newSnapshotId) { Guid guidOldSnapshotId = Guid.Parse(oldSnapshotId); Guid guidNewSnapshotId = Guid.Parse(newSnapshotId); Dictionary <String, String> changes = ServerContextSingleton.Instance.ServerContext.ChangesBetween(guidOldSnapshotId, guidNewSnapshotId). ToDictionary(k => k.Key.ToString(), k => k.Value.ToString());; Dictionary <String, Dictionary <String, String> > rez = new Dictionary <string, Dictionary <String, String> >(); rez.Add(RESULT, changes); return(rez.ToJSON()); }
public override string GetContent() { var dic = new Dictionary <string, string>(); dic["appId"] = this.AppId; dic["timeStamp"] = this.TimeStamp; dic["nonceStr"] = this.NonceStr; dic["package"] = this.Package; dic["signType"] = this.SignType; dic["paySign"] = this.AppSignature; return(dic.ToJSON()); }
void AlertDialogCallback(string _selectedButton, string _callerTag) { Dictionary <string, string> _dataDict = new Dictionary <string, string>(); _dataDict[kButtonPressed] = _selectedButton; _dataDict[kCaller] = _callerTag; if (NPBinding.UI != null) { NPBinding.UI.InvokeMethod(kAlertDialogClosedEvent, _dataDict.ToJSON()); } }
private void LogCallDetails <TResult>(Delegate method, object[] args, CircuitModel model, TResult result = default(TResult), Stopwatch sw = null) { var log = new Dictionary <string, object>(); log["Method"] = model.MethodKey; if (sw != null) { log["TimeTaken"] = sw.Elapsed; } if (model.LastAttemptFailureReason != CircuitModel.FailureReasonEnum.None) { log["Failed"] = model.LastAttemptFailureReason; } var argslist = new Dictionary <string, object>(); if (args != null) { var definitionParams = method.Method.GetParameters(); for (int i = 0; i < args.Length; i++) { argslist[definitionParams[i].Name] = args[i]; } } log["Request"] = argslist; //some objects don't have paramaterless constructors, // and some objects have properties which call other services (which means recursive .ToJSON() could indirectly trigger more service calls to siebel) ////if (result != null && result.ToJSON().ToMD5().Equals(Activator.CreateInstance(result.GetType()).ToJSON().ToMD5())) log.EmptyResponse = true; if (result != null) { try { //this might seem pointless, but if ToJSON fails, it will cause an error here as a timeout attempt. // Instead of the logging system recursively writing logs and calling siebel over and over if the result has a GET property which calls a service // If there is a safe way to remove this line, performance could be increased on the circuitbreaker while logging is active result.ToJSON(); log["Response"] = result; } catch (Exception e) { log["ResponseSerializationFailure"] = e.Message; } } model.LastLogSerialized = log.ToJSON(); Task.Run(() => _loggingHelper.Log(log)); }
/// <summary> /// Adds Metadata to pin /// </summary> public void AddMetadata(Dictionary <string, object> Meta) { if (UrlIsValid) { string Url = RawUrl + "/AddMetadata"; _ = Utilities.Post(Url, Meta.ToJSON()); } else { throw NoURL; } }
private void SendConfigInfoToNative(string[] _senderIDs, Dictionary <string, string> _customKeysInfo, bool _needsBigStyle, Texture2D _whiteSmallNotificationIcon, bool _allowVibration) { if (_senderIDs.Length == 0) { DebugUtility.Logger.LogError(Constants.kDebugTag, "Add senderid list for notifications to work"); } List <string> list = new List <string>(_senderIDs); bool _usesExternalRemoteNotificationService = NPSettings.Application.SupportedAddonServices.UsesOneSignal; //Pass this to android Plugin.Call(NativeInfo.Methods.INITIALIZE, list.ToJSON(), _customKeysInfo.ToJSON(), _whiteSmallNotificationIcon == null ? false : true, _allowVibration, _usesExternalRemoteNotificationService); }
private void LogExceptionDetails <TResult>(Delegate method, object[] args, CircuitModel model, Exception exception, Stopwatch sw = null) { var log = new Dictionary <string, object>(); log["Method"] = model.MethodKey; //look back in the stacktrace to find parent calling method var methodBase = (new StackTrace()).GetFrame(6).GetMethod(); var classType = methodBase.ReflectedType; if (classType != null) { var namespaceName = classType.Namespace; log["CalledFrom"] = namespaceName + "." + classType.Name + "." + methodBase.Name; } if (sw != null) { log["TimeTaken"] = sw.Elapsed; } if (args != null) { var definitionParams = method.Method.GetParameters(); var argslist = new Dictionary <string, object>(); for (int i = 0; i < args.Length; i++) { argslist[definitionParams[i].Name] = args[i]; } if (argslist.Count > 0) { log["Request"] = argslist; } } var loggableExceptionData = new Dictionary <string, object>(); if (exception != null) { loggableExceptionData["ClassName"] = exception.GetType().FullName; loggableExceptionData["Message"] = exception.Message; loggableExceptionData["InnerException"] = exception.InnerException; loggableExceptionData["StackTraceString"] = exception.GetType().FullName + exception.StackTrace.Replace("\r\n", ""); loggableExceptionData["Source"] = exception.Source; } log["Exception"] = loggableExceptionData; model.LastLogSerialized = log.ToJSON(); Task.Run(() => _loggingHelper.Log(log)); }
private void PickImageCancelled() { Dictionary <string, int> _packedData = new Dictionary <string, int>(); _packedData[kFinishReason] = (int)ePickImageFinishReason.CANCELLED; if (NPBinding.MediaLibrary != null) { NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON()); } // Reset view ResetView(); }
private void PickImageFinished(string _path) { Dictionary <string, object> _packedData = new Dictionary <string, object>(); _packedData[kImagePath] = _path; _packedData[kFinishReason] = (int)ePickImageFinishReason.SELECTED; if (NPBinding.MediaLibrary != null) { NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON()); } // Reset view ResetView(); }
void SingleFieldPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList) { Dictionary <string, string> _dataDict = new Dictionary <string, string>(); _dataDict[kButtonPressed] = _selectedButton; if (_inputList != null && _inputList[0] != null) { _dataDict[kInput] = _inputList[0].GetCurrentText(); } if (NPBinding.UI != null) { NPBinding.UI.InvokeMethod(kSingleFieldPromptDialogClosedEvent, _dataDict.ToJSON()); } }
public static HttpContent json(HttpRequest request) { try { var result = new Dictionary<string, object>(); result.Add("request", Encoding.ASCII.GetString(request.Data)); result.Add("guid", Guid.NewGuid().ToString()); result.Add("html", @"<h1 class=""page-header"">" + request.Data + @"</h1><br/>" ); if (Encoding.ASCII.GetString(request.Data) == "error") throw new ApplicationException("error test"); return new HttpContent(result.ToJSON()); } catch (Exception ex) { return new HttpErrorContent(ex); } }
public GetListsResult GetLists(string apiKey, ListFilters filters, int?start, int?limit, string sort_field, string sort_dir) { GetListsResult result = null; var parameters = new Dictionary <string, object>(); parameters.Add("apikey", apiKey); parameters.Add("filters", filters); if (start.HasValue) { parameters.Add("start", start.Value); } if (limit.HasValue) { parameters.Add("limit", limit.Value); } if (!string.IsNullOrEmpty(sort_field)) { parameters.Add("sort_field", sort_field); } if (!string.IsNullOrEmpty(sort_dir)) { parameters.Add("sort_dir", sort_dir); } RestResponse response = RestClient.Post("[VER]/lists/list.[FORMAT]", parameters.ToJSON()); if (response.HasError) { if (response.HasData) { ErrorResponseInfo e = response.Get <ErrorResponseInfo>(); throw new Exception(string.Format("{0} ({1}) {2}", e.name, e.code, e.error)); } throw new Exception(response.Message); } if (response.HasData) { result = response.Get <GetListsResult>(); } return(result); }
public static HttpContent json(HttpRequest request) { try { var result = new Dictionary <string, object>(); result.Add("request", Encoding.ASCII.GetString(request.Data)); result.Add("guid", Guid.NewGuid().ToString()); result.Add("html", @"<h1 class=""page-header"">" + request.Data + @"</h1><br/>"); if (Encoding.ASCII.GetString(request.Data) == "error") { throw new ApplicationException("error test"); } return(new HttpContent(result.ToJSON())); } catch (Exception ex) { return(new HttpErrorContent(ex)); } }
static void Main(string[] args) { string a = "hello", b = "bye"; Console.WriteLine(a.GreaterThan(b)); int[] array = { 1, 2, 3, 4 }; Console.WriteLine(array.Implode()); Console.WriteLine(array.ToJSON()); List<int> list = new List<int>() { 5, 6, 7, 8 }; Console.WriteLine(list.Implode()); Console.WriteLine(list.ToJSON()); Dictionary<int, string> dict = new Dictionary<int, string>(); dict.Add(3, "three"); dict.Add(5, "five"); Console.WriteLine(dict.ToJSON()); TestClass test = new TestClass("Andrew", new int[] { 1, 2, 3 }, 13); Console.WriteLine(test.ToJSON()); Console.ReadKey(); }
public static string BuildSemantics(IDictionary<string, object> semantics) { var strings = new Dictionary<string, string>(); foreach (var entry in semantics) { if (entry.Value == null) continue; var type = entry.Value.GetType(); if (type == typeof(string)) strings.Add(entry.Key, entry.Value as string); #if NETFX else if (type.IsEnum) #elif UNIVERSAL else if (type.GetTypeInfo().IsEnum) #endif strings.Add(entry.Key, ((int)entry.Value).ToStringInvariant()); else if (type.IsNumber()) strings.Add(entry.Key, entry.ToStringInvariant()); else strings.Add(entry.Key, entry.Value.ToJSON()); } return strings.ToJSON(HtmlEncode: false); }
public string GetRootObjectId(string snapshotId) { Guid snapshotIdParsed = Guid.Parse(snapshotId); Guid rootId = ServerContextSingleton.Instance.ServerContext.GetRootObjectId(snapshotIdParsed); Dictionary<String, Guid> result = new Dictionary<string, Guid>(); result.Add(RESULT, rootId); return result.ToJSON(); }
public HttpContent(Dictionary<string, object> json) : this(Encoding.ASCII.GetBytes(json.ToJSON()), "application/json") { }
public string DefaultWorkspaceTimeout() { Dictionary<String, long> result = new Dictionary<string, long>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.DefaultWorkspaceTimeout.Ticks); return result.ToJSON(); }
public string LastSnapshotId() { Dictionary<String, Guid> result = new Dictionary<string, Guid>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.LastSnapshotId()); return result.ToJSON(); }
static bool WriteConfig() { try { var config = new Dictionary<Type, ThingConfig>(); foreach (var kv in Lookup) { var pinConf = kv.Key.Config.Find(cp => cp.Name == "Pin").Value; var sensor = kv.Value; config.Add(sensor.GetType(), new ThingConfig() { Pin = pinConf, Period = (int)sensor.Watcher.SamplingPeriod }); } File.WriteAllText(ThingsConfFileName, config.ToJSON()); return true; } catch (Exception ex) { DebugEx.TraceErrorException(ex); return false; } }
static Dictionary<Type, ThingConfig> ReadConfig() { Dictionary<Type, ThingConfig> config = null; try { if (File.Exists(ThingsConfFileName)) { var content = File.ReadAllText(ThingsConfFileName); //deserialize into List of Configurations and pick the active one config = content.FromJSON<Dictionary<Type, ThingConfig>>(); } } catch (Exception ex) { DebugEx.TraceErrorException(ex); } if (config == null) { config = new Dictionary<Type, ThingConfig>() { { typeof(GPIO), new ThingConfig() { Pin = "", Period = 100 } }, { typeof(Buzzer), new ThingConfig() { Pin = "D7", Period = 0 } }, { typeof(RgbLed), new ThingConfig() { Pin = "D4", Period = 0 } }, { typeof(SoundSensor), new ThingConfig() { Pin = "A2", Period = 1000 } }, { typeof(LightSensor), new ThingConfig() { Pin = "A1", Period = 500 } }, { typeof(Button), new ThingConfig() { Pin = "D2", Period = 200 } }, { typeof(RotaryAngleSensor), new ThingConfig() { Pin = "A0", Period = 200 } }, { typeof(Relay), new ThingConfig() { Pin = "D3", Period = 1000 } }, { typeof(TempAndHumidity), new ThingConfig() { Pin = "D6", Period = 500 } }, { typeof(UltraSonicRanger), new ThingConfig() { Pin = "D8", Period = 100 } }, { typeof(LCD), new ThingConfig() { Pin = "I2C", Period = 0 } }, }; try { File.WriteAllText(ThingsConfFileName, config.ToJSON()); } catch (Exception ex) { DebugEx.TraceErrorException(ex); } } return config; }
public string GetRootType() { Type rootType = ServerContextSingleton.Instance.ServerContext.GetRootType(); TypeMetadata root = TypeSingleton.ExtractTypeMetadata(rootType); Dictionary<String, TypeMetadata> result = new Dictionary<string, TypeMetadata>(); result.Add(RESULT, root); return result.ToJSON(); }
void Button6Click(object sender, EventArgs e) { var data = @"\tC:\\test\\ \n"; data = Regex.Replace(data, @"([^\\]|^)([\\][n])", m => m.Groups[1].Value + "\n"); data = Regex.Replace(data, @"([^\\]|^)([\\][t])", m => m.Groups[1].Value + "\t"); data = Regex.Replace(data, @"([^\\]|^)([\\][\\])", m => m.Groups[1].Value + "\\"); System.Diagnostics.Debug.WriteLine(data); var json = new Dictionary<string, object>(); json.Add("test", @"c:\test\ 102/103 ""abc efg"""); var jsonString = json.ToJSON(); var decodeJsonString = jsonString.GetJSON("test", "abc"); json = new Dictionary<string, object>(); json.Add("test", decodeJsonString); var jsonString2 = json.ToJSON(); System.Diagnostics.Debug.WriteLine(jsonString); System.Diagnostics.Debug.WriteLine(jsonString2); }
public string CreateSubscription(Guid workspaceId, Guid instanceId, string propertyName, bool notifyChangesFromSameWorkspace, string callerId) { //EventHandler<Execom.IOG.Events.ObjectChangedEventArgs> delegate += Subscription sub = null; if(propertyName == null) { sub = ServerContextSingleton.Instance.ServerContext.CreateSubscription(workspaceId, instanceId, notifyChangesFromSameWorkspace, JSEventHandler); MemberManager.AddSubscription(callerId, sub.SubscriptionId.ToString()); } else { sub = ServerContextSingleton.Instance.ServerContext.CreateSubscription(workspaceId, instanceId, propertyName, notifyChangesFromSameWorkspace, JSEventHandler); MemberManager.AddSubscription(callerId, sub.SubscriptionId.ToString()); } Dictionary<String, Subscription> result = new Dictionary<String, Subscription>(); result.Add(RESULT, sub); return result.ToJSON(); }
public string EnumerateNodes() { Dictionary<String, System.Collections.IEnumerable> result = new Dictionary<string, System.Collections.IEnumerable>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.EnumerateNodes()); return result.ToJSON(); }
public string GetNode(string nodeId, int access) { Guid nodeGuid = Guid.Parse(nodeId); NodeAccess nodeAccess = (NodeAccess)access; Dictionary<String, NodeWrapper> result = new Dictionary<string, NodeWrapper>(); var node = ServerContextSingleton.Instance.ServerContext.GetNode(nodeGuid, nodeAccess); var nodeWraped = NodeWrapper.TransformeNode(node); result.Add(RESULT, nodeWraped); return result.ToJSON(); }
public string ChangesBetween(string oldSnapshotId, string newSnapshotId) { Guid guidOldSnapshotId = Guid.Parse(oldSnapshotId); Guid guidNewSnapshotId = Guid.Parse(newSnapshotId); Dictionary<String, String> changes = ServerContextSingleton.Instance.ServerContext.ChangesBetween(guidOldSnapshotId, guidNewSnapshotId). ToDictionary(k => k.Key.ToString(), k => k.Value.ToString()); ; Dictionary<String, Dictionary<String, String>> rez = new Dictionary<string, Dictionary<String, String>>(); rez.Add(RESULT, changes); return rez.ToJSON(); }
public string SnapshotIsolationEnabled() { Dictionary<String, Boolean> result = new Dictionary<string, Boolean>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.SnapshotIsolationEnabled); return result.ToJSON(); }
public string Contains(string identifier) { Guid id = Guid.Parse(identifier); Dictionary<String, Boolean> result = new Dictionary<string, Boolean>(); result.Add(RESULT, ServerContextSingleton.Instance.ServerContext.Contains(id)); return result.ToJSON(); }
public string Commit(string workspaceId, object changeSet) { Guid guidWorkspaceId = Guid.Parse(workspaceId); //transform changeSet into IsolatedChangeSet object IsolatedChangeSet<Guid, object, EdgeData> serverChangeSet = ChangeSetParser.Parse(changeSet); //commit changes CommitResult<Guid> commitResult = ServerContextSingleton.Instance.ServerContext.Commit(guidWorkspaceId, serverChangeSet); String resultSnapshotId = commitResult.ResultSnapshotId.ToString(); Dictionary<string, string> mapping = new Dictionary<string, string>(); foreach (KeyValuePair<Guid, Guid> mapObject in commitResult.Mapping) { mapping.Add(mapObject.Key.ToString(), mapObject.Value.ToString()); } CommitResult<String> commitResultString = new CommitResult<string>(resultSnapshotId, mapping); Dictionary<String, CommitResult<String>> rez = new Dictionary<string, CommitResult<string>>(); rez.Add(RESULT, commitResultString); return rez.ToJSON(); }