Ejemplo n.º 1
0
        private static void ImportPlanets(SystemContext context)
        {
            var json       = File.ReadAllText("../../Import/Json/planets.json");
            var planetsDto = JsonConvert.DeserializeObject <List <PlanetDto> >(json);

            foreach (var planetDto in planetsDto)
            {
                if (planetDto.Mass > 0)
                {
                    if (!DM.IsStarSystemExisting(planetDto.Name))
                    {
                        DM.CreateStarSystem(planetDto.StarSystem);
                    }
                    var starSystem = DM.GetStarSystem(planetDto.StarSystem);

                    Planet planet = new Planet()
                    {
                        Name       = planetDto.Name,
                        Mass       = planetDto.Mass,
                        StarSystem = starSystem,
                    };

                    context.Planets.Add(planet);
                    context.StarSystems.FirstOrDefault(ss => ss.Name == starSystem.Name).Planets.Add(planet);
                    context.SaveChanges();

                    Console.WriteLine($"Record {planetDto.Name} successfully imported.");
                }
                else
                {
                    Console.WriteLine("Error: Invalid data input.");
                }
            }
        }
Ejemplo n.º 2
0
        private static void ImportDiscoveries(SystemContext context)
        {
            var      xml         = XDocument.Load("../../Xml/discoveries.xml");
            XElement discoveries = xml.Root;

            foreach (var discovery in discoveries.Elements())
            {
                DateTime          dateMade      = DateTime.Parse(discovery.Attribute("DateMade").Value);
                List <Star>       stars         = discovery.Elements("Stars").Cast <Star>().ToList();
                List <Planet>     planets       = discovery.Elements("Planets").Cast <Planet>().ToList();
                List <Astronomer> pioneers      = discovery.Elements("Pioneers").Cast <Astronomer>().ToList();
                List <Astronomer> observers     = discovery.Elements("Observers").Cast <Astronomer>().ToList();
                string            telescopeUsed = discovery.Attribute("Telescope").Value;

                if (DM.HasNotExistingAstronomer(pioneers) || DM.HasNotExistingAstronomer(observers) ||
                    DM.HasNotExistingPlanet(planets) || DM.HasNotExistingStar(stars))
                {
                    continue;
                }

                Discovery dis = new Discovery()
                {
                    Date          = dateMade,
                    Stars         = stars,
                    Pioneers      = pioneers,
                    Observers     = observers,
                    Planets       = planets,
                    TelescopeUsed = DM.GetTelescope(telescopeUsed),
                };

                Console.WriteLine($"Successfully imported discovery.");
                context.Discoveries.Add(dis);
            }
            context.SaveChanges();
        }
 void introduction()
 {
     if (DM.inDialog)
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             DM.DisplayNextSentence();
         }
     }
     else
     {
         if (firstTime)
         {
             string[] dialogue = new string[5];
             for (int i = 0; i < 5; i++)
             {
                 dialogue[i] = GC.PrendiDialogo(i);
             }
             DM.StartDialogue(dialogue);
             firstTime = false;
         }
         else
         {
             eventLoader++;
         }
     }
 }
Ejemplo n.º 4
0
        public static void Parse(string command)
        {
            switch (command)
            {
            case "inventory":
                Console.Clear();
                DM.ShowInventory(GM.player);
                break;

            case "stats":
                Console.Clear();
                DM.ShowStats(GM.player);
                break;

            case "help":
                Console.Clear();
                Console.WriteLine(@"
inventory - Displays your inventory
stats - Displays your stats
check - Shows the monster and other battle information
attack - Attack using your weapon
magic - Use a spell
item - Use an item from your inventory");
                break;

            default:
                Console.Clear();
                Console.WriteLine("\nType 'help' to view all commands");
                break;
            }
        }
Ejemplo n.º 5
0
    void introduction()
    {
        if (DM.inDialog)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                DM.DisplayNextSentence();
            }
        }
        else
        {
            if (firstTime)
            {
                string[] dialogue = new string[1];

                dialogue[0] = GC.PrendiDialogo(38);

                DM.StartDialogue(dialogue);
                firstTime = false;
            }
            else
            {
                eventLoader++;
            }
        }
    }
Ejemplo n.º 6
0
        private void OnDoPotentialPlantPartioning(object sender, EventArgs e)
        {
            if (Plant.IsEmerged)
            {
                DM.Clear();
                // Setup DM supplies from each organ
                BiomassSupplyType[] supplies = Organs.Select(organ => organ.CalculateDryMatterSupply()).ToArray();

                double totalWt = Organs.Sum(o => o.Total.Wt);
                DM.SetupSupplies(supplies, totalWt);

                BiomassPoolType[] demands = Organs.Select(organ => organ.CalculateDryMatterDemand()).ToArray();
                DM.SetupDemands(demands);

                DoReAllocation(Organs.ToArray(), DM, DMArbitrator);         // Allocate supply of reallocated DM to organs
                DoFixation(Organs.ToArray(), DM, DMArbitrator);             // Allocate supply of fixed DM (photosynthesis) to organs
                DoRetranslocation(Organs.ToArray(), DM, DMArbitrator);      // Allocate supply of retranslocated DM to organs
                SendPotentialDMAllocations(Organs.ToArray());               // Tell each organ what their potential growth is so organs can calculate their N demands

                N.Clear();

                // Setup N supplies from each organ
                supplies = Organs.Select(organ => organ.CalculateNitrogenSupply()).ToArray();
                double totalN = Organs.Sum(o => o.Total.N);
                N.SetupSupplies(supplies, totalN);

                // Setup N demands
                demands = Organs.Select(organ => organ.CalculateNitrogenDemand()).ToArray();
                N.SetupDemands(demands);

                DoReAllocation(Organs.ToArray(), N, NArbitrator);           // Allocate N available from reallocation to each organ
            }
        }
Ejemplo n.º 7
0
        private void UpdateForm_Load(object sender, EventArgs e)
        {
            ConsoleHelper.WriteWarningLine("开始检查更新...");

            //检测本地网络
            if (!Net.LocalConnectionStatus())
            {
                ConsoleHelper.WriteErrorLine("本地网络连接已断开...");
                MessageBox.Show("本地网络连接异常,请检查!");
                this.Close();
                return;
            }
            //获取服务器端版本
            try
            {
                string requestid = DM.getId();
                string url       = "http://www.wiyixiao4.com/api/MusicPlayer/index.php";
                string postData  = "requestid=" + requestid + "&" + "version=" + appVersion.ToString();
                string ret       = HttpPost(url, postData);

                ResultProcess(ret);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Purge an x Amount of messages
        /// </summary>
        /// <param name="duser">Args = Amount to remove</param>
        /// <returns></returns>
        public static async Task Purge(DUser duser)
        {
            int Amount = 0;                              //Just to set an int

            if (!Int32.TryParse(duser.Args, out Amount)) //Try parse. If error say it
            {
                await DiscordUtils.SendBotMessage(Messages.StringToNumberError, duser);

                return;
            }

            IReadOnlyList <DiscordMessage> List = await duser.TextChannel.GetMessagesAsync(Amount); //Create list with messages

            ulong ChannelID = duser.TextChannel.Id;

            foreach (DiscordMessage DM in List) //Foreach message in list, Delete them
            {
                if (DM.ChannelId == ChannelID)
                {
                    await DM.DeleteAsync();
                }
            }

            await DiscordUtils.SendBotMessage(Utils.Replace(Messages.PurgeMessage, "~1", Amount.ToString()), duser); //Send message everything went well
        }
Ejemplo n.º 9
0
 /// <summary>Calculate all of the Organ DM Demands </summary>
 public virtual void DMDemands()
 {
     // Setup DM demands for each organ
     SetDMDemand?.Invoke(this, new EventArgs());
     BiomassPoolType[] demands = Organs.Select(organ => organ.DMDemand).ToArray();
     DM.GetDemands(demands);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }
            string paramStr0 = ParamStr(0);
            Field  pOpen     = SeriesToField("Open", paramStr0 + ".open", iSize);

            if (!EnsureField(pOpen, paramStr0 + ".open"))
            {
                return(false);
            }
            Field pHigh = SeriesToField("High", paramStr0 + ".high", iSize);

            if (!EnsureField(pHigh, paramStr0 + ".high"))
            {
                return(false);
            }
            Field pLow = SeriesToField("Low", paramStr0 + ".low", iSize);

            if (!EnsureField(pLow, paramStr0 + ".low"))
            {
                return(false);
            }
            Field pClose = SeriesToField("Close", paramStr0 + ".close", iSize);

            if (!EnsureField(pClose, paramStr0 + ".close"))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pOpen);
            pRS.AddField(pHigh);
            pRS.AddField(pLow);
            pRS.AddField(pClose);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            General   ta   = new General();
            Recordset pInd = ta.WeightedClose(pNav, pRS, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), pInd.Value(FullName, n + 1));
            }
            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 new void Start()
 {
     base.Start();
     if (DM.Instance != null)
     {
         DM.RegisterPlayer(entityName, this);
     }
 }
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            string paramStr0 = ParamStr(0);
            string paramStr1 = ParamStr(1);

            if (paramStr0 == paramStr1)
            {
                ProcessError("Source 1 cannot be the same as Source 2\nSource 2 must be a volume series", IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            // Get the data

            Field pSource = SeriesToField("Source", paramStr0, iSize);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Field pVolume = SeriesToField("Volume", paramStr1, iSize);

            if (!EnsureField(pVolume, paramStr1))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);
            pRS.AddField(pVolume);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.NegativeVolumeIndex(pNav, pSource, pVolume, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
            // Validate
            int size = _chartPanel._chartX.RecordCount;

            if (size == 0)
            {
                return(false);
            }

            string paramStr0 = ParamStr(0);
            string paramStr1 = ParamStr(1);

            if (paramStr0 == paramStr1)
            {
                ProcessError("Source 1 cannot be the same as Source 2", IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            Field pSource1 = SeriesToField("Source1", paramStr0, size);

            if (!EnsureField(pSource1, paramStr0))
            {
                return(false);
            }

            Field pSource2 = SeriesToField("Source2", paramStr1, size);

            if (!EnsureField(pSource2, paramStr1))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource1);
            pRS.AddField(pSource2);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.ComparativeRelativeStrength(pNav, pSource1, pSource2, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < size; ++n)
            {
                AppendValue(DM.GetTimeStampByIndex(n), pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
 public override void Interact()
 {
     //Calls the functions within DialogueManager, then Gets the Dialogue or Sentences of this
     //	script within the GameObjectand passes it through the Dialogue Manager.
     string[] sentences = evidence.dialogue.Split(new string[] { "\n" }, StringSplitOptions.None);
     DM.ShowDialogue(sentences, evidence.speakerSprite);
     notebook.AddEvidence(evidence);
     DM.isInteracting = true;
 }
Ejemplo n.º 15
0
        public override void PlaceMage(Room room, DM mage)
        {
            var w = new Dot(Rnd.Int(Left + 1, Right), Top + 2);

            Painter.Fill(Run.Level, new Rect().Setup(w.X - 1, w.Y - 1, 3, 2), Tile.FloorA);

            mage.BottomCenter = w * 16 + new Vector2(8, -8);
            Painter.DrawLine(Run.Level, new Dot(w.X - 1, w.Y), new Dot(w.X + 1, w.Y), Tile.WallA);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
            // Validate
            int size = _chartPanel._chartX.RecordCount;

            if (size == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > size / 2)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }
            IndicatorType param2 = (IndicatorType)ParamInt(2);

            if (param2 < Constants.MA_START || param2 > Constants.MA_END)
            {
                ProcessError("Invalid Moving Average Type for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, size);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Oscillator ta   = new Oscillator();
            Recordset  pInd = ta.DetrendedPriceOscillator(pNav, pSource, paramInt1, param2, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < size; ++n)
            {
                AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 * 2 ? null : pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 17
0
        public static void Parse(string command)
        {
            switch (command)
            {
            case "inventory":
                Console.Clear();
                DM.ShowInventory(GM.player);
                break;

            case "stats":
                Console.Clear();
                DM.ShowStats(GM.player);
                break;

            case "next":
                Console.Clear();
                GM.RoomEnter();
                break;

            case "equip":
                Console.Clear();
                GM.subPhase = "Equipping";
                break;

            case "equipped":
                Console.Clear();
                DM.ShowEquipped(GM.player);
                break;

            case "inspect":
                Console.Clear();
                GM.subPhase = "Inspecting";
                break;

            case "check":
                Console.Clear();
                Console.WriteLine("\nFloor: " + GM.floor.ToString() + " | Room: " + GM.room.ToString());
                break;

            case "help":
                Console.Clear();
                Console.WriteLine(@"
inventory - Displays your inventory
stats - Displays your stats
inspect - Checks the effects of an item
equip - Change your equipment
equipped - Check your equipped items
check - Checks the floor and room number
next - Move to the next room");
                break;

            default:
                Console.Clear();
                Console.WriteLine("\nType 'help' to view all commands");
                break;
            }
        }
Ejemplo n.º 18
0
 public IMDBClient(String locale) : base(new DiskCache(DM.GetLocalFilePath("httpcache")), null, 0, 0, 10000)
 {
     Locale = (locale ?? "fr_FR").Replace("-", "_");
     if (DeviceId == null)
     {
         DeviceId = Guid.NewGuid().ToString();
         SayHello();
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
            // Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 4 || paramInt1 > iSize / 2)
            {
                ProcessError("Invalid Periods (min 4) for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pHigh     = SeriesToField("High", paramStr0 + ".high", iSize);

            if (!EnsureField(pHigh, paramStr0 + ".high"))
            {
                return(false);
            }
            Field pLow = SeriesToField("Low", paramStr0 + ".low", iSize);

            if (!EnsureField(pLow, paramStr0 + ".low"))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pHigh);
            pRS.AddField(pLow);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.MassIndex(pNav, pRS, paramInt1, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), n < paramInt1 * 3 ? null : pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 20
0
        //funcion entrenar red
        private void EntrenarRed()
        {
            canIteracionesXP = 0;
            double resultadorata = 0;

            //ciclo para recorrer por numero de iteracciones
            do
            {
                canIteracionesXP++;
                resultadorata           = 1 / canIteracionesXP;
                rataAprendizaje         = Math.Round(resultadorata, 2);
                lblRataAprendizaje.Text = rataAprendizaje.ToString();
                distanciasEvXPatron     = new double[(int)numPatrones];

                //ciclo para recorrer los patrones
                //m = 0;
                double sumaDm = 0;
                for (int a = 0; a < numPatrones; a++)
                {
                    //presento el patron
                    //m++;
                    //vector que tiene cada entrada por patron
                    obtenerPatrones = new string[(int)numEntradas];
                    obtenerPatrones = listPatrones[a].Split(';');
                    int posicionVencedora = CalcularDistanciaEuclidiana();
                    ActivarCompetencia(posicionVencedora);
                    //MessageBox.Show("Patrón # " + i + 1);
                    distanciasEvXPatron[a] = Math.Round(distanciaE[posicionVencedora], 2);
                }

                for (int l = 0; l < numPatrones; l++)
                {
                    //MessageBox.Show("Distanciaxpatron"+distanciasEvXPatron[l].ToString());
                    sumaDm = sumaDm + distanciasEvXPatron[l];
                    //MessageBox.Show("Suma DM "+sumaDm.ToString());
                }
                DM = sumaDm / numPatrones;
                //MessageBox.Show("DM "+sumaDm.ToString());
                if (Double.IsInfinity(DM))
                {
                    MessageBox.Show("El valor de DM tiende a infinito. reinicialice la red.");
                    canIteracionesXP = numIteraciones;
                    matrizPesos      = new double[(int)numEntradas, (int)numNeuronasMapa];
                    continue;
                }
                //GuardarPesos();
                if ((DM >= 0) && (DM < 1))
                {
                    GuardarPesos();
                }
                lblDM.Text = DM.ToString();
                lbliteracionMomento.Text = canIteracionesXP.ToString();
                // MessageBox.Show("iteracion" + canIteracionesXP);
                chartDM.Series["DM"].Points.AddXY(canIteracionesXP, DM);
                Thread.Sleep(200);
            } while ((DM != 0) && (canIteracionesXP < numIteraciones));
        }
Ejemplo n.º 21
0
        public IActionResult newDM(int SenderID, int ReceiverID, DM directMessage)
        {
            dbContext.DMs.Add(directMessage);
            dbContext.SaveChanges();

            System.Console.WriteLine("Success!");

            return(RedirectToAction("directmessage", new { SenderID = SenderID, ReceiverID = ReceiverID }));
        }
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            double paramDbl2 = ParamDbl(2);

            if (paramDbl2 <= 0.01 || paramDbl2 >= 0.9)
            {
                ProcessError("Invalid Minimum Tick Value (0.01 to 0.9) for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, iSize);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }
            string paramStr1 = ParamStr(1);
            Field  pVolume   = SeriesToField("Volume", paramStr1, iSize);

            if (!EnsureField(pVolume, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);
            pRS.AddField(pVolume);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.TradeVolumeIndex(pNav, pSource, pVolume, paramDbl2, FullName);

            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), pInd.Value(FullName, n + 1));
            }
            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 23
0
        ///Virtual method for init the Element.
        public void Init()
        {
            DailyLabileSenescenceN = 0;

            areaIndex = 0;
            N.Init();
            DM.Init();

            PotentialSpecificN = 0;
        }
Ejemplo n.º 24
0
    public void response(List <string> semantics)
    {
        string Tag = "";

        Tag = DM.semanticToAudio(semantics);

        AudioClip[] audioClips = DM.getSingleClips(Tag);

        scFSM.PlaySuspectAudio(Tag, audioClips);
    }
Ejemplo n.º 25
0
        /// <summary>Accumulate all of the Organ DM Supplies </summary>
        public virtual void DMSupplies()
        {
            // Setup DM supplies from each organ
            SetDMSupply?.Invoke(this, new EventArgs());
            BiomassSupplyType[] supplies = Organs.Select(organ => organ.DMSupply).ToArray();

            double totalWt = Organs.Sum(o => o.Total.Wt);

            DM.GetSupplies(supplies, totalWt);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
            // Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pHigh     = SeriesToField("High", paramStr0 + ".high", iSize);

            if (!EnsureField(pHigh, paramStr0 + ".high"))
            {
                return(false);
            }
            Field pLow = SeriesToField("Low", paramStr0 + ".low", iSize);

            if (!EnsureField(pLow, paramStr0 + ".low"))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pHigh);
            pRS.AddField(pLow);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Bands     ta   = new Bands();
            Recordset pInd = ta.PrimeNumberBands(pNav, pHigh, pLow);

            // Output the indicator values
            Clear();

            TwinIndicator sBottom = (TwinIndicator)EnsureSeries(FullName + " Bottom");

            sBottom.SetStrokeColor(StrokeColor.Invert(), false);
            sBottom.SetStrokeThickness(StrokeThickness, false);

            _title = FullName + " Top";

            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), pInd.Value("Prime Bands Top", n + 1));
                sBottom.AppendValue(DM.TS(n), pInd.Value("Prime Bands Bottom", n + 1));
            }
            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
            // Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > iSize / 2)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            double paramDbl2 = ParamDbl(2);

            if (paramDbl2 < 0.1 || paramDbl2 > 0.95)
            {
                ProcessError("Invalid R2 Scale (0.1 to 0.95) for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, iSize);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);
            pNav.Recordset_ = pRS;


            // Calculate the indicator
            MovingAverage ta   = new MovingAverage();
            Recordset     pInd = ta.VIDYA(pNav, pSource, paramInt1, paramDbl2, FullName);


            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), n < paramInt1 * 2 ? null : pInd.Value(FullName, n + 1));
            }
            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 28
0
    public void ActionComplete()
    {
        foreach (string state in currentAction.resultState)
        {
            DM.SetWorldState(state, true);
        }

        Debug.Log("Completed action:" + currentAction.name);


        currentAction.scene.AdvanceStory();
        currentAction = null;
    }
Ejemplo n.º 29
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > iSize / 2)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, iSize);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);
            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Index     ta   = new Index();
            Recordset pInd = ta.RelativeStrengthIndex(pNav, pSource, paramInt1, FullName);


            // Output the indicator values
            Clear();
            double?value = 0;

            for (int n = 0; n < iSize; ++n)
            {
                value = n < paramInt1 + 1 || value == 0 ? null : pInd.Value(FullName, n + 1);
                AppendValue(DM.TS(n), value);
            }
            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Action to be executd for calculating indicator
        /// </summary>
        /// <returns>for future usage. Must be ignored at this time.</returns>
        protected override bool TrueAction()
        {
// Validate
            int iSize = _chartPanel._chartX.RecordCount;

            if (iSize == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 2 || paramInt1 > iSize / 2)
            {
                ProcessError("Invalid Periods (min 2) for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }


            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pSource   = SeriesToField("Source", paramStr0, iSize);

            if (!EnsureField(pSource, paramStr0))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            LinearRegression ta   = new LinearRegression();
            Recordset        pInd = ta.Regression(pNav, pSource, paramInt1);


            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), n < paramInt1 ? null : pInd.Value("RSquared", n + 1));
            }

            return(_calculateResult = PostCalculate());
        }
Ejemplo n.º 31
0
 public Token(DM type, string value)
 {
     Type = type;
     Value = value;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// <para>Create a new instance of <see cref="ScreenEx"/></para>
 /// </summary>
 /// <param name="screen"></param>
 /// <param name="devMode">A <see cref="ScreenSettingsDevMode"/> received from <see cref="Status.Screen.EnumDisplaySettings"/></param>
 public ScreenEx(Forms.Screen screen, ScreenSettingsDevMode devMode)
     : base(screen.DeviceName)
 {
     this.Type = DeviceType.Screen;
     this.Name = screen.DeviceName;
     this.BitsPerPixel = (byte)screen.BitsPerPixel;
     this.Bounds = new Rectangle(screen.Bounds.Location, screen.Bounds.Size);
     this.Primary = screen.Primary;
     this.SpecVersion = devMode.dmSpecVersion;
     this.DriverVersion = devMode.dmDriverVersion;
     this.FixedOutput = (FixedOutput)devMode.dmDisplayFixedOutput;
     this.LogPixels = devMode.dmLogPixels;
     this.ColorDepth = (ColorDepth)devMode.dmBitsPerPel;
     this.DisplayFlags = devMode.dmDisplayFlags;
     this.Frequency = (byte)devMode.dmDisplayFrequency;
     this.Orientation = (ScreenOrientation)devMode.dmDisplayOrientation;
     this.fields = 0;
 }
Ejemplo n.º 33
0
 public SemestersOfferedModel(DM.SemestersOffered s)
 {
     _semestersOffered = s;
 }