Exemplo n.º 1
0
        public void Destroy()
        {
            vertices.Clear();
            uvs.Clear();
            triangles.Clear();
            GameObject.Destroy(meshFilter.mesh);
            GameObject.Destroy(meshCollider.sharedMesh);
            GameObject.Destroy(mesh);
            GameObject.Destroy(meshCollider);
            GameObject.Destroy(meshFilter);

            GameObject.Destroy(meshObject);

            Patches.Remove(this);
        }
Exemplo n.º 2
0
        public void ReadPatchVersions()
        {
            PatchServerProcess.Patches.Clear();

            // Add version 0.0 - signifies new install
            PatchServerProcess.Patches.Add(0.0, null);

            StreamReader r = null;

            try
            {
                string directory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                string tfile     = Path.Combine(directory, "Patches", "Versions.txt");
                if (!File.Exists(tfile))
                {
                    Log1.Logger("Patcher").Fatal("Could not locate patch version file [" + tfile + "]. Patch server will not be able to distribute patches.");
                    return;
                }
                r = new StreamReader(tfile);
                while (r.Peek() > -1)
                {
                    string line = r.ReadLine().Trim();
                    if (line.StartsWith("--"))
                    {
                        continue;
                    }

                    if (line.Length < 1)
                    {
                        continue;
                    }

                    string[] parts = line.Split(char.Parse(" "));
                    if (parts.Length == 2)
                    {
                        double version    = double.Parse(parts[0]);
                        string file       = parts[1];
                        string tdirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                        file = Path.Combine(tdirectory, "Patches", file);
                        if (!File.Exists(file))
                        {
                            Log1.Logger("Patcher").Error("Versions.txt claims that there is a patch file " + file + ", which was not found in the Patches directory.");
                            continue;
                        }

                        // Read the version and found the file. seems like a good patch.
                        Patches.Remove(version);
                        Patches.Add(version, new FileInfo(file));
                        Log1.Logger("Patcher").Info(string.Format("Read patch version {0}.", version));
                    }
                }

                Log1.Logger("Patcher").Info(string.Format("Read {0} total patches.", Patches.Count));
            }
            catch
            {
            }
            finally
            {
                if (r != null)
                {
                    r.Close();
                    r.Dispose();
                }
            }
        }