Пример #1
0
        /// <summary>
        /// Event Handler : Invokes the RecordHelper.SaveRecording method on the temporary sound file.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveRec_Click(object sender, EventArgs e)
        {
            String TempPath = SoundPath + "\\Recording\\Temp.wav";

            //Invoke the save file method
            RecordHelper.SaveRecording(TempPath);
        }
Пример #2
0
        public DnsQuestion(RecordHelper helper)
        {
            Query = helper.ReadDomainName();

            _type  = (QueryType)helper.ReadUInt16();
            _class = helper.ReadUInt16();
        }
Пример #3
0
        public DnsResponse(byte[] data)
        {
            var record = new RecordHelper(data);
            var header = new DnsHeader(record);

            Questions = new List<DnsQuestion>();
            Answers = new List<AnswerReader>();
            Authorities = new List<AuthorityReader>();
            Additionals = new List<AdditionalReader>();

            for (var intI = 0; intI < header.QdCount; intI++)
            {
                Questions.Add(new DnsQuestion(record));
            }

            for (var intI = 0; intI < header.AnCount; intI++)
            {
                Answers.Add(new AnswerReader(record));
            }

            for (var intI = 0; intI < header.NsCount; intI++)
            {
                Authorities.Add(new AuthorityReader(record));
            }

            for (var intI = 0; intI < header.ArCount; intI++)
            {
                Additionals.Add(new AdditionalReader(record));
            }
        }
 public override void DoStart()
 {
     InputManager.IsReplay = IsReplay;
     if (IsReplay)
     {
         RecordHelper.Deserialize(recordFilePath, this);
     }
 }
Пример #5
0
        /// <summary>
        /// Reads a record set file and outputs a CSV.
        /// </summary>
        /// <param name='inStream'>
        /// The stream for the record set.
        /// </param>
        /// <param name='outWriter'>
        /// Where to write the CSV.
        /// </param>
        /// <param name="excludeOrigColumns">
        /// Should the output include the original values as well as the standarized ones
        /// </param>
        public static void WriteCSV(Stream inStream, TextWriter outWriter, bool excludeOrigColumns)
        {
            var serializer = new XmlSerializer(typeof(RecordSet));
            var records    = (RecordSet)serializer.Deserialize(inStream);
            var table      = RecordHelper.BuildTableOfRecords(records);

            if (excludeOrigColumns)
            {
                var collectionFieldsToRemove = new List <DataColumn>();
                foreach (var collectionField in table.Columns.Cast <DataColumn>().Where(x => x.ColumnName.EndsWith("_ORIG")))
                {
                    if (
                        table.Columns.Cast <DataColumn>().Any(
                            x =>
                            x.ColumnName ==
                            collectionField.ColumnName.Substring(0, collectionField.ColumnName.Length - 5) + "_STD" ||
                            x.ColumnName == collectionField.ColumnName.Substring(0, collectionField.ColumnName.Length - 5)))
                    {
                        collectionFieldsToRemove.Add(collectionField);
                    }
                }

                foreach (var dataColumn in collectionFieldsToRemove)
                {
                    table.Columns.Remove(dataColumn);
                }
            }

            var columnCount = table.Columns.Count;

            foreach (DataColumn column in table.Columns)
            {
                outWriter.Write(column.ColumnName);
                if (--columnCount > 0)
                {
                    outWriter.Write(",");
                }
            }
            outWriter.WriteLine();
            foreach (DataRow row in table.Rows)
            {
                columnCount = table.Columns.Count;
                foreach (DataColumn column in table.Columns)
                {
                    outWriter.Write(row [column]);
                    if (--columnCount > 0)
                    {
                        outWriter.Write(",");
                    }
                }
                outWriter.WriteLine();
            }

            // Ensure all the buffered data is written before finishing
            outWriter.Flush();
        }
Пример #6
0
 public RecordSoa(RecordHelper helper)
 {
     _mName   = helper.ReadDomainName();
     _rName   = helper.ReadDomainName();
     _serial  = helper.ReadUInt32();
     _refresh = helper.ReadUInt32();
     _retry   = helper.ReadUInt32();
     _expire  = helper.ReadUInt32();
     _minimum = helper.ReadUInt32();
 }
Пример #7
0
        public DnsHeader(RecordHelper helper)
        {
            _id    = helper.ReadUInt16();
            _flags = helper.ReadUInt16();

            QdCount = helper.ReadUInt16();
            AnCount = helper.ReadUInt16();
            NsCount = helper.ReadUInt16();
            ArCount = helper.ReadUInt16();
        }
Пример #8
0
        private void InitDevices()
        {
            var devices = DeviceHelper.GetCaptureDevices();
            var device  = devices.Find(m => m.FriendlyName == "Microphone (4- Logitech USB Headset)");

            this.recordHelper            = new RecordHelper(device);
            recordHelper.ProgressReport += RecordHelper_ProgressReport;

            this.playbackHelper         = new PlaybackHelper();
            playbackHelper.PlayStopped += PlaybackHelper_PlayStopped;
        }
Пример #9
0
        public void DoRecord()
        {
            var devices = DeviceHelper.GetCaptureDevices();
            var device  = devices.Find(m => m.FriendlyName == "Microphone (4- Logitech USB Headset)");

            using (var r = new RecordHelper(device))
            {
                r.Start("test_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".wav");
                Thread.Sleep(5000);
                r.Stop();
            }
        }
Пример #10
0
        public void TestFormulaToStringConversion()
        {
            WorkbookStream wbs = TestHelpers.GetMacroLoopWorkbookStream();

            List <RecordType> relevantTypes = new List <RecordType>()
            {
                RecordType.BoundSheet8, //Sheet definitions (Defines macro sheets + hides them)
                RecordType.Lbl,         //Named Cells (Contains Auto_Start)
                RecordType.Formula      //The meat of most cell content
            };

            List <BiffRecord> relevantRecords = wbs.Records.Where(rec => relevantTypes.Contains(rec.Id)).ToList();

            relevantRecords = RecordHelper.ConvertToSpecificRecords(relevantRecords);

            relevantRecords = PtgHelper.UpdateGlobalsStreamReferences(relevantRecords);

            List <string> results = relevantRecords.Select(r => r.ToHexDumpString()).ToList();


            string b1formula = results.Where(res => res.StartsWith("Formula[B1]")).First();

            Assert.AreEqual("Formula[B1]: invokeChar=A11", b1formula);

            string b2formula = results.Where(res => res.StartsWith("Formula[B2]")).First();

            Assert.AreEqual("Formula[B2]: var=999", b2formula);

            string b5formula = results.Where(res => res.StartsWith("Formula[B5]")).First();

            Assert.AreEqual("Formula[B5]: InvokeFormula(\"=HALT()\",A1)", b5formula);

            string b6formula = results.Where(res => res.StartsWith("Formula[B6]")).First();

            Assert.AreEqual("Formula[B6]: WProcessMemory(-1,B2+(D1*255),ACTIVE.CELL(),LEN(ACTIVE.CELL()),0)", b6formula);

            string a11formula = results.Where(res => res.StartsWith("Formula[A11]")).First();

            Assert.AreEqual("Formula[A11]: RETURN(CHAR(var))", a11formula);

            string a12formula = results.Where(res => res.StartsWith("Formula[A12]")).First();

            Assert.AreEqual("Formula[A12]: RETURN(FORMULA(arg1,arg2))", a12formula);

            string d13formula = results.Where(res => res.StartsWith("Formula[D13]")).First();

            Assert.AreEqual("Formula[D13]: stringToBuild=stringToBuild&invokeChar()", d13formula);

            string d14formula = results.Where(res => res.StartsWith("Formula[D14]")).First();

            Assert.AreEqual("Formula[D14]: curCell=ABSREF(\"R[1]C\",curCell)", d14formula);
        }
Пример #11
0
 public RecordAaaa(RecordHelper helper)
 {
     IPAddress.TryParse(
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}:" +
         $"{helper.ReadUInt16():x}",
         out _value);
 }
Пример #12
0
        /// <summary>
        /// 最近报修
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public ActionResult LatestRepair(string code)
        {
            url.urltype = "LatestRepair";
            try
            {
                if (!string.IsNullOrEmpty(code))
                {
                    if (!string.IsNullOrEmpty(CodeJjudgeByOpenid(code)))
                    {
                        var user = wuser.GetUserInfo(this.openid);
                        if (user.UserInfo != null)
                        {
                            ViewBag.user   = user;
                            ViewBag.openid = this.openid;

                            //历史报修记录
                            var repairlist = repairHelper.GetHistoryRepair(this.openid);
                            ViewBag.RepairList          = repairlist.Count() == 0 ? null : repairlist;
                            ViewBag.Recordid            = RecordHelper.GetRecord(this.openid);
                            ViewBag.HasUnFinishedRepair = repairHelper.HasUnFinishedRepair(this.openid);
                            ViewBag.Village             = repairHelper.GetAllVillage().FirstOrDefault(item => item.Name == ViewBag.Recordid.Address);
                        }
                        else
                        {
                            Response.Redirect(WechatHelper.BackForCode("PhoneWeb", "Register", ""));
                        }
                    }
                    else
                    {
                        Response.Redirect(WechatHelper.BackForCode("PhoneWeb", "LatestRepair", ""));
                    }
                }
                else
                {
                    Response.Redirect(WechatHelper.BackForCode("PhoneWeb", "LatestRepair", ""));
                }
            }
            catch (Exception)
            {
                throw;
            }

            //ViewBag.user = wuser.GetUserInfo("olQmIjmqPu9tExxvjfJpNAFV4gJ4");
            //ViewBag.openid = "olQmIjmqPu9tExxvjfJpNAFV4gJ4";
            //ViewBag.RepairList = repairHelper.GetHistoryRepair("olQmIjmqPu9tExxvjfJpNAFV4gJ4");

            return(View());
        }
Пример #13
0
    private void OnDestroy()
    {
        netClient?.Send(new Msg_QuitRoom());
        foreach (var mgr in _mgrs)
        {
            mgr.DoDestroy();
        }

        if (!IsReplay)
        {
            RecordHelper.Serialize(recordFilePath, this);
        }

        Debug.FlushTrace();
        DoDestroy();
    }
Пример #14
0
        public void TestAddMacroSheet()
        {
            byte[]         wbBytes = TestHelpers.GetTemplateMacroBytes();
            WorkbookStream wbs     = new WorkbookStream(wbBytes);

            byte[]            mtBytes             = TestHelpers.GetMacroTestBytes();
            WorkbookStream    macroWorkbookStream = new WorkbookStream(mtBytes);
            BoundSheet8       macroSheet          = new BoundSheet8(BoundSheet8.HiddenState.Visible, BoundSheet8.SheetType.Macrosheet, "MacroSheet");
            List <BOF>        macroWorkbookBofs   = macroWorkbookStream.GetAllRecordsByType <BOF>();
            BOF               LastBofRecord       = macroWorkbookBofs.Last();
            List <BiffRecord> sheetRecords        = macroWorkbookStream.GetRecordsForBOFRecord(LastBofRecord);

            byte[] sheetBytes = RecordHelper.ConvertBiffRecordsToBytes(sheetRecords);

            wbs = wbs.AddSheet(macroSheet, sheetBytes);
            ExcelDocWriter writer = new ExcelDocWriter();

            writer.WriteDocument(TestHelpers.AssemblyDirectory + Path.DirectorySeparatorChar + "addedsheet.xls", wbs.ToBytes());
        }
Пример #15
0
        /// <summary>
        /// This function when given the name of a keybound action will process and execute that action if it is allowed
        /// </summary>
        /// <param name="actionName"></param>
        private void processBaseShortcut(String actionName)
        {
            switch (actionName)
            {
            case "Play":
                //Call the method for playing a sound effect
                playSelectedSound();
                break;

            case "Stop":
                MediaCenter.StopMainPlayer();
                MediaCenter.StopPlaybackPlayer();
                break;

            case "Record":
                toggleRecording();
                break;

            case "Playback":
                MediaCenter.playbackRecording(SoundPath);
                break;

            case "Mute":
                toggleMuteStatus();
                break;

            case "Save":
                if (btnSaveRec.Enabled)
                {
                    //TODO - Change where the temp file and add conditions to prevent it from being opened by the main playergit
                    String TempPath = SoundPath + "\\Recording\\Temp.wav";
                    //Invoke the save file method
                    RecordHelper.SaveRecording(TempPath);
                }
                break;

            //Do nothing if not a base shortcut for this form
            default:
                break;
            }
        }
Пример #16
0
        /// <summary>
        /// 提交报修
        /// </summary>
        /// <returns></returns>
        public ActionResult Repair()
        {
            url.urltype = "Repair";
#if DEBUG
            this.openid = "olQmIjj1QGQ9-NUdNvA9QZFnmUxI";
#else
#endif
            var user = wuser.GetUserInfo(this.openid);
            if (user.UserInfo != null)
            {
                ViewBag.user   = user;
                ViewBag.openid = this.openid;
                //历史报修记录
                ViewBag.RepairList          = repairHelper.GetHistoryRepair(this.openid);
                ViewBag.Recordid            = RecordHelper.GetRecord(this.openid);
                ViewBag.HasUnFinishedRepair = repairHelper.HasUnFinishedRepair(this.openid);

                ViewBag.Village       = repairHelper.GetAllVillage().FirstOrDefault(item => item.Name == ViewBag.Recordid.Address);
                ViewBag.OveruseRepair = repairHelper.GetOveruseRepair();
                ViewBag.RepairAdress  = repairHelper.GetAllVillage();
                ViewBag.Title         = "自助报修";
            }
            return(View());
        }