public override void Process(opis message) { opis data = new opis(); if (!string.IsNullOrEmpty(rawData)) { if (rawData.Trim().StartsWith("{")) { data.load(rawData); } else { data.load(Compress.DeComprez(rawData)); } } message.CopyArr(data); }
opis CreateMethodMessage(string specName, string method, string param = "") { var methodRun = new opis(); var req = "{\"N\": \"api_provider\",\"K\": \"message\",\"B\": \"###msgtype\",\"a\": [{\"N\": \"contTargetModel\",\"K\": \"TargetingChecks\",\"B\": \"\",\"a\": [{\"N\": \"1\",\"K\": \"targetAnyCont\",\"B\": \"\"}]},{\"N\": \"p\",\"K\": \"\",\"B\": \"" + param + "\"}]}"; methodRun.load(req.Replace("###msgreceiv", specName) .Replace("###msgtype", method)); return(methodRun); }
public static void LoadEnvironment(string path) { string data = ""; string zipdata = DataFileUtils.LoadSingleLineZipped(path); if (!string.IsNullOrEmpty(zipdata)) { data = zipdata; } ContextGlobal = new opis(); ContextGlobal.load(data); DeCompressWords(); }
public static void DecompressOpis(opis t) { opis parsed = new opis(); try { parsed.load(Compress.DeComprez(t.body)); } catch (IndexOutOfRangeException e) { parsed.body = Compress.DeComprez(t.body); } t.CopyArr(parsed); t.body = parsed.body; }
public static void LoadEnvironment(string path) { string data = ""; string zipdata = DataFileUtils.LoadSingleLineZipped(path); // string zipdata = DataFileUtils.LoadSingleLine(path); if (!string.IsNullOrEmpty(zipdata)) { data = zipdata; } //dataOut = new string[100000]; //datcou = 0; ContextGlobal = new opis(); ContextGlobal.load(data); }
public override void Process(opis message) { if (message.PartitionKind != "stringArray") { logopis["err:"].body = "message is not a stringArray "; } string[] proc = (string[])message.bodyObject; for (int i = 0; i < proc.Length; i++) { if (proc[i].Length > 4) { opis d = new opis(); d.load(proc[i]); message["data"] = d; break; } } }
public override void Process(opis message) { opis trtrt = new opis(); try { if (modelSpec.isHere(opis_json)) { trtrt.load(message.body); } else { trtrt.JsonParce(message.body); } } catch (Exception e) { trtrt["error parce"].body = e.Message; } message.body = ""; if (modelSpec.isHere(opis_json)) { message.body = trtrt.body; } if (modelSpec.isHere(decode_names)) { trtrt.RunRecursively(x => x.PartitionName = TemplatesMan.UTF8BigEndian_to_Kirill(x.PartitionName)); } message.CopyArr(new opis()); message.AddArr(trtrt); }
public override void Process(opis message) { //byte[] buffer = Encoding.UTF8.GetBytes(message.body); //string rez = Convert.ToBase64String(buffer); // rez = Convert.ToBase64String(CompressBufferDeflate(buffer)); //message.body = DecompressString(CompressString(message.body)); //rez = Convert.ToBase64String(DeflateStream.CompressString(message.body)); if (modelSpec.isHere(generateSessionId)) { string rez = ""; var r = new Random(); for (int i = 1; i < 9; i++) { int A = r.Next(16000, 65000); string hexValue1 = A.ToString("X"); rez += hexValue1; if (i > 1 && i < 6) { rez += "-"; } } // 4A7E 3C04 - F684 - 4D60 - AC9E - E66B F1E4 870F //byte[] bbb = Encoding.UTF8.GetBytes(message.body); //string rez = BitConverter.ToString(bbb).Replace("-", string.Empty); message.body = rez; return; } if (modelSpec.isHere(generateRandomHex)) { int len = modelSpec[generateRandomHex].intVal; len = len / 4; string rez = ""; var r = new Random(); for (int i = 0; i < len; i++) { int A = r.Next(16000, 65000); string hexValue1 = A.ToString("x"); rez += hexValue1; } message.body = rez; return; } if (modelSpec.isHere(epochTime)) { double ts = (DateTime.Now - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds; double correction = StrUtils.LongFromString(modelSpec.V(epochTime)); message.body = (ts - correction).ToString().Substring(0, 10); return; } if (modelSpec.isHere(epochTime_ms)) { double ts = (DateTime.Now - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds; double correction = StrUtils.LongFromString(modelSpec.V(epochTime)); string ssdf = (ts - correction).ToString().Replace(",", ""); message.body = ssdf.Length < 14 ? ssdf.PadRight(13, '0') : ssdf.Substring(0, 13); //message.body = (ts - correction).ToString().Replace(",", "").Substring(0, 13); return; } if (modelSpec.isHere(decodeBase64)) { byte[] data = Convert.FromBase64String(message.body); message.body = Encoding.UTF8.GetString(data); return; } if (modelSpec.isHere(ENcodeBase64)) { //logopis["message_body"].body = message.body; //logopis["message duplicated"] = message.Duplicate(); byte[] buffer = Encoding.UTF8.GetBytes(message.body); message.body = Convert.ToBase64String(buffer); //logopis["Result message_body"].body = message.body; return; } if (modelSpec.isHere(arhivateBranch)) { message.body = Comprez(message.serialize()); message.CopyArr(new opis()); return; } if (modelSpec.isHere(DeArhivateBranch)) { opis parsed = new opis(); try { parsed.load(DeComprez(message.body)); } catch (IndexOutOfRangeException e) { parsed.body = DeComprez(message.body); } message.CopyArr(parsed); message.body = parsed.body; return; } if (modelSpec.isHere(makeTrackingtoken)) { // here we build payload {"payload":{"server_token":"1484138152791|1421652562016702438|4272561644|76eb81169b957ceeda455393f54d8dde2257da69d47856c0f1c55a9482052be8","is_analytics_tracked":true,"uuid":"2b200c6cdc3841f5a7b58d65fbecb6aa1421652562016702438"},"signature":"","version":5} //byte[] buffer = Encoding.UTF8.GetBytes(message.body); //string rez = Convert.ToBase64String(buffer); //modelSpec[makeTrackingtoken]["userid"] //modelSpec[makeTrackingtoken]["imageId"] //Convert.FromBase64String //message.body = (ts - correction).ToString().Substring(0, 10); return; } message.body = Comprez_Zlib(message.body); }