Esempio n. 1
0
        /// <summary>
        /// Test a particular enum (file)
        /// </summary>
        /// <param name="pathEnum">enum (file) which we want to test</param>
        /// <returns>report</returns>
        public StringBuilder Test(PathEnum pathEnum)
        {
            stringBuilder.Clear();

            Testing(pathEnum);

            return(stringBuilder);
        }
Esempio n. 2
0
        public ITreeImpl GetTreeKind(int pathCount)
        {
            Lazy <ITreeImpl> treeType;
            PathEnum         pathEnum = (PathEnum)pathCount;

            if (!returnTreeKindDict.TryGetValue(pathEnum, out treeType))
            {
                throw new NotImplementedException("here is no implementation of IAccountDiscountCalculatorFactory interface for given Account Status");
            }
            return(treeType.Value);
        }
Esempio n. 3
0
        /// <summary>
        /// Возвращает разницу относительных путей
        /// </summary>
        public static string GetDifferenceOfPaths(PathEnum longPath, PathEnum shortPath)
        {
            string strLong  = GetRelativePath(longPath);
            string strShort = GetRelativePath(shortPath) + "\\";

            if (!strLong.StartsWith(strShort))
            {
                throw new InvalidOperationException();
            }

            return(strLong.Remove(0, strShort.Length));
        }
Esempio n. 4
0
 private void Testing(PathEnum pathEnum)
 {
     try
     {
         string path = testsDictionary[pathEnum];
         readerWriter = new ReaderGraph(path);
         Testing();
     }
     catch (KeyNotFoundException)
     {
         throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString());
     }
     catch (MyException.ReaderWriterException.ReaderWriterException e)
     {
         stringBuilder.AppendLine(e.Message);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Test a operation (OperationEnum) on a file (pathEnum)
        /// </summary>
        /// <param name="operationEnum">type of operation (enum)</param>
        /// <param name="pathEnum">file path (enum)</param>
        /// <returns>report</returns>
        public StringBuilder Test(OperationEnum operationEnum, PathEnum pathEnum)
        {
            stringBuilder.Clear();

            string path = testsDictionary[pathEnum];

            readerWriter = new ReaderGraph(path);

            switch (operationEnum)
            {
            case OperationEnum.clearFile:
                ClearFile();
                break;

            case OperationEnum.createFile:
                CreateFile();
                break;

            case OperationEnum.deleteFile:
                DeleteFile();
                break;

            case OperationEnum.existFile:
                ExistFile();
                break;

            case OperationEnum.readFile:
                ReadFile();
                break;

            case OperationEnum.writeFile:
                WriteFile();
                break;

            default:
                throw new MyException.TestsException.TestsMissingTestException(operationEnum.ToString());
            }

            return(stringBuilder);
        }
Esempio n. 6
0
        /// <summary>
        /// Возвращает относительный путь
        /// </summary>
        public static string GetRelativePath(PathEnum vspPath)
        {
            switch (vspPath)
            {
            case PathEnum.Bin:
                return("Bin");

            case PathEnum.Logs:
                return("Logs");

            case PathEnum.Image:
                return("Image");

            case PathEnum.Video:
                return("Video");

            case PathEnum.Text:
                return("Text");

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 7
0
        private void Testing(Graph.Graph.GraphRepresentationEnum graphEnum, PathEnum pathEnum)
        {
            try
            {
                List <string> fileList = new List <string>();
                switch (graphEnum)
                {
                case Graph.Graph.GraphRepresentationEnum.adjacencyList:
                    fileList = testsGraphAdjacencyListDictionary[pathEnum];
                    break;

                case Graph.Graph.GraphRepresentationEnum.adjacencyMatrix:
                    fileList = testsGraphAdjacencyMatrixDictionary[pathEnum];
                    break;

                case Graph.Graph.GraphRepresentationEnum.edgeList:
                    fileList = testsGraphEdgeListDictionary[pathEnum];
                    break;

                default:
                    throw new MyException.TestsException.TestsMissingTestException(graphEnum.ToString());
                }
                foreach (string file in fileList)
                {
                    reader = new ReaderGraph(ReaderWriter.CreateTestFile(file), false);
                    Testing();
                }
            }
            catch (KeyNotFoundException)
            {
                throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString());
            }
            catch (MyException.ReaderWriterException.ReaderWriterException e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Возвращает полный путь, относительно указанного корневого
 /// </summary>
 public static string GetPath(PathEnum Path, string rootPath)
 {
     return((Path != PathEnum.Root) ? Utils.GetNormalisedFullPath(rootPath, true) + GetRelativePath(Path) : Utils.GetNormalisedFullPath(rootPath, false));
 }
Esempio n. 9
0
 /// <summary>
 /// Возвращает полный путь
 /// </summary>
 public static string GetPath(PathEnum Path)
 {
     return(GetPath(Path, RegistrySettings.InstallPath));
 }
Esempio n. 10
0
        private void Testing(PathEnum pathEnum)
        {
            try
            {
                Graph.IGraphInterface graph;
                GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence             randomSequence;
                GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence largestFirstSequence;
                testPath = ReaderWriter.CreateTestFile(testsDictionary[pathEnum]);
                reader   = new ReaderGraph(testPath, false);
                writer   = new WriterGraph(testPath, false);

                stringBuilder.AppendLine(pathEnum.ToString());
                try
                {
                    switch (pathEnum)
                    {
                    case PathEnum.write:
                        graph          = reader.ReadFile();
                        randomSequence = new GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence(graph);
                        randomSequence.Color();
                        writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.randomSequence, false);
                        reader.ReadFile();
                        stringBuilder.AppendLine("OK");
                        break;

                    case PathEnum.recordExists:
                        graph = reader.ReadFile();
                        largestFirstSequence = new GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence(graph);
                        largestFirstSequence.Color();
                        if (!writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.largestFirstSequence, false))
                        {
                            stringBuilder.AppendLine("OK");
                        }
                        else
                        {
                            stringBuilder.AppendLine("NOK");
                        }
                        reader.ReadFile();
                        break;

                    case PathEnum.first:
                        graph          = reader.ReadFile();
                        randomSequence = new GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence(graph);
                        randomSequence.Color();
                        writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.randomSequence, false);
                        reader.ReadFile();
                        stringBuilder.AppendLine("OK");
                        break;

                    default:
                        stringBuilder.AppendLine("This pathEnum isn't implemented!");
                        break;
                    }
                }
                catch (MyException.ReaderWriterException.ReaderWriterException e)
                {
                    stringBuilder.AppendLine(e.Message);
                }
                catch (MyException.GraphException.GraphException e)
                {
                    stringBuilder.AppendLine(e.Message);
                }
            }
            catch (KeyNotFoundException)
            {
                throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString());
            }
            catch (MyException.ReaderWriterException.ReaderWriterException e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }
 private void DecreasePath()
 {
     targetPath--;
     targetPath = ClampPath();
 }
 private void IncreasePath()
 {
     targetPath++;
     targetPath = ClampPath();
 }
Esempio n. 13
0
        /// <summary>
        /// Test a particular type of file with a particular representation of graph
        /// </summary>
        /// <param name="graphRepresentation">representation of graph</param>
        /// <param name="pathEnum">type of file</param>
        /// <returns>report</returns>
        public StringBuilder Test(Graph.Graph.GraphRepresentationEnum graphRepresentation, PathEnum pathEnum)
        {
            stringBuilder.Clear();

            Testing(graphRepresentation, pathEnum);

            return(stringBuilder);
        }
Esempio n. 14
0
 void Awake()
 {
     unityLoaderScript = GetComponent<AssetLoader>();
     path = PathEnum.BundlesChunkBased;
 }