public void SplitStringBySpaceTest()
        {
            FileConvertor fileConvertor = new FileConvertor();

            string[] splittedString = fileConvertor.SplitStringBySpace("01 12 15 23");
            CollectionAssert.AreEqual(new string[] { "01", "12", "15", "23" }, splittedString);
        }
        public void SplitStringByEnterTest()
        {
            FileConvertor fileConvertor = new FileConvertor();

            string[] splittedString = fileConvertor.SplitStringByEnter("01 12 15 23\n14 14 05 23");
            CollectionAssert.AreEqual(new string[] { "01 12 15 23", "14 14 05 23" }, splittedString);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// копировать файл инструмента
        /// </summary>
        /// <param name="_outputFolder">выходная директория</param>
        /// <exception cref="ArgumentNullException"></exception>
        public void CopyFiles(string _outputFolder)
        {
            if (string.IsNullOrEmpty(_outputFolder))
            {
                throw new ArgumentNullException("Не задана выходная папка для инструментов");
            }
            try
            {
                _outputFolder = _outputFolder.AsPath();

                string toolNewPath = System.IO.Path.Combine(_outputFolder, FileName);
                if (!tool.IsToolSWF)
                {
                    if (!System.IO.File.Exists(toolNewPath))
                    {
                        System.IO.File.Copy(tool.AbsOrigPath, toolNewPath, false);
                    }
                }
                else
                {
                    FileConvertor.ConvertSWFToPng(tool.AbsOrigPath, toolNewPath, imgParams.Width, imgParams.Height);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Ошибка при копировании файлов инструмента " + tool.Id + ". " + ex.Message);
            }
        }
Ejemplo n.º 4
0
        public object[] getIndex()
        {
            List<object> l = new List<object>();

            try
            {
                string correntPath = Session["correntPathToIndex"].ToString();

                var ft = new HugoBotWebApplication.Discretistation.FileHandler();

                var ansFromGetChunks = ft.GetChunks(correntPath);

                correntPath += "/index";
                var indexBeforeParse = ft.GetChunk(correntPath);

                l = FileConvertor.parseByteArrToIndex(indexBeforeParse);
            }
            catch { }
            return l.ToArray();
        }