Exemplo n.º 1
0
 //Helper to display signs on UI
 private void displaySign(string name, double value, double threshold)
 {
     string[] row = new string[2];
     row[0] = value.ToString();
     row[1] = value > threshold ? "Yes" : "No";
     FormInterface.listViewAddItemRange(UI.signCountListView, name, row);
 }
Exemplo n.º 2
0
 // Use this for dependency injection
 public HomeController(UserInterface iUser, PartnershipNightInterface iPn, CharityInterface iChar, BvLocationInterface iLoc, FormInterface iForm)
 {
     uRepo = iUser;
     pnRepo = iPn;
     cRepo = iChar;
     lRepo = iLoc;
     fRepo = iForm;
 }
Exemplo n.º 3
0
 // The default constructor is called by the framework
 public HomeController()
 {
     uRepo = new UserRepository();
     pnRepo = new PartnershipNightRepository();
     cRepo = new CharityRepository();
     lRepo = new BvLocationRepository();
     fRepo = new FormRepository();
 }
Exemplo n.º 4
0
 // Use this for dependency injection
 public HomeController(UserInterface iUser, PartnershipNightInterface iPn, CharityInterface iChar, BvLocationInterface iLoc, FormInterface iForm)
 {
     uRepo  = iUser;
     pnRepo = iPn;
     cRepo  = iChar;
     lRepo  = iLoc;
     fRepo  = iForm;
 }
Exemplo n.º 5
0
 // The default constructor is called by the framework
 public HomeController()
 {
     uRepo  = new UserRepository();
     pnRepo = new PartnershipNightRepository();
     cRepo  = new CharityRepository();
     lRepo  = new BvLocationRepository();
     fRepo  = new FormRepository();
 }
        public CaptureKinectServiceNew(FormInterface form, String movementKey, bool trainingFile)
        {
            this.form = form;

            this.trainingFile = trainingFile;

            movement = movementKey;
            moment   = 1;
        }
Exemplo n.º 7
0
 public ProcessWatcher()
 {
     pWatcher = this;
     this.UI  = FormInterface.GetInstance();
     //Initialize spy manager
     spyMgr = new NktSpyMgr();
     spyMgr.Initialize();
     //Keeps all the hookmanagers with their process IDs
     hManagers = new Dictionary <int, HookManager>();
 }
Exemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();

            tabs = new Dictionary<string, FormInterface>();

            tabs.Add("Enigma", enigma = new EnigmaForm());
            enigma.CurrentPath = currentPath;
            tabs.Add("AES", new AESForm());
            tabs.Add("RailFence", new RailFenceForm());
            tabs.Add("MacierzoweA", new MacierzoweAForm());
            tabs.Add("MacierzoweB", new MacierzoweBForm());
            tabs.Add("MacierzoweC", new MacierzoweCForm());
            tabs.Add("CezaraA", new CezarAForm());
            tabs.Add("CezaraB", new CezarBForm());
            tabs.Add("Vigenere", new VigenereForm());
            tabs.Add("Kodowanie bloków", blocks = new EncryptingBlocks());

            createTabs();
            currentTab = (FormInterface) tabControl.SelectedTab.Controls[0];
        }
Exemplo n.º 9
0
        public static Descriptor[] getDownloads(TreeNode nodes, FormInterface fi)
        {
            ArrayList descriptors = new ArrayList();

            if (nodes.Nodes.Count > 0)
            {
                if (nodes.FirstNode.Text == null || nodes.FirstNode.Text == "")
                {
                    nodes.Nodes.Clear();
                    PlexUtils.populateSubNodes(nodes, fi);
                }
                foreach (TreeNode node in nodes.Nodes)
                {
                    if (((Descriptor)node.Tag).canDownload)
                    {
                        descriptors.Add(node.Tag);
                    }
                    else
                    {
                        if (node.Nodes.Count > 0)
                        {
                            if (node.FirstNode.Text == null || node.FirstNode.Text == "")
                            {
                                node.Nodes.Clear();
                                PlexUtils.populateSubNodes(node, fi);
                            }
                            descriptors.AddRange(getDownloads(node, fi));
                        }
                    }
                }
            }
            else if (((Descriptor)nodes.Tag).canDownload)
            {
                descriptors.Add(nodes.Tag);
            }
            return((Descriptor[])descriptors.ToArray(typeof(Descriptor)));
        }
Exemplo n.º 10
0
 //Display string evaluation result to UI
 internal void displayStrings()
 {
     for (int i = 0; i < suspiciousStrings.Length; i++)
     {
         if (discoveredStrings[i])
         {
             FormInterface.listViewAddItem(UI.stringListView, suspiciousStrings[i]);
         }
     }
     FormInterface.listViewAddItem(UI.stringListView, "---------------");
     if (foundExtensionsWhitelist && !foundExtensionsBlacklist)
     {
         FormInterface.listViewAddItem(UI.stringListView, "Found extension whitelist");
     }
     if (!foundExtensionsWhitelist && foundExtensionsBlacklist)
     {
         FormInterface.listViewAddItem(UI.stringListView, "Found extension blacklist");
     }
     if (foundExtensionsWhitelist && foundExtensionsBlacklist)
     {
         FormInterface.listViewAddItem(UI.stringListView, "Found extension list");
     }
     FormInterface.listViewAddItem(UI.stringListView, "String suspicion: " + ransomLikelihoodFromStrings);
 }
Exemplo n.º 11
0
 public static string[] getDownloadURLs(TreeNode node, FormInterface fi)
 {
     return(getDownloads(node, fi).Select(x => x.getDownloadURL() + "|" + x.downloadFullpath).ToArray());
 }
Exemplo n.º 12
0
        public static void populateSubNodes(TreeNode tnode, FormInterface fi, TreeNode newParent = null)
        {
            using (WebClient wc = new System.Net.WebClient())
            {
                String xmlString = null;
                string query     = String.Empty;
                if (((Descriptor)tnode.Tag).isSearchNode)
                {
                    Search dialog = new Search();
                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        query = String.Format("query={0}", Uri.EscapeDataString(dialog.query));
                    }
                }
                string url = ((Descriptor)tnode.Tag).host + tnode.Name + (!tnode.Name.Contains("?") ? '?' : '&') + query + (query.Equals(string.Empty) ? "" : "&") + ((Descriptor)tnode.Tag).token;
                Console.WriteLine(url);
                try
                {
                    xmlString = wc.DownloadString(url);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return;
                }
                #region MediaContainer
                string title2 = null;
                int    count  = 0;
                if (xmlString.Contains("<MediaContainer "))
                {
                    using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                    {
                        while (reader.ReadToFollowing("MediaContainer"))
                        {
                            if (reader.MoveToAttribute("title2"))
                            {
                                title2 = reader.ReadContentAsString();
                                count++;
                            }
                        }
                    }
                }
                #endregion
                #region FolderData
                using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                {
                    String key;
                    String title;
                    while (reader.ReadToFollowing("Directory"))
                    {
                        string seasonNumber = null;
                        string ShowName     = null;
                        if (reader.MoveToAttribute("type"))
                        {
                            switch (reader.ReadContentAsString())
                            {
                            case "season":
                                if (reader.MoveToAttribute("index"))
                                {
                                    seasonNumber = reader.ReadContentAsString();
                                }
                                break;

                            case "show":
                                if (reader.MoveToAttribute("title"))
                                {
                                    ShowName = reader.ReadContentAsString();
                                }
                                break;
                            }
                        }
                        if (reader.MoveToAttribute("key"))
                        {
                            key = reader.ReadContentAsString();
                            if (reader.MoveToAttribute("title") || reader.MoveToAttribute("name"))
                            {
                                title = reader.ReadContentAsString();

                                TreeNode node = new TreeNode(title);
                                node.Name = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                if (title.Equals("search") || (reader.MoveToAttribute("search") && reader.ReadContentAsInt() == 1))
                                {
                                    node.Tag = new Descriptor((Descriptor)tnode.Tag);
                                    ((Descriptor)node.Tag).isSearchNode = true;
                                }
                                else
                                {
                                    node.Tag = new Descriptor((Descriptor)tnode.Tag);
                                    ((Descriptor)node.Tag).isSearchNode = false;
                                }
                                if (ShowName != null)
                                {
                                    ((Descriptor)node.Tag).ShowTitle = ShowName;
                                }
                                if (seasonNumber != null)
                                {
                                    ((Descriptor)node.Tag).seasonNumber = seasonNumber;
                                }
                                node.Nodes.Add(new TreeNode());
                                fi.AddNode(newParent == null ? tnode : newParent, node);
                            }
                        }
                    }
                }
                #endregion
                #region PhotoData
                if (xmlString.Contains("<Photo "))
                {
                    using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                    {
                        String key;
                        String title;
                        while (reader.ReadToFollowing("Photo"))
                        {
                            if (!reader.MoveToAttribute("key"))
                            {
                                continue;
                            }
                            key = reader.ReadContentAsString();

                            if (!reader.MoveToAttribute("title"))
                            {
                                continue;
                            }
                            title = reader.ReadContentAsString();

                            TreeNode node = new TreeNode(title);
                            node.Name = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                            node.Tag  = new Descriptor((Descriptor)tnode.Tag);

                            if (!reader.ReadToFollowing("Media"))
                            {
                                continue;
                            }

                            int  width      = -1;
                            int  height     = -1;
                            int  size       = -1;
                            bool isIndirect = false;

                            if (reader.MoveToAttribute("width"))
                            {
                                width = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("height"))
                            {
                                height = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("size"))
                            {
                                height = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("indirect"))
                            {
                                isIndirect = reader.ReadContentAsInt() == 1;
                            }

                            if (!reader.ReadToFollowing("Part"))
                            {
                                continue;
                            }
                            do
                            {
                                if (!reader.MoveToAttribute("key"))
                                {
                                    continue;
                                }

                                key = reader.ReadContentAsString();
                                string container = String.Empty;

                                if (reader.MoveToAttribute("container"))
                                {
                                    container = reader.ReadContentAsString();
                                }

                                if (!reader.MoveToAttribute("file"))
                                {
                                    continue;
                                }

                                Descriptor Tag = new Descriptor((((Descriptor)tnode.Tag).host), ((Descriptor)tnode.Tag).token);
                                Tag.downloadFullpath = reader.ReadContentAsString();
                                Tag.downloadFilename = Tag.downloadFullpath.Substring(Tag.downloadFullpath.LastIndexOf(@"\") + 1).Substring(Tag.downloadFullpath.LastIndexOf(@"/") + 1);
                                if (Tag.downloadFilename == String.Empty)
                                {
                                    Tag.downloadFilename = String.Format("{0}.{1}", title, container);
                                }
                                title = String.Format("Download {0} ({1}x{2}) {3}", Tag.downloadFilename, width, height, size);
                                TreeNode subnode = new TreeNode(title);
                                Tag.downloadUrl = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                Tag.canDownload = true;
                                subnode.Name    = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                subnode.Tag     = Tag;
                                node.Nodes.Add(subnode);
                            }while (reader.ReadToNextSibling("Part"));
                            fi.AddNode(newParent == null ? tnode : newParent, node);
                        }
                    }
                }
                #endregion
                #region VideoData
                if (xmlString.Contains("<Video "))
                {
                    using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                    {
                        String key;
                        String title;
                        while (reader.ReadToFollowing("Video"))
                        {
                            String episodeNumber = null;
                            if (reader.MoveToAttribute("type"))
                            {
                                switch (reader.ReadContentAsString())
                                {
                                //TODO: are there other types we need here?
                                case "episode":
                                    if (reader.MoveToAttribute("index"))
                                    {
                                        episodeNumber = reader.ReadContentAsString();
                                    }
                                    break;
                                }
                            }
                            if (!reader.MoveToAttribute("key"))
                            {
                                continue;
                            }
                            key = reader.ReadContentAsString();
                            if (reader.MoveToAttribute("title"))
                            {
                                title = reader.ReadContentAsString();
                            }
                            else if (reader.MoveToAttribute("type") && reader.ReadContentAsString().Equals("clip"))
                            {
                                title = tnode.Text;
                            }
                            else
                            {
                                title = "Show Video";
                            }
                            TreeNode node = new TreeNode(title);
                            node.Name = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                            node.Tag  = new Descriptor((Descriptor)tnode.Tag);
                            ((Descriptor)node.Tag).episodeNumber = episodeNumber;
                            if (!reader.ReadToFollowing("Media"))
                            {
                                continue;
                            }

                            int  width      = -1;
                            int  height     = -1;
                            int  size       = -1;
                            bool isIndirect = false;
                            if (reader.MoveToAttribute("width"))
                            {
                                width = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("height"))
                            {
                                height = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("size"))
                            {
                                height = reader.ReadContentAsInt();
                            }
                            if (reader.MoveToAttribute("indirect"))
                            {
                                isIndirect = reader.ReadContentAsInt() == 1;
                            }

                            if (!reader.ReadToFollowing("Part"))
                            {
                                continue;
                            }
                            do
                            {
                                if (!reader.MoveToAttribute("key"))
                                {
                                    continue;
                                }
                                key = reader.ReadContentAsString();
                                string container = null;
                                if (reader.MoveToAttribute("container"))
                                {
                                    container = reader.ReadContentAsString();
                                }
                                string filename = key;
                                if (isIndirect)
                                {
                                    ((Descriptor)node.Tag).isIndirect = true;
                                    node.Nodes.Add("");
                                    node.Name = key;
                                }
                                else if (key.StartsWith("http") || (reader.MoveToAttribute("file") && !(filename = reader.ReadContentAsString()).Equals(String.Empty)))
                                {
                                    Descriptor Tag = new Descriptor((((Descriptor)tnode.Tag).host), ((Descriptor)tnode.Tag).token);
                                    if (((Descriptor)tnode.Tag).seasonNumber != null)
                                    {
                                        Tag.seasonNumber = ((Descriptor)tnode.Tag).seasonNumber;
                                    }
                                    if (((Descriptor)tnode.Tag).episodeNumber != null)
                                    {
                                        Tag.episodeNumber = ((Descriptor)tnode.Tag).episodeNumber;
                                    }
                                    if (((Descriptor)tnode.Tag).ShowTitle != null)
                                    {
                                        Tag.ShowTitle = ((Descriptor)tnode.Tag).ShowTitle;
                                    }
                                    Tag.downloadFullpath = filename;
                                    Tag.downloadFilename = Tag.downloadFullpath.Substring(Tag.downloadFullpath.LastIndexOf(@"\") + 1).Substring(Tag.downloadFullpath.LastIndexOf(@"/") + 1);
                                    if (Tag.downloadFilename.Contains('?') && container != null)
                                    {
                                        if (title2 != null)
                                        {
                                            Tag.downloadFilename = String.Format("{0}.{1}", title2, container);
                                        }
                                        else
                                        {
                                            Tag.downloadFilename = String.Format("{0}.{1}", tnode.Text, container);
                                        }
                                    }
                                    title = String.Format("Download {0} ({1}x{2})", Tag.downloadFilename, width, height, size);
                                    if (Tag.ShowTitle != null && Tag.episodeNumber != null)
                                    {
                                        if (Tag.seasonNumber != null)
                                        {
                                            Tag.subdir = String.Format("{0}.S{1:00}E{2:00}", Tag.ShowTitle, Int32.Parse(Tag.seasonNumber), Int32.Parse(Tag.episodeNumber));
                                        }
                                        else
                                        {
                                            Tag.subdir = String.Format("{0}.S01E{2:00}", Tag.ShowTitle, Tag.seasonNumber, Int32.Parse(Tag.episodeNumber));
                                        }
                                    }
                                    TreeNode subnode = new TreeNode(title);
                                    if (key.StartsWith("http"))
                                    {
                                        Tag.downloadUrl = key;
                                    }
                                    else
                                    {
                                        Tag.downloadUrl = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                    }
                                    Tag.canDownload = true;
                                    Tag.isIndirect  = isIndirect;
                                    subnode.Name    = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                    subnode.Tag     = Tag;
                                    if (!((Descriptor)tnode.Tag).isSubtitlesNode)
                                    {
                                        if (isIndirect)
                                        {
                                            subnode.Nodes.Add("");
                                        }
                                        else
                                        {
                                            node.Nodes.Add(subnode);
                                            TreeNode subNode = new TreeNode("Subtitles")
                                            {
                                                Name = node.Name,
                                                Tag  = new Descriptor((Descriptor)tnode.Tag)
                                                {
                                                    parentPart      = subnode.Name,
                                                    isSubtitlesNode = true
                                                }
                                            };
                                            subNode.Nodes.Add("");
                                            node.Nodes.Add(subNode);
                                        }
                                    }
                                    else
                                    {
                                        reader.MoveToElement();
                                        if (reader.ReadToDescendant("Stream"))
                                        {
                                            string lastLanguage = null;
                                            int    s_count      = 0;
                                            do
                                            {
                                                if (!reader.MoveToAttribute("streamType") && reader.ReadContentAsInt() != 3)
                                                {
                                                    continue;
                                                }
                                                if (!reader.MoveToAttribute("key"))
                                                {
                                                    continue;
                                                }
                                                key = reader.ReadContentAsString();
                                                string language = null;
                                                if (reader.MoveToAttribute("language"))
                                                {
                                                    language = reader.ReadContentAsString();
                                                }
                                                if (language == lastLanguage)
                                                {
                                                    s_count++;
                                                }
                                                else
                                                {
                                                    s_count = 0;
                                                }
                                                lastLanguage = language;
                                                string codec = null;
                                                if (reader.MoveToAttribute("codec"))
                                                {
                                                    codec = reader.ReadContentAsString();
                                                }

                                                string sub_title = null;
                                                if (reader.MoveToAttribute("title"))
                                                {
                                                    sub_title = reader.ReadContentAsString();
                                                }
                                                string parent_title = title.Replace("Download ", "");
                                                sub_title = parent_title.Remove(parent_title.LastIndexOf('.') + 1)
                                                            + (sub_title == null ? "" : sub_title + " - ")
                                                            + language
                                                            + (s_count > 0 ? " (" + s_count + ")" :"")
                                                            + "." + codec;
                                                TreeNode subNode = new TreeNode("Download " + sub_title)
                                                {
                                                    Name = node.Name,
                                                    Tag  = new Descriptor((Descriptor)tnode.Tag)
                                                    {
                                                        parentPart       = subnode.Name,
                                                        isSubtitlesNode  = true,
                                                        downloadFullpath = sub_title,
                                                        downloadFilename = sub_title,
                                                        canDownload      = true,
                                                        downloadUrl      = key.StartsWith("http") ? key : (
                                                            key.StartsWith("/") ? key
                                                            : (string)tnode.Name + '/' + key
                                                            )
                                                    }
                                                };
                                                fi.AddNode(newParent == null ? tnode : newParent, subNode);
                                            }while (reader.ReadToFollowing("Stream"));
                                        }
                                        node = null;
                                    }
                                }
                            }while (reader.ReadToNextSibling("Part"));
                            if (node != null)
                            {
                                fi.AddNode(newParent == null ? tnode : newParent, node);
                            }
                        }
                    }
                }
                #endregion
                #region TrackData
                if (xmlString.Contains("<Track "))
                {
                    using (XmlReader reader = XmlReader.Create(new StringReader(xmlString)))
                    {
                        String key;
                        String title;
                        String album  = null;
                        String artist = null;
                        while (reader.ReadToFollowing("Track"))
                        {
                            if (!reader.MoveToAttribute("key"))
                            {
                                continue;
                            }

                            key = reader.ReadContentAsString();

                            if (!reader.MoveToAttribute("title"))
                            {
                                continue;
                            }

                            title = reader.ReadContentAsString();

                            if (reader.MoveToAttribute("grandparentTitle"))
                            {
                                artist = reader.ReadContentAsString();
                                title  = string.Format("{0} - {1}", artist, title);
                            }
                            if (reader.MoveToAttribute("parentTitle"))
                            {
                                album = reader.ReadContentAsString();
                            }

                            TreeNode node = new TreeNode(title);
                            node.Name = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                            node.Tag  = tnode.Tag;

                            if (!reader.ReadToFollowing("Media"))
                            {
                                continue;
                            }
                            int duration = -1;

                            if (reader.MoveToAttribute("duration"))
                            {
                                duration = reader.ReadContentAsInt();
                            }

                            if (!reader.ReadToFollowing("Part"))
                            {
                                continue;
                            }

                            do
                            {
                                if (!reader.MoveToAttribute("key"))
                                {
                                    continue;
                                }
                                key = reader.ReadContentAsString();
                                string container = String.Empty;
                                if (reader.MoveToAttribute("container"))
                                {
                                    container = reader.ReadContentAsString();
                                }
                                if (!reader.MoveToAttribute("file"))
                                {
                                    continue;
                                }

                                Descriptor Tag = new Descriptor((((Descriptor)tnode.Tag).host), ((Descriptor)tnode.Tag).token);
                                Tag.downloadFullpath = reader.ReadContentAsString();
                                Tag.downloadFilename = Tag.downloadFullpath.Substring(Tag.downloadFullpath.LastIndexOf(@"\") + 1).Substring(Tag.downloadFullpath.LastIndexOf(@"/") + 1);

                                if (Tag.downloadFilename == String.Empty)
                                {
                                    Tag.downloadFilename = String.Format("{0}.{1}", title, container);
                                }

                                if (duration > 0)
                                {
                                    title = String.Format("Download {0} ({1})", Tag.downloadFilename, duration);
                                }
                                else
                                {
                                    title = String.Format("Download {0}", Tag.downloadFilename);
                                }

                                if (album != null)
                                {
                                    if (artist != null)
                                    {
                                        Tag.subdir = String.Format("{0} - {1}", artist, album);
                                    }
                                    else
                                    {
                                        Tag.subdir = album;
                                    }
                                }

                                TreeNode subnode = new TreeNode(title);
                                Tag.downloadUrl = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                Tag.canDownload = true;
                                subnode.Name    = key.StartsWith("/") ? key : (string)tnode.Name + '/' + key;
                                subnode.Tag     = Tag;
                                node.Nodes.Add(subnode);
                            }while (reader.ReadToNextSibling("Part"));
                            fi.AddNode(newParent == null ? tnode : newParent, node);
                        }
                    }
                }
                #endregion
            }
            if (tnode.Name == Descriptor.libraryBasePath)
            {
                var node = new TreeNode("Search")
                {
                    Tag = tnode.Tag, Name = "/search"
                };
                ((Descriptor)node.Tag).isSearchNode = true;
                node.Nodes.Add(new TreeNode());
                fi.AddNode(newParent == null ? tnode : newParent, node);
            }
        }
Exemplo n.º 13
0
 private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentTab = (FormInterface) tabControl.SelectedTab.Controls[0];
 }
Exemplo n.º 14
0
 // The default constructor is called by the framework
 public LeaderBoardController()
 {
     fRepo = new FormRepository();
 }
 // The default constructor is called by the framework
 public LeaderBoardController()
 {
     fRepo = new FormRepository();
 }