Ejemplo n.º 1
0
 // -----------------------------------------------------------------------------------
 /// <summary>
 /// Load a PNG into preview and save the file name
 /// </summary>
 void LoadCharacterSheet()
 {
     characterSheetFile = EditorUtility.OpenFilePanel("Load Character Sheet", "", "png");
     if (string.IsNullOrEmpty(characterSheetFile))
     {
         return;
     }
     baseSheet  = new BaseSheet(File.GetRawTextureData(characterSheetFile));
     foldout[0] = true;
 }
Ejemplo n.º 2
0
 // --- Methods ----------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------
 /// <summary>
 /// Clears the previews
 /// </summary>
 void Clear()
 {
     loadedFile         = null;
     guid               = System.Guid.NewGuid().ToString().ToUpper();
     tags               = "";
     artist             = "";
     characterName      = "";
     baseSheet          = null;
     rounds             = new RoundImages[Config.Rounds];
     characterSheetFile = null;
     roundFiles         = new List <string[]>(new string[Config.Rounds][]);
 }
Ejemplo n.º 3
0
        // -----------------------------------------------------------------------------------
        /// <summary>
        /// Loads and decrypts a character sheet from file
        /// </summary>
        void LoadCharacterSheet()
        {
            BinaryReader br = new BinaryReader(System.IO.File.Open(source, FileMode.Open));

            BlowFishCS.BlowFish blowfish = new BlowFishCS.BlowFish(IllogicGate.Data.EncryptedFile.RestoreKey(ShuffledKey));

            // read and decrypt the character sheet
            br.BaseStream.Seek(header.characterSheet.offset, SeekOrigin.Begin);
            byte[] rawData = br.ReadBytes(header.characterSheet.length);
            rawData = blowfish.Decrypt_ECB(rawData);
            rawData = LZMAtools.DecompressLZMAByteArrayToByteArray(rawData);
            br.Close();

            _characterSheet = new BaseSheet(rawData);
        }
Ejemplo n.º 4
0
        // -----------------------------------------------------------------------------------
        /// <summary>
        /// Loads a created character file to test if it was saved correctly
        /// </summary>
        void Load()
        {
            Clear();

            string target = EditorUtility.OpenFilePanel("Select file", "", "chr");

            if (string.IsNullOrEmpty(target))
            {
                return;
            }

            loadedFile = new File(target);
            baseSheet  = loadedFile.baseSheet;

            guid          = loadedFile.guid;
            artist        = loadedFile.artist;
            characterName = loadedFile.characterName;
            tags          = loadedFile.tags;

            for (int i = 0; i < loadedFile.availableRounds; i++)
            {
                rounds[i] = loadedFile.LoadRound(i);
            }
        }