Exemplo n.º 1
0
        public string GetJobFlagsAtPos(int pos)
        {
            string res = "";

            if (pos > (RawBytes.Count - 4))
            {
                return(res);
            }
            UInt32 Flags = GetUInt32AtPos(pos);

            for (uint BitShiftCount = 0; BitShiftCount < 32; BitShiftCount++)
            {
                if ((Flags & 0x00000001) == 1)
                {
                    if (res != "")
                    {
                        res += " ";
                    }

                    if (BitShiftCount == 0)
                    {
                        res += "SubJob";
                    }
                    else
                    {
                        var JobName = DataLookups.NLU(DataLookups.LU_Job).GetValue(BitShiftCount);
                        if (JobName == "")
                        {
                            JobName = "[Bit" + BitShiftCount.ToString() + "]";
                        }
                        res += JobName;
                    }
                }
                Flags = Flags >> 1;
            }

            return(res);
        }
Exemplo n.º 2
0
        public bool SaveToFile(string filename)
        {
            List <string> sl = new List <string>();

            sl.Add("rem;original-file;" + Path.GetFileName(filename));
            switch (FilterOutType)
            {
            case FilterType.Off:
                sl.Add("outtype;off");
                break;

            case FilterType.ShowPackets:
                sl.Add("outtype;show");
                break;

            case FilterType.HidePackets:
                sl.Add("outtype;hide");
                break;

            case FilterType.AllowNone:
                sl.Add("outtype;none");
                break;
            }
            foreach (UInt16 i in FilterOutList)
            {
                sl.Add("out;0x" + i.ToString("X3") + ";" + DataLookups.NLU(DataLookups.LU_PacketOut).GetValue(i));
            }

            switch (FilterInType)
            {
            case FilterType.Off:
                sl.Add("intype;off");
                break;

            case FilterType.ShowPackets:
                sl.Add("intype;show");
                break;

            case FilterType.HidePackets:
                sl.Add("intype;hide");
                break;

            case FilterType.AllowNone:
                sl.Add("intype;none");
                break;
            }
            foreach (UInt16 i in FilterInList)
            {
                sl.Add("in;0x" + i.ToString("X3") + ";" + DataLookups.NLU(DataLookups.LU_PacketIn).GetValue(i));
            }

            try
            {
                File.WriteAllLines(filename, sl);
            }
            catch (Exception x)
            {
                MessageBox.Show("Failed to save " + filename + "\r\nException: " + x.Message, "Save Filter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }