Пример #1
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;

            versionString = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);

            // Add commit hash and date information if available
            // The commit hash and date are stored in a file bin/.version
            // This file can automatically created by a post
            // commit script in the opensim git master repository or
            // by issuing the follwoing command from the top level
            // directory of the opensim repository
            // git log -n 1 --pretty="format:%h-%ci" >bin/.version
            // For the full git commit hash use %H instead of %h
            //
            string gitCommitFileName = ".version";

            if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return(versionString);
        }
Пример #2
0
        public async Task <ResultStatus> CreateFlavour(string name)
        {
            Flavour newFlavour = new Flavour()
            {
                Name = name
            };

            flavoursRepository.Add(newFlavour);
            int code = await flavoursRepository.SaveChanges();

            bool status = (code != 0);

            ResultStatus resultStatus = new ResultStatus
            {
                Status = status
            };

            if (status)
            {
                resultStatus.Message = "Successfully created new flavour";
            }
            else
            {
                resultStatus.Message = "Failed to create new flavour";
            }

            return(resultStatus);
        }
Пример #3
0
    public void Fill(float amount, Flavour flavour)
    {
        if (this.flavour != flavour)
        {
            this.flavour = flavour;
            drinkLevel.GetComponent <MeshRenderer>().material.color = flavour.getColor();
        }

        if (filled == 0)
        {
            drinkLevel.gameObject.SetActive(true);
        }

        if (filled < 1)
        {
            filled += amount;

            if (filled > 1)
            {
                filled = 1;
            }
        }


        UpdateDrinkLevel();
    }
Пример #4
0
        public async Task <ResultStatus> DeleteFlavourById(int id)
        {
            Flavour target = await GetFlavourById(id);

            flavoursRepository.Delete(target);
            int code = await flavoursRepository.SaveChanges();

            bool status = (code != 0);

            ResultStatus resultStatus = new ResultStatus
            {
                Status = status
            };

            if (status)
            {
                resultStatus.Message = "Successfully deleted flavour";
            }
            else
            {
                resultStatus.Message = "Failed to deleted flavour";
            }

            return(resultStatus);
        }
Пример #5
0
        public async Task <ResultStatus> UpdateFlavourById(int id, string newName)
        {
            Flavour target = await GetFlavourById(id);

            target.Name = newName;
            flavoursRepository.Update(target);
            int code = await flavoursRepository.SaveChanges();

            bool status = (code != 0);

            ResultStatus resultStatus = new ResultStatus
            {
                Status = status
            };

            if (status)
            {
                resultStatus.Message = "Successfully updated flavour";
            }
            else
            {
                resultStatus.Message = "Failed to update flavour";
            }

            return(resultStatus);
        }
        public async Task <IActionResult> Edit(int id, [Bind("FlavourId,FlavourName,FlavourDescription")] Flavour flavour)
        {
            if (id != flavour.FlavourId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(flavour);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlavourExists(flavour.FlavourId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(flavour));
        }
Пример #7
0
        public async Task <Flavour> GetFlavourById(int id)
        {
            Flavour flavour = null;

            flavour = await flavoursRepository.All().Where(f => f.Id == id).FirstOrDefaultAsync();

            return(flavour);
        }
Пример #8
0
 public Tile(int x, int y, Flavour f, Status s, GameObject o)
 {
     X               = x;
     Y               = y;
     Flavour         = f;
     Status          = s;
     ObjectReference = o;
 }
		public static ContentTypeDefinitionBuilder WithBodyPart(
			this ContentTypeDefinitionBuilder builder,
			Flavour defaultFlavour = Flavour.Html)
		{
			return builder.WithPart(
				"BodyPart",
				partBuilder => partBuilder.WithSetting("BodyTypePartSettings.Flavor", defaultFlavour.ToString()));
		}
Пример #10
0
        public async Task <Flavour> GetFlavourByName(string name)
        {
            Flavour flavour = null;

            flavour = await flavoursRepository.All().Where(f => f.Name == name).FirstOrDefaultAsync();

            return(flavour);
        }
Пример #11
0
 public static ContentTypeDefinitionBuilder WithBodyPart(
     this ContentTypeDefinitionBuilder builder,
     Flavour defaultFlavour = Flavour.Html)
 {
     return(builder.WithPart(
                typeof(BodyPart).Name,
                partBuilder => partBuilder.WithSetting("BodyTypePartSettings.Flavor", defaultFlavour.ToString())));
 }
Пример #12
0
        private static IAssetBundle ReadXliff(string filename, Stream file, Flavour flavour, ZipArchiveEntry entry = null)
        {
            var parser = new XliffParser();

            parser.Filename = filename;
            parser.Flavour  = flavour;
            parser.ZipEntry = entry;
            return(parser.Read(file));
        }
Пример #13
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.GetComponent <Holdable>())
     {
         Flavour drinkFlavour = other.gameObject.GetComponentInChildren <Fillable>().getFlavour();
         if (drinkFlavour == this.requestedFlavour)
         {
             AcceptDrink(other.gameObject);
         }
     }
 }
        public IHttpActionResult GetFlavour(int id)
        {
            Flavour flavour = unitOfWork.GetFlavourRepository.GetByID(id);

            if (flavour == null)
            {
                return(NotFound());
            }

            return(Ok(flavour));
        }
Пример #15
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;

            versionString = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);

            // Add commit hash and date information if available
            // The commit hash and date are stored in a file bin/.version
            // This file can automatically created by a post
            // commit script in the opensim git master repository or
            // by issuing the follwoing command from the top level
            // directory of the opensim repository
            // git log -n 1 --pretty="format:%h-%ci" >bin/.version
            // For the full git commit hash use %H instead of %h
            //
            string gitCommitFileName = ".version";

            string pathToGitFile = Path.Combine(Environment.CurrentDirectory,
                                                Path.Combine("..\\", Path.Combine(".git", "logs")));

            if (Directory.Exists(pathToGitFile))
            {
                string gitFile = Path.Combine(pathToGitFile, "HEAD");
                if (File.Exists(gitFile))
                {
                    try
                    {
                        string[] lines         = File.ReadAllLines(gitFile);
                        string   lastLine      = lines[lines.Length - 1];
                        string[] splitLastLine = lastLine.Split(new string[2] {
                            " ", "\t"
                        },
                                                                StringSplitOptions.RemoveEmptyEntries);
                        versionString = "Aurora-" + splitLastLine[1].Substring(0, 6)
                                        /*First 6 digits of the commit hash*/ +
                                        " " + splitLastLine[5] /*Time zone info*/;
                        FileStream s    = File.Open(gitCommitFileName, FileMode.Create);
                        byte[]     data = Encoding.UTF8.GetBytes(versionString);
                        s.Write(data, 0, data.Length);
                        s.Close();
                    }
                    catch
                    {
                    }
                }
            }
            else if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return(versionString);
        }
        public async Task <IActionResult> Create([Bind("FlavourId,FlavourName,FlavourDescription")] Flavour flavour)
        {
            if (ModelState.IsValid)
            {
                _context.Add(flavour);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(flavour));
        }
Пример #17
0
        private static IEnumerable <IAsset> ReadXliff(string filename, Stream file, ref Flavour flavour, ZipArchiveEntry entry)
        {
            var parser = new XliffParser();

            parser.Filename = filename;
            parser.Flavour  = flavour;
            parser.ZipEntry = entry;
            var assets = parser.Read(file);

            flavour = parser.Flavour;
            return(assets);
        }
        public IHttpActionResult PostFlavour(Flavour flavour)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            unitOfWork.GetFlavourRepository.Insert(flavour);
            unitOfWork.Save();

            return(CreatedAtRoute("DefaultApi", new { id = flavour.FlId }, flavour));
        }
Пример #19
0
        public async Task <ActionResult> Create(Flavour flavour, string Treat1, string Treat2, string Treat3, string Treat4)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            flavour.User = currentUser;
            _db.Flavours.Add(flavour);
            _db.SaveChanges();

            List <string> treats = new List <string>();

            treats.Add(Treat1);
            treats.Add(Treat2);
            treats.Add(Treat3);
            treats.Add(Treat4);

            foreach (string treat in treats)
            {
                if (treat != null)
                {
                    Treat treatObject;
                    int   treatId;
                    if (_db.Treats.Contains(new Treat()
                    {
                        TreatName = treat
                    }))
                    {
                        treatObject = _db.Treats.FirstOrDefault(Treat => Treat.TreatName == treat);
                        treatId     = treatObject.TreatId;
                    }
                    else
                    {
                        var newTreat = new Treat();
                        _db.Treats.Add(new Treat()
                        {
                            TreatName = treat
                        });                                               // add treat to database
                        _db.SaveChanges();
                        treatObject = _db.Treats.FirstOrDefault(Treat => Treat.TreatName == treat);
                        treatId     = treatObject.TreatId;
                    }
                    _db.FlavourTreat.Add(new FlavourTreat()
                    {
                        TreatId = treatId, FlavourId = flavour.FlavourId
                    });
                }
            }


            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #20
0
 public ActionResult Edit(Flavour flavour, int TreatId)
 {
     if (TreatId != 0)
     {
         _db.FlavourTreat.Add(new FlavourTreat()
         {
             TreatId = TreatId, FlavourId = flavour.FlavourId
         });
     }
     _db.Entry(flavour).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #21
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;
            versionString = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);

            // Add commit hash and date information if available
            // The commit hash and date are stored in a file bin/.version
            // This file can automatically created by a post
            // commit script in the opensim git master repository or
            // by issuing the follwoing command from the top level
            // directory of the opensim repository
            // git log -n 1 --pretty="format:%h-%ci" >bin/.version
            // For the full git commit hash use %H instead of %h
            //
            string gitCommitFileName = ".version";

            string pathToGitFile = Path.Combine(Environment.CurrentDirectory,
                                                Path.Combine("..\\", Path.Combine(".git", "logs")));

            if (Directory.Exists(pathToGitFile))
            {
                string gitFile = Path.Combine(pathToGitFile, "HEAD");
                if (File.Exists(gitFile))
                {
                    try
                    {
                        string[] lines = File.ReadAllLines(gitFile);
                        string lastLine = lines[lines.Length - 1];
                        string[] splitLastLine = lastLine.Split(new string[2] {" ", "\t"},
                                                                StringSplitOptions.RemoveEmptyEntries);
                        versionString = "WhiteCore-" + splitLastLine[1].Substring(0, 6)
                                        /*First 6 digits of the commit hash*/+
                                        " " + splitLastLine[5] /*Time zone info*/;
                        FileStream s = File.Open(gitCommitFileName, FileMode.Create);
                        byte[] data = Encoding.UTF8.GetBytes(versionString);
                        s.Write(data, 0, data.Length);
                        s.Close();
                    }
                    catch
                    {
                    }
                }
            }
            else if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return versionString;
        }
        public static FlavourModel Create(Flavour f)
        {
            if (f == null)
            {
                return(null);
            }

            return(new FlavourModel()
            {
                SeriesNumber = f.SeriesNumber,
                PriceInCents = f.PriceInCents,
                Name = f.Name
            });
        }
Пример #23
0
 private Transaction GetFakeTransaction(Machine fakeMachine, Flavour fakeFlaviour)
 {
     return(new Transaction()
     {
         Machine = fakeMachine,
         Flavour = fakeFlaviour,
         FlavourId = fakeFlaviour.Id,
         PriceInCents = 2500,
         IsActive = true,
         TransactionType = TransactionType.cash,
         MachineId = fakeMachine.Id,
         TansactionTime = DateTime.Now
     });
 }
Пример #24
0
        public ActionResult Create(Treat treat, string Flavour1, string Flavour2, string Flavour3, string Flavour4)
        {
            _db.Treats.Add(treat);
            _db.SaveChanges();

            List <string> flavours = new List <string>();

            flavours.Add(Flavour1);
            flavours.Add(Flavour2);
            flavours.Add(Flavour3);
            flavours.Add(Flavour4);

            foreach (string flavour in flavours)
            {
                if (flavour != null)
                {
                    Flavour flavourObject;
                    int     flavourId;
                    if (_db.Flavours.Contains(new Flavour()
                    {
                        FlavourName = flavour
                    }))
                    {
                        flavourObject = _db.Flavours.FirstOrDefault(Flavour => Flavour.FlavourName == flavour);
                        flavourId     = flavourObject.FlavourId;
                    }
                    else
                    {
                        var newflavour = new Flavour();
                        _db.Flavours.Add(new Flavour()
                        {
                            FlavourName = flavour
                        });                                                       // add treat to database
                        _db.SaveChanges();
                        flavourObject = _db.Flavours.FirstOrDefault(Flavour => Flavour.FlavourName == flavour);
                        flavourId     = flavourObject.FlavourId;
                    }
                    _db.FlavourTreat.Add(new FlavourTreat()
                    {
                        FlavourId = flavourId, TreatId = treat.TreatId
                    });
                }
            }



            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #25
0
        public Flavour AddFlavour(string name)
        {
            using (var context = new MicrobrewitContext())
            {
                var flavourId = (context.Flavours.Max(f => (int?)f.FlavourId) ?? 0) + 1;
                var flavour   = new Flavour()
                {
                    FlavourId = flavourId,
                    Name      = name
                };
                context.Flavours.Add(flavour);
                context.SaveChanges();

                return(flavour);
            }
        }
		public static ContentPartDefinitionBuilder WithTextField(
			this ContentPartDefinitionBuilder builder,
			string name,
			Flavour flavor,
			bool required = true,
			string hint = "")
		{
			var strFlavor = SplitCamel(flavor.ToString());

			return builder.WithField(
				name,
				fieldBuilder =>
					fieldBuilder.OfType("TextField")
						.WithSetting("TextFieldSettings.Required", required.ToString(CultureInfo.InvariantCulture))
						.WithSetting("TextFieldSettings.Flavor", strFlavor)
						.WithSetting("TextFieldSettings.Hint", hint));
		}
Пример #27
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;

            // Check if there's a custom .version file with the commit hash in it
            // Else return the standard versionString.

            string gitCommitFileName = ".version";

            if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return(versionString);
        }
Пример #28
0
        public static ContentPartDefinitionBuilder WithTextField(
            this ContentPartDefinitionBuilder builder,
            string name,
            Flavour flavor,
            bool required = true,
            string hint   = "")
        {
            var strFlavor = flavor.ToString().SplitCamel();

            return(builder.WithField(
                       name,
                       fieldBuilder =>
                       fieldBuilder.OfType("TextField")
                       .WithSetting("TextFieldSettings.Required", required.ToString(CultureInfo.InvariantCulture))
                       .WithSetting("TextFieldSettings.Flavor", strFlavor)
                       .WithSetting("TextFieldSettings.Hint", hint)));
        }
Пример #29
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;

            // Check if there's a custom .version file with the commit hash in it
            // Else return the standard versionString.

            string gitCommitFileName = ".version";

            if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return versionString;
        }
Пример #30
0
        private static IAssetBundle ReadZip(string filename, Stream file, Flavour flavour)
        {
            // If this is a MS-DOS compatible zip file,
            // the filenames are encoded with the created machine's OEM codepage,
            // which we don't know what it is.
            // Windows assumes it is same as this machine's ANSI.
            // It works fine in most cases, and on SBCS world,
            // the worst-case symptom is getting files with broken filename.
            // On MBCS world, however, when receiving a zip file from other region,
            // some particular combinations of bytes in a filename
            // could be considered illegal per the receiving system's MBCS ANSI,
            // and opening a file may fail.
            // It is unacceptable, especially given that a name of a zip entry is
            // not important for the purpose of this program.
            // That's why we explicitly say it is 850,
            // even though it is very unlikely today.
            // Please be reminded that the specified encoding only affects the decoding of
            // zip entry names and has nothing to do with the contents.

            using (var zip = new ZipArchive(file, ZipArchiveMode.Read, true, Encoding.GetEncoding(850)))
            {
                var assets = new List <IAsset>();
                foreach (var entry in zip.Entries)
                {
                    // It seems the stream from ZipEntry.Open() doesn't suppoprt Seek.
                    // We need a trick here.
                    using (var f = entry.Open())
                    {
                        if (!IsXliff(f, true))
                        {
                            continue;
                        }
                    }
                    using (var f = entry.Open())
                    {
                        var bundle = ReadXliff(filename, f, flavour, entry);
                        if (bundle != null)
                        {
                            assets.AddRange(bundle.Assets);
                        }
                    }
                }
                return(assets.Count == 0 ? null : new SimpleAssetBundle(assets, ReaderManager.FriendlyFilename(filename)));
            }
        }
Пример #31
0
 public IAssetBundle Read(string filename, Flavour flavour = Flavour.Auto)
 {
     using (var file = File.OpenRead(filename))
     {
         if (file.IsZip())
         {
             return(ReadZip(filename, file, flavour));
         }
         else if (IsXliff(file))
         {
             return(ReadXliff(filename, file, flavour));
         }
         else
         {
             return(null);
         }
     }
 }
Пример #32
0
        public IHttpActionResult GenerateBill([FromBody] IList <GenerateBillRequest> request)
        {
            IList <GenerateBillResponse> response = new List <GenerateBillResponse>();

            foreach (var req in request)
            {
                Topping topping  = uow.GetToppingRepository.GetByID(req.ToppingsId);
                Flavour flavours = uow.GetFlavourRepository.GetByID(req.FlavourId);

                response.Add(new GenerateBillResponse
                {
                    Flavour = flavours.FlName,
                    Topping = topping.Name,
                    Price   = req.Scoop * (flavours.FlPrice + topping.Price)
                });
            }
            return(Ok(response));
        }
        public IHttpActionResult PutFlavour(int id, Flavour flavour)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != flavour.FlId)
            {
                return(BadRequest());
            }

            unitOfWork.GetFlavourRepository.Attach(flavour);
            unitOfWork.Save();



            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #34
0
 private IEnumerable <IAsset> ReadAssets(string filename, Flavour flavour)
 {
     using (var file = FileUtils.OpenRead(filename))
     {
         if (file.IsZip())
         {
             return(ReadZip(filename, file, flavour));
         }
         else if (IsXliff(file) && flavour != Flavour.MemoQHistory)
         {
             var local_flavour = flavour;
             return(ReadXliff(filename, file, ref flavour, null));
         }
         else
         {
             return(null);
         }
     }
 }
Пример #35
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = "OpenSim Arriba " + versionNumber + " " + flavour;
            if (flavour == Flavour.Dev)
            {
                try
                {
                    using (Stream resource = typeof(VersionInfo).Assembly.GetManifestResourceStream("OpenSim.Framework.Servers.versioninfo.txt"))
                    {
                        using (TextReader tr = new StreamReader(resource))
                        {
                            string versioninfo = tr.ReadLine().Trim();
                            versionString = "OpenSim Arriba " + versioninfo + " " + flavour;
                        }
                    }
                }
                catch
                {

                }
            }
            return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
        }
Пример #36
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;
            versionString = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);

            string pathToGitFile = Path.Combine(Environment.CurrentDirectory,
                                                Path.Combine("..\\", Path.Combine(".git", "logs")));

            if (Directory.Exists(pathToGitFile))
            {
                string gitFile = Path.Combine(pathToGitFile, "HEAD");
                if (File.Exists(gitFile))
                {
                    string[] lines = File.ReadAllLines(gitFile);
                    string lastLine = lines[lines.Length - 1];
                    string[] splitLastLine = lastLine.Split(new string[2] {" ", "\t"},
                                                            StringSplitOptions.RemoveEmptyEntries);
                    versionString = "Aurora-" + splitLastLine[1].Substring(0, 6) /*First 6 digits of the commit hash*/+
                                    " " + splitLastLine[5] /*Time zone info*/;
                }
            }

            return versionString;
        }
Пример #37
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;
            versionString = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);

            // Add commit hash and date information if available
            // The commit hash and date are stored in a file bin/.version
            // This file can automatically created by a post
            // commit script in the opensim git master repository or
            // by issuing the follwoing command from the top level
            // directory of the opensim repository
            // git log -n 1 --pretty="format:%h-%ci" >bin/.version
            // For the full git commit hash use %H instead of %h
            //
            string gitCommitFileName = ".version";

            if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                versionString = CommitFile.ReadLine();
                CommitFile.Close();
            }
            return versionString;
        }
Пример #38
0
 static string GetVersionString(string versionNumber, Flavour flavour)
 {
     string versionString = VERSION_NAME + " " + versionNumber + " " + flavour;
     return versionString;
 }
Пример #39
0
 public Tile(int x, int y, Flavour f, Status s, GameObject o)
 {
     X = x;
     Y = y;
     Flavour = f;
     Status = s;
     ObjectReference = o;
 }
 public static string GetVersionString(string versionNumber, Flavour flavour, string versionMinor)
 {
     string versionString = "OpenSim " + versionNumber + " " + flavour + " Build " + versionMinor;
     return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
 }
Пример #41
0
        public static string GetVersionString(string versionNumber, Flavour flavour)
        {
            string versionString = "Aurora " + versionNumber + " (" + flavour + ")";
            string ReturnValue = versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
            string buildVersion = string.Empty;

            // Add commit hash and date information if available
            // The commit hash and date are stored in a file bin/.version
            // This file can automatically created by a post
            // commit script in the opensim git master repository or
            // by issuing the follwoing command from the top level
            // directory of the opensim repository
            // git log -n 1 --pretty="format:%h: %ci" >bin/.version
            // For the full git commit hash use %H instead of %h
            //
            // The subversion information is deprecated and will be removed at a later date
            // Add subversion revision information if available
            // Try file "svn_revision" in the current directory first, then the .svn info.
            // This allows to make the revision available in simulators not running from the source tree.
            // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
            // elsewhere as well
            string svnRevisionFileName = "svn_revision";
            string svnFileName = ".svn/entries";
            string gitCommitFileName = ".version";
            string inputLine;
            int strcmp;

            if (File.Exists(gitCommitFileName))
            {
                StreamReader CommitFile = File.OpenText(gitCommitFileName);
                buildVersion = CommitFile.ReadLine();
                CommitFile.Close();
                ReturnValue += buildVersion ?? "";
            }

            // Remove the else logic when subversion mirror is no longer used
            else
            {
                if (File.Exists(svnRevisionFileName))
                {
                    StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
                    buildVersion = RevisionFile.ReadLine();
                    buildVersion.Trim();
                    RevisionFile.Close();

                }

                if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
                {
                    StreamReader EntriesFile = File.OpenText(svnFileName);
                    inputLine = EntriesFile.ReadLine();
                    while (inputLine != null)
                    {
                        // using the dir svn revision at the top of entries file
                        strcmp = String.Compare(inputLine, "dir");
                        if (strcmp == 0)
                        {
                            buildVersion = EntriesFile.ReadLine();
                            break;
                        }
                        else
                        {
                            inputLine = EntriesFile.ReadLine();
                        }
                    }
                    EntriesFile.Close();
                }

                ReturnValue += string.IsNullOrEmpty(buildVersion) ? "      " : ("." + buildVersion + "     ").Substring(0, 6);
            }
            return ReturnValue;
        }
Пример #42
0
 public static string GetVersionString(string versionNumber, Flavour flavour)
 {
     string versionString = "VoxelSim " + versionNumber + " " + flavour;
     return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
 }
Пример #43
0
 public static string GetVersionString(string versionNumber, Flavour flavour)
 {
     string versionString = "FreeBird " + versionNumber;
     return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
 }