Click here to Skip to main content
15,892,293 members
Home / Discussions / C#
   

C#

 
AnswerRe: errors Pin
Ron Beyer4-Nov-13 10:43
professionalRon Beyer4-Nov-13 10:43 
GeneralRe: errors Pin
Member 103798864-Nov-13 10:57
Member 103798864-Nov-13 10:57 
GeneralRe: errors Pin
Bernhard Hiller4-Nov-13 21:27
Bernhard Hiller4-Nov-13 21:27 
GeneralRe: errors Pin
Richard MacCutchan4-Nov-13 22:41
mveRichard MacCutchan4-Nov-13 22:41 
QuestionEnglish to Arabic text for printing in Arabic Pin
Aswartha Vamsi4-Nov-13 5:35
Aswartha Vamsi4-Nov-13 5:35 
AnswerRe: English to Arabic text for printing in Arabic Pin
Richard MacCutchan4-Nov-13 6:12
mveRichard MacCutchan4-Nov-13 6:12 
AnswerRe: English to Arabic text for printing in Arabic Pin
Ravi Bhavnani4-Nov-13 6:51
professionalRavi Bhavnani4-Nov-13 6:51 
QuestionList problem ! Pin
_Q12_3-Nov-13 15:18
_Q12_3-Nov-13 15:18 
C#
/*I work at this code from a month now, and still is full of bugs... 
I decided to get help, because i can not think clear (i slept a lot, but did not helped)
When i change something in the UPcode, something in the DOWNcode is mess up. If i change something, a f***ing chain of events crack in my face (and they are not compiler errors) - just the functionality of the software.
What i want to do here is like this:
      Look into a saved pls list of movies, and copy all the lines inside it( ---unordered---, like they were saved last time)
	-compare what is in director with what is saved in list
		if same data, skip all / load default
		if new files(movies) in dir, bring new lines in front of list (or behind)
		if missing files in list, clear list, but mentain the last (unordered) lines in file
	-if file does not exist, make one new (default - in alphabetical order)*/


C#
        private void Form1_Load(object sender, EventArgs e)
        {
            //Add movies from Directory
            DirectoryInfo di = new DirectoryInfo(path);
            foreach (var movie in di.GetFiles())
            {
                foreach (var extension in extensionsForMovies)
                {
                    if (movie.Extension.ToUpper() == extension)
                    {
                        List1.Add(movie.Name);
                    }
                }
            }
          
            DateTime dt = DateTime.UtcNow;
            string day = dt.Day.ToString(); if (dt.Day < 10) day = 0 + dt.Day.ToString();//if Day<10 put 0 in front (01,02,03...)
            string month = dt.Month.ToString(); if (dt.Month < 10) month = 0 + dt.Month.ToString();
            string date = dt.Year.ToString() + month + day;


            index = new FileInfo("   index" + List1.Count + "  [" + date + "].pls");
            label1.Text = List1.Count + " files/" + nrMovies() + " saved";
        }



        List<string> List1 = new List<string>(); //movie_List   list of movies
        List<string> List2 = new List<string>(); //file_List    list of saves
        List<string> List3 = new List<string>(); //temp_List
private void button1Create_Click(object sender, EventArgs e)
        {
            // if a *.PLS file exist read all data
            bool isPLSfile = false;
            DirectoryInfo di = new DirectoryInfo(path);
            foreach (var movie in di.GetFiles())
            {
                if (movie.Extension.ToUpper() == ".PLS")
                {
                    List2.Clear(); List3.Clear();
                    //READ
                    StreamReader sr074 = new StreamReader(movie.FullName);
                    while (!sr074.EndOfStream)
                    {
                        List2.Add(sr074.ReadLine() + "\r\n");
                    }
                    sr074.Close();
                    List2.RemoveAt(0);
                    List2.RemoveAt(0);
                    isPLSfile = true;
                }
            }
            if (isPLSfile == false) { button0Default.PerformClick(); goto End; }
            string llinelist1_ = "", llinelist2_ = "";
        again:
            for (int i = 0; i < List2.Count; i++)
            {
                for (int j = 0; j < List1.Count; j++)
                {
                    llinelist1_ = List1[j];
                    llinelist2_ = List2[i];
                    if (llinelist2_.Contains(llinelist1_))  
                    {
                        List3.Add(List1[j]);//bring linia.list1 into list3 but ordered by list2
                        //------------------// at the end, it will remain only the rest
                        List1.RemoveAt(j);
                        List2.RemoveAt(i);
                        goto again;

                    }
                }
            }
            //--------------------------------------------------
	    //but some  movies still remain after cleaning, and your list1 is reordered after list3(but incomplete)
            foreach (var List1_Line in List1)
            {
                //List3.Add(List1_Line);        //at End
                List3.Insert(0, List1_Line);    //at Start
            }
            //if old movies are still in the list (many lines)
            List2.Clear();
            //--------------------------------------------------
            foreach (var line in List3) //bring all movies from director,but reordered after last save
            {
                List2.Add(line);
            }

            //--------------------------------------------------
            //ERASE
            FileInfo fi = new FileInfo(index.FullName);
            fi.Delete();
            //SAVE
            StreamWriter sw = new StreamWriter(index.Name, false, Encoding.Unicode);
            sw.Write("[playlist]\r\nNumberOfEntries=" + List3.Count + "\r\n");
            string s4563 = "";
            for (int i = 1; i < List2.Count + 1; i++)
            {
                s4563 = "File" + i + "=" + path + "\\" + List2[i - 1] + "\r\n";// File3=C:\Path\05 q1.flv
               "sw.Write(s4563);
            }
            sw.Close();
            //--------------------------------------------------
            //start software
            label1.Text = List3.Count + " files/" + nrMovies() + " saved";
            Process.Start(path + "//" + index);

         End:
            List2.Clear(); List3.Clear(); //here not sure...
        }


Thanks
AnswerRe: List problem ! Pin
Abhinav S3-Nov-13 19:13
Abhinav S3-Nov-13 19:13 
GeneralRe: List problem ! Pin
_Q12_3-Nov-13 19:47
_Q12_3-Nov-13 19:47 
AnswerRe: List problem ! Pin
OriginalGriff3-Nov-13 22:04
mveOriginalGriff3-Nov-13 22:04 
AnswerRe: List problem ! Pin
Richard MacCutchan3-Nov-13 22:10
mveRichard MacCutchan3-Nov-13 22:10 
AnswerRe: List problem ! Pin
Paulo Augusto Kunzel4-Nov-13 3:02
professionalPaulo Augusto Kunzel4-Nov-13 3:02 
AnswerRe: List problem ! Pin
Pete O'Hanlon4-Nov-13 3:24
mvePete O'Hanlon4-Nov-13 3:24 
Questionalways black screen Pin
josephdalebert2-Nov-13 23:33
josephdalebert2-Nov-13 23:33 
AnswerRe: always black screen Pin
Richard Andrew x643-Nov-13 13:20
professionalRichard Andrew x643-Nov-13 13:20 
QuestionC# Generic Dictionary ordered by Value: is it really ordered ? Pin
BillWoodruff2-Nov-13 8:05
professionalBillWoodruff2-Nov-13 8:05 
AnswerRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
harold aptroot2-Nov-13 8:23
harold aptroot2-Nov-13 8:23 
GeneralRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
BillWoodruff2-Nov-13 18:43
professionalBillWoodruff2-Nov-13 18:43 
AnswerRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
TnTinMn2-Nov-13 17:28
TnTinMn2-Nov-13 17:28 
GeneralRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
BillWoodruff2-Nov-13 18:48
professionalBillWoodruff2-Nov-13 18:48 
GeneralRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
TnTinMn3-Nov-13 10:50
TnTinMn3-Nov-13 10:50 
AnswerRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
jschell4-Nov-13 8:05
jschell4-Nov-13 8:05 
AnswerRe: C# Generic Dictionary ordered by Value: is it really ordered ? Pin
Keith Barrow5-Nov-13 2:22
professionalKeith Barrow5-Nov-13 2:22 
QuestionBurning open file to CD/DVD Pin
Member 103095672-Nov-13 1:34
Member 103095672-Nov-13 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.