Пример #1
0
        //Rename the files
        public void RenameItVoid(string contains, string renameTo, int count)
        {
            for (int i = 0; i < loadedFiles.Length; i++)
            {
                string result;
                string nameWithoutExtension = Path.GetFileNameWithoutExtension(loadedFiles[i].FullName);
                string getExtension         = Path.GetExtension(loadedFiles[i].FullName);
                string path = loadedFiles[i].DirectoryName;


                if (nameWithoutExtension.Length > count)
                {
                    this.ToCheck = nameWithoutExtension.Substring(nameWithoutExtension.Length - count);
                    this.First   = nameWithoutExtension.Substring(0, (nameWithoutExtension.Length - 1) - (ToCheck.Length - 1));
                    nameWithoutExtension.Substring(0, nameWithoutExtension.Length - 1);


                    result = ToCheck.Replace(contains, renameTo);

                    this.FinaleName = this.First + result + getExtension;

                    string fullNewName = path + "\\" + FinaleName;

                    if (fullNewName != loadedFiles[i].FullName)
                    {
                        Renamed = true;
                        renamedFiles++;
                        renamedCounter++;
                        File.Move(loadedFiles[i].FullName, fullNewName);
                    }
                }
            }
        }
Пример #2
0
    public void RefreshBlocs(int posX, int posZ)
    {
        GameObject ToCheck;

        if ((ToCheck = GetBlockAt(posX + 1, posZ)) != null)
        {
            ToCheck.GetComponent <Building>().SetModel();
        }
        if ((ToCheck = GetBlockAt(posX, posZ + 1)) != null)
        {
            ToCheck.GetComponent <Building>().SetModel();
        }
        if ((ToCheck = GetBlockAt(posX - 1, posZ)) != null)
        {
            ToCheck.GetComponent <Building>().SetModel();
        }
        if ((ToCheck = GetBlockAt(posX, posZ - 1)) != null)
        {
            ToCheck.GetComponent <Building>().SetModel();
        }
    }