Example #1
0
        private void WriteFar()
        {
            Far far = new Far();

            far.CPU_TYPE              = 2;
            far.RecordHeader.REC_LEN += 1;
            far.STDF_VER              = 4;
            far.RecordHeader.REC_LEN += 1;
            sfw.WriteRecord(far);
        }
Example #2
0
 public void PrintTree()
 {
     Print();
     if (Far != null)
     {
         Far.PrintTree();
     }
     if (Mor != null)
     {
         Mor.PrintTree();
     }
 }
Example #3
0
        /*
         *      beaconRegion.NotifyEntryStateOnDisplay = true;
         *      beaconRegion.NotifyOnEntry = true;
         *      beaconRegion.NotifyOnExit = true;
         *      locationmanager.RegionEntered += (object sender, CLRegionEventArgs e) => {
         *              if (e.Region.Identifier == beaconId) {
         *
         *                      var notification = new UILocalNotification () { AlertBody = "The Xamarin beacon is close by!" };
         *                      UIApplication.SharedApplication.CancelAllLocalNotifications();
         *                      UIApplication.SharedApplication.PresentLocationNotificationNow (notification);
         *              }
         *      };
         * locationmanager.StartMonitoring (beaconRegion);
         *
         * CLBeaconRegion beaconRegionNotifications;
         */
        #endregion


        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            Unknown.Dispose();
            Unknown = null;
            Near.Dispose();
            Near = null;
            Far.Dispose();
            Far = null;
            Immediate.Dispose();
            Immediate = null;
        }
        public void SetsParentIdWhenPropertyExistsWhenTableNameId(SUT sut, IInvocation invocation, int farId)
        {
            var far = new Far() { FarId = farId };
            var boo = new Boo();

            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.FarId.Should().Be(far.FarId);
        }
        public void SetsIdOnMatchingPropertyWhenTableNameId(SUT sut, IInvocation invocation, int booId)
        {
            var far = new Far { BooId = booId };
            var boo = new Boo();

            invocation.Method.Returns(far.GetType().GetProperty("Boo").GetGetMethod());
            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.BooId.Should().Be(booId);
        }
        public void SetsParentIdWhenPropertyExistsWhenTableNameId(SUT sut, IInvocation invocation, int farId)
        {
            var far = new Far()
            {
                FarId = farId
            };
            var boo = new Boo();

            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.FarId.Should().Be(far.FarId);
        }
        public void SetsIdOnMatchingPropertyWhenTableNameId(SUT sut, IInvocation invocation, int booId)
        {
            var far = new Far {
                BooId = booId
            };
            var boo = new Boo();

            invocation.Method.Returns(far.GetType().GetProperty("Boo").GetGetMethod());
            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.BooId.Should().Be(booId);
        }
Example #8
0
        public void TestFar()
        {
            var far = new Far();

            TestRoundTripEquality(far);

            far.CpuType = 1;
            TestRoundTripEquality(far);

            far.CpuType = 2;
            TestRoundTripEquality(far, endian: Endian.Little);

            far.CpuType     = 1;
            far.StdfVersion = 5;
            TestRoundTripEquality(far);
        }
Example #9
0
        public void TestParseFar()
        {
            var far = new Far("test.far");

            far.ParseFar();

            Assert.AreEqual(far.Signature, "FAR!byAZ");
            Assert.AreEqual(far.Version, 1);
            Assert.AreEqual(far.ManifestOffset, 160);
            Assert.AreEqual(far.Manifest.NumberOfFiles, 1);
            Assert.AreEqual(far.Manifest.ManifestEntries.Count, 1);
            Assert.AreEqual(far.Manifest.ManifestEntries[0].FileLength1, 144);
            Assert.AreEqual(far.Manifest.ManifestEntries[0].FileLength2, 144);
            Assert.AreEqual(far.Manifest.ManifestEntries[0].Filename, "test.bmp");
            Assert.AreEqual(far.Manifest.ManifestEntries[0].FilenameLength, 8);
            Assert.AreEqual(far.Manifest.ManifestEntries[0].FileOffset, 16);
        }
Example #10
0
        private void InferEndianFromFar(Far far)
        {
            if (far == null)
            {
                throw new ArgumentNullException("far");
            }
            switch (far.CpuType)
            {
            case 0:
            case 1:
                _Endian = Endian.Big;
                break;

            default:
                _Endian = Endian.Little;
                break;
            }
        }
Example #11
0
        /// <summary>
        /// Returns the string representation of this object</summary>
        /// <param name="format">Optional standard numeric format string for a floating point number.
        /// If null, "R" is used for round-trip support in case the string is persisted.
        /// http://msdn.microsoft.com/en-us/library/vstudio/dwhawy9k(v=vs.100).aspx </param>
        /// <param name="formatProvider">Optional culture-specific formatting provider. This is usually
        /// a CultureInfo object or NumberFormatInfo object. If null, the current culture is used.
        /// Use CultureInfo.InvariantCulture for persistence.</param>
        /// <returns>String representation of object</returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            string listSeparator = StringUtil.GetNumberListSeparator(formatProvider);

            // For historic reasons, use "R" for round-trip support, in case this string is persisted.
            if (format == null)
            {
                format = "R";
            }

            return(String.Format(
                       "{0}{6} {1}{6} {2}{6} {3}{6} {4}{6} {5}",
                       Right.ToString(format, formatProvider),
                       Left.ToString(format, formatProvider),
                       Top.ToString(format, formatProvider),
                       Bottom.ToString(format, formatProvider),
                       Near.ToString(format, formatProvider),
                       Far.ToString(format, formatProvider),
                       listSeparator));
        }
Example #12
0
        public static TRecord GetSingleRecord <TRecord>(this StdfFile file) where TRecord : StdfRecord
        {
            StartOfStreamRecord sos            = null;
            Far               far              = null;
            TRecord           recordOfInterest = null;
            EndOfStreamRecord eos              = null;

            foreach (var record in file.GetRecordsEnumerable())
            {
                if (sos == null)
                {
                    sos = (StartOfStreamRecord)record;
                }
                else if (far == null)
                {
                    far = (Far)record;
                    if (typeof(TRecord) == typeof(Far))
                    {
                        recordOfInterest = (TRecord)(object)far;
                    }
                }
                else if (recordOfInterest == null)
                {
                    recordOfInterest = (TRecord)record;
                }
                else if (eos == null)
                {
                    eos = (EndOfStreamRecord)record;
                }
                else
                {
                    Assert.Fail("There were extra records");
                }
            }
            Assert.IsNotNull(sos, "No start of stream");
            Assert.IsNotNull(recordOfInterest, "No record of interest");
            Assert.IsNotNull(eos, "No end of stream");
            //TODO: assert things about sos/eos?
            return(recordOfInterest);
        }
Example #13
0
        private void ExtractUigraphics(string pathToSimsExe)
        {
            var simsInstallationDirectory = Path.GetDirectoryName(pathToSimsExe);
            var uigraphicsPath            = simsInstallationDirectory + @"\UIGraphics\UIGraphics.far";

            log.Info($"Extracting images from {uigraphicsPath}");
            if (!File.Exists(uigraphicsPath))
            {
                MessageBox.Show($"Couldn't find UIGraphics.far at {uigraphicsPath}");
                log.Info($"Couldn't find UIGraphics.far at {uigraphicsPath}");
            }
            CreateDirectory(@"Content\UIGraphics");
            var far           = new Far(uigraphicsPath);
            var extractImages = new List <string>(images)
            {
                @"Downtown\largeback.bmp",
                @"Studiotown\dlgframe_1024x768.bmp",
                @"cpanel\Backgrounds\PanelBack.bmp"
            };

            far.Extract(outputDirectory: @"Content\UIGraphics", filter: extractImages);
        }
Example #14
0
        public void TestExtract()
        {
            var far = new Far("test.far");

            far.ParseFar();
            far.Extract();
            Assert.IsTrue(File.Exists("test.bmp"));

            // Assert the extracted file matches the file in the .far exactly
            using (var outFs = new FileStream("test.bmp", FileMode.Open, FileAccess.Read))
                using (var farFs = new FileStream("test.far", FileMode.Open, FileAccess.Read))
                {
                    farFs.Seek(16, SeekOrigin.Begin);
                    for (int i = 0; i < 144; i++)
                    {
                        Assert.AreEqual(farFs.ReadByte(), outFs.ReadByte());
                    }
                }

            File.Delete("test.bmp");
            far.Extract(outputDirectory: "UIGraphics");
            Assert.IsTrue(File.Exists(Path.Combine("UIGraphics", "test.bmp")));
            Directory.Delete("UIGraphics", true);
        }
 /// <summary>Returns a String that represents the current BoundingFrustum.</summary>
 public override string ToString()
 {
     return(string.Format(CultureInfo.CurrentCulture, "{{Near:{0} Far:{1} Left:{2} Right:{3} Top:{4} Bottom:{5}}}", new object[] { Near.ToString(), Far.ToString(), Left.ToString(), Right.ToString(), Top.ToString(), Bottom.ToString() }));
 }
 public void ParentIdShouldBeSameWhenTableNameId(Far far)
 {
     far.Boo.FarId.Should().Be(far.FarId);
 }
 public void IdShouldMatchNavigationPropertyIdWhenTableNameId(Far far)
 {
     far.BooId.Should().Be(far.Boo.BooId);
 }
 public void ParentIdShouldBeSameWhenTableNameIdForIDbSet(Far far)
 {
     far.Boo.FarId.Should().Be(far.FarId);
 }
 public void IdShouldMatchNavigationPropertyIdWhenTableNameId(Far far)
 {
     far.BooId.Should().Be(far.Boo.BooId);
 }