public DetectedLocationPathHolder(EnvironmentVariable ev, string absolute_root, string path, string owner) : base(ev, path) { if (absolute_root == null) throw new Exception("ABSOLUTE ROOT MUST BE PROVIDED"); this.AbsoluteRoot = absolute_root; this.owner = owner; }
protected void AddPath(EnvironmentVariable ev, string path, string user = null) { if (user == null) user = GLOBAL_CONST; if(!Paths.ContainsKey(user)) this.Paths.Add(user, new Dictionary<EnvironmentVariable,string>()); Dictionary<EnvironmentVariable, string> entry = this.Paths[user]; entry[ev] = path; }
private List<DetectedLocationPathHolder> detectPSGame(PlayStationID id, EnvironmentVariable ev) { id.path = null; id.rel_root = ev; List<DetectedLocationPathHolder> interim = getPaths(id as LocationPathHolder); List<DetectedLocationPathHolder> return_me = new List<DetectedLocationPathHolder>(); foreach(DetectedLocationPathHolder path in interim) { DirectoryInfo test = new DirectoryInfo(path.full_dir_path); if(test.GetDirectories(id.prefix + id.suffix + "*").Length>0) { path.owner = null; return_me.Add(path); } } return return_me; }
protected override void LoadMoreData(XmlElement element) { foreach (XmlAttribute attrib in element.Attributes) { if (attributes.Contains(attrib.Name)) continue; switch (attrib.Name) { case "ev": this.ev = parseEnvironmentVariable(attrib.Value); break; case "path": this.path = attrib.Value; break; default: throw new NotSupportedException(attrib.Name); } } }
public DetectedLocationPathHolder(EnvironmentVariable ev, string absolute_root, string path, string owner) : base(ev, path) { if (absolute_root == null) throw new Exception("ABSOLUTE ROOT MUST BE PROVIDED"); this.owner = owner; this.AbsoluteRoot = absolute_root; if (this.Exists) { string[] parts = this.FullDirPath.Split(System.IO.Path.DirectorySeparatorChar); DirectoryInfo dir = new DirectoryInfo(parts[0] + System.IO.Path.DirectorySeparatorChar); int i = 1; bool found; while (i < parts.Length) { found = false; foreach (DirectoryInfo folder in dir.GetDirectories()) { if (folder.Name.ToLower() == parts[i].ToLower()) { found = true; dir = folder; i++; break; } } if (!found) { throw new Exceptions.WTFException("The folder " + parts[i] + " could not be found in " + dir.FullName); } } string new_root = dir.FullName.Substring(0, absolute_root.Length).TrimEnd(System.IO.Path.DirectorySeparatorChar); string new_path = dir.FullName.Substring(absolute_root.Length).Trim(System.IO.Path.DirectorySeparatorChar); if(this.Path==null) { if (this.Path == null && !String.IsNullOrEmpty(new_path) || this.AbsoluteRoot.ToLower() != new_root.ToLower()) { throw new Exceptions.WTFException(String.Concat(this.Path,new_path,this.AbsoluteRoot,new_root)); } } else { if (new_path.ToLower() != this.Path.ToLower() || this.AbsoluteRoot.ToLower() != new_root.ToLower()) { throw new Exceptions.WTFException(String.Concat(this.Path, new_path, this.AbsoluteRoot, new_root)); } } this.AbsoluteRoot = new_root; this.Path = new_path; } }
public VariableInputForm(Guid environmentId, EnvironmentVariable variable) { this.environmentId = environmentId; this.variable = variable; InitializeComponent(); }
/// <summary> /// Exports the environment variable. /// </summary> private void ExportEnvironmentVariable() { try { saveFileDialog.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString(); if (saveFileDialog.ShowDialog() == DialogResult.OK) { EnvironmentVariable envVar = new EnvironmentVariable(); envVar.VarName = txtVariableName.Text; envVar.VarValues = this.EnvironmentVariableValue().ToString(); ImportExportManager importExportManager = new ImportExportManager(); importExportManager.EnvVariable = envVar; importExportManager.Save(saveFileDialog.FileName); MessageBox.Show( "'" + txtVariableName.Text + "' successfully exported to " + saveFileDialog.FileName + " file.", "Export Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!"); } }
public List<string> getUsers(EnvironmentVariable for_me) { List<string> return_me = new List<string>(); foreach (KeyValuePair<HandlerType, ALocationHandler> handler in handlers) { return_me.AddRange(handler.Value.getUsers(for_me)); } return return_me; }
public string getFolder(EnvironmentVariable ev, string user) { LocationPath parse_me = new LocationPath(ev, null); List<string> users = this.getUsers(ev); if (user == null) { foreach (string usr in users) { return this.getAbsoluteRoot(parse_me, usr); } return this.getAbsoluteRoot(parse_me, null); } if (users.Contains(user)) { return this.getAbsoluteRoot(parse_me, user); } throw new Exception("User " + user + " does not have a folder for EV " + ev.ToString()); }
public LocationPathHolder(LocationPathHolder copy_me) : base(copy_me) { rel_root = copy_me.rel_root; path = copy_me.path; }
private string getFolder(EnvironmentVariable ev, string path) { LocationPathHolder parse_me = new LocationPathHolder(); parse_me.path = path; parse_me.rel_root = ev; foreach(string user in Core.locations.getUsers(ev)) { return Core.locations.getAbsoluteRoot(parse_me,user); } return Core.locations.getAbsoluteRoot(parse_me,null); }
public GitEnvironmentVariable(EnvironmentVariable environmentVariable) { EnvironmentVariable = environmentVariable; }
public EditEnvironmentVariableCommand(CoinKernelViewModel coinKernelVm, EnvironmentVariable environmentVariable) { this.CoinKernelVm = coinKernelVm; this.EnvironmentVariable = environmentVariable; }
public Accuracy(EnvironmentVariable ev) : base(ev) { this.ev = ev; }