Esempio n. 1
0
 private void Update(float t, object osObj)
 {
     for (int index = 0; index < this.Actions.Count; ++index)
     {
         try
         {
             float key1 = this.Actions[index].Key;
             SerializableAction serializableAction = this.Actions[index].Value;
             float key2 = key1 - t;
             if ((double)key2 <= 0.0)
             {
                 try
                 {
                     serializableAction.Trigger((object)(OS)osObj);
                 }
                 catch (Exception ex)
                 {
                     ((OS)osObj).write(Utils.GenerateReportFromException(ex));
                     Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                 }
                 this.Actions.RemoveAt(index);
                 --index;
             }
             else
             {
                 this.Actions[index] = new KeyValuePair <float, SerializableAction>(key2, serializableAction);
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Esempio n. 2
0
        private FileEntry EncryptAction(SerializableAction action, float delay)
        {
            string    str       = FileEncrypter.EncryptString(action.GetSaveString(), "das", "UNKNOWN", FastDelayableActionSystem.EncryptionPass, (string)null);
            FileEntry fileEntry = new FileEntry(delay.ToString("0.0000000000", (IFormatProvider)CultureInfo.InvariantCulture) + "\n" + str, this.SeqNum.ToString("000") + ".act");

            ++this.SeqNum;
            return(fileEntry);
        }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        public List <FileEntry> GetAllFilesForActions()
        {
            this.SeqNum = 0;
            List <FileEntry> fileEntryList1 = new List <FileEntry>();

            for (int index = 0; index < this.Actions.Count; ++index)
            {
                List <FileEntry> fileEntryList2 = fileEntryList1;
                KeyValuePair <float, SerializableAction> action1 = this.Actions[index];
                SerializableAction action2 = action1.Value;
                action1 = this.Actions[index];
                double    key       = (double)action1.Key;
                FileEntry fileEntry = this.EncryptAction(action2, (float)key);
                fileEntryList2.Add(fileEntry);
            }
            return(fileEntryList1);
        }
Esempio n. 5
0
 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)
         {
         }
     }
 }
Esempio n. 6
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);
        }
Esempio n. 7
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));
             }
         }
     }
 }
Esempio n. 8
0
 public override void AddAction(SerializableAction action, float delay);
Esempio n. 9
0
 public virtual void AddAction(SerializableAction action, float delay);
Esempio n. 10
0
 public override void AddAction(SerializableAction action, float delay)
 {
     this.Actions.Add(new KeyValuePair <float, SerializableAction>(delay, action));
 }
Esempio n. 11
0
        public virtual void AddAction(SerializableAction action, float delay)
        {
            string str = FileEncrypter.EncryptString(action.GetSaveString(), "das", "UNKNOWN", DelayableActionSystem.EncryptionPass, (string)null);

            this.folder.files.Add(new FileEntry(delay.ToString("0.0000000000", (IFormatProvider)CultureInfo.InvariantCulture) + "\n" + str, this.GetNextSeqNumber() + ".act"));
        }