예제 #1
0
 // finds a rulecondition by format.
 // it is assumed that the text format is unique
 public T FindByKeyType(KEYTYPE key)
 {
     foreach (RulePart rp in this)
     {
         if (rp.KeyType == key)
         {
             return((T)rp);
         }
     }
     return(null);
 }
예제 #2
0
        byte[] streamkey(KEYTYPE type)
        {
            switch (type)
            {
            case KEYTYPE.MODULUS: return(keyinfo.Modulus);

            case KEYTYPE.EXPONENT: return(keyinfo.D);

            case KEYTYPE.P: return(keyinfo.P);

            case KEYTYPE.Q: return(keyinfo.Q);

            default: return(new byte[] { });
            }
        }
예제 #3
0
        void WriteBin(KEYTYPE type)
        {
            if (!this.checkBoxBin.Checked)
            {
                return;
            }
            string filename = Enum.GetName(typeof(KEYTYPE), type).ToLower() + ".bin";

            using (System.IO.Stream stream = new System.IO.FileStream(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
            {
                using (System.IO.BinaryWriter writing = new System.IO.BinaryWriter(stream))
                {
                    writing.Write(streamkey(type));
                    writing.Flush();
                    writing.Close();
                }
            }
        }
예제 #4
0
        public void PickupKey(KEYTYPE keyType)
        {
            if (keyType == KEYTYPE.REG)
            {
                RegKeyCount++;
            }
            else if (keyType == KEYTYPE.BOSS)
            {
                HasBossKey = true;
            }

            if (RegKeyCount > 0)
            {
                HasRegDoorKey = true;
            }
            else
            {
                HasRegDoorKey = false;
            }
        }
예제 #5
0
        public void UseKey(KEYTYPE key)
        {
            if (key == KEYTYPE.REG)
            {
                RegKeyCount--;
            }
            else if (key == KEYTYPE.BOSS)
            {
                HasBossKey = false;
            }

            if (RegKeyCount > 0)
            {
                HasRegDoorKey = true;
            }
            else
            {
                HasRegDoorKey = false;
                RegKeyCount   = 0;
            }
        }
예제 #6
0
파일: RuleCondition.cs 프로젝트: ewin66/dev
 public void settingRuleCondition(string labelGUIText, string hyperlinkGUIText, string mainCpClientInstanceName, KEYTYPE keyType, string description)
 {
     this.labelGUIText             = labelGUIText;
     this.hyperlinkGUIText         = hyperlinkGUIText;
     this.mainCpClientInstanceName = mainCpClientInstanceName;
     this.KeyType     = keyType;
     this.description = description;
 }