Пример #1
0
        public Form1()
        {
            InitializeComponent();
            if (checkBoxNewItemPid.Checked)
            {
                ServerPath.Enabled = false;
            }

            ReadFileInArray config = new ReadFileInArray("config.cfg");

            path = config.arrayListOfStrings[0].Replace("ServerPath=", "");
        }
Пример #2
0
        public FilesItemInfo(string localPath, string[] arrayNewPidNumbers, string[] arrayOldPidNumbers, string[] arrayItemNames)
        {
            this.arrayItemNames     = arrayItemNames;
            this.arrayNewPidNumbers = arrayNewPidNumbers;
            this.arrayOldPidNumbers = arrayOldPidNumbers;

            ReadFileInArray config = new ReadFileInArray("config.cfg");

            path = config.arrayListOfStrings[0].Replace("ServerPath=", "") + localPath;

            file = new ReadFileInArray(path);
        }
Пример #3
0
        private void allDialogsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string[]        arrayItemNames;
            string[]        arrayNewPidNumbers;
            string[]        arrayOldPidNumbers;
            ReadFileInArray new_itempid;

            new_itempid = new ReadFileInArray(NewItemPidPath.Text);
            ReadFileInArray oldItemsName;

            oldItemsName = new ReadFileInArray("old_itempid.fos");
            List <string> NewListOfStrings = getListOfStrings(new_itempid.arrayListOfStrings);
            List <string> OldListOfStrings = getListOfStrings(oldItemsName.arrayListOfStrings);

            arrayItemNames     = new string[NewListOfStrings.Count];
            arrayNewPidNumbers = new string[NewListOfStrings.Count];
            arrayOldPidNumbers = new string[NewListOfStrings.Count];

            int i = 0;

            foreach (string str in NewListOfStrings)
            {
                string buf      = str.Replace("#define", "").Replace(" ", "").Replace("\t", "");
                int    startNum = 0;
                int    finNum   = 0;
                for (int j = 0, jMax = buf.Length; j < jMax; j++)
                {
                    if (buf[j] == ')')
                    {
                        finNum = j;
                        break;
                    }
                    if (buf[j] == '(')
                    {
                        startNum = j;
                    }
                }

                arrayItemNames[i]     += buf.Substring(0, startNum);
                arrayNewPidNumbers[i] += buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0 ? ((finNum - startNum) - 1) : 1);

                arrayOldPidNumbers[i] = "-1";
                foreach (string oldStr in OldListOfStrings)
                {
                    buf = oldStr.Replace("#define", "").Replace(" ", "").Replace("\t", "");
                    if (!buf.Contains(arrayItemNames[i]))
                    {
                        continue;
                    }

                    string subbuf = "";
                    foreach (char ch in buf)
                    {
                        if (ch == '(')
                        {
                            break;
                        }

                        subbuf += ch;
                    }

                    if (subbuf != arrayItemNames[i])
                    {
                        continue;
                    }

                    startNum = 0;
                    finNum   = 0;
                    for (int j = 0, jMax = buf.Length; j < jMax; j++)
                    {
                        if (buf[j] == ')')
                        {
                            finNum = j;
                            break;
                        }
                        if (buf[j] == '(')
                        {
                            startNum = j;
                        }
                    }
                    arrayOldPidNumbers[i] = buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0 ? ((finNum - startNum) - 1) : 1);
                }
                i++;
            }

            string[] fileNames = Directory.GetFiles(path + "dialogs");

            for (int k = 0; k < fileNames.Length; k++)
            {
                fileNames[k] = fileNames[k].Replace(path + "dialogs\\", "");
                if (!fileNames[k].Contains(".fodlg"))
                {
                    continue;
                }
                DialogFiles dialog = new DialogFiles(fileNames[k], arrayNewPidNumbers, arrayOldPidNumbers, arrayItemNames);
                dialog.setNewPid();
                dialog.writeFile();
            }
        }
Пример #4
0
        public FilesItemInfo(string localPath, string new_itempidPath)
        {
            ReadFileInArray config = new ReadFileInArray("config.cfg");

            path = config.arrayListOfStrings[0].Replace("ServerPath=", "") + localPath;

            file        = new ReadFileInArray(path);
            new_itempid = new ReadFileInArray(new_itempidPath);
            ReadFileInArray oldItemsName;

            oldItemsName = new ReadFileInArray("old_itempid.fos");

            List <string> NewListOfStrings = getListOfStrings(new_itempid.arrayListOfStrings);
            List <string> OldListOfStrings = getListOfStrings(oldItemsName.arrayListOfStrings);

            arrayItemNames     = new string[NewListOfStrings.Count];
            arrayNewPidNumbers = new string[NewListOfStrings.Count];
            arrayOldPidNumbers = new string[NewListOfStrings.Count];

            int i = 0;

            foreach (string str in NewListOfStrings)
            {
                string buf      = str.Replace("#define", "").Replace(" ", "").Replace("\t", "");
                int    startNum = 0;
                int    finNum   = 0;
                for (int j = 0, jMax = buf.Length; j < jMax; j++)
                {
                    if (buf[j] == ')')
                    {
                        finNum = j;
                        break;
                    }
                    if (buf[j] == '(')
                    {
                        startNum = j;
                    }
                }

                arrayItemNames[i]     += buf.Substring(0, startNum);
                arrayNewPidNumbers[i] += buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0?((finNum - startNum) - 1):1);

                arrayOldPidNumbers[i] = "-1";
                foreach (string oldStr in OldListOfStrings)
                {
                    buf = oldStr.Replace("#define", "").Replace(" ", "").Replace("\t", "");
                    if (!buf.Contains(arrayItemNames[i]))
                    {
                        continue;
                    }

                    string subbuf = "";
                    foreach (char ch in buf)
                    {
                        if (ch == '(')
                        {
                            break;
                        }

                        subbuf += ch;
                    }

                    if (subbuf != arrayItemNames[i])
                    {
                        continue;
                    }

                    startNum = 0;
                    finNum   = 0;
                    for (int j = 0, jMax = buf.Length; j < jMax; j++)
                    {
                        if (buf[j] == ')')
                        {
                            finNum = j;
                            break;
                        }
                        if (buf[j] == '(')
                        {
                            startNum = j;
                        }
                    }
                    arrayOldPidNumbers[i] = buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0 ? ((finNum - startNum) - 1) : 1);
                }
                i++;
            }
        }