コード例 #1
0
ファイル: MHGameService.cs プロジェクト: Lucasvo1/FHVGame
 public void SaveSetupPositions(List<MHSetupPosition> sps)
 {
     if (sps != null)
     {
         try
         {
             setupPositions = sps;
             FileHelper fWriter = new FileHelper();
             fWriter.WriteAsXml<MHSetupPosition>(sps, Conf.GetSetting<string>("mhSetupFile"));
         }
         catch (Exception e)
         {
             Log.Fatal(e);
         }
     }
 }
コード例 #2
0
ファイル: VMService.cs プロジェクト: Lucasvo1/FHVGame
        private void OnDumpRequested(MsgDump obj)
        {
            FileHelper fWriter = new FileHelper();

            if (obj.Key == "VM")
            {
                Log.DebugFormat("Try to write mapping to {0}", obj);
                List<ValueMapping> list = new List<ValueMapping>();

                foreach (KeyValuePair<int, ValueMapping> entry in VirtualToDMXMapping)
                {
                    list.Add(VirtualToDMXMapping[entry.Key]);
                }
                list.Add(VirtualToImgMapping);
                foreach (KeyValuePair<int, ValueMapping> entry in DMXToVirtualMapping)
                {
                    list.Add(DMXToVirtualMapping[entry.Key]);
                }
                list.Add(ImgToVirtualMapping);
                fWriter.WriteAsXml<ValueMapping>(list, obj.Filename);
            }

            if (obj.Key == "VMSETUP")
            {
                List<KeyValuePair<int, List<DMXImgSetupMappingValue>>> list = new List<KeyValuePair<int, List<DMXImgSetupMappingValue>>>();
                foreach (KeyValuePair<int, List<DMXImgSetupMappingValue>> item in DMXSetupValues)
                {
                    list.Add(item);
                }

                List<KeyValuePair<int, Position>> list2 = new List<KeyValuePair<int, Position>>();
                foreach (KeyValuePair<int, Position> pos in ImgSetupPositions)
                {
                    list2.Add(pos);
                }

                try
                {
                    fWriter.WriteAsXml<KeyValuePair<int, List<DMXImgSetupMappingValue>>>(list, obj.Filename);
                }
                catch (Exception e)
                {
                    Log.Fatal(e);
                }
                try
                {
                    fWriter.WriteAsXml<KeyValuePair<int, Position>>(list2, obj.Filename, true);
                }
                catch (Exception e)
                {
                    Log.Fatal(e);
                }
            }
        }