Beispiel #1
0
        public static unsafe int GetData(string filePath, string fileName, int* legs, MqlStr* actions, MqlStr* errors)
        {
            var dispatchedPettern = GetData(filePath, fileName);
            if (!dispatchedPettern.Success)
            {
                errors[0].SetString(dispatchedPettern.Error);
                return 0;
            }
            for (var i = 0; i < dispatchedPettern.Legs.Count; i++)
                for (var j = 0; j < dispatchedPettern.Legs[i].Count; j++)
                {
                    var index = UnsafeCodeHelper.Index(i, j, 16, 4);
                    legs[index] = dispatchedPettern.Legs[i][j];
                }
            for (var i = 0; i < dispatchedPettern.Actions.Count; i++)
                for (var j = 0; j < dispatchedPettern.Actions[i].Count; j++)
                {
                    var index = UnsafeCodeHelper.Index(i, j, 16, 5);
                    actions[index].SetString(dispatchedPettern.Actions[i][j]);
                }

            return 1;
        }
Beispiel #2
0
 public static unsafe int ParseActions(string actionsStr, MqlStr* actions, int* magics)
 {
     var tradeActions = ActionParser.Parse(actionsStr);
     for (var i = 0; i < tradeActions.Count; i++)
     {
         actions[i].SetString(tradeActions[i].Action);
         magics[i] = tradeActions[i].Magic;
     }
     return tradeActions.Count;
 }
Beispiel #3
0
 public static unsafe void SaveSession(string appName, string recordId, MqlStr* keys, MqlStr* values, int count)
 {
     var appDataFileName = Functions.GetAppDataFileName(appName);
     var attributes = new Dictionary<string, string>();
     for (var index = 0; index < count; ++index)
         attributes.Add(keys[index].ToString(), values[index].ToString());
     recordId = recordId.Replace(" ", "");
     locker.EnterWriteLock();
     if (!File.Exists(appDataFileName))
         ToXml.CreateXmlDefaulFile(appDataFileName);
     XmlRecordAppender.AppendRecord(appDataFileName, recordId, attributes);
     locker.ExitWriteLock();
 }
Beispiel #4
0
 public static unsafe int LoadSession(string appName, string recordId, MqlStr* keys, MqlStr* values, int dataArraySize)
 {
     var appDataFileName = Functions.GetAppDataFileName(appName);
     locker.EnterReadLock();
     if (!File.Exists(appDataFileName))
     {
         locker.ExitReadLock();
         return 0;
     }
     recordId = recordId.Replace(" ", "");
     var dictionary = XmlRecordReader.ReadRecord(appDataFileName, recordId);
     for (var index = 0; index < dictionary.Count; ++index)
     {
         if (index >= dataArraySize)
             break;
         keys[index].SetString(dictionary.Keys.ElementAt(index));
         values[index].SetString(dictionary.Values.ElementAt(index));
     }
     locker.ExitReadLock();
     return dictionary.Count;
 }