Exemplo n.º 1
0
 void InsertAlgorithm(TreeNavigator navigator, AlgorithmInfo info)
 {
     navigator
     .SetValue(iconCol, info.Icon)
     .SetValue(nameCol, info.Name)
     .SetValue(infoCol, info);
 }
Exemplo n.º 2
0
        public void SetAlgorithm(AlgorithmInfo algorithm)
        {
            this.algorithm = algorithm as CompressionAlgorithm;
            if (this.algorithm == null)
            {
                throw new ArgumentException("Invalid algorithm type");
            }

            ratioBtn.Value                   = this.algorithm.CompressionRatio;
            ratioBalancedBtn.Value           = this.algorithm.BalancedCompressionRatio;
            supportSubfilesCheck.Active      = this.algorithm.SupportsSubFiles;
            avgSubfilesBtn.Value             = this.algorithm.AverageSubFiles;
            supportDirectAccessCheck.Active  = this.algorithm.SupportsInmediateAccess;
            isHeaderEncryptedCheck.Active    = this.algorithm.IsHeaderEncrypted;
            areSubfilesEncryptedCheck.Active = this.algorithm.AreSubFilesEncrypted;

            if (this.algorithm.EncryptionAlgorithms != null)
            {
                string txt = "";
                foreach (int id in this.algorithm.EncryptionAlgorithms)
                {
                    txt += id.ToString() + " ";
                }
                algorithmUsedTxt.Text = txt;
            }
        }
Exemplo n.º 3
0
        void EditClicked(object sender, EventArgs e)
        {
            AlgorithmInfo selected = store.GetNavigatorAt(algorithmTree.SelectedRow).GetValue(infoCol);

            AlgorithmManager.Instance.AlgorithmList.Remove(selected);
            algorithmView.UpdateAlgorithm();

            AlgorithmManager.Instance.AlgorithmList.Add(selected);
            AlgorithmManager.Instance.Save();

            UpdateList(sender, e);
            SelectAlgorithm(selected);
        }
Exemplo n.º 4
0
        void SelectAlgorithm(AlgorithmInfo algorithm)
        {
            TreeNavigator nav = store.GetFirstNode();

            do
            {
                if (nav.GetValue(infoCol) == algorithm)
                {
                    algorithmTree.SelectRow(nav.CurrentPosition);
                    break;
                }
            } while (nav.MoveNext());
        }
Exemplo n.º 5
0
        void AlgorithmSelected(object sender, EventArgs e)
        {
            if (algorithmTree.SelectedRow == null)
            {
                return;
            }

            AlgorithmInfo info = store.GetNavigatorAt(algorithmTree.SelectedRow).GetValue(infoCol);

            if (info != null)
            {
                algorithmView.SetAlgorithm(info);
                gameInfo.SetGame(info.Device, info.GameId);
            }
        }
Exemplo n.º 6
0
        public void SetAlgorithm(AlgorithmInfo algorithm)
        {
            this.algorithm = algorithm as IntegrityAlgorithm;
            if (this.algorithm == null)
            {
                throw new ArgumentException("Invalid algorithm type");
            }

            hashSizeBtn.Value    = this.algorithm.HashSize;
            isBrokenCheck.Active = this.algorithm.IsBroken;

            if (this.algorithm.Key != null)
            {
                keyTxt.Text = BitConverter.ToString(this.algorithm.Key).Replace('-', ' ');
            }
        }
Exemplo n.º 7
0
        public void SetAlgorithm(AlgorithmInfo algorithm)
        {
            this.algorithm = algorithm as EncryptionAlgorithm;
            if (this.algorithm == null)
            {
                throw new ArgumentException("Invalid algorithm type");
            }

            symmetricCheck.Active = this.algorithm.IsSymmetric;
            crcName.Text          = this.algorithm.CrcName;

            if (this.algorithm.Key != null)
            {
                keyTxt.Text = BitConverter.ToString(this.algorithm.Key).Replace('-', ' ');
            }
        }
Exemplo n.º 8
0
        public void SetAlgorithm(AlgorithmInfo algorithm)
        {
            this.algorithm = algorithm;

            idBtn.Value                      = algorithm.Id;
            gameIdBtn.Value                  = algorithm.GameId;
            nameTxt.Text                     = algorithm.Name;
            companyTxt.Text                  = algorithm.Company;
            typeCombo.SelectedItem           = algorithm.Type;
            deviceCombo.SelectedItem         = algorithm.Device;
            detectableCheck.Active           = algorithm.CanBeDetected;
            instructionsBtn.Value            = algorithm.Instructions;
            basedOnTxt.Text                  = algorithm.BasedOn;
            filesBtn.Value                   = algorithm.Files;
            filesCombo.SelectedItem          = algorithm.FileType;
            filesFreqBtn.Value               = algorithm.FileFrecuencyAccess;
            bestAlgorithmCombo.SelectedIndex = algorithm.BestAlgorithm;
            qualityBtn.Value                 = algorithm.Quality;
            detailsTxt.Text                  = algorithm.Details;

            if (algorithmSpecificView != null)
            {
                algorithmSpecificView.View.Dispose();
            }

            switch (algorithm.Type)
            {
            case AlgorithmType.Compression:
                algorithmSpecificView = new CompressionFrame();
                break;

            case AlgorithmType.Encryption:
                algorithmSpecificView = new EncryptionFrame();
                break;

            case AlgorithmType.Integrity:
                algorithmSpecificView = new IntegrityFrame();
                break;
            }

            algorithmSpecificView.SetAlgorithm(algorithm);
            algorithmSpecific.Content = algorithmSpecificView.View;
        }
Exemplo n.º 9
0
        void InsertInGameList(AlgorithmInfo info)
        {
            var    gameInfo = GameInfoManager.Instance.GetGameInfo(info.Device, info.GameId);
            string title;

            if (gameInfo != null)
            {
                title = string.Format("{0} [{1}]", gameInfo.Title, gameInfo.Device);
            }
            else
            {
                title = "Unknown";
            }

            var navigator = SearchNode(title);

            if (navigator == null)
            {
                navigator = store.AddNode().SetValue(nameCol, title);
            }

            InsertAlgorithm(navigator.AddChild(), info);
        }
Exemplo n.º 10
0
        public static XElement ToXml(AlgorithmInfo algorithm)
        {
            YAXSerializer serializer = null;

            switch (algorithm.Type)
            {
            case AlgorithmType.Encryption:
                serializer = new YAXSerializer(typeof(EncryptionAlgorithm));
                break;

            case AlgorithmType.Compression:
                serializer = new YAXSerializer(typeof(CompressionAlgorithm));
                break;

            case AlgorithmType.Integrity:
                serializer = new YAXSerializer(typeof(IntegrityAlgorithm));
                break;

            default:
                return(null);
            }

            return(XElement.Parse(serializer.Serialize(algorithm)));
        }