Beispiel #1
0
        public override void loadInit()
        {
            base.loadInit();
            this.root                 = this.comp.files.root.searchForFolder("MsgBoard");
            this.missionFolder        = this.root.searchForFolder("listings");
            this.closedMissionsFolder = this.root.searchForFolder("closed");
            if (this.closedMissionsFolder == null)
            {
                this.closedMissionsFolder = new Folder("closed");
                this.root.folders.Add(this.closedMissionsFolder);
            }
            int num;

            if (!this.missionAssigner)
            {
                for (int index = 0; index < this.missionFolder.files.Count; ++index)
                {
                    try
                    {
                        string str  = this.missionFolder.files[index].name.Replace("_", " ");
                        string data = this.missionFolder.files[index].data;
                        this.missions.Add(new ActiveMission((List <MisisonGoal>)null, (string)null, new MailServer.EMailData())
                        {
                            postingTitle = str,
                            postingBody  = data
                        });
                    }
                    catch (Exception ex)
                    {
                        num = 0 + 1;
                    }
                }
            }
            else
            {
                List <ActiveMission> branchMissions = this.os.branchMissions;
                for (int index = 0; index < this.missionFolder.files.Count; ++index)
                {
                    try
                    {
                        string data = this.missionFolder.files[index].data;
                        int    contractRegistryNumber = 0;
                        this.os.branchMissions.Clear();
                        ActiveMission        activeMission     = (ActiveMission)MissionSerializer.restoreMissionFromFile(data, out contractRegistryNumber);
                        List <ActiveMission> activeMissionList = new List <ActiveMission>();
                        activeMissionList.AddRange((IEnumerable <ActiveMission>) this.os.branchMissions.ToArray());
                        this.branchMissions.Add(activeMissionList);
                        this.missions.Add(activeMission);
                    }
                    catch (Exception ex)
                    {
                        num = 0 + 1;
                    }
                }
                this.os.branchMissions = branchMissions;
            }
        }
 public override void loadInit()
 {
     base.loadInit();
     root                 = comp.files.root.searchForFolder("MsgBoard");
     missionFolder        = root.searchForFolder("listings");
     closedMissionsFolder = root.searchForFolder("closed");
     if (closedMissionsFolder == null)
     {
         closedMissionsFolder = new Folder("closed");
         root.folders.Add(closedMissionsFolder);
     }
     if (!missionAssigner)
     {
         for (var index = 0; index < missionFolder.files.Count; ++index)
         {
             try
             {
                 var str1 = missionFolder.files[index].name.Replace("_", " ");
                 var str2 = missionFolder.files[index].data;
                 missions.Add(new ActiveMission(null, null, new MailServer.EMailData())
                 {
                     postingTitle = str1,
                     postingBody  = str2
                 });
             }
             catch (Exception ex)
             {
                 var num = 0 + 1;
             }
         }
     }
     else
     {
         var list1 = os.branchMissions;
         for (var index = 0; index < missionFolder.files.Count; ++index)
         {
             try
             {
                 var data = missionFolder.files[index].data;
                 var contractRegistryNumber = 0;
                 os.branchMissions.Clear();
                 var activeMission =
                     (ActiveMission)MissionSerializer.restoreMissionFromFile(data, out contractRegistryNumber);
                 var list2 = new List <ActiveMission>();
                 list2.AddRange(os.branchMissions.ToArray());
                 branchMissions.Add(list2);
                 missions.Add(activeMission);
             }
             catch (Exception ex)
             {
                 var num = 0 + 1;
             }
         }
         os.branchMissions = list1;
     }
 }
        public void addMisison(ActiveMission m)
        {
            var dataEntry = m.postingBody;

            if (missionAssigner)
            {
                dataEntry = MissionSerializer.generateMissionFile(m, 0, groupName);
            }
            missionFolder.files.Add(new FileEntry(dataEntry, m.postingTitle));
            missions.Add(m);
            branchMissions.Add(os.branchMissions);
        }
Beispiel #4
0
 private void loadListingMissionsFromFiles()
 {
     for (int index = 0; index < this.listingsFolder.files.Count; ++index)
     {
         string data = this.listingsFolder.files[index].data;
         string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[index]);
         try
         {
             this.listingMissions.Add(stringForContractFile, (ActiveMission)MissionSerializer.restoreMissionFromFile(data, out this.contractRegistryNumber));
         }
         catch (FormatException ex)
         {
         }
     }
 }
Beispiel #5
0
 private void loadListingMissionsFromFiles()
 {
     for (var index = 0; index < listingsFolder.files.Count; ++index)
     {
         var data = listingsFolder.files[index].data;
         var stringForContractFile = getIDStringForContractFile(listingsFolder.files[index]);
         try
         {
             listingMissions.Add(stringForContractFile,
                                 (ActiveMission)MissionSerializer.restoreMissionFromFile(data, out contractRegistryNumber));
         }
         catch (FormatException ex)
         {
         }
     }
 }
Beispiel #6
0
        private void addMission(ActiveMission mission, bool insertAtTop = false)
        {
            contractRegistryNumber += Utils.getRandomByte() + 1;
            listingMissions.Add(string.Concat(contractRegistryNumber), mission);
            var fileEntry = new FileEntry(
                MissionSerializer.generateMissionFile(mission, contractRegistryNumber, "CSEC"),
                "Contract#" + contractRegistryNumber);

            if (insertAtTop)
            {
                listingsFolder.files.Insert(0, fileEntry);
            }
            else
            {
                listingsFolder.files.Add(fileEntry);
            }
        }
Beispiel #7
0
        private void addMission(ActiveMission mission, bool insertAtTop = false, bool preventRegistryNumberChange = false, int desiredInsertionIndex = -1)
        {
            if (insertAtTop && desiredInsertionIndex <= -1)
            {
                desiredInsertionIndex = 0;
            }
            this.contractRegistryNumber += (int)Utils.getRandomByte() + 1;
            this.listingMissions.Add(string.Concat((object)this.contractRegistryNumber), mission);
            FileEntry fileEntry = new FileEntry(MissionSerializer.generateMissionFile((object)mission, this.contractRegistryNumber, "CSEC", (string)null), "Contract#" + (object)this.contractRegistryNumber);

            if (desiredInsertionIndex < this.listingsFolder.files.Count && (insertAtTop || desiredInsertionIndex >= 0))
            {
                this.listingsFolder.files.Insert(desiredInsertionIndex, fileEntry);
            }
            else
            {
                this.listingsFolder.files.Add(fileEntry);
            }
        }
Beispiel #8
0
        public void addMisison(ActiveMission m, bool injectToTop = false)
        {
            string dataEntry = m.postingBody;

            if (this.missionAssigner)
            {
                dataEntry = MissionSerializer.generateMissionFile((object)m, 0, this.groupName, (string)null);
            }
            FileEntry fileEntry = new FileEntry(dataEntry, m.postingTitle);

            if (injectToTop)
            {
                this.missionFolder.files.Insert(0, fileEntry);
                this.missions.Insert(0, m);
                this.branchMissions.Insert(0, this.os.branchMissions);
            }
            else
            {
                this.missionFolder.files.Add(fileEntry);
                this.missions.Add(m);
                this.branchMissions.Add(this.os.branchMissions);
            }
        }