private ICookieGetter CreateCookieGetter(Firefox3Profile prof)
		{
			string name = "Firefox3";
			string path = null;

			if (prof != null) {
				name += " " + prof.name;
				path = System.IO.Path.Combine(prof.path, COOKEFILE_NAME);				
			}

			CookieStatus status = new CookieStatus(name, path, this.BrowserType, PathType.File);
			return new Firefox3CookieGetter(status);
		}
Пример #2
0
		/// <summary>
		/// Firefoxのプロフィールフォルダ内のフォルダをすべて取得する
		/// </summary>
		/// <returns></returns>
		public static Firefox3Profile[] GetProfiles(string moz_path, string iniFileName)
		{
			string profile_path = System.IO.Path.Combine(moz_path, iniFileName);

			List<Firefox3Profile> results = new List<Firefox3Profile>();

			if (System.IO.File.Exists(profile_path)) {
				using (System.IO.StreamReader sr = new System.IO.StreamReader(profile_path)) {
					Firefox3Profile prof = null;
					while (!sr.EndOfStream) {
						string line = sr.ReadLine();

						if (line.StartsWith("[Profile")) {
							prof = new Firefox3Profile();
							results.Add(prof);
						}

						if (prof != null) {
							KeyValuePair<string, string> kvp = getKVP(line);

							switch (kvp.Key) {
								case "Name":
									prof.name = kvp.Value;
									break;
								case "IsRelative":
									prof.isRelative = kvp.Value == "1";
									break;
								case "Path":
									prof.path = kvp.Value.Replace('/', '\\');
									if (prof.isRelative) {
										prof.path = System.IO.Path.Combine(moz_path, prof.path);
									}
									break;
								case "Default":
									prof.isDefault = kvp.Value == "1";
									break;
							}
						}
					}
				}

			}

			return results.ToArray();

		}