Пример #1
0
    static void ѕреобразоватьЋог(string файл)
    {
        Console.WriteLine("‘айл: " + файл);
        StreamWriter sw = null;

        try
        {
            string[] линии = File.ReadAllLines(файл, кодировка);
            файл = Path.Combine(Path.GetDirectoryName(файл), Path.GetFileNameWithoutExtension(файл));
            string новый‘айл;
            int    i = 1;
            while (true)
            {
                новый‘айл = файл;
                if (i != 1)
                {
                    новый‘айл += " (" + i + ")";
                }
                новый‘айл += ".htm";
                if (!File.Exists(новый‘айл))
                {
                    break;
                }
                i++;
            }
            sw = new StreamWriter(новый‘айл, false, кодировка);
            sw.WriteLine("<html><head>");
            sw.WriteLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">");
            sw.WriteLine("<link href=\"mystyles.css\" rel=\"stylesheet\" type=\"text/css\">");
            sw.Write("</head><body><pre><a class=07>");
            for (i = 0; i < линии.Length; i++)
            {
                string лини¤ = линии[i];
                лини¤ = лини¤.Replace("&", "&amp;");
                лини¤ = лини¤.Replace("<", "&lt;");
                лини¤ = лини¤.Replace(">", "&gt;");
                лини¤ = лини¤.Replace("\"", "&quot;");
                лини¤ = Regex.Replace(лини¤, @"^[\da-fA-F]{4} ", "");
                лини¤ = Regex.Replace(лини¤, @"\u001B([\da-fA-F]{2})", "</a><a class=$1>");
                sw.WriteLine(лини¤);
            }
            sw.WriteLine("</a></pre></body></html>");
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
        }
        if (sw != null)
        {
            sw.Close();
        }
    }
Пример #2
0
 var services = new DriveService(новый BaseClientService.Initializer()