public ConfigControl() { InitializeComponent(); this.flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; this.contraConfig = ProjectItemManager.Instance().contraConfig; this.proList = this.contraConfig.ProjectItemList; this.allCheck.Checked = this.contraConfig.Enabled != null && Boolean.Parse(this.contraConfig.Enabled); for (int i = 0; i < this.proList.Count; i++) { ItemControl control = new ItemControl(this.proList[i], this); this.flowLayoutPanel1.Controls.Add(control); } ChangeLabelColor(); }
void IAutoTamper.AutoTamperResponseBefore(Session oSession) { //throw new NotImplementedException(); CotraConfig contraConfig = ProjectItemManager.Instance().contraConfig; bool flag = true; for (int i = 0, k = contraConfig.ProjectItemList.Count; i < k && flag; i++) { if (Boolean.Parse(contraConfig.Enabled) && Boolean.Parse(contraConfig.ProjectItemList[i].Enabled)) { if (!DoMatch(contraConfig.ProjectItemList[i].UserAgent, oSession.oRequest["User-Agent"])) { for (int j = 0, v = contraConfig.ProjectItemList[i].OutURLList.Count; j < v && flag; j++) { if (Boolean.Parse(contraConfig.ProjectItemList[i].OutURLList[j].Enabled) && DoMatch(contraConfig.ProjectItemList[i].OutURLList[j].OutURL, oSession.fullUrl)) { for (int m = 0, n = contraConfig.ProjectItemList[i].CookieList.Count; m < n && flag; m++) { oSession.oResponse.headers.Add("Set-Cookie", contraConfig.ProjectItemList[i].CookieList[m].Name + "=" + contraConfig.ProjectItemList[i].CookieList[m].Value + "; PATH=/; DOMAIN=" + contraConfig.ProjectItemList[i].CookieHost + ";"); } if (contraConfig.ProjectItemList[i].AttachedCookie.Length > 0) { var AttachedCookie = contraConfig.ProjectItemList[i].AttachedCookie.Split(';'); for (int x = 0, y = AttachedCookie.Length; x < y; x++) { if (AttachedCookie[x].Length > 0) { oSession.oResponse.headers.Add("Set-Cookie", AttachedCookie[x] + "; PATH=/; DOMAIN=" + contraConfig.ProjectItemList[i].CookieHost + ";"); } } } flag = false; } } } } } }
void IAutoTamper.AutoTamperRequestBefore(Session oSession) { CotraConfig contraConfig = ProjectItemManager.Instance().contraConfig; var sCookie = oSession.oRequest["Cookie"]; for (int i = 0, k = contraConfig.ProjectItemList.Count; i < k; i++) { if (Boolean.Parse(contraConfig.Enabled) && Boolean.Parse(contraConfig.ProjectItemList[i].Enabled)) { if (contraConfig.ProjectItemList[i].RequestCookies.Length > 0 && DoMatch(contraConfig.ProjectItemList[i].UserAgent, oSession.oRequest["User-Agent"]) && DoMatch(contraConfig.ProjectItemList[i].InURL, oSession.fullUrl)) { bool whenflag = true; if (Boolean.Parse(contraConfig.ProjectItemList[i].WhenEnabled) && contraConfig.ProjectItemList[i].WhenContents.Length > 0) { whenflag = false; try { Match whenmatch = new Regex("(^| )" + contraConfig.ProjectItemList[i].WhenContents + "(;|$)").Match(sCookie); if (whenmatch.Success) { whenflag = true; } } catch { } } if (whenflag) { List <CookieSet> setList = new List <CookieSet>(); var cookieStr = contraConfig.ProjectItemList[i].RequestCookies.Split(';'); for (int j = 0, v = cookieStr.Length; j < v; j++) { try { Match match = new Regex("(^| )" + cookieStr[j] + "(?:=([^;]*))?(;|$)").Match(sCookie); if (cookieStr[j].Length > 0 && match.Success) { CookieSet editItem = contraConfig.ProjectItemList[i].CookieList.Find(o => o.Name == cookieStr[j]); if (editItem != null) { editItem.Value = match.Groups[2].Value; } else { CookieSet tempset = new CookieSet(); tempset.Name = cookieStr[j]; tempset.Value = match.Groups[2].Value; contraConfig.ProjectItemList[i].CookieList.Add(tempset); } //CookieSet tempset = new CookieSet(); //tempset.Name = cookieStr[j]; //tempset.Value = match.Groups[2].Value; //setList.Add(); //contraConfig.ProjectItemList[i].CookieList.Add(tempset); } } catch { } } this.oConfigControl.RefleshCookieLabel(); } //if (setList.Count > 0) //{ // contraConfig.ProjectItemList[i].CookieList = setList; //} } } } //throw new NotImplementedException(); }
void IFiddlerExtension.OnBeforeUnload() { //throw new NotImplementedException(); ProjectItemManager.Instance().SaveRule(); }
public ProjectChapterController(ProjectItemManager projectItemManager, AuthorizationManager authorizationManager) { m_projectItemManager = projectItemManager; m_authorizationManager = authorizationManager; }
public ProjectAudioController(ProjectItemManager projectItemManager, ProjectContentManager projectContentManager, AuthorizationManager authorizationManager) { m_projectItemManager = projectItemManager; m_projectContentManager = projectContentManager; m_authorizationManager = authorizationManager; }
void DocumentClosed(Document document) { ProjectItemManager.ItemClosed(document.ProjectItem); }
private void MenuItemCallback(object sender, EventArgs e) { UIHierarchyItem item = GetSelectedItem(); if (item == null) { return; } string folder = FindFolder(item); if (string.IsNullOrEmpty(folder) || !Directory.Exists(folder)) { return; } // See if the user has a valid selection on the Solution Tree and avoid prompting the user // for a file name. Project project = GetActiveProject(); if (project == null) { return; } string defaultExt = GetProjectDefaultExtension(project); string input = PromptForFileName( folder, defaultExt ).TrimStart('/', '\\').Replace("/", "\\"); if (string.IsNullOrEmpty(input)) { return; } if (input.EndsWith("\\", StringComparison.Ordinal)) { input = input + "__dummy__"; } TemplateMap templates = GetTemplateMap(); string projectPath = Path.GetDirectoryName(project.FullName); string relativePath; if (folder.StartsWith(projectPath, StringComparison.OrdinalIgnoreCase) && folder.Length > projectPath.Length) { relativePath = CombinePaths(folder.Substring(projectPath.Length + 1), input); // I'm intentionally avoiding the use of Path.Combine because input may contain pattern characters // such as ':' which will cause Path.Combine to handle differently. We simply need a string concat here. } else { relativePath = input; } try { var itemManager = new ProjectItemManager(_dte, templates); var creator = itemManager.GetCreator(project, projectPath, relativePath); var info = creator.Create(project); SelectCurrentItem(); if (info != ItemInfo.Empty && _lastUsedExtension != defaultExt && info.Extension == _lastUsedExtension) { // TODO: Save extension to project-specific storage _overridingExtension = info.Extension; } _lastUsedExtension = info.Extension; } catch (Exception ex) { MessageBox.Show(ex.Message, "Cannot Add New File", MessageBoxButton.OK, MessageBoxImage.Error); } }
void ItemRenamed(ProjectItem projectItem, string oldname) { ProjectItemManager.ItemRenamed(projectItem, oldname); }
void DocumentSaved(Document document) { ProjectItemManager.ItemSaved(document.ProjectItem); }
void ItemRemoved(ProjectItem projectItem) { ProjectItemManager.ItemRemoved(projectItem); }
void ItemAdded(ProjectItem projectItem) { ProjectItemManager.ItemAdded(projectItem); }
void ProjectRemoved(Project project) { ProjectItemManager.ProjectRemoved(project); }
void ProjectAdded(Project project) { ProjectItemManager.ProjectAdded(project); }
void SolutionOpened() { ProjectItemManager.SolutionOpened(); }