Exemplo n.º 1
0
        public void createList()
        {
            string template = FILEWORK.ReadFileContent(templateList);
            string result   = template;


            List <string> urls = new List <string>();

            foreach (var travel in DATA._TRAVELS)
            {
                string link = "http://kapybara.ru/data/travel/" + travel.Id.ToString() + ".html";
                urls.Add("'" + link + "'");
            }

            foreach (var content in DATA._CONTENT)
            {
                if (content is FOOD)
                {
                    continue;
                }
                urls.Add("'" + content.link + "'");
            }
            var lr = String.Join(", \n         ", urls.ToArray());

            result = result.Replace("$urls", lr);
            FILEWORK.WriteFileContent(fpath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 2
0
        public void changeInfoContent(DirectoryInfo content)
        {
            List <string> txts = new List <string>();

            txts = FILEWORK.GetAllFiles(content.FullName, txts, ".txt");
            string txtFi = txts[0];
            string fc    = FILEWORK.ReadFileContent(txtFi);


            List <string> imgs = new List <string>();

            imgs = FILEWORK.GetAllFiles(content.FullName, imgs, ".jpg");
            string imgFi = imgs[0];

            FileInfo f     = new FileInfo(imgFi);
            var      d     = File.GetLastWriteTime(imgFi);
            string   tdade = d.ToString("yyyy-MM-dd HH:mm:ss");

            string newContent = tdade + "\n\n" + fc;

            FILEWORK.WriteFileContent(txtFi, newContent);

            //меняем название на info.txt
            FileInfo f2 = new FileInfo(txtFi);

            string newName = content.FullName + "\\info.txt";

            System.IO.File.Move(f2.FullName, newName);
        }
Exemplo n.º 3
0
        private void catParseWork(refItem _ref, DirectoryInfo di)
        {
            int stIndex2 = getStartIndex(_ref.destinationPass);

            FileInfo[] fi = di.GetFiles();
            foreach (var content in fi)
            {
                string ins = new String(' ', 20 - "CHANGE".Length);

                //переписываем данные файла info.txt
                Console.WriteLine(String.Format("{0}{1}{3}| {2}", CONST._INS, "CHANGE", content.Name, ins));
                //1. создаем папкочку
                string pass = _ref.destinationPass + "//" + stIndex2.ToString();
                Directory.CreateDirectory(pass);
                //2. копируем картинку
                string fname    = content.FullName;
                string relPath  = _ref.destinationPass + "//" + stIndex2.ToString() + "//";
                string destname = relPath + content.Name;
                File.Move(fname, destname);
                //3. создание txt
                string newName = relPath + "info.txt";
                //File.Create(newName);
                //4. запись даты
                FileInfo f     = new FileInfo(destname);
                var      d     = File.GetLastWriteTime(destname);
                string   tdade = d.ToString("yyyy-MM-dd HH:mm:ss");

                string newContent = tdade + "\n\n";
                FILEWORK.WriteFileContent(newName, newContent);
                stIndex2++;

                // changeInfoContent(content);
            }
        }
Exemplo n.º 4
0
        public void createItems()
        {
            imgtemplate1 = FILEWORK.ReadFileContent(PATH.templ + "\\" + TRAVEL._type.ToLower() + "\\img1item.txt");
            liItem       = FILEWORK.ReadFileContent(PATH.templ + "\\" + TRAVEL._type.ToLower() + "\\ulitem.txt");
            diItem       = FILEWORK.ReadFileContent(PATH.templ + "\\" + TRAVEL._type.ToLower() + "\\diitem.txt");

            string template = FILEWORK.ReadFileContent(itemtemplate);

            template = template.Replace("$header2", CONST.header2);
            template = template.Replace("$footer2", CONST.footer2);
            // string itemtemplateitem = FILEWORK.ReadFileContent(PATH.templ + "\\" + WORKOUT._type.ToUpper() + "\\itemworkoutitem.txt");

            foreach (var item in DATA._TRAVELS)
            {
                string result = template;
                result = result.Replace("$title", item.name);
                //
                result = reseatMainInfo(item, result);

                result = reseatTextInfo(item, result);


                result = reseatCreateYoutube(item, result);

                string path = PATH.site + "\\data\\travel\\" + item.Id + ".html";

                FILEWORK.WriteFileContent(path, result);
                Console.WriteLine("+ " + path);
            }
        }
Exemplo n.º 5
0
        public void createList()
        {
            string template = FILEWORK.ReadFileContent(templateList);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", CONST.footer1);
            string result = template;

            result = executeType("travel", 1, result);
            result = executeType("work", 2, result);
            result = executeType("friends", 3, result);
            result = executeType("sport", 4, result);
            result = executeType("dog", 5, result);
            result = executeType("food", 6, result);
            result = executeType("book", 7, result);

            double catalogSize = 0;

            catalogSize = FILEWORK.sizeOfFolder(PATH.data, ref catalogSize); //Вызываем наш рекурсивный метод
            sizes       = String.Format("{0} ГБ", catalogSize);
            result      = result.Replace("$1", items.ToString());
            result      = result.Replace("$2", imgs.ToString());
            result      = result.Replace("$3", youtubs.ToString());
            result      = result.Replace("$4", sizes);

            FILEWORK.WriteFileContent(fpath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 6
0
        public void setProcced()
        {
            List <string> res = new List <string>();

            res.AddRange(proceed);
            res.AddRange(newproceed);
            string result = string.Join("\n", res);

            FILEWORK.WriteFileContent(PATH.imgProcessedFile, result);
        }
Exemplo n.º 7
0
        public void createList()
        {
            string template = FILEWORK.ReadFileContent(templateList);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", CONST.footer1);
            string result = template;

            FILEWORK.WriteFileContent(fpath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 8
0
        public void saveInfo()
        {
            string res = "";

            foreach (var d in data)
            {
                String r = niceString(d.ModelString, d.Name, d.embededUrl, 50, 50);
                res = res + r + '\n';
            }

            FILEWORK.WriteFileContent(PATH.videofolderSave, res);
        }
Exemplo n.º 9
0
        private void createItems()
        {
            string template = FILEWORK.ReadFileContent(itemtemplate);

            template = template.Replace("$header2", CONST.header2);
            template = template.Replace("$footer2", CONST.footer2);
            string itemtemplateitem = FILEWORK.ReadFileContent(PATH.templ + "\\" + FOOD._type.ToUpper() + "\\itemfooditem.txt");

            foreach (var item in DATA._FOOD)
            {
                string result = template;
                result = result.Replace("$Id", item.Id.ToString());
                result = result.Replace("$date", item.date.ToString("yyyy-MM-dd"));
                result = result.Replace("$mainImg", item.Id + "/" + item.mainImg);

                string texts = string.Join("<br> <br>", item.txtContents.ToArray());
                result = result.Replace("$text", "<p>" + texts + "</p>");

                string        imgres = "";
                List <string> imgs   = item.imgs.Where(o => o != DATA.imageDict[item.mainImg]).ToList();
                foreach (string img in imgs)
                {
                    string itimgs = itemtemplateitem;
                    string ig     = DATA.RevImageDict[img];
                    itimgs = itimgs.Replace("$image", item.Id + "/" + ig);
                    string bi = "build" + item.Id;
                    itimgs = itimgs.Replace("$fancygroupfull", bi);

                    imgres = imgres + itimgs;
                }
                string youcont = "";
                foreach (string you in item.youtubs)
                {
                    bool   isOne  = item.youtubs.Count == 1 || (item.youtubs.Last() == you && item.youtubs.Count % 2 != 0);
                    string itimgs = !isOne ? CONST.youtube1 : CONST.youtube2;
                    itimgs  = itimgs.Replace("$srcitem", you);
                    youcont = youcont + itimgs;
                }
                result = result.Replace("$youtubs", youcont);

                result = result.Replace("$images", imgres);


                string path = PATH.site + "\\data\\food\\" + item.Id + ".html";

                FILEWORK.WriteFileContent(path, result);
                Console.WriteLine("+ " + path);
            }
        }
Exemplo n.º 10
0
        public void createList()
        {
            string template     = FILEWORK.ReadFileContent(templateList);
            string itemtemplate = FILEWORK.ReadFileContent(templateListItem);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", "");
            template = template.Replace("$numcats", DATA._FOOD.Count.ToString());


            string      itemFull = "";
            List <FOOD> friends  = DATA._FOOD.OrderByDescending(o => o.Id).ToList();

            foreach (FOOD item in friends)
            {
                if (item.Id == 8)
                {
                }
                string itemres = itemtemplate;

                int index = 1;
                //foreach (string img in item.mainIng)
                //{
                //    string sname = DATA.imageDict[img];
                //    string rr = "$image" + index;
                //    itemres = itemres.Replace(rr, imglistprefix + "\\" + item.Id + "\\" + img);
                //    index++;
                //}

                string rr = "$image" + index;
                itemres = itemres.Replace(rr, imglistprefix + "\\" + item.Id + "\\" + item.mainImg);
                //itemres = itemres.Replace("$city", item.name);
                itemres = itemres.Replace("$date", item.date.ToString("yyyy-MM-dd"));
                //itemres = itemres.Replace("$price", item.lcount);
                itemres = itemres.Replace("$link", imglistprefix + "\\" + item.Id + ".html");

                string texts = string.Join("<br>", item.txtContents.ToArray());
                itemres  = itemres.Replace("$text", "<p>" + texts + "</p>");
                itemFull = itemFull + itemres;
            }
            string result = template.Replace("param_models", itemFull);

            FILEWORK.WriteFileContent(opath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 11
0
        public void createList()
        {
            string template = FILEWORK.ReadFileContent(templateList);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", CONST.footer1);
            string result = template;

            result = createLast10(result);
            result = createBiGWork(result);
            result = createBiGFriends(result);
            result = createBiGDog(result);
            result = createBiGSport(result);
            result = createBiGFood(result);


            FILEWORK.WriteFileContent(fpath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 12
0
        public void createList()
        {
            string template     = FILEWORK.ReadFileContent(templateList);
            string itemtemplate = FILEWORK.ReadFileContent(templateListItem);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", "");



            string        itemFull = "";
            List <TRAVEL> travels  = DATA._TRAVELS.OrderByDescending(o => o.Id).ToList();

            foreach (TRAVEL item in travels)
            {
                string itemres = itemtemplate;

                int index = 1;
                foreach (string img in item.mainIng)
                {
                    string sname = DATA.imageDict[img];
                    string rr    = "$image" + index;
                    itemres = itemres.Replace(rr, imglistprefix + "\\" + item.Id + "\\" + img);
                    index++;
                }

                itemres  = itemres.Replace("$city", item.name);
                itemres  = itemres.Replace("$date", item.ldate);
                itemres  = itemres.Replace("$price", item.lcount);
                itemres  = itemres.Replace("$link", imglistprefix + "\\" + item.Id + ".html");
                itemFull = itemFull + itemres;
            }
            string result = template.Replace("param_models", itemFull);

            FILEWORK.WriteFileContent(opath, result);
            Console.WriteLine("+ " + fpath);
        }
Exemplo n.º 13
0
        private void createItems()
        {
            string template = FILEWORK.ReadFileContent(itemtemplate);

            template = template.Replace("$header2", CONST.header2);
            template = template.Replace("$footer2", CONST.footer2);
            string itemtemplateitem = FILEWORK.ReadFileContent(PATH.templ + "\\" + DOGANDCAT._type.ToUpper() + "\\itemdogandcatitem.txt");

            foreach (var item in DATA._DOGANDCAT)
            {
                string result = template;
                result = result.Replace("$Id", item.Id.ToString());
                result = result.Replace("$date", item.date.ToString("yyyy-MM-dd"));
                result = result.Replace("$mainImg", item.Id + "/" + item.mainImg);

                string texts = string.Join("<br> <br>", item.txtContents.ToArray());
                result = result.Replace("$text", "<p>" + texts + "</p>");
                string bi = "build" + item.Id;
                //боковые КОНТЕНТ //либо ютуб первый либо картинки
                if (item.hasYoutube)
                {
                    //правый ютуб
                    string you   = item.you1[0];
                    string ycont = CONST.youtubeRight;
                    ycont  = ycont.Replace("$srcitem", you);
                    result = result.Replace("$leftcontent", ycont);
                }
                else
                {
                    //правые картинки
                    string        imgres = "";
                    List <string> imgs   = item.img1;
                    foreach (string img in imgs)
                    {
                        string itimgs = itemtemplateitem;
                        string ig     = DATA.RevImageDict[img];
                        itimgs = itimgs.Replace("$image", item.Id + "/" + ig);
                        imgres = imgres + itimgs;
                    }
                    result = result.Replace("$leftcontent", imgres);
                }

                //отстаточные картинки
                string        imgsco = "";
                List <string> imgs2  = item.img2;
                foreach (string img in imgs2)
                {
                    string itimgs = itemtemplateitem;
                    string ig     = DATA.RevImageDict[img];
                    itimgs = itimgs.Replace("$image", item.Id + "/" + ig);
                    imgsco = imgsco + itimgs;
                }
                result = result.Replace("$images", imgsco);

                string youcont = "";
                foreach (string you in item.you2)
                {
                    bool   isOne  = item.you2.Count == 1 || (item.you2.Last() == you && item.you2.Count % 2 != 0);
                    string itimgs = !isOne ? CONST.youtube1 : CONST.youtube2;
                    itimgs  = itimgs.Replace("$srcitem", you);
                    youcont = youcont + itimgs;
                }
                result = result.Replace("$youtubs", youcont);
                result = result.Replace("$fancygroupfull", bi);



                string path = PATH.site + "\\data\\dogandcat\\" + item.Id + ".html";

                FILEWORK.WriteFileContent(path, result);
                Console.WriteLine("+ " + path);
            }
        }
Exemplo n.º 14
0
        public void createList()
        {
            string template     = FILEWORK.ReadFileContent(templateList);
            string itemtemplate = FILEWORK.ReadFileContent(templateListItem);

            template = template.Replace("$header1", CONST.header1);
            template = template.Replace("$footer1", CONST.footer1);
            string         itemFull = "";
            List <WORKOUT> works    = DATA._WORKOUT.OrderByDescending(o => o.Id).ToList();

            foreach (WORKOUT item in works)
            {
                string itemres = itemtemplate;
                string bi      = "build" + item.Id;


                itemres = itemres.Replace("$fancygroupfull", bi);

                itemres = itemres.Replace("$fancygroupfull", bi);
                itemres = itemres.Replace("$title", item.date.ToString("yyyy-MM-dd"));

                string texts = string.Join("<br> <br>", item.txtContents.ToArray());
                itemres = itemres.Replace("$text", texts);

                List <string> used  = new List <string>();
                string        i1    = item.mainImg;
                string        sname = DATA.imageDict[i1];

                used.Add(sname);
                itemres = itemres.Replace("$image1", imglistprefix + "\\" + item.Id + "\\" + i1);

                string i2 = imgName(used, item);
                itemres = itemres.Replace("$image2", imglistprefix + "\\" + item.Id + "\\" + i2);

                string i3 = imgName(used, item);
                itemres = itemres.Replace("$image3", imglistprefix + "\\" + item.Id + "\\" + i3);


                string i4 = imgName(used, item);
                itemres = itemres.Replace("$image4", imglistprefix + "\\" + item.Id + "\\" + i4);

                string i5 = imgName(used, item);
                itemres = itemres.Replace("$image5", imglistprefix + "\\" + item.Id + "\\" + i5);

                string i6 = imgName(used, item);
                itemres = itemres.Replace("$image6", imglistprefix + "\\" + item.Id + "\\" + i6);


                string i7 = imgName(used, item);
                itemres = itemres.Replace("$image7", imglistprefix + "\\" + item.Id + "\\" + i7);


                itemres = itemres.Replace("$link", imglistprefix + "\\" + item.Id + ".html");

                itemFull = itemFull + itemres;
            }
            string result = template.Replace("$items", itemFull);

            FILEWORK.WriteFileContent(opath, result);
            Console.WriteLine("+ " + fpath);
        }