Exemple #1
0
        public void InserterTest()
        {
            PipeLineContext c = new PipeLineContext();

            c.PathToSourceFile      = @"C:\Users\C51188\Documents\CSAHC_Tradedetails_20180228\blabla.txt";
            c.ConnectionString      = @"Data Source=NLGSPIDCS34019\S0QRMSN;Initial Catalog=QRM_TDM_DMT_LIQ_DEV_DWH;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
            c.FieldDelimiter        = '|';
            c.DestinationTableName  = "MurexTradeDetails";
            c.IsSuggestingDataTypes = false;
            c.LinesToScan           = 2000;
            ConcurrentQueue <List <string> > RowsCollection = new ConcurrentQueue <List <string> >();
            SourceFileReader        Reader     = new SourceFileReader(c, RowsCollection);
            Inserter                Writer     = new Inserter(c, RowsCollection);
            DestinationTableCreator TableMaker = new DestinationTableCreator(c);

            Reader.ReadFinished += Writer.StopWriting;

            Writer.FinishedWriting += IsDone;

            TableMaker.CreateTable();
            Reader.StartReading();
            Writer.CreateConcurrentWriter();
            Writer.CreateConcurrentWriter();

            while (!Done)
            {
                Thread.Sleep(2000);
            }
        }
Exemple #2
0
        static void DisplayCurrentSourceCode(CorSourcePosition source)
        {
            SourceFileReader sourceReader = new SourceFileReader(source.Path);
            ConsoleColor     oldcolor     = Console.ForegroundColor;

            // Print three lines of code
            System.Diagnostics.Debug.Assert(source.StartLine < sourceReader.LineCount && source.EndLine < sourceReader.LineCount);
            if (source.StartLine >= sourceReader.LineCount ||
                source.EndLine >= sourceReader.LineCount)
            {
                return;
            }

            for (Int32 i = source.StartLine; i <= source.EndLine; i++)
            {
                String line          = sourceReader[i];
                bool   highlightning = false;

                // for each line highlight the code
                for (Int32 col = 0; col < line.Length; col++)
                {
                    if (source.EndColumn == 0 || col >= source.StartColumn - 1 && col <= source.EndColumn)
                    {
                        // highlight
                        if (!highlightning)
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            highlightning           = true;
                        }
                        Console.Write(line[col]);
                    }
                    else
                    {
                        // normal display
                        if (highlightning)
                        {
                            Console.ForegroundColor = oldcolor;
                            highlightning           = false;
                        }
                        Console.Write(line[col]);
                    }
                }
            }
            Console.ForegroundColor = oldcolor;
            Console.WriteLine();
        }
Exemple #3
0
        static void DisplayCurrentSourceCode(CorSourcePosition source)
        {
            SourceFileReader sourceReader = new SourceFileReader(source.Path);
            ConsoleColor     oldcolor     = Console.ForegroundColor;

            // Print three lines of code
            Debug.Assert(source.StartLine < sourceReader.LineCount && source.EndLine < sourceReader.LineCount);
            if (source.StartLine >= sourceReader.LineCount ||
                source.EndLine >= sourceReader.LineCount)
            {
                return;
            }

            var extraLines = 3;
            var startLine  = Math.Max(source.StartLine - extraLines, 0);
            var endLine    = Math.Min(source.EndLine + extraLines, sourceReader.LineCount);

            for (Int32 i = startLine; i <= endLine; i++)
            {
                String line = sourceReader[i];

                // for each line highlight the code
                for (Int32 col = 0; col < line.Length; col++)
                {
                    if ((i >= source.StartLine && i <= source.EndLine) &&
                        (source.EndColumn == 0 || col >= source.StartColumn - 1 && col <= source.EndColumn))
                    {
                        Console.ForegroundColor = ConsoleColor.Green; // Yellow;
                        Console.Write(line[col]);
                    }
                    else
                    {
                        // normal display
                        Console.ForegroundColor = oldcolor;
                        Console.Write(line[col]);
                    }
                }
                Console.ForegroundColor = oldcolor;
                Console.WriteLine();
            }
            Console.ForegroundColor = oldcolor;
            Console.WriteLine();
        }
Exemple #4
0
#pragma warning disable S3241 // Methods should not return values that are never used
        private async Task StartFileTransfer()
#pragma warning restore S3241 // Methods should not return values that are never used
        {
            //build staging table
            if (!Context.IsAppendingDataToExistingTable)
            {
                DestinationTableCreator TableMaker = new DestinationTableCreator(Context);
                TableMaker.CreateTable();
            }

            //create buffer
            ConcurrentQueue <List <string> > Queu = new ConcurrentQueue <List <string> >();
            //create threads to transfer file
            SourceFileReader Reader = new SourceFileReader(Context, Queu);
            Inserter         Writer = new Inserter(Context, Queu);

            Writer.done             = false;
            Reader.ReadFinished    += Writer.StopWriting;
            Writer.FinishedWriting += OnWriterFinishing;

            // start everything up and monitor for finish
            Reader.StartReading();
            for (int i = 0; i < NumberOfWriterThreads; i++)
            {
                Writer.CreateConcurrentWriter();
            }

            await Task.Run(() =>
            {
                while (NumberOfWriterThreads > NumberOfFinishedThreads)
                {
                    Task.Delay(1000).Wait();
                }
            });


            btnStartTransfer.Enabled = true;
            OnLoadStageOneFinished();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            //string path = @"C:\Users\k.priftis.PROSVASISHQ\Desktop\data\ApplicationModule.vb";

            IFileReader reader = new SourceFileReader(PathProvider.GetPath());
            IFileWriter writer = new SourceFileWriter(PathProvider.GetPath());

            int x = GeneratorUtility.GetClassDeclarationIndex();
            int y = GeneratorUtility.GetInterfaceDeclarationIndex();
            int f = GeneratorUtility.GetInterfaceIndexToImplement();

            List <IGenerator> generators = new List <IGenerator>()
            {
                new InterFaceGenerator(new ImportGenerator("Prosvasis.Common", reader, writer), new companyLoggableImplementation(reader, writer), new InterfaceDeclarationGenerator("ICompanyLoggable", reader, writer)),
                //new ProsvasisCommonImportGenerator(reader,writer),
                new ImportGenerator("Chrysikos", reader, writer),
                new EntityLogGenerator("Kwstas", reader, writer),
            };

            new CompanyLoggableDeclaration("dkfjvnkjf", reader, writer);
            ClassTranformer tranformer = new ClassTranformer(generators);

            tranformer.Transform();
        }
        private string GetCurrentSourceCode(CorSourcePosition source)
        {
            SourceFileReader sourceReader = new SourceFileReader(source.Path);
            StringBuilder sb = new StringBuilder();
            // Print three lines of code
            if (source.StartLine >= sourceReader.LineCount ||
                source.EndLine >= sourceReader.LineCount)
                return string.Empty;

            for (Int32 i = source.StartLine; i <= source.EndLine; i++){
                String line = sourceReader[i];
                sb.AppendLine(line);
            }
            return sb.ToString();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            List <string> letterGuessed = new List <string>();
            var           hangmanPics   = HangmanPics.HangmanPicsDict;

            var list = SourceFileReader.GetListOfCountryDetails("../../../countries_and_capitals.txt");

            while (true)
            {
                int tries         = 0;
                var t0            = DateTime.Now;
                int i             = RandomNumberGenerator.getRandomNum(0, list.Count);
                var secretCountry = list[i];
                Console.WriteLine("Guess the capital ");
                Console.WriteLine("Guess for a {0} Letter Capital Word ", secretCountry.Capital.Length);
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("You Have {0} Health points", healthPoints);
                Console.WriteLine(hangmanPics[healthPoints]);

                while (healthPoints > 0)
                {
                    string input = Console.ReadLine();
                    tries++;
                    if (input.ToLower() == secretCountry.Capital.ToLower())
                    {
                        Console.WriteLine("Congratulations, that was secret word!");
                        break;
                    }

                    if (letterGuessed.Contains(input))
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("You Entered Letter [{0}] already", input);
                        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        Console.WriteLine("Try a Different Word");
                        GetAlphabet(input);
                        continue;
                    }
                    letterGuessed.Add(input);
                    if (IsWord(secretCountry.Capital, letterGuessed))
                    {
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine(secretCountry.Capital);
                        Console.WriteLine("Congratulations");
                        Console.WriteLine($"The capital of { secretCountry.Name }.");
                        break;
                    }
                    else if (secretCountry.Capital.Contains(input))
                    {
                        Console.ForegroundColor = ConsoleColor.Magenta;
                        Console.WriteLine("Nice Entry");
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        string letters = Isletter(secretCountry.Capital, letterGuessed);
                        Console.Write(letters);
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Letter Not in My Word");
                        healthPoints--;
                        Console.WriteLine(hangmanPics[healthPoints]);
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("You Have {0} Live", healthPoints);
                    }
                    Console.WriteLine();
                    if (healthPoints == 0)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Game Over \nMy Secret Word is [ {0} ]", secretCountry.Capital);
                        Console.WriteLine($"The capital of { secretCountry.Name }.");
                        break;
                    }
                }
                var td           = DateTime.Now;
                var measuredTime = td.Subtract(t0);
                Console.WriteLine($"This round took {measuredTime.ToString("mm")} minutes and {measuredTime.ToString("ss")} seconds.");


                Console.WriteLine("Do you want to play again? [Y/N]");
                string option = Console.ReadLine();
                if (option == "Y" || option == "y")
                {
                    healthPoints = 6;
                    letterGuessed.Clear();
                    continue;
                }
                else
                {
                    break;
                }
            }
        }