Example #1
0
    // Save text to file
    private void ExportText(Unity_Studio.AssetPreloadData asset)
    {
        Unity_Studio.TextAsset m_TextAsset = new Unity_Studio.TextAsset(asset, false);
        Directory.CreateDirectory(ContentData.ContentPath());
        Directory.CreateDirectory(ContentData.ContentPath() + gameType);
        Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg");
        Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/text");
        string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/text/" + asset.Text;
        string fileName      = fileCandidate + asset.extension;

        m_TextAsset = new Unity_Studio.TextAsset(asset, true);
        // This should apend a postfix to the name to avoid collisions, but as we import multiple times
        // This is broken
        while (File.Exists(fileName))
        {
            return;// Fixme;
        }

        // Write to disk
        using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
        {
            // Pass the Deobfuscate key to decrypt
            writer.Write(m_TextAsset.Deobfuscate(finder.ObfuscateKey()));
            writer.Close();
        }

        // Run monster data extration tool if in dev
        if (Application.isEditor && asset.Text.Equals("Localization"))
        {
            if (finder is MoMFinder)
            {
                ExtractDataTool.MoM(m_TextAsset.Deobfuscate(finder.ObfuscateKey()));
            }
        }
    }
Example #2
0
    private void ExportText(Unity_Studio.AssetPreloadData asset)
    {
        Unity_Studio.TextAsset m_TextAsset = new Unity_Studio.TextAsset(asset, false);
        Directory.CreateDirectory(ContentData.ContentPath());
        Directory.CreateDirectory(ContentData.ContentPath() + gameType);
        Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg");
        Directory.CreateDirectory(ContentData.ContentPath() + gameType + "/ffg/text");
        string fileCandidate = ContentData.ContentPath() + gameType + "/ffg/text/" + asset.Text;
        string fileName      = fileCandidate + asset.extension;

        m_TextAsset = new Unity_Studio.TextAsset(asset, true);
        while (File.Exists(fileName))
        {
            return;// Fixme;
        }

        using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
        {
            writer.Write(m_TextAsset.Deobfuscate(finder.ObfuscateKey()));
            writer.Close();
        }

        // Run monster data extration tool if in dev
        if (Application.isEditor && asset.Text.Equals("Localization"))
        {
            if (finder is MoMFinder)
            {
                ExtractDataTool.MoM(m_TextAsset.Deobfuscate(finder.ObfuscateKey()));
            }
        }
    }