Beispiel #1
0
        public File[] ArrInput(string input)
        {
            string[] arrString = input.Split('\n');
            File[]   arrFiles  = new File[arrString.Length];
            int      found     = 0;

            for (int i = 0; i < arrString.Length; i++)
            {
                if (arrString[i].StartsWith("Text:"))
                {
                    found       = arrString[i].IndexOf(":");
                    arrFiles[i] = new TextFiles(arrString[i].Substring(found + 1));
                }
                else if (arrString[i].StartsWith("Image:"))
                {
                    found       = arrString[i].IndexOf(":");
                    arrFiles[i] = new Images(arrString[i].Substring(found + 1));
                }
                else if (arrString[i].StartsWith("Movie:"))
                {
                    found       = arrString[i].IndexOf(":");
                    arrFiles[i] = new Movies(arrString[i].Substring(found + 1));
                }
            }
            return(arrFiles);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            String      text        = @"Text: file.txt(6B); Some string content
                            Image: img.bmp(19MB); 1920х1080
                            Text:data.txt(12B); Another string
                            Text:data1.txt(7B); Yet another string
                             Movie:logan.2017.mkv(19GB); 1920х1080; 2h12m";
            StringParse stringInput = new StringParse();

            stringInput.ArrInput(text);
            File      file     = new File();
            TextFiles textFile = new TextFiles(text);
        }