private static void SavePath(string ainFileName, DialogTopic topic, string path) { if (String.IsNullOrEmpty(ainFileName)) { ainFileName = "Default"; } string regPath = "Directories\\" + ainFileName; string regKey = topic.ToString(); RegistryUtility.SaveSetting(regKey, regPath, path); }
private static string GetPath(string ainFileName, DialogTopic topic) { string path = ""; if (!TryGetPath(ainFileName, topic, ref path)) { switch (topic) { case DialogTopic.LoadAinFile: case DialogTopic.AssembleCodeSaveAin: case DialogTopic.QuickCompileCodeSaveAin: case DialogTopic.ImportTextSaveAin: TryGetPath(ainFileName, DialogTopic.LoadAinFile, ref path); TryGetPath(ainFileName, DialogTopic.AssembleCodeSaveAin, ref path); TryGetPath(ainFileName, DialogTopic.ImportTextSaveAin, ref path); TryGetPath(ainFileName, DialogTopic.QuickCompileCodeSaveAin, ref path); break; case DialogTopic.DecompileCode: case DialogTopic.CompileCode: TryGetPath(ainFileName, DialogTopic.CompileCode, ref path); TryGetPath(ainFileName, DialogTopic.DecompileCode, ref path); break; case DialogTopic.DisassembleCode: case DialogTopic.AssembleCode: TryGetPath(ainFileName, DialogTopic.AssembleCode, ref path); TryGetPath(ainFileName, DialogTopic.DisassembleCode, ref path); break; case DialogTopic.ExportText: case DialogTopic.ImportText: TryGetPath(ainFileName, DialogTopic.ExportText, ref path); TryGetPath(ainFileName, DialogTopic.ImportText, ref path); break; case DialogTopic.QuickCompileCode: break; case DialogTopic.SaveDocument: case DialogTopic.OpenDocument: TryGetPath(ainFileName, DialogTopic.OpenDocument, ref path); TryGetPath(ainFileName, DialogTopic.SaveDocument, ref path); break; } } //if (!String.IsNullOrEmpty(ainFileName) && String.IsNullOrEmpty(path)) //{ // return GetPath("", topic); //} return(path); }
private static bool TryGetPath(string ainFileName, DialogTopic topic, ref string path) { if (String.IsNullOrEmpty(path)) { if (String.IsNullOrEmpty(ainFileName)) { ainFileName = "Default"; } string regPath = "Directories\\" + ainFileName; string regKey = topic.ToString(); path = RegistryUtility.GetSetting(regKey, regPath, "") ?? ""; if (String.IsNullOrEmpty(path)) { return(false); } return(true); } return(false); }
partial void PostDuplicate(DialogTopic obj, DialogTopic rhs, Func <FormKey> getNextFormKey, IList <(IMajorRecordCommon Record, FormKey OriginalFormKey)>?duplicatedRecords)
public static Record CreateRecord(string Tag) { Record outRecord; switch (Tag) { case "TES4": outRecord = new Header(); break; case "GMST": outRecord = new GameSetting(); break; case "TXST": outRecord = new TextureSet(); break; case "MICN": outRecord = new MenuIcon(); break; case "GLOB": outRecord = new GlobalVariable(); break; case "CLAS": outRecord = new Class(); break; case "FACT": outRecord = new Faction(); break; case "HDPT": outRecord = new HeadPart(); break; case "HAIR": outRecord = new Hair(); break; case "EYES": outRecord = new Eyes(); break; case "RACE": outRecord = new Race(); break; case "SOUN": outRecord = new Sound(); break; case "ASPC": outRecord = new AcousticSpace(); break; case "MGEF": outRecord = new MagicEffect(); break; case "SCPT": outRecord = new Script(); break; case "LTEX": outRecord = new LandscapeTexture(); break; case "ENCH": outRecord = new ObjectEffect(); break; case "SPEL": outRecord = new ActorEffect(); break; case "ACTI": outRecord = new ESPSharp.Records.Activator(); break; case "TACT": outRecord = new TalkingActivator(); break; case "TERM": outRecord = new Terminal(); break; case "ARMO": outRecord = new Armor(); break; case "BOOK": outRecord = new Book(); break; case "CONT": outRecord = new Container(); break; case "DOOR": outRecord = new Door(); break; case "INGR": outRecord = new Ingredient(); break; case "LIGH": outRecord = new Light(); break; case "MISC": outRecord = new MiscItem(); break; case "STAT": outRecord = new Static(); break; case "SCOL": outRecord = new StaticCollection(); break; case "MSTT": outRecord = new MoveableStatic(); break; case "PWAT": outRecord = new PlaceableWater(); break; case "GRAS": outRecord = new Grass(); break; case "TREE": outRecord = new Tree(); break; case "FURN": outRecord = new Furniture(); break; case "WEAP": outRecord = new Weapon(); break; case "AMMO": outRecord = new Ammunition(); break; case "NPC_": outRecord = new NonPlayerCharacter(); break; case "CREA": outRecord = new Creature(); break; case "LVLC": outRecord = new LeveledCreature(); break; case "LVLN": outRecord = new LeveledNPC(); break; case "KEYM": outRecord = new Key(); break; case "ALCH": outRecord = new Ingestible(); break; case "IDLM": outRecord = new IdleMarker(); break; case "NOTE": outRecord = new Note(); break; case "COBJ": outRecord = new ConstructibleObject(); break; case "PROJ": outRecord = new Projectile(); break; case "LVLI": outRecord = new LeveledItem(); break; case "WTHR": outRecord = new Weather(); break; case "CLMT": outRecord = new Climate(); break; case "REGN": outRecord = new Region(); break; case "NAVI": outRecord = new NavigationMeshInfoMap(); break; case "DIAL": outRecord = new DialogTopic(); break; case "QUST": outRecord = new Quest(); break; case "IDLE": outRecord = new IdleAnimation(); break; case "PACK": outRecord = new Package(); break; case "CSTY": outRecord = new CombatStyle(); break; case "LSCR": outRecord = new LoadScreen(); break; case "ANIO": outRecord = new AnimatedObject(); break; case "WATR": outRecord = new Water(); break; case "EFSH": outRecord = new EffectShader(); break; case "EXPL": outRecord = new Explosion(); break; case "DEBR": outRecord = new Debris(); break; case "IMGS": outRecord = new ImageSpace(); break; case "IMAD": outRecord = new ImageSpaceAdapter(); break; case "FLST": outRecord = new FormList(); break; case "PERK": outRecord = new Perk(); break; case "BPTD": outRecord = new BodyPartData(); break; case "ADDN": outRecord = new AddonNode(); break; case "AVIF": outRecord = new ActorValueInformation(); break; case "RADS": outRecord = new RadiationStage(); break; case "CAMS": outRecord = new CameraShot(); break; case "CPTH": outRecord = new CameraPath(); break; case "VTYP": outRecord = new VoiceType(); break; case "IPCT": outRecord = new Impact(); break; case "IPDS": outRecord = new ImpactDataSet(); break; case "ARMA": outRecord = new ArmorAddon(); break; case "ECZN": outRecord = new EncounterZone(); break; case "MESG": outRecord = new Message(); break; case "RGDL": outRecord = new Ragdoll(); break; case "DOBJ": outRecord = new DefaultObjectManager(); break; case "LGTM": outRecord = new LightingTemplate(); break; case "MUSC": outRecord = new MusicType(); break; case "IMOD": outRecord = new ItemMod(); break; case "REPU": outRecord = new Reputation(); break; case "RCPE": outRecord = new Recipe(); break; case "RCCT": outRecord = new RecipeCategory(); break; case "CHIP": outRecord = new CasinoChip(); break; case "CSNO": outRecord = new Casino(); break; case "LSCT": outRecord = new LoadScreenType(); break; case "MSET": outRecord = new MediaSet(); break; case "ALOC": outRecord = new MediaLocationController(); break; case "CHAL": outRecord = new Challenge(); break; case "AMEF": outRecord = new AmmoEffect(); break; case "CCRD": outRecord = new CaravanCard(); break; case "CMNY": outRecord = new CaravanMoney(); break; case "CDCK": outRecord = new CaravanDeck(); break; case "DEHY": outRecord = new DehydrationStage(); break; case "HUNG": outRecord = new HungerStage(); break; case "SLPD": outRecord = new SleepDeprivationStage(); break; case "CELL": outRecord = new Cell(); break; case "WRLD": outRecord = new Worldspace(); break; case "LAND": outRecord = new GenericRecord(); break; case "NAVM": outRecord = new NavigationMesh(); break; case "INFO": outRecord = new DialogResponse(); break; case "REFR": outRecord = new Reference(); break; case "ACHR": outRecord = new PlacedNPC(); break; case "ACRE": outRecord = new PlacedCreature(); break; case "PGRE": outRecord = new PlacedGrenade(); break; case "PMIS": outRecord = new PlacedMissile(); break; default: Console.WriteLine("Encountered unknown record: " + Tag); outRecord = new GenericRecord(); break; } outRecord.Tag = Tag; return(outRecord); }
public static DialogResult ShowDialogWithTopic(this FileDialog fileDialog, DialogTopic topic) { string loadedAinFileName = ""; if (Expression.defaultAinFile != null) { loadedAinFileName = Expression.defaultAinFile.OriginalFilename ?? ""; } string ainFileName = Path.GetFileNameWithoutExtension(loadedAinFileName).ToLowerInvariant(); string path = GetPath(ainFileName, topic); if (String.IsNullOrEmpty(path) && !String.IsNullOrEmpty(loadedAinFileName)) { path = Path.GetDirectoryName(loadedAinFileName); } if (!String.IsNullOrEmpty(path) && Directory.Exists(path)) { fileDialog.InitialDirectory = path; } DialogResult dialogResult = DialogResult.None; if (String.IsNullOrEmpty(fileDialog.FileName)) { switch (topic) { case DialogTopic.AssembleCode: case DialogTopic.CompileCode: case DialogTopic.ImportText: case DialogTopic.LoadAinFile: if (!string.IsNullOrEmpty(fileDialog.DefaultExt)) { if (Directory.Exists(path)) { string[] matchingFiles = Directory.GetFiles(path, "*." + fileDialog.DefaultExt, SearchOption.TopDirectoryOnly); if (matchingFiles.Length == 1) { fileDialog.FileName = Path.GetFileName(matchingFiles[0]); } } } break; } } if (fileDialog is SaveFileDialog) { dialogResult = ((SaveFileDialog)fileDialog).ShowDialogEx(); } else { dialogResult = fileDialog.ShowDialog(); } if (dialogResult == DialogResult.OK) { path = Path.GetDirectoryName(fileDialog.FileName); if (topic != DialogTopic.LoadAinFile) { SavePath(ainFileName, topic, path); } SavePath("", topic, path); } return(dialogResult); }