public virtual void InstantlyResolveAllActions(object osObj)
 {
     for (int index = 0; index < this.folder.files.Count; index = index - 1 + 1)
     {
         string data = this.folder.files[index].data;
         int    num  = data.IndexOf('\n');
         using (Stream streamFromString = Utils.GenerateStreamFromString(FileEncrypter.DecryptString(data.Substring(num + 1), DelayableActionSystem.EncryptionPass)[2]))
         {
             XmlReader rdr = XmlReader.Create(streamFromString);
             SerializableAction.Deserialize(rdr).Trigger((object)(OS)osObj);
             rdr.Close();
         }
         this.folder.files.RemoveAt(index);
     }
 }
 private void Update(float t, object osObj)
 {
     for (int index = 0; index < this.folder.files.Count; ++index)
     {
         try
         {
             string data1  = this.folder.files[index].data;
             int    length = data1.IndexOf('\n');
             string str    = data1.Substring(0, length);
             string data2  = data1.Substring(length + 1);
             float  num    = (float)Convert.ToDouble(str, (IFormatProvider)CultureInfo.InvariantCulture) - t;
             if ((double)num <= 0.0)
             {
                 using (Stream streamFromString = Utils.GenerateStreamFromString(FileEncrypter.DecryptString(data2, DelayableActionSystem.EncryptionPass)[2]))
                 {
                     try
                     {
                         XmlReader rdr = XmlReader.Create(streamFromString);
                         SerializableAction.Deserialize(rdr).Trigger((object)(OS)osObj);
                         rdr.Close();
                     }
                     catch (Exception ex)
                     {
                         ((OS)osObj).write(Utils.GenerateReportFromException(ex));
                         Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                     }
                 }
                 this.folder.files.RemoveAt(index);
                 --index;
             }
             else
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.Append(num.ToString("0.0000000000", (IFormatProvider)CultureInfo.InvariantCulture));
                 stringBuilder.Append('\n');
                 stringBuilder.Append(data2);
                 this.folder.files[index].data = stringBuilder.ToString();
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Exemple #3
0
        public static SerializableConditionalActionSet Deserialize(XmlReader rdr)
        {
            SerializableConditionalActionSet ret = new SerializableConditionalActionSet();
            Action <XmlReader, string>       bodyContentReadAction = (Action <XmlReader, string>)((xmlReader, EndKeyName) =>
            {
                while (!rdr.EOF && (string.IsNullOrWhiteSpace(rdr.Name) || rdr.NodeType == XmlNodeType.Comment || rdr.NodeType == XmlNodeType.Whitespace))
                {
                    rdr.Read();
                }
                for (bool flag = !xmlReader.EOF && (!(xmlReader.Name == EndKeyName) || xmlReader.IsStartElement()); flag; flag = !xmlReader.EOF && (!(xmlReader.Name == EndKeyName) || xmlReader.IsStartElement()))
                {
                    ret.Actions.Add(SerializableAction.Deserialize(xmlReader));
                    do
                    {
                        xmlReader.Read();
                    }while (xmlReader.NodeType == XmlNodeType.Whitespace || xmlReader.NodeType == XmlNodeType.Comment);
                }
            });

            ret.Condition = SerializableCondition.Deserialize(rdr, bodyContentReadAction);
            return(ret);
        }
Exemple #4
0
 public void DeserializeActions(List <FileEntry> files)
 {
     this.Actions.Clear();
     for (int index = 0; index < files.Count; ++index)
     {
         try
         {
             string data1  = this.folder.files[index].data;
             int    length = data1.IndexOf('\n');
             string str    = data1.Substring(0, length);
             string data2  = data1.Substring(length + 1);
             float  key    = (float)Convert.ToDouble(str, (IFormatProvider)CultureInfo.InvariantCulture);
             using (Stream streamFromString = Utils.GenerateStreamFromString(FileEncrypter.DecryptString(data2, FastDelayableActionSystem.EncryptionPass)[2]))
             {
                 try
                 {
                     SerializableAction serializableAction = SerializableAction.Deserialize(XmlReader.Create(streamFromString));
                     this.Actions.Add(new KeyValuePair <float, SerializableAction>(key, serializableAction));
                 }
                 catch (Exception ex)
                 {
                     if (OS.DEBUG_COMMANDS)
                     {
                         Utils.AppendToWarningsFile("Error deserializing action in fast action host :\n" + Utils.GenerateReportFromExceptionCompact(ex));
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             if (OS.DEBUG_COMMANDS)
             {
                 Utils.AppendToWarningsFile("Error deserializing action " + (object)index + " in fast action host :\n" + Utils.GenerateReportFromExceptionCompact(ex));
             }
         }
     }
 }