コード例 #1
0
ファイル: UtilityTranslation.cs プロジェクト: halgari/Mutagen
        public static MasterReferenceReader ConstructWriteMasters(IModGetter mod, BinaryWriteParameters param)
        {
            MasterReferenceReader ret     = new MasterReferenceReader(mod.ModKey);
            HashSet <ModKey>      modKeys = new HashSet <ModKey>();

            switch (param.MastersListSync)
            {
            case BinaryWriteParameters.MastersListSyncOption.NoCheck:
                modKeys.Add(mod.MasterReferences.Select(m => m.Master));
                break;

            case BinaryWriteParameters.MastersListSyncOption.Iterate:
                modKeys.Add(
                    // All FormKeys of links
                    mod.LinkFormKeys.Select(f => f.ModKey)
                    // All FormKeys of records themselves
                    .And(mod.EnumerateMajorRecords().Select(m => m.FormKey.ModKey)));
                break;

            default:
                throw new NotImplementedException();
            }
            modKeys.Remove(mod.ModKey);
            modKeys.Remove(ModKey.Null);
            ret.SetTo(modKeys.Select(m => new MasterReference()
            {
                Master = m
            }));
            return(ret);
        }
コード例 #2
0
 public static void WriteToFile(string path, IModGetter mod)
 {
     WriteToFile(
         path,
         mod.NextFormID,
         mod.EnumerateMajorRecords()
         .SelectWhere(m =>
     {
         var edid = m.EditorID;
         if (edid == null)
         {
             return(TryGet <KeyValuePair <string, FormKey> > .Failure);
         }
         return(TryGet <KeyValuePair <string, FormKey> > .Succeed(
                    new KeyValuePair <string, FormKey>(edid, m.FormKey)));
     }));
 }
コード例 #3
0
 private void RunProcessors(IModGetter mod)
 {
     // Do any major record iteration work
     if (_recordIterationActions.Count > 0 ||
         _formLinkIterationActions.Count > 0)
     {
         foreach (var maj in mod.EnumerateMajorRecords())
         {
             foreach (var majAction in _recordIterationActions)
             {
                 majAction(maj);
             }
             foreach (var formKey in maj.ContainedFormLinks)
             {
                 foreach (var formLinkAction in _formLinkIterationActions)
                 {
                     formLinkAction(maj.FormKey, formKey);
                 }
             }
         }
     }
 }