private static void TryHoken(AinFile ainFile, ref WordWrapOptions wordWrapOptions)
        {
            //void 顔表示(int nCG_NUM)
            //void ADV設定(int nBG_NUM, int nEffect_Num, int nEffect_Time)
            //void 全表示(int 効果番号, int 効果時間)
            if (ContainsFunction(ainFile, "顔表示", DataType.Int, "nCG_NUM") &&
                ContainsFunction(ainFile, "ADV設定", DataType.Int, "nBG_NUM", DataType.Int, "nEffect_Num", DataType.Int, "nEffect_Time") &&
                ContainsFunction(ainFile, "全表示", DataType.Int, "効果番号", DataType.Int, "効果時間"))
            {
                wordWrapOptions = new WordWrapOptions();
                var profile = wordWrapOptions.WordWrapOptionsProfiles[0];
                profile.MaxLinesPerMessage   = 3;
                profile.MaxCharactersPerLine = 57;

                profile = wordWrapOptions.WordWrapOptionsProfiles[1];
                profile.MaxLinesPerMessage   = 3;
                profile.MaxCharactersPerLine = 57;
                profile.SetTriggerCodes(ainFile, "CALLFUNC A");

                profile = wordWrapOptions.WordWrapOptionsProfiles[2];
                profile.MaxLinesPerMessage   = 3;
                profile.MaxCharactersPerLine = 41;
                profile.SetTriggerCodes(ainFile, "CALLFUNC 顔表示");
            }
            return;
        }
        public void SaveToRegistry(AinFile ainFile)
        {
            string baseName = Path.GetFileNameWithoutExtension(ainFile.OriginalFilename);
            string pathName = "AnnotationSettings\\" + baseName;

            SaveToRegistry(pathName);
        }
 public TextImportExportOld2(AinFile ainFile)
 {
     this.ainFile            = ainFile;
     this.stringExportImport = new StringExportImport(ainFile);
     this.stringExportImport.GetExclusionList();
     //this.replacer = new Replacer(ainFile);
 }
 public WordWrapForm2(WordWrapOptions wordWrapOptions, AinFile ainFile)
 {
     this.wordWrapOptionsAttached = wordWrapOptions ?? new WordWrapOptions();
     this.wordWrapOptions         = this.wordWrapOptionsAttached.Clone();
     this.ainFile = ainFile;
     InitializeComponent();
 }
Esempio n. 5
0
        public MetadataFile Clone(AinFile ainFile)
        {
            var clone = new MetadataFile(ainFile);

            foreach (var pair in this.EnumerationTypes)
            {
                clone.EnumerationTypes.Add(pair.Key, pair.Value.Clone());
            }

            foreach (var pair in this.Metadata)
            {
                var variable = pair.Key.Canonicalize(ainFile);
                if (variable != null)
                {
                    var metaData = pair.Value.Clone();
                    if (metaData.FuncTypeIndex != -1)
                    {
                        var funcType = this.ainFile.GetFuncType(metaData.FuncTypeIndex);
                        if (funcType != null)
                        {
                            var otherFuncType    = ainFile.GetFuncType(funcType.Name);
                            int newFuncTypeIndex = otherFuncType.Index;
                            metaData.FuncTypeIndex = newFuncTypeIndex;
                        }
                    }
                    clone.Metadata.Add(variable, metaData);
                }
            }
            return(clone);
        }
        public AnnotateWithNamesForm(AinFile ainFile)
            : this()
        {
            LoadEnumerationTypes(ainFile);

            this.mySettings = AnnotationSettings.GetAnnotationSettings(ainFile);
            ReadSettings();
        }
 public EnumerationType GetEnumerationType(AinFile ainFile)
 {
     if (String.IsNullOrEmpty(this.EnumerationTypeName))
     {
         return(null);
     }
     return(ainFile.MetadataFile.EnumerationTypes.GetOrNull(this.EnumerationTypeName));
 }
        private void LoadEnumerationTypes(AinFile ainFile)
        {
            var enumerationTypeNames = ainFile.MetadataFile.EnumerationTypes.Keys.ToArray();

            foreach (var typeName in enumerationTypeNames)
            {
                this.enumComboBox.Items.Add(typeName);
            }
        }
        public static WordWrapOptions DetectGame(AinFile ainFile)
        {
            WordWrapOptions wordWrapOptions = null;

            //Detect games
            TryDaibanchou(ainFile, ref wordWrapOptions);
            TrySengokuRance(ainFile, ref wordWrapOptions);
            TryDalkGaiden(ainFile, ref wordWrapOptions);
            TryRance6(ainFile, ref wordWrapOptions);
            TryDungeonsAndDolls(ainFile, ref wordWrapOptions);
            TryGalzooIsland(ainFile, ref wordWrapOptions);
            TryTsumaShibori(ainFile, ref wordWrapOptions);
            TryHoken(ainFile, ref wordWrapOptions);
            //TryDaiteikoku(ainFile, ref wordWrapOptions);
            TryHaruurare(ainFile, ref wordWrapOptions);
            //TryRance02(ainFile, ref wordWrapOptions);
            //TryRanceQuest(ainFile, ref wordWrapOptions);
            //TryOyakoRankan(ainFile, ref wordWrapOptions);
            //TryDrapeko(ainFile, ref wordWrapOptions);
            //TryRance01(ainFile, ref wordWrapOptions);
            //TryRance9(ainFile, ref wordWrapOptions);

            //if (wordWrapOptions != null)
            //{
            //    //generate default code for next line and next message commands
            //    wordWrapOptions.NextLineFunctionCode = GetGeneratedCode(wordWrapOptions.NextLineFunctionName, ainFile);
            //    wordWrapOptions.NextMessageFunctionCode = GetGeneratedCode(wordWrapOptions.NextMessageFunctionName, ainFile);
            //}


            ////Face portrait detection for a few games

            ////hoken
            //MatchFunction(ainFile, wordWrapOptions, 57, 41, "顔表示", DataType.Int);

            ////tsumashibori
            //MatchFunction(ainFile, wordWrapOptions, 57, 42, "顔", DataType.Int, DataType.Int);

            ////rancequest
            //if (MatchFunction(ainFile, wordWrapOptions, 57, 42, "セリフ2", DataType.Int, DataType.String) &&
            //    MatchFunction(ainFile, wordWrapOptions, 57, 42, "セリフ", DataType.Int, DataType.String) &&
            //    MatchFunction(ainFile, wordWrapOptions, 57, 42, "ト書き") &&
            //    MatchFunction(ainFile, wordWrapOptions, 57, 42, "思考", DataType.Int, DataType.String))
            //{
            //    wordWrapOptions.ReduceMarginFunctionName = new string[] { "セリフ", "セリフ2", "ト書き", "思考" }.Join(Environment.NewLine);
            //    wordWrapOptions.UseVariableWidthFont = true;
            //}

            ////oyakoranken
            //if (MatchFunction(ainFile, wordWrapOptions, -1, -1, "◎台詞", DataType.String, DataType.String))
            //{
            //    wordWrapOptions.UseVariableWidthFont = true;
            //}

            return(wordWrapOptions);
        }
 public Replacer(AinFile ainFile, string outputFileName, WordWrapOptionsOld wordWrapOptions)
 {
     this.ainFile         = ainFile;
     this.originalAinFile = ainFile;
     this.outputFileName  = outputFileName;
     this.wordWrapOptions = wordWrapOptions;
     if (this.wordWrapOptions != null)
     {
         this.WordWrap    = true;
         this.wordWrapper = new WordWrapperOld(ainFile, wordWrapOptions);
     }
 }
        public Variable[] GetVariables(AinFile ainFile)
        {
            List <Variable> list = new List <Variable>();

            foreach (var variableName in VariableNames)
            {
                int dotPosition = variableName.IndexOf('.');
                if (dotPosition == -1)
                {
                    dotPosition = variableName.Length;
                }
                if (dotPosition > 0)
                {
                    string functionName  = variableName.Substring(0, dotPosition);
                    string parameterName = "";
                    if (dotPosition + 1 <= variableName.Length)
                    {
                        parameterName = variableName.Substring(dotPosition + 1);
                    }

                    var function = ainFile.GetFunction(functionName);
                    if (function != null)
                    {
                        Variable variable = null;
                        for (int i = 0; i < function.ParameterCount; i++)
                        {
                            if (function.Parameters[i].Name == parameterName)
                            {
                                variable = function.Parameters[i];
                                break;
                            }
                        }
                        if (variable == null)
                        {
                            int variableIndex = 0;
                            if (!int.TryParse(parameterName, out variableIndex))
                            {
                                variableIndex = 0;
                            }
                            variable = function.GetNonVoidFunctionParameter(variableIndex) as Variable;
                        }

                        if (variable != null)
                        {
                            list.Add((Variable)variable);
                        }
                    }
                }
            }
            return(list.ToArray());
        }
 public CodeSearchCache(AinFile ainFile)
 {
     this.ainFile             = ainFile;
     this.codeSearcher        = new CodeSearcher(ainFile);
     this.FunctionsCache      = new Cache <Function>(ainFile, this.GetCalls2);
     this.GlobalsCache        = new AllMatchesCache <Global>(ainFile, this.AddGlobals);
     this.IntsCache           = new AllMatchesCache <int>(ainFile, this.AddInts);
     this.StringsCache        = new AllMatchesCache <string>(ainFile, this.AddStrings);
     this.MessagesCache       = new AllMatchesCache <string>(ainFile, this.AddMessages);
     this.LibraryCallsCache   = new AllMatchesCache <HllFunction>(ainFile, this.AddLibraryCalls);
     this.SystemCallsCache    = new AllMatchesCache <Function>(ainFile, this.AddSystemCalls);
     this.BuiltInMethodsCache = new BuiltInFunctionsCache(ainFile, this.AddInstructions);
     this.StructCache         = new Cache2(ainFile);
 }
        public static AnnotationSettings GetAnnotationSettings(AinFile ainFile)
        {
            var    annotationSettings = new AnnotationSettings();
            string baseName           = Path.GetFileNameWithoutExtension(ainFile.OriginalFilename);
            string pathName           = "AnnotationSettings\\" + baseName;

            if (RegistryUtility.PathExists(pathName))
            {
                RegistryUtility.GetObject(pathName, annotationSettings);
            }
            else
            {
            }
            return(annotationSettings);
        }