Пример #1
0
            public static GNFS All(string filename)
            {
                string loadJson = File.ReadAllText(filename);
                GNFS   gnfs     = JsonConvert.DeserializeObject <GNFS>(loadJson);

                string directoryName = Path.GetDirectoryName(filename);

                gnfs.SaveLocations = new DirectoryLocations(directoryName);

                int    counter      = 0;
                bool   finished     = false;
                string polyFilename = string.Empty;

                do
                {
                    counter++;
                    polyFilename = Path.GetFullPath(Path.Combine(gnfs.SaveLocations.SaveDirectory, $"Polynomial.{counter:00}"));
                    if (File.Exists(polyFilename))
                    {
                        Polynomial deserializedPoly = Load.Polynomial(polyFilename);
                        gnfs.PolynomialCollection.Add(deserializedPoly);
                    }
                    else
                    {
                        finished = true;
                    }
                }while (!finished);

                gnfs.CurrentPolynomial = gnfs.PolynomialCollection.First();

                Load.FactorBase(ref gnfs);

                Load.FactorPair.Rational(ref gnfs);
                Load.FactorPair.Algebraic(ref gnfs);
                Load.FactorPair.Quadratic(ref gnfs);

                gnfs.CurrentRelationsProgress._gnfs = gnfs;

                Load.Relations.Smooth(ref gnfs);
                Load.Relations.Rough(ref gnfs);
                Load.Relations.Free(ref gnfs);

                return(gnfs);
            }