public static FileVersionCode CombineFileVersionCodes(FileVersionCode downloadedFVC, FileVersionCode generatedFVC)
 {
     string[] codePaths = new string[4];
     codePaths[0] = generatedFVC.MD5Hash;
     codePaths[1] = generatedFVC.FileLastWriteTime.ToString();
     codePaths[2] = generatedFVC.FilePath;
     codePaths[3] = downloadedFVC.DownloadToken;
     return(new FileVersionCode(codePaths));
 }
        public void WriteIndexFile()
        {
            LoadData();

            List <FileVersionCode> downloadedFVCs = FileVersionCode.ConvertToFileVersions(File.ReadAllLines("index.mbi"));
            List <FileVersionCode> generatedFVCs  = FileVersionCode.ConvertToFileVersions(list);

            list.Clear();

            Console.WriteLine("Writing " + Channel + " index file..." + Environment.NewLine);

            foreach (FileVersionCode generatedFVC in generatedFVCs)
            {
                bool foundFile = false;

                for (int i = 0; i < downloadedFVCs.Count; i++)
                {
                    foundFile = generatedFVC.FilePath.Equals(downloadedFVCs[i].FilePath);
                    if (foundFile)
                    {
                        FileVersionCode f = FileVersionCode.CombineFileVersionCodes(downloadedFVCs[i], generatedFVC);
                        list.Add(f.Code);
                        i = downloadedFVCs.Count;
                    }
                }

                if (!foundFile && AddNewFiles)
                {
                    list.Add(generatedFVC.Code);
                    Console.WriteLine("Added new file: " + generatedFVC.Code);
                }
            }

            File.WriteAllLines(Channel + ".index.mbi", list);

            Console.WriteLine(Environment.NewLine + "Finished." + Environment.NewLine);
        }