예제 #1
0
        public NESettings(int group, NetworkSettings Options, GroupOfNE NetworkElements, ref Notes note)
        {
            InitializeComponent();
            StartPosition = FormStartPosition.CenterScreen;
            var g = MainForm.groups.GroupsOfNE[group];

            if (!g.isHostName)
            {
                button1.Enabled  = false;
                textBox2.Enabled = false;
            }
            if (!g.isIP)
            {
                button1.Enabled   = false;
                comboBox1.Enabled = false;
            }
            if (!g.isTrouthp)
            {
                numericUpDown1.Enabled = false;
            }
            if (!g.isPorts)
            {
                numericUpDown2.Enabled = false;
            }
            for (int i = 0; i < g.Parametres.Count; i++)
            {
                listBox2.Items.Add(g.Parametres[i]);
                listBox1.Items.Add("");
            }
            this.Options         = Options;
            this.NetworkElements = NetworkElements;
            this.notes           = note;
            PharseOptions();
        }
예제 #2
0
        //int i = 0;

        public ImageTextures(ref GroupOfNE NetworkElements)
        {
            StartPosition = FormStartPosition.CenterParent;
            InitializeComponent();
            this.NetworkElements = NetworkElements;
            foreach (var g in MainForm.groups.GroupsOfNE)
            {
                ListViewGroup listViewGroup = new ListViewGroup(g.name);
                listView1.Groups.Add(listViewGroup);
            }
            GetImages();
        }
예제 #3
0
 public ParametresForm(ref Groups groups, ref GroupOfNE NE)
 {
     StartPosition = FormStartPosition.CenterParent;
     InitializeComponent();
     this.groups = groups;
     this.NE     = NE;
     for (int i = 0; i < MainForm.parametrs.Parametres.Count; i++)
     {
         listBox2.Items.Add(MainForm.parametrs.Parametres[i]);
     }
     foreach (var g in groups.GroupsOfNE)
     {
         listBox1.Items.Add(g.name);
     }
 }
예제 #4
0
 public void Edit(int id, string oldname, string newname, ref Groups groups, ref GroupOfNE NE, bool toLog)
 {
     if (!Parametres.Contains(newname))
     {
         for (int i = 0; i < groups.GroupsOfNE.Count; i++)
         {
             for (int j = 0; j < groups.GroupsOfNE[i].Parametres.Count; j++)
             {
                 if (groups.GroupsOfNE[i].Parametres[j] == oldname)
                 {
                     groups.GroupsOfNE[i].Parametres[j] = newname;
                 }
             }
         }
         for (int i = 0; i < NE.NetworkElements.Count; i++)
         {
             if (!NE.NetworkElements[i].delete)
             {
                 for (int j = 0; j < NE.NetworkElements[i].Options.Options.Count; j++)
                 {
                     if (NE.NetworkElements[i].Options.Options[j].Name == oldname)
                     {
                         NE.NetworkElements[i].Options.Options[j].Name = newname;
                     }
                 }
             }
         }
         if (toLog)
         {
             Element elem  = new Element(13, id, oldname, -2);
             Element _elem = new Element(13, id, newname, -2);
             MainForm.MyMap.log.Add(new LogMessage("Изменил параметр с '" + oldname + "' на '" + newname + "'", elem, _elem));
         }
         Parametres[id] = newname;
     }
     else
     {
         MessageBox.Show("Такой параметр уже добавлен");
     }
 }
예제 #5
0
        /// <summary>
        /// Загрузка параметров при импорте здания
        /// </summary>
        /// <param name="NE">Группа сетевых элементов</param>
        internal static void _OpenFromBuild(ref GroupOfNE NE)
        {
            XmlSerializer formatter = new XmlSerializer(typeof(GroupOfParametres));

            using (FileStream fs = new FileStream(Application.StartupPath + @"\###tempdirectory._temp###\NetworkSettings", FileMode.Open))
            {
                GroupOfParametres _parametrs = (GroupOfParametres)formatter.Deserialize(fs);
                for (int i = 0; i < NE.NetworkElements.Count; i++)
                {
                    //MainForm.groups.GroupsOfNE.Contains(NE.NetworkElements[i].groupname)

                    /*
                     * for (int opt = 0; opt < NE.NetworkElements[i].Options.Options.Count; opt++)
                     * {
                     *  bool isLoadParam = false;
                     *  for (int j = 0; j < MainForm.parametrs.Parametres.Count; j++)
                     *  {
                     *      if (NE.NetworkElements[i].Options.Options[opt].Name == MainForm.parametrs.Parametres[j])
                     *      {
                     *          //NE.NetworkElements[i].Options.Options[opt].ID = j;
                     *          isLoadParam = true;
                     *          break;
                     *      }
                     *  }
                     *  if (!isLoadParam)
                     *  {
                     *      MainForm.parametrs.Add(NE.NetworkElements[i].Options.Options[opt].Name);
                     *      //NE.NetworkElements[i].Options.Options[opt].ID = MainForm.parametrs.Params.Count - 1;
                     *      int lastindex = MainForm.parametrs.Parametres.Count - 1;
                     *      Element elem = new Element(13, lastindex, "", -1);
                     *      Element _elem = new Element(13, lastindex, MainForm.parametrs.Parametres[lastindex], -1);
                     *      MainForm.MyMap.log.Add(new LogMessage("Добавил параметр", elem, _elem));
                     *  }*/
                    // }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Загрузка параметров при импорте здания
        /// </summary>
        /// <param name="NE">Группа сетевых элементов</param>
        internal static void _OpenFromBuild(ref GroupOfNE NE)
        {
            XmlSerializer formatter = new XmlSerializer(typeof(Groups));

            using (FileStream fs = new FileStream(Application.StartupPath + @"\###tempdirectory._temp###\Groups", FileMode.Open))
            {
                Groups groups = (Groups)formatter.Deserialize(fs);
                for (int i = 0; i < NE.NetworkElements.Count; i++)
                {
                    int id = -1;
                    for (int j = 0; j < MainForm.groups.GroupsOfNE.Count; j++)
                    {
                        if (MainForm.groups.GroupsOfNE[j].name == NE.NetworkElements[i].groupname)
                        {
                            id = j;
                            break;
                        }
                    }
                    if (id != -1)
                    {
                        var group = groups.GroupsOfNE[NE.NetworkElements[i].type];
                        if (group.isHostName)
                        {
                            MainForm.groups.GroupsOfNE[id].isHostName = true;
                        }
                        if (group.isTrouthp)
                        {
                            MainForm.groups.GroupsOfNE[id].isTrouthp = true;
                        }
                        if (group.isIP)
                        {
                            MainForm.groups.GroupsOfNE[id].isIP = true;
                        }
                        if (group.isPorts)
                        {
                            MainForm.groups.GroupsOfNE[id].isPorts = true;
                        }
                        foreach (var p in group.Parametres)
                        {
                            if (!MainForm.groups.GroupsOfNE[id].Parametres.Contains(p))
                            {
                                MainForm.parametrs.Add(p);
                            }
                        }
                        NE.NetworkElements[i].type      = id;
                        NE.NetworkElements[i].groupname = MainForm.groups.GroupsOfNE[id].name;
                    }
                    else
                    {
                        for (int j = 0; j < groups.GroupsOfNE.Count; j++)
                        {
                            if (groups.GroupsOfNE[j].name == NE.NetworkElements[i].groupname)
                            {
                                id = j;
                                break;
                            }
                        }
                        MainForm.groups.Add(groups.GroupsOfNE[id]);
                        NE.NetworkElements[i].groupname = MainForm.groups.GroupsOfNE[MainForm.groups.GroupsOfNE.Count - 1].name;
                        NE.NetworkElements[i].type      = MainForm.groups.GroupsOfNE.Count - 1;
                    }
                }
            }
            for (int i = 0; i < MainForm.ImagesURL.Textures.Count; i++)
            {
                for (int j = 0; j < MainForm.groups.GroupsOfNE.Count; j++)
                {
                    if (MainForm.ImagesURL.Textures[i].namegroup == MainForm.groups.GroupsOfNE[j].name)
                    {
                        MainForm.ImagesURL.Textures[i].Type = j;
                    }
                }
            }
        }
예제 #7
0
파일: GroupOfNE.cs 프로젝트: venegret77/NDD
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="ne">Группа сетевых элементов</param>
 public GroupOfNE(GroupOfNE ne)
 {
     NetworkElements = ne.NetworkElements;
 }