Ejemplo n.º 1
0
        static void CompressionDifferenceTests()
        {
            string path = Console.ReadLine();

            XmlGenerator.ToFile(path);
        }
Ejemplo n.º 2
0
        static public void Run()
        {
            string readableFilename;

            do
            {
                //Net.Recreate();

                Console.Write("File to read: ");
                readableFilename = Console.ReadLine().Trim('"');

                if (!string.IsNullOrWhiteSpace(readableFilename))
                {
                    //Net.Recreate();

                    //int countersCyclesToEquality = 0;

                    //while (true)
                    //{
                    long linksBefore = Net.And.ReferersByLinkerCount;
                    //long charsLinksBefore = Net.Character.ReferersBySourceCount;

                    int totalBytesRead = 0;

                    char[] chars = FileHelpers.ReadAllChars(readableFilename);

                    SmartTextParsing(chars, 0, chars.Length);

                    //string xmlSnapshotFilename = Path.Combine(Path.GetDirectoryName(readableFilename), Path.GetFileNameWithoutExtension(readableFilename) + "." + countersCyclesToEquality + ".gexf");
                    //XmlGenerator.ToFile(xmlSnapshotFilename, link =>
                    //{
                    //    return (link.ReferersByLinkerCount < (link.ReferersBySourceCount + link.ReferersByTargetCount)) && ((link.ReferersBySourceCount + link.ReferersByTargetCount + link.ReferersByLinkerCount) >= 0);
                    //});

                    totalBytesRead += chars.Length;

                    long linksAfter = Net.And.ReferersByLinkerCount - linksBefore;
                    //long charsLinksAfter = Net.Character.ReferersBySourceCount - charsLinksBefore;

                    Console.Write(totalBytesRead);
                    Console.Write(" ~ ");
                    Console.WriteLine(linksAfter);

                    //if (linksAfter == 0)
                    //{
                    //    break;
                    //}
                    //   countersCyclesToEquality++;
                    //}

                    //Console.WriteLine("Total cycles: {0}.", countersCyclesToEquality);

                    //Console.WriteLine("Total 'and' links used: {0}", linksAfter);
                    //Console.WriteLine("Total 'char' links used: {0}", charsLinksAfter);
                }
            } while (!string.IsNullOrWhiteSpace(readableFilename));

            Console.ReadLine();

            Console.WriteLine("Xml export started.");

            readableFilename = @"C:\Texts\result.txt";

            string xmlFilename = Path.Combine(Path.GetDirectoryName(readableFilename), Path.GetFileNameWithoutExtension(readableFilename) + ".gexf");

            XmlGenerator.ToFile(xmlFilename, link =>
            {
                return((link.ReferersByLinkerCount < (link.ReferersBySourceCount + link.ReferersByTargetCount)) && ((link.ReferersBySourceCount + link.ReferersByTargetCount + link.ReferersByLinkerCount) >= 5));
            });

            Console.WriteLine("Xml export finished");

            Console.ReadLine();
        }