Beispiel #1
0
        internal static void StopCurrentEngine()
        {
            var dispose = true;

            if (!IsEngineRunning)
            {
                return;
            }
            if (_Engine.GetType() == typeof(ProfileCreator))
            {
                dispose = EngineAs <ProfileCreator>().Dispose();
            }

            if (_Engine.GetType() == typeof(Grinder))
            {
                EngineAs <Grinder>().Stop();
                IsWaitingForGeneration = false;
                tmpGrind = null;
            }

            if (dispose)
            {
                _Engine = null;
            }
        }
Beispiel #2
0
 public void Should_CreateObject_AndNotNull()
 {
     Assert.DoesNotThrow(() =>
     {
         var gridner = new Grinder();
         Assert.IsNotNull(gridner);
     });
 }
Beispiel #3
0
        private void Grind()
        {
            List <Vector3> cs = GetPoses();

            grinder = new Grinder(Game1.mainwow, Game1.mainPlayer, cs);
            while (true)
            {
                grinder.Update();
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            using (ImageProcessor processor = ImageProcessor.FromFile(@"D:\Pictures\Profilbilder\IMG_9084.JPG"))
            {
                processor
                .Add(Spinner.OrientToExif())
                .Add(Grinder.MakeRound(1, 20))
                .Add(ColorAdaption.Decolorize())
                .Add(ColorAdaption.Lighten(-30))
                //.Add(ColorAdaption.Invert());
                ;

                processor.SaveToFile(@"C:\Users\flo\Pictures\rounded.png");
            }
        }
Beispiel #5
0
        internal static void StartGrinder(bool parLoadLast)
        {
            if (IsEngineRunning)
            {
                return;
            }
            string tmpProfileName;

            if (parLoadLast && Options.LastProfile != "")
            {
                tmpProfileName = Options.LastProfile;
            }
            else
            {
                using (var locateProfile = new OpenFileDialog())
                {
                    locateProfile.CheckFileExists  = true;
                    locateProfile.CheckPathExists  = true;
                    locateProfile.Filter           = "xml Profile (*.xml)|*.xml";
                    locateProfile.FilterIndex      = 1;
                    locateProfile.InitialDirectory = Paths.ProfileFolder;
                    if (locateProfile.ShowDialog() == DialogResult.OK)
                    {
                        tmpProfileName = locateProfile.FileName;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            tmpGrind = new Grinder();
            if (!IsWaitingForGeneration && tmpGrind.Prepare(tmpProfileName, Callback))
            {
                Main.MainForm.Invoke(new MethodInvoker(delegate
                {
                    Main.MainForm.lGrindState.Text = "State: Loading mmaps";
                    IsWaitingForGeneration         = true;
                    Options.LastProfile            = tmpProfileName;
                }));
            }
        }
    public override void _EnterTree()
    {
        grinder = (Grinder)building;

        blocksSelector = GetNode <ItemList>("back/BlocksList");

        imageDesc               = GetNode <TextureRect>("back/BlockDescription/ImageBlock/TextureRect");
        titleDesc               = GetNode <Label>("back/BlockDescription/Description/HBox/Title");
        energyDesc              = GetNode <Label>("back/BlockDescription/Description/HBox/Energy");
        descriptionDesc         = GetNode <Label>("back/BlockDescription/Description/Description");
        inventory               = GetNode <ItemList>("back3/Inventory");
        inventory.MaxColumns    = 5;
        inventory.FixedIconSize = new Vector2(64, 64);

        btnGrind = GetNode <Button>("back/BlockDescription/BtnGrind");

        InitBlocksSelector();
        _on_BlocksList_item_selected(0);
        Refresh();
    }
Beispiel #7
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] Grinder grinder)
        {
            try
            {
                using (SqlConnection conn = Connection)
                {
                    conn.Open();
                    using (SqlCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = @"UPDATE Grinder
                                     SET Brand = @Brand, Model = @Model, UserId = @UserId
                                     WHERE Id = @id";

                        cmd.Parameters.Add(new SqlParameter("@id", id));
                        cmd.Parameters.Add(new SqlParameter("@Brand", grinder.Brand));
                        cmd.Parameters.Add(new SqlParameter("@Model", grinder.Model));
                        cmd.Parameters.Add(new SqlParameter("@UserId", grinder.UserId));


                        int rowsAffected = cmd.ExecuteNonQuery();
                        if (rowsAffected > 0)
                        {
                            return(new StatusCodeResult(StatusCodes.Status204NoContent));
                        }
                        throw new Exception("No rows affected");
                    }
                }
            }
            catch (Exception)
            {
                if (!GrinderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }
Beispiel #8
0
        public async Task <IActionResult> Get()

        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        SELECT *
                        FROM Grinder 
                        WHERE 1 = 1 
                        ";


                    SqlDataReader reader = cmd.ExecuteReader();

                    List <Grinder> allGrinders = new List <Grinder>();

                    while (reader.Read())
                    {
                        var grinder = new Grinder()
                        {
                            Id     = reader.GetInt32(reader.GetOrdinal("Id")),
                            Brand  = reader.GetString(reader.GetOrdinal("Brand")),
                            Model  = reader.GetString(reader.GetOrdinal("Model")),
                            UserId = reader.GetString(reader.GetOrdinal("UserId"))
                        };


                        allGrinders.Add(grinder);
                    }
                    reader.Close();

                    return(Ok(allGrinders));
                }
            }
        }
Beispiel #9
0
        internal static void StopCurrentEngine()
        {
            GuiCore.MainForm.runToolStripMenuItem.Enabled   = true;
            GuiCore.MainForm.runToolStripMenuItem.Text      = "Run";
            GuiCore.MainForm.pauseToolStripMenuItem.Enabled = false;
            GuiCore.MainForm.stopToolStripMenuItem.Enabled  = false;
            GuiCore.MainForm.lGrindLoadProfile.Text         = "Profile: ";
            GuiCore.MainForm.lGrindState.Text = "State: ";

            var dispose = true;

            if (!IsEngineRunning)
            {
                return;
            }
            if (_Engine.GetType() == typeof(ProfileCreator))
            {
                dispose = EngineAs <ProfileCreator>().Dispose();
            }

            if (_Engine.GetType() == typeof(Grinder))
            {
                EngineAs <Grinder>().Stop();

                if (tmpGrind != null)
                {
                    tmpGrind.Stop();
                    tmpGrind = null;
                }
            }

            if (dispose)
            {
                _Engine = null;
            }

            Helpers.Logger.Append("Stopped all.");
        }
Beispiel #10
0
        public async Task <IActionResult> Post([FromBody] Grinder grinder)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        INSERT INTO Grinder (Brand, Model, UserId)
                        OUTPUT INSERTED.Id
                        VALUES (@Brand, @Model, @UserId)";

                    cmd.Parameters.Add(new SqlParameter("@Brand", grinder.Brand));
                    cmd.Parameters.Add(new SqlParameter("@Model", grinder.Model));
                    cmd.Parameters.Add(new SqlParameter("@UserId", grinder.UserId));

                    int id = (int)cmd.ExecuteScalar();

                    grinder.Id = id;
                    return(CreatedAtRoute("GetGrinder", new { id = id }, grinder));
                }
            }
        }
Beispiel #11
0
        public async Task <IActionResult> Get([FromRoute] int id)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        SELECT * FROM Grinder
                        WHERE Id = @id";
                    cmd.Parameters.Add(new SqlParameter("@id", id));
                    SqlDataReader reader = cmd.ExecuteReader();

                    Grinder grinder = null;

                    if (reader.Read())
                    {
                        grinder = new Grinder()
                        {
                            Id     = reader.GetInt32(reader.GetOrdinal("Id")),
                            Brand  = reader.GetString(reader.GetOrdinal("Brand")),
                            Model  = reader.GetString(reader.GetOrdinal("Model")),
                            UserId = reader.GetString(reader.GetOrdinal("UserId"))
                        };


                        reader.Close();

                        return(Ok(grinder));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
            }
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            ConsoleKeyInfo opcao;

            Console.WriteLine();
            Console.WriteLine("*******       LOTOGRINDER - Analisador Lotérico (v 0.0)       *******");
            Console.WriteLine();

            do
            {
                Console.WriteLine("[1] - Gerar combinação (n, r)");
                Console.WriteLine("[2] - Carregar todos os concursos");
                Console.WriteLine("[3] - Baixar resultado do concurso atual");
                Console.WriteLine("[4] - Processar atraso das combinações ");
                Console.WriteLine("[5] - Processar atraso concurso atual ");
                Console.WriteLine("[6] - Processar premiação das combinações ");
                Console.WriteLine("[7] - Processar 5 últimos atrasos das combinações ");
                Console.WriteLine("[8] - Processar Concurso Atual ");
                Console.WriteLine("[9] - Processar Todos os Concursos ");
                Console.WriteLine("[0] - Sair ");
                Console.WriteLine();
                Console.WriteLine("Escolha a opção desejada:");
                opcao = Console.ReadKey();
            }while (opcao.Key != ConsoleKey.D1 && opcao.Key != ConsoleKey.D2 &&
                    opcao.Key != ConsoleKey.D3 && opcao.Key != ConsoleKey.D4 &&
                    opcao.Key != ConsoleKey.D5 && opcao.Key != ConsoleKey.D6 &&
                    opcao.Key != ConsoleKey.D7 && opcao.Key != ConsoleKey.D8 &&
                    opcao.Key != ConsoleKey.D9 && opcao.Key != ConsoleKey.D0);

            Console.WriteLine();

            if (opcao.Key == ConsoleKey.D0)
            {
                return;
            }
            else
            {
                if (opcao.Key == ConsoleKey.D1)
                {
                    Console.WriteLine();
                    Console.WriteLine("***   Gerar combinação (n, r)   ***");
                    Console.WriteLine();

                    Console.Write("Quantidade de números a combinar: ");
                    string sN = Console.ReadLine();

                    Console.Write("Tamanho de cada combinação: ");
                    string sK = Console.ReadLine();

                    DateTime inicio = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    Combinacoes(int.Parse(sN), int.Parse(sK));

                    DateTime termino = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    TimeSpan duracao = termino - inicio;

                    Console.WriteLine();
                    Console.WriteLine("Duração: {0}", duracao.ToString());
                    Console.WriteLine();

                    Console.WriteLine();
                    Console.Write("Tecle <ENTER> para encerrar...");
                    Console.Read();
                }
                else if (opcao.Key == ConsoleKey.D2)
                {
                    Console.WriteLine("\nDeletando todos os concursos...");
                    new DB().DeletarConcursos();

                    Console.WriteLine("\nGravando todos os concursos...");
                    List <string[]> listaConcursos = Grinder.LerConcursos();

                    new DB().BulkConcurso(listaConcursos);
                    Console.WriteLine("Gravado com sucesso!");
                }
                else if (opcao.Key == ConsoleKey.D4)
                {
                    do
                    {
                        DateTime inicio = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        Grinder.ProcessarAtraso(1, 3268760, false);

                        DateTime termino = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        TimeSpan duracao = termino - inicio;

                        Console.WriteLine();
                        Console.WriteLine("Duração: {0}", duracao.ToString());
                        Console.WriteLine();

                        Console.WriteLine();
                        Console.Write("Processar novos lotes? [S/N]: ");
                        opcao = Console.ReadKey();
                    }while (opcao.Key != ConsoleKey.N);
                }
                else if (opcao.Key == ConsoleKey.D5)
                {
                    DateTime inicio = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    Grinder.ProcessarLotesAtrasoConcursoAtual();

                    DateTime termino = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    TimeSpan duracao = termino - inicio;

                    Console.WriteLine();
                    Console.WriteLine("Duração: {0}", duracao.ToString());
                    Console.WriteLine();
                    Console.Write("Tecle <ENTER> para encerrar...");
                    Console.Read();
                }
                else if (opcao.Key == ConsoleKey.D6)
                {
                    do
                    {
                        DateTime inicio = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        Grinder.ProcessarPremiacoes(1, 3268760);

                        DateTime termino = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        TimeSpan duracao = termino - inicio;

                        Console.WriteLine();
                        Console.WriteLine("Duração: {0}", duracao.ToString());
                        Console.WriteLine();

                        Console.WriteLine();
                        Console.Write("Processar novos lotes? [S/N]: ");
                        opcao = Console.ReadKey();
                    }while (opcao.Key != ConsoleKey.N);
                }
                else if (opcao.Key == ConsoleKey.D7)
                {
                    do
                    {
                        DateTime inicio = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        Grinder.ProcessarUltimosAtrasos(1, 100000);

                        DateTime termino = DateTime.Now;

                        Console.WriteLine();
                        Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                        Console.WriteLine();

                        TimeSpan duracao = termino - inicio;

                        Console.WriteLine();
                        Console.WriteLine("Duração: {0}", duracao.ToString());
                        Console.WriteLine();

                        Console.WriteLine();
                        Console.Write("Processar novos lotes? [S/N]: ");
                        opcao = Console.ReadKey();
                    }while (opcao.Key != ConsoleKey.N);
                }
                else if (opcao.Key == ConsoleKey.D8)
                {
                    DateTime inicio = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    Grinder.ProcessarConcursoAtual(1, 3268760);

                    DateTime termino = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    TimeSpan duracao = termino - inicio;

                    Console.WriteLine();
                    Console.WriteLine("Duração: {0}", duracao.ToString());
                    Console.WriteLine();
                    Console.Write("Tecle <ENTER> para encerrar...");
                    Console.Read();
                }
                else if (opcao.Key == ConsoleKey.D9)
                {
                    DateTime inicio = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Início: {0}", inicio.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    Grinder.ProcessarTodosConcursos(1, 3268760);

                    DateTime termino = DateTime.Now;

                    Console.WriteLine();
                    Console.WriteLine("Término: {0}", termino.ToString("dd/MM/yyyy hh:mm:ss"));
                    Console.WriteLine();

                    TimeSpan duracao = termino - inicio;

                    Console.WriteLine();
                    Console.WriteLine("Duração: {0}", duracao.ToString());
                    Console.WriteLine();
                    Console.Write("Tecle <ENTER> para encerrar...");
                    Console.Read();
                }
            }
        }
Beispiel #13
0
 // Use this for initialization
 void Start()
 {
     grinder          = GetComponent <Grinder>();
     secondsRemaining = timeToDrop;
 }
Beispiel #14
0
 private void Awake()
 {
     grinder = grinderObj.GetComponent <Grinder>();
 }
Beispiel #15
0
        internal static void StartGrinder(bool parLoadLast)
        {
            Helpers.Logger.Append("Grinder starting up");
            GuiCore.MainForm.runToolStripMenuItem.Enabled   = false;
            GuiCore.MainForm.pauseToolStripMenuItem.Enabled = true;
            GuiCore.MainForm.stopToolStripMenuItem.Enabled  = true;

            if (IsEngineRunning)
            {
                return;
            }

            string tmpProfileName = string.Empty;

            if (parLoadLast && Settings.Settings.LastProfileFileName != "")
            {
                tmpProfileName = Paths.ProfilesDirectory + Settings.Settings.LastProfileFileName;
            }
            else
            {
                using (var locateProfile = new OpenFileDialog())
                {
                    locateProfile.CheckFileExists  = true;
                    locateProfile.CheckPathExists  = true;
                    locateProfile.Filter           = "xml Profile (*.xml)|*.xml";
                    locateProfile.FilterIndex      = 1;
                    locateProfile.InitialDirectory = Paths.ProfilesDirectory;
                    if (locateProfile.ShowDialog() == DialogResult.OK)
                    {
                        tmpProfileName = locateProfile.FileName;
                    }
                    else
                    {
                        //  StopCurrentEngine();
                        //  return;
                    }
                }
            }

            Helpers.Logger.Append("cc directory: " + Settings.Settings.CCDirectory.ToString());
            Helpers.Logger.Append("internal directory: " + Paths.InternalDirectory.ToString());
            Helpers.Logger.Append("wow directory: " + Paths.WowDirectory.ToString());
            Helpers.Logger.Append("profiles directory: " + Paths.ProfilesDirectory.ToString());
            Helpers.Logger.Append("working directory: " + Paths.WorkingDirectory.ToString());
            Helpers.Logger.Append("settings file: " + Paths.SettingsFile.ToString());
            Helpers.Logger.Append("bot assembly file: " + Paths.BotAssemblyFile.ToString());

            tmpGrind = new Grinder();
            if (tmpGrind.Prepare(tmpProfileName, Callback))
            {
                GuiCore.MainForm.Invoke(new MethodInvoker(delegate
                {
                    GuiCore.MainForm.lGrindState.Text     = "State: Loading mmaps";
                    string profileFileName                = tmpProfileName.Replace(Paths.ProfilesDirectory, "");
                    Settings.Settings.LastProfileFileName = profileFileName;
                }));
            }
            else
            {
                Helpers.Logger.Append("Grinder wasn't able to finish preparing! Aborting launch process..");
                GuiCore.MainForm.runToolStripMenuItem.Enabled   = true;
                GuiCore.MainForm.pauseToolStripMenuItem.Enabled = false;
                GuiCore.MainForm.stopToolStripMenuItem.Enabled  = false;
            }

            StartTick = DateTime.Now.Ticks;
        }
 public Grinder_s(Grinder grinder) : base(Product.type_.grinder, grinder.uniqueID, grinder.objectID, grinder.subID, grinder.GetName(), grinder.productGO.transform.position, grinder.productGO.transform.eulerAngles)
 {
 }
    public Product CreateProduct(StoreObjectReference toCreate, Vector3 pos)
    {
        GameObject newProductGameObject = Instantiate(toCreate.gameObject_);
        ProductGO  newProductGO         = newProductGameObject.GetComponent <ProductGO>();

        newProductGO.transform.position = pos;
        newProductGO.gameObject.SetActive(false);
        if (toCreate.color.colorIsAssigned)
        {
            newProductGameObject = ApplyColor(newProductGameObject, toCreate.color.color);
        }

        /*if (newProductGO.colorable)
         * {
         *  if (toCreate.randomColor != null)
         *  {
         *      newProductGameObject = ApplyColor(newProductGameObject, toCreate.randomColor);
         *  }
         *  else
         *  {
         *      newProductGameObject = ApplyRandomColor(newProductGameObject);
         *  }
         * }*/
        Product.type_ productType;
        switch (toCreate.proType)
        {
        case StoreObjectReference.productType.jar:
            productType = Product.type_.storageJar;
            break;

        case StoreObjectReference.productType.glassBong:
            productType = Product.type_.glassBong;
            break;

        case StoreObjectReference.productType.acrylicBong:
            productType = Product.type_.acrylicBong;
            break;

        case StoreObjectReference.productType.glassPipe:
            productType = Product.type_.glassPipe;
            break;

        case StoreObjectReference.productType.acrylicPipe:
            productType = Product.type_.acrylicPipe;
            break;

        case StoreObjectReference.productType.rollingPaper:
            productType = Product.type_.rollingPaper;
            break;

        case StoreObjectReference.productType.edible:
            productType = Product.type_.edible;
            break;

        case StoreObjectReference.productType.bowl:
            productType = Product.type_.bowl;
            break;

        case StoreObjectReference.productType.grinder:
            productType = Product.type_.grinder;
            break;

        default:
            productType = Product.type_.reference;
            break;
        }
        newProductGO.objectID = toCreate.objectID;
        switch (productType)
        {
        case Product.type_.glassBong:
        case Product.type_.acrylicBong:
            Bong newBong = new Bong(toCreate, newProductGameObject);
            newBong.uniqueID     = Dispensary.GetUniqueProductID();
            newBong.objectID     = toCreate.objectID;
            newBong.boxWeight    = toCreate.boxWeight;
            newProductGO.product = newBong;
            return(newBong);

        case Product.type_.glassPipe:
        case Product.type_.acrylicPipe:
            Pipe newPipe = new Pipe(toCreate, newProductGameObject);
            newPipe.uniqueID     = Dispensary.GetUniqueProductID();
            newPipe.objectID     = toCreate.objectID;
            newPipe.boxWeight    = toCreate.boxWeight;
            newProductGO.product = newPipe;
            return(newPipe);

        case Product.type_.storageJar:
            StorageJar newJar = new StorageJar(toCreate, newProductGameObject);
            newJar.uniqueID      = Dispensary.GetUniqueProductID();
            newJar.objectID      = toCreate.objectID;
            newJar.boxWeight     = toCreate.boxWeight;
            newProductGO.product = newJar;
            return(newJar);

        case Product.type_.bowl:
            Bowl newBowl = new Bowl(toCreate, newProductGameObject);
            newBowl.uniqueID     = Dispensary.GetUniqueProductID();
            newBowl.objectID     = toCreate.objectID;
            newBowl.boxWeight    = toCreate.boxWeight;
            newProductGO.product = newBowl;
            //newBowl = (Bowl)ApplyRandomColor(newBowl);
            return(newBowl);

        case Product.type_.grinder:
            Grinder newGrinder = new Grinder(toCreate, newProductGameObject);
            newGrinder.uniqueID  = Dispensary.GetUniqueProductID();
            newGrinder.objectID  = toCreate.objectID;
            newGrinder.boxWeight = toCreate.boxWeight;
            newProductGO.product = newGrinder;
            //newGrinder = (Grinder)ApplyRandomColor(newGrinder);
            return(newGrinder);
        }
        return(null);
    }
Beispiel #18
0
 void Awake()
 {
     grinder   = grinderObj.GetComponent <Grinder>();
     firstPos  = new Vector2(0f, 0f);
     secondPos = new Vector2(0f, 0f);
 }