Ejemplo n.º 1
0
        void Load()
        {
            FileStream fs = null;

            try
            {
                fs = File.OpenRead(SettingsManager.RunOnceFilePath);
                var reader = new RawDataReader(fs, Encoding.UTF8);

                byte[] sign = Signature;

                foreach (byte b in sign)
                {
                    if (b != reader.ReadByte())
                    {
                        throw new CorruptedFileException(SettingsManager.RunOnceFilePath);
                    }
                }

                int actCount = reader.ReadInt();
                for (int i = 0; i < actCount; ++i)
                {
                    var             code = (RunOnceAction_t)reader.ReadInt();
                    IRunOnceCommand act  = m_actBuilder[code]();
                    act.Read(reader);
                    m_actions.Add(act);
                }
            }
            catch (Exception ex)
            {
                Dbg.Log(ex.Message);
                m_actions.Clear();
            }
            finally
            {
                if (fs != null)
                {
                    fs.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public void AddFirst(IRunOnceCommand action)
        {
            Dbg.Assert(action != null);

            m_actions.Insert(0, action);
        }
Ejemplo n.º 3
0
        public void Add(IRunOnceCommand action)
        {
            Dbg.Assert(action != null);

            m_actions.Add(action);
        }