21 Temmuz 2015 Salı

c# crwaler yapımı 1

public ISet<string> GetNewLinks(string content)
{
    Regex regexLink = new Regex("(?<=<a\\s*?href=(?:'|\"))[^'\"]*?(?=(?:'|\"))");

    ISet<string> newLinks = new HashSet<string>();    
    foreach (var match in regexLink.Matches(content))
    {
        if (!newLinks.Contains(match.ToString()))
            newLinks.Add(match.ToString());
    }

    return newLinks;
}

13 Temmuz 2015 Pazartesi

c# kaldıgı yerden devam etmek için

c# kaldıgı numaradan devam etmek için kodlar..


 private void SonIDOku()
        {
            try
            {
                string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                string str2 = "";
                if (File.Exists(folderPath + @"\lastid.txt"))
                {
                    StreamReader reader = new StreamReader(folderPath + @"\lastid.txt");
                    str2 = reader.ReadLine();
                    reader.Close();
                    this.index_value = Convert.ToInt32(str2);
                }
                else
                {
                    this.index_value = 0;
                }
            }
            catch (Exception)
            {
                this.index_value = 0;
            }
        }

        private void SonIDYaz()
        {
            try
            {
                string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                File.Create(folderPath + @"\lastid.txt").Close();
                TextWriter writer = new StreamWriter(folderPath + @"\lastid.txt", true);
                int num = this.index_value + 1;
                writer.Write(num);
                writer.Close();
            }
            catch (Exception)
            {
            }
        }

C# ip adresi alma öğrenme kullanma

c# ile ip adresi bulma kaynak kod ip adresi ,wan ip adresini bulmak için ,internetten ip almak için gerekli kod.

 private string getExternalIp()
        {
            try
            {
                return new WebClient().DownloadString("http://ipinfo.io/ip");
            }
            catch
            {
                return null;
            }
        }

C# http request oluşturma

c# ile http request oluşturmak için gerekli kaynak kod


            // Create a request for the URL. 
            WebRequest request = WebRequest.Create (
              "http://www.contoso.com/default.html");
            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;
            // Get the response.
            WebResponse response = request.GetResponse ();
            // Display the status.
            Console.WriteLine (((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream ();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader (dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd ();
            // Display the content.
            Console.WriteLine (responseFromServer);
            // Clean up the streams and the response.
            reader.Close ();
            response.Close ();

2 kelime arasını alma

c# ile 2 kelime arasındaki ifadeyi almak kaynak kodu regex

try {
                Match m = Regex.Match(metin, "<" + kelime + ">(.*?)</" + kelime + ">");
                return m.Groups[1].Captures[0].Value;
         
 }catch { return "hata"; }

10 Temmuz 2015 Cuma

C# FFmpeg Download Link

C# ffmpeg download link 32 bit http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z

C# FFmpeg Komutlar Video birleştirme ses ekleme

ses silme:
ffmpeg -i video.mp4 -c copy -an videoo.mp4



ses ekleme:
ffmpeg.exe -i oo.mp3 -i f.mp4 -acodec copy -vcodec copy muxed.mp4



video hızlandırma ses sorunlu
ffmpeg -i video.mp4 -vf setpts=(0.8)*PTS output.mp4


parta bölme
ffmpeg -i video.mp4 -t 00:00:50 -c copy small-1.mp4 -ss 00:00:50 -codec copy small-2.mp4



video birleştirme

ffmpeg -f concat -i file-list.txt -c copy output.mp4


ses kaldırma

ffmpeg -i video.mp4 -an mute-video.mp4


müziği alma:

ffmpeg -i video.mp4 -vn -ab 256 audio.mp3

video gif çevirme :

ffmpeg -i video.mp4 -vf scale=500:-1 -t 10 -r 10 image.gif


video resme çevirme:
ffmpeg -i movie.mp4 -r 0.25 frames_%04d.png


videoyu yeniden boyutlandırma:

ffmpeg -i input.mp4 -s 480x320 -c:a copy output.mp4

video yazı ekleme :

ffmpeg -i movie.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mkv

video sesin miktarını değiştirme:

ffmpeg -i input.wav -af 'volume=0.5' output.wav

video yönünü değiştirme:

ffmpeg -i input.mp4 -filter:v 'transpose=1' rotated-video.mp4


ffmpeg -i input.mp4 -filter:v 'transpose=2,transpose=2' rotated-video.mp4