Example #1
0
        public movementCase TestDiskConfiguration2()
        {
            // create each gear and assign name first
            Watch.gears.BaseGear Disk1 = new Watch.gears.BaseGear();
            Disk1.GearName = "Disk1";
            Disk1.GearID   = 1;
            Disk1.Rotation = gears.BaseGear._Rotation.Clockwise;

            Watch.gears.InnerGear Disk2 = new Watch.gears.InnerGear();
            Disk2.GearName = "Disk2";
            Disk2.GearID   = 2;

            Disk1.BaseTeeth              = 30;
            Disk1.BaseTeethDriving       = true;
            Disk1.BaseTeethDrivingGearID = Disk2.GearID;

            Disk2.BaseTeeth                = 50;
            Disk2.InnerTeeth               = 15;
            Disk2.InnerTeethDrivenBy       = true;
            Disk2.InnerTeethDrivenByGearID = Disk1.GearID;

            // create the movement
            Watch.movement.movementCase oMovementCase = new Watch.movement.movementCase();
            oMovementCase.BaseGears.Add(Disk1);
            oMovementCase.BaseGears.Add(Disk2);

            // now get the movement working
            oMovementCase.incNotches(ref oMovementCase, 1);
            return(oMovementCase);
        }
Example #2
0
        public movementCase MakeMoonDisk90Daily()
        {
            // create each gear and assign name first
            Watch.gears.BaseGear BaseDailyDriver = new Watch.gears.BaseGear();
            BaseDailyDriver.GearName           = "BaseDailyDriver";
            BaseDailyDriver.GearID             = 1;
            BaseDailyDriver.Rotation           = gears.BaseGear._Rotation.AntiClockwise;
            BaseDailyDriver.DiskBaseUnitDriver = gears.BaseGear._DiskBaseUnitDriver.daily;

            Watch.gears.InnerGear DailyDisk = new Watch.gears.InnerGear();
            DailyDisk.GearName = "DailyDriver";
            DailyDisk.GearID   = 2;

            Watch.gears.InnerGear Intermediatetepper = new Watch.gears.InnerGear();
            Intermediatetepper.GearName = "Intermediatetepper";
            Intermediatetepper.GearID   = 3;

            Watch.gears.BaseGear MoonDisk = new Watch.gears.BaseGear();
            MoonDisk.GearName = "MoonDisk";
            MoonDisk.GearID   = 4;

            // now create the properties of each gear and their relationships to each other

            BaseDailyDriver.BaseTeeth              = 24;
            BaseDailyDriver.BaseTeethDriving       = true;
            BaseDailyDriver.BaseTeethDrivingGearID = DailyDisk.GearID;

            DailyDisk.InnerTeeth               = 7;
            DailyDisk.BaseTeeth                = 30;
            DailyDisk.InnerTeethDrivenBy       = true;
            DailyDisk.InnerTeethDrivenByGearID = BaseDailyDriver.GearID;
            DailyDisk.BaseTeethDriving         = true;
            DailyDisk.BaseTeethDrivingGearID   = Intermediatetepper.GearID;

            Intermediatetepper.BaseTeeth               = 90;
            Intermediatetepper.InnerTeeth              = 32;
            Intermediatetepper.BaseTeethDrivenBy       = true;
            Intermediatetepper.BaseTeethDrivenByGearID = DailyDisk.GearID;
            Intermediatetepper.InnerTeethDriving       = true;
            Intermediatetepper.InnerTeethDrivingGearID = MoonDisk.GearID;

            MoonDisk.BaseTeeth               = 90;
            MoonDisk.BaseTeethDrivenBy       = true;
            MoonDisk.BaseTeethDrivenByGearID = Intermediatetepper.GearID;

            // create the movement
            Watch.movement.movementCase oMovementCase = new Watch.movement.movementCase();
            oMovementCase.BaseGears.Add(BaseDailyDriver);
            oMovementCase.BaseGears.Add(DailyDisk);
            oMovementCase.BaseGears.Add(Intermediatetepper);
            oMovementCase.BaseGears.Add(MoonDisk);

            return(oMovementCase);
        }
Example #3
0
        public List <string> ListAllProperties(movementCase oC, bool toFile, string Fln)
        {
            List <string> listProperties = new List <string>();

            foreach (gears.BaseGear baseG in oC.baseGears)
            {
                switch (baseG.GetType().ToString())
                {
                case "Watch.gears.BaseGear":
                {
                    listProperties.Add(" >>>>>>>>>>> BaseGear <<<<<<<<<<<");
                    foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(baseG))
                    {
                        string name  = descriptor.Name;
                        object value = descriptor.GetValue(baseG);
                        listProperties.Add(name + "=" + value);
                    }
                    continue;
                }

                case "Watch.gears.InnerGear":
                {
                    listProperties.Add(" >>>>>>>>>>> InnerGear <<<<<<<<<<<");
                    Watch.gears.InnerGear oInner = (Watch.gears.InnerGear)baseG;
                    foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(oInner))
                    {
                        string name  = descriptor.Name;
                        object value = descriptor.GetValue(oInner);
                        listProperties.Add(name + "=" + value);
                    }
                    continue;
                }
                }
            }


            if (toFile)
            {
                TextWriter tw = new StreamWriter(Fln);
                foreach (String s in listProperties)
                {
                    tw.WriteLine(s);
                }
                tw.Close();
                //Console.Write("saved to filename:" + Fln);
                //Console.Read();
            }
            return(listProperties);
        }
Example #4
0
        public double GetFinalGearPosition(movementCase oC)
        {
            double FinalGearPosition = 0;
            int    i = oC.baseGears.Count() - 1;

            switch (oC.baseGears[i].GetType().ToString())
            {
            case "Watch.gears.BaseGear":
            {
                FinalGearPosition = oC.baseGears[i].BaseTeethNotchesTraversed;
                break;
            }

            case "Watch.gears.InnerGear":
            {
                Watch.gears.InnerGear oInner = (Watch.gears.InnerGear)oC.baseGears[i];
                FinalGearPosition = oInner.BaseTeethNotchesTraversed;
                break;
            }
            }
            return(FinalGearPosition);
        }
Example #5
0
        public movementCase MakeMoonDisk135Hourly()
        {
            // create each gear and assign name first
            Watch.gears.BaseGear HourDisk = new Watch.gears.BaseGear();
            HourDisk.GearName = "HourlyDriver";
            HourDisk.GearID   = 1;
            HourDisk.Rotation = gears.BaseGear._Rotation.Clockwise;

            Watch.gears.InnerGear Stepper = new Watch.gears.InnerGear();
            Stepper.GearName = "MoonDiskDriver";
            Stepper.GearID   = 2;

            Watch.gears.BaseGear Intermediate1 = new Watch.gears.BaseGear();
            Intermediate1.GearName = "Intermediate1";
            Intermediate1.GearID   = 3;


            Watch.gears.BaseGear Intermediate2 = new Watch.gears.BaseGear();
            Intermediate2.GearName = "Intermediate2";
            Intermediate2.GearID   = 4;

            Watch.gears.BaseGear MoonDisk = new Watch.gears.BaseGear();
            MoonDisk.GearName = "MoonDisk";
            MoonDisk.GearID   = 5;

            // now create the properties of each gear and their relationships to each other
            HourDisk.BaseTeeth              = 12;
            HourDisk.BaseTeethDriving       = true;
            HourDisk.BaseTeethDrivingGearID = Stepper.GearID;

            Stepper.BaseTeeth               = 105;
            Stepper.InnerTeeth              = 10;
            Stepper.BaseTeethDrivenBy       = true;
            Stepper.BaseTeethDrivenByGearID = HourDisk.GearID;
            Stepper.InnerTeethDriving       = true;
            Stepper.InnerTeethDrivingGearID = Intermediate1.GearID;

            Intermediate1.BaseTeeth               = 50;
            Intermediate1.BaseTeethDrivenBy       = true;
            Intermediate1.BaseTeethDrivenByGearID = Stepper.GearID;
            Intermediate1.BaseTeethDriving        = true;
            Intermediate1.BaseTeethDrivingGearID  = Intermediate2.GearID;

            Intermediate2.BaseTeeth               = 90;
            Intermediate2.BaseTeethDrivenBy       = true;
            Intermediate2.BaseTeethDrivenByGearID = Intermediate1.GearID;
            Intermediate2.BaseTeethDriving        = true;
            Intermediate2.BaseTeethDrivingGearID  = MoonDisk.GearID;

            MoonDisk.BaseTeeth               = 135;
            MoonDisk.BaseTeethDrivenBy       = true;
            MoonDisk.BaseTeethDrivenByGearID = Intermediate2.GearID;

            // create the movement
            Watch.movement.movementCase oMovementCase = new Watch.movement.movementCase();
            oMovementCase.BaseGears.Add(HourDisk);
            oMovementCase.BaseGears.Add(Stepper);
            oMovementCase.BaseGears.Add(Intermediate1);
            oMovementCase.BaseGears.Add(Intermediate2);
            oMovementCase.BaseGears.Add(MoonDisk);

            return(oMovementCase);
        }
Example #6
0
        public movementCase MakeMoonDisk(string sMoonDiskConfig)
        {
            Watch.movement.movementCase oMovementCase = new Watch.movement.movementCase();

            string GearType = string.Empty;
            int    GearID;
            string line = string.Empty;

            using (StreamReader reader = new StreamReader(sMoonDiskConfig))
            {
                while (!reader.EndOfStream)
                {
                    line     = reader.ReadLine();
                    GearType = line.Substring(line.IndexOf("=", 0) + 1);
                    line     = reader.ReadLine();
                    GearID   = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                    switch (GearType)
                    {
                    case "Base":
                    {
                        Watch.gears.BaseGear Base = new Watch.gears.BaseGear();
                        line          = reader.ReadLine();
                        Base.GearName = line.Substring(line.IndexOf("=", 0) + 1);

                        line = reader.ReadLine();
                        string DiskBaseUnitDriver = line.Substring(line.IndexOf("=", 0) + 1);
                        if (DiskBaseUnitDriver.Equals("hourly"))
                        {
                            Base.DiskBaseUnitDriver = gears.BaseGear._DiskBaseUnitDriver.hourly;
                        }
                        else if (DiskBaseUnitDriver.Equals("daily"))
                        {
                            Base.DiskBaseUnitDriver = gears.BaseGear._DiskBaseUnitDriver.daily;
                        }

                        Base.GearID = GearID;
                        line        = reader.ReadLine();
                        string Direction = line.Substring(line.IndexOf("=", 0) + 1);

                        if (Direction.Equals("Clockwise"))
                        {
                            Base.Rotation = gears.BaseGear._Rotation.Clockwise;
                        }
                        else if (Direction.Equals("AntiClockwise"))
                        {
                            Base.Rotation = gears.BaseGear._Rotation.AntiClockwise;
                        }

                        line                   = reader.ReadLine();
                        Base.BaseTeeth         = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        line                   = reader.ReadLine();
                        Base.BaseTeethDrivenBy = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line                   = reader.ReadLine();
                        if (Base.BaseTeethDrivenBy)
                        {
                            Base.BaseTeethDrivenByGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }
                        line = reader.ReadLine();
                        Base.BaseTeethDriving = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line = reader.ReadLine();

                        if (Base.BaseTeethDriving)
                        {
                            Base.BaseTeethDrivingGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }
                        oMovementCase.BaseGears.Add(Base);
                        break;
                    }

                    case "InnerGear":
                    {
                        Watch.gears.InnerGear Inner = new Watch.gears.InnerGear();
                        line           = reader.ReadLine();
                        Inner.GearName = line.Substring(line.IndexOf("=", 0) + 1);

                        line = reader.ReadLine();
                        string DiskBaseUnitDriver = line.Substring(line.IndexOf("=", 0) + 1);
                        if (DiskBaseUnitDriver.Equals("hourly"))
                        {
                            Inner.DiskBaseUnitDriver = gears.BaseGear._DiskBaseUnitDriver.hourly;
                        }
                        else if (DiskBaseUnitDriver.Equals("daily"))
                        {
                            Inner.DiskBaseUnitDriver = gears.BaseGear._DiskBaseUnitDriver.daily;
                        }


                        Inner.GearID = GearID;
                        line         = reader.ReadLine();
                        string Direction = line.Substring(line.IndexOf("=", 0) + 1);
                        if (Direction.Equals("Clockwise"))
                        {
                            Inner.Rotation = gears.BaseGear._Rotation.Clockwise;
                        }
                        else if (Direction.Equals("AntiClockwise"))
                        {
                            Inner.Rotation = gears.BaseGear._Rotation.AntiClockwise;
                        }

                        line                    = reader.ReadLine();
                        Inner.BaseTeeth         = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        line                    = reader.ReadLine();
                        Inner.InnerTeeth        = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        line                    = reader.ReadLine();
                        Inner.BaseTeethDrivenBy = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line                    = reader.ReadLine();
                        if (Inner.BaseTeethDrivenBy)
                        {
                            Inner.BaseTeethDrivenByGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }

                        line = reader.ReadLine();
                        Inner.BaseTeethDriving = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line = reader.ReadLine();
                        if (Inner.BaseTeethDriving)
                        {
                            Inner.BaseTeethDrivingGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }

                        line = reader.ReadLine();
                        Inner.InnerTeethDriving = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line = reader.ReadLine();
                        if (Inner.InnerTeethDriving)
                        {
                            Inner.InnerTeethDrivingGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }

                        line = reader.ReadLine();
                        Inner.InnerTeethDrivenBy = Convert.ToBoolean(line.Substring(line.IndexOf("=", 0) + 1));
                        line = reader.ReadLine();
                        if (Inner.InnerTeethDrivenBy)
                        {
                            Inner.InnerTeethDrivenByGearID = Convert.ToInt16(line.Substring(line.IndexOf("=", 0) + 1));
                        }

                        oMovementCase.BaseGears.Add(Inner);
                        break;
                    }
                    }
                }
            }

            return(oMovementCase);
        }