コード例 #1
0
 public List <string> config()
 {
     return(new List <string>
     {
         $"Last Used Media Directory:{LastUsedMediaDirectory}",
         $"Overwrite Original:{OverWriteOriginal}",
         $"Use Enclosed Folder as the Temporary encode path:{UseEnclosedFolder}",
         $"TempFolderLocation:{TempFolderDirectory}",
         $"Show Encoder Console:{ShowEncodeConsole}",
         $"Is Network Path:{IsNetworkPath}",
         $"Sort Type:{MediaFiles.SortTypeToString(sortType)}",
         $"Sort Order:{MediaFiles.SortOrderToString(sortOrder)}"
     });
 }
コード例 #2
0
        public void Read(string file, string path)
        {
            try
            {
                Directory.CreateDirectory(path);
                using (StreamReader reader = File.OpenText(Path.Combine(path, file)))
                {
                    string text = "";
                    while (!reader.EndOfStream)
                    {
                        string line = reader.ReadLine();

                        if (line.StartsWith("Last Used Media Directory:"))
                        {
                            text = line.Replace("Last Used Media Directory:", "");
                            last_used_media_directory = text;
                        }
                        if (line.StartsWith("Overwrite Original:"))
                        {
                            text = line.Replace("Overwrite Original:", "");
                            try
                            {
                                overwriteoriginal = bool.Parse(text.ToLower());
                            }
                            catch (Exception e)
                            {
                                reference.Log.Add(e.StackTrace);
                                overwriteoriginal = false;
                            }
                        }
                        if (line.StartsWith("Use Enclosed Folder as the Temporary encode path:"))
                        {
                            text = line.Replace("Use Enclosed Folder as the Temporary encode path:", "");
                            try
                            {
                                UseEnclosedFolder = bool.Parse(text.ToLower());
                            }
                            catch (Exception e)
                            {
                                reference.Log.Add(e.StackTrace);
                                UseEnclosedFolder = true;
                            }
                        }

                        if (line.StartsWith("TempFolderLocation:"))
                        {
                            text = line.Replace("TempFolderLocation:", "");
                            TempFolderDirectory = text;
                        }

                        if (line.StartsWith("Show Encoder Console:"))
                        {
                            text = line.Replace("Show Encoder Console:", "");
                            bool.TryParse(text, out bool b);
                            ShowEncodeConsole = b;
                        }

                        if (line.StartsWith("Is Network Path:"))
                        {
                            text = line.Replace("Is Network Path:", "");
                            bool.TryParse(text, out bool b);
                            IsNetworkPath = b;
                        }
                        if (line.StartsWith("Sort Order:"))
                        {
                            text      = line.Replace("Sort Order:", "");
                            sortOrder = MediaFiles.ParseOrder(text);
                        }
                        if (line.StartsWith("Sort Type:"))
                        {
                            text     = line.Replace("Sort Type:", "");
                            sortType = MediaFiles.ParseType(text);
                        }
                    }
                    reader.Close();
                }
            }
            catch (FileNotFoundException)
            {
                Write(config(), file, path, false);
            }
            catch (Exception e)
            {
                Console.WriteLine("" + e.StackTrace);
            }
        }