public SchematicVM GetTraits(int id) { using (Repository repo = new Repository(new XolarDatabase())) { List <TraitImpact> impacts = repo.GetTraitImpacts(id); SchematicVM result = new SchematicVM(); result.id = impacts[0].SchematicId; result.name = impacts[0].Schematic.Name; result.level = impacts[0].Schematic.Level; result.stars = impacts[0].Schematic.Stars; result.description = impacts[0].Schematic.Description; result.stat = new List <stat>(); foreach (TraitImpact ti in impacts) { stat s = new stat(); s.id = ti.Id; s.name = ti.Trait.Description; s.value = ti.Impact; result.stat.Add(s); } return(result); } }
public Result getattr(string path, out stat stbuf) { //return Result.ENOENT; Logger.WriteLine("hello_getattr: '{0}'", path); Logger.Flush(); Stream.Flush(); stbuf = default(stat); if (path == "/") { stbuf.st_mode = (uint)Mode.S_IFDIR | 0755; stbuf.st_nlink = (IntPtr)2; } else if (path == "/hello") { stbuf.st_mode = (uint)Mode.S_IFREG | 0444; stbuf.st_nlink = (IntPtr)1; stbuf.st_size = 100; } else { return Result.ENOENT; } return Result.OK; }
public List <SchematicVM> GetSchematics() { using (Repository repo = new Repository(new XolarDatabase())) { List <SchematicVM> result = new List <SchematicVM>(); List <Schematic> schematics = repo.GetSchematics(); foreach (Schematic sch in schematics) { SchematicVM vm = new SchematicVM(); vm.id = sch.Id; vm.name = sch.Name; vm.imgurl = sch.Picture.Source; vm.level = sch.Level; vm.stars = sch.Stars; vm.description = sch.Description; vm.stat = new List <stat>(); List <TraitImpact> impacts = repo.GetTraitImpacts(sch.Id); foreach (TraitImpact ti in impacts) { stat s = new stat(); s.name = ti.Trait.Description; s.value = ti.Impact; vm.stat.Add(s); } result.Add(vm); } return(result); } }
//Constructor public UIStatText(GameBoard game, LiveUnit rep, stat display, int xPos, int yPos, int width, int height) : base(game, xPos, yPos, width, height) { this.rep = rep; this.toDisplay = display; this.mouseEvents = false; this.visible = true; this.layer = 95; }
public ActionResult post_dex(pokedexpost poke, IEnumerable <HttpPostedFileBase> image) { pokedex pokedata = Newtonsoft.Json.JsonConvert.DeserializeObject <pokedex>(poke.dexdata); stat statdata = Newtonsoft.Json.JsonConvert.DeserializeObject <stat>(poke.statdata); var type = Newtonsoft.Json.JsonConvert.DeserializeObject <List <type> >(poke.typedata); type[] tipe = type.ToArray(); pokemon_type[] poktip = new pokemon_type[tipe.Count()]; using (TypeDAL tipedal = new TypeDAL()) { for (int i = 0; i < tipe.Count(); i++) { poktip[i] = new pokemon_type(); poktip[i].type_id = tipedal.get_type_id(tipe[i].type1); poktip[i].pokedex_id = pokedata.pokedex_id; } } statdata.pokedex_id = pokedata.pokedex_id; //simpan file ke folder, belum insert string ke database string filepath = ""; if (image.Count() > 0) { foreach (var pic in image) { if (pic != null) { filepath = Path.Combine(HttpContext.Server.MapPath("~/Content/Images"), pic.FileName); pic.SaveAs(filepath); pokedata.image = pic.FileName; } } } using (PokedexDAL pokedal = new PokedexDAL()) { string[] respon = pokedal.addpokedex(pokedata, statdata, poktip); Respon res = new Respon(); if (respon[0] == "1") { res.error = "0"; res.success = "1"; res.tag = "post pokedex"; res.token = "success adding"; } else { res.error = "1"; res.success = "0"; res.tag = "post pokedex"; res.token = "failed adding"; } return(Json(res)); } }
void Start() { bs.mouseOn(); _stat = stat.start; bs.json(this, URL + "0.js", (v) => { M.init(v); V.init(); title(); }); }
public void setSupport(battleType supportType, status statusMod, stat statBoost, int scalar, bool selfTarget, bool targetAlly) { this.supprtType = supportType; this.statusMod = statusMod; this.statBoost = statBoost; this.scalar = scalar; this.selfTarget = selfTarget; this.targetAlly = targetAlly; return; }
public string ReadFileSelfReturn(string FileLocation) { List<stat> hs = new List<stat>(); var result = ""; using( StreamReader sr = new StreamReader(FileLocation)) { while ((result = sr.ReadLine()) != null) { if(result.Contains("|AB")) { var x = new stat(); var line = (result.IndexOf("|AB") + 3); var raw = result.Remove(0, line); var end = raw.IndexOf("|"); raw = raw.Remove(end); x.item = raw; x.type = "return"; x.date = ReturnDate(result); x.user = "******"; hs.Add(x); } } } var processedFile = MyDocuments() + "\\self-return-processed" + DateTime.Now.ToFileTime().ToString() + ".txt"; ; StreamWriter sw = new StreamWriter(processedFile); foreach (var item in hs) { sw.WriteLine(item.date + "," + item.type + "," + item.user + "," + item.item); } sw.Close(); return processedFile; }
void setStat(stat param, int val) { if (val == 0) { setStat(param, false); } else { setStat(param, true); } }
void setStat(stat param, bool val) { if (val) { status |= param; } else { status &= ~param; } }
private static FileInfo ToFileInfo(stat stat) { return(new FileInfo { Mode = Convert.ToInt32(stat.st_mode.ToString()), IsLink = LibC.S_ISLNK(stat.st_mode), OwnerId = Convert.ToInt32(stat.st_uid.ToString()), GroupId = Convert.ToInt32(stat.st_gid.ToString()), LastModTime = DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64(stat.st_mtim.tv_sec.ToString())).UtcDateTime, }); }
static int lstat(string path, out stat buf) { if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64) { return(lstat_arm64(path, out buf)); } else { return(lstat_x64(path, out buf)); } }
// Update is called once per frame void Update() { if (rot.GetRotate()) { GameObject r = rot.GetRot(); if (r.name.Contains("finish")) { if (!fin) { t = Time.time; fin = true; } if (r.GetComponent <Light>().range < range) { r.GetComponent <Light>().range += Time.deltaTime * 2; r.GetComponent <orbit>().SetOrb(r.GetComponent <Light>().range); } if (Time.time - t > cooldown && Vector3.Distance(r.transform.position, transform.position) < dist && r.GetComponent <Light>().range > range) { fin = false; GameObject[] objs = Resources.FindObjectsOfTypeAll <GameObject>(); foreach (GameObject obj in objs) { if (obj.name == "Finish" && obj.layer == 5) { gameObject.GetComponent <rotor>().SetTyp(-7); GameObject.FindWithTag("level"); enabled = false; obj.SetActive(true); gameObject.GetComponent <rotor>().enabled = false; gameObject.GetComponent <TrailRenderer>().enabled = false; stat st = GameObject.FindWithTag("stat").GetComponent <stat>(); if (st.GetLevel() <= LevelHandle.GetLoadedLevelId() && st.GetLevel() >= 0) { GameObject.FindWithTag("stat").GetComponent <stat>().PlusOne(); GameObject.FindWithTag("stat").GetComponent <stat>().SaveStats(); } break; } } } } else { fin = false; } } else { fin = false; } }
public void setModifiers(int range, stat statBoost, int scalar, bool targetAlly) { if (this.iTypeMain == itemType.BATTLE || this.iTypeSub == itemType.BATTLE) { this.range = range; this.statBoost = statBoost; this.scalar = scalar; this.targetAlly = targetAlly; } return; }
void ponderateStat(stat category, float[] stats) { float media = 0; if (category == stat.precision) { stats[0] *= precisionMovPond / 100; stats[1] *= precisionPrecPond / 100; stats[2] *= precisionVelPond / 100; for (int i = 0; i < stats.Length; i++) { media += stats[i]; } mediaPrecision = media; } else if (category == stat.aimTime) { stats[0] *= aimTimeMovPond / 100; stats[1] *= aimTimePrecPond / 100; stats[2] *= aimTimeVelPond / 100; for (int i = 0; i < stats.Length; i++) { media += stats[i]; } mediaAimTime = media; } else if (category == stat.tracking) { stats[0] *= trackingTrackPond / 100; stats[1] *= trackingMovPond / 100; for (int i = 0; i < stats.Length; i++) { media += stats[i]; } mediaTracking = media; } else if (category == stat.reactionTime) { stats[0] *= reactionTimeMovPond / 100; stats[1] *= reactionTimeReflexPond / 100; stats[2] *= reactionTimePrecPond / 100; stats[3] *= reactionTimeVelPond / 100; for (int i = 0; i < stats.Length; i++) { media += stats[i]; } mediaReactionTime = media; } }
public stat stat() { var temp = new stat(); using (var db = new PerceptronDatabaseEntities()) { var sqlConnection1 = new SqlConnection( "Server= CHIRAGH-I; Database= PerceptronDatabase; Integrated Security=SSPI;"); var cmd = new SqlCommand { CommandText = "SELECT count( distinct UserId) as one FROM SearchQueries", CommandType = CommandType.Text, Connection = sqlConnection1 }; sqlConnection1.Open(); int j = 0; var dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { temp.user = dataReader["one"].ToString(); } dataReader.Close(); cmd.Dispose(); sqlConnection1.Close(); } using (var db = new PerceptronDatabaseEntities()) { var sqlConnection1 = new SqlConnection( "Server= CHIRAGH-I; Database= PerceptronDatabase; Integrated Security=SSPI;"); var cmd = new SqlCommand { CommandText = "Select count( QueryId) as two FROM SearchResults", CommandType = CommandType.Text, Connection = sqlConnection1 }; sqlConnection1.Open(); int j = 0; var dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { temp.search = dataReader["two"].ToString(); } dataReader.Close(); cmd.Dispose(); sqlConnection1.Close(); } return(temp); }
public unsafe override int GetAttr(ReadOnlySpan <byte> path, ref stat stat, FuseFileInfoRef fiRef) { try { if (verbosity > 10) { Console.WriteLine($"GetAttr {path.GetString()}"); } int error = 0, level = 0; var procs = ProcPath(path, ref error, ref level, mustExist: true); if (error != 0) { return(-LibC.ENOENT); } var last = procs.Pop(); //Console.WriteLine($" getAttr - last {last.Item1.GetString()} error {last.Item3}"); if (last.Item2 == null) { return(-last.Item3); } //Console.WriteLine($" return: {last.Item2.Stat.st_mode.ModMask()}"); last.Item2.GetStat(ref stat); var physFile = last.Item2.GetStatPhysical(); if (physFile != null) { var nstat = new stat(); var lc = LibC.lstat(RawDirs.ToBytePtr(physFile.ToArray()), &nstat); if (lc < 0) { return(-LibC.errno); } // Real stat is kept in a physical backing file (mostly st_size) // Not trying to keep this syned in the database yet last.Item2.GetStat(ref stat, nstat); } //Console.WriteLine($"Length Stat={stat.st_size}"); return(0); } catch (Exception ex) { Console.WriteLine($"Error GetAttr: {ex.Message} {ex.StackTrace}"); return(-LibC.EIO); } }
public void TakeDamage(int damage) { damage -= armor.GetValue(); damage = Mathf.Clamp(damage, 0, int.MaxValue); currentHealth -= damage; // Debug.Log(transform.name + "takes " + damage + "damage."); if (currentHealth <= 0) { Die(); } }
public void Trace_with_roulette(double rad, double length, double mue, double mus, double chanceToSurvive) { do { //direction cosines: Vector3d direction = new Vector3d(Math.Cos(Theta) * Math.Cos(Phi), Math.Cos(Theta) * Math.Sin(Phi), Math.Sin(Theta)); double step = -Math.Log(random.NextDouble()) / (mue + mus); CurrentPosition = CurrentPosition + step * direction; if ((this.CurrentPosition.X * this.CurrentPosition.X + this.CurrentPosition.Y * this.CurrentPosition.Y) >= rad * rad && this.CurrentPosition.Z <= -length / 2 && this.CurrentPosition.Z >= length / 2) { Status = stat.Finished; break; } Status = stat.Scattered; double dW = (mue / mus) * Energy; Energy -= dW; double scatAngleTheta = Math.Acos(1 - 2 * random.NextDouble()); double scatAnglePhi = 2 * Math.PI * random.NextDouble(); var tmp = direction; if (tmp.Z == 1) { direction = new Vector3d(Math.Sin(scatAngleTheta) * Math.Cos(scatAnglePhi), Math.Sin(scatAngleTheta) * Math.Sin(scatAnglePhi), Math.Cos(scatAngleTheta)); } else if (tmp.Z == -1) { direction = new Vector3d(Math.Sin(scatAngleTheta) * Math.Cos(scatAnglePhi), -Math.Sin(scatAngleTheta) * Math.Sin(scatAnglePhi), -Math.Cos(scatAngleTheta)); } else { direction.X = Math.Sin(scatAngleTheta) * (tmp.X * tmp.Z * Math.Cos(scatAnglePhi) - tmp.Y * Math.Sin(scatAnglePhi)) / Math.Sqrt(1 - tmp.Z * tmp.Z) + tmp.X * Math.Cos(scatAngleTheta); direction.Y = Math.Sin(scatAngleTheta) * (tmp.Y * tmp.Z * Math.Cos(scatAnglePhi) + tmp.X * Math.Sin(scatAnglePhi)) / Math.Sqrt(1 - tmp.Z * tmp.Z) + tmp.Y * Math.Cos(scatAngleTheta); direction.Z = -Math.Sqrt(1 - tmp.Z * tmp.Z) * Math.Sin(scatAngleTheta) * Math.Cos(scatAnglePhi) + tmp.Z * Math.Cos(scatAngleTheta); } if (random.NextDouble() <= chanceToSurvive) { Energy = Energy / chanceToSurvive; } else { Energy = 0; Status = stat.Absorbed; } }while (Status != stat.Absorbed); }
public unsafe static int Stat(ReadOnlySpan <byte> path, ref stat newStat) { fixed(stat *ns = &newStat) { var lc = LibC.lstat(path.ToBytePtr(), ns); if (lc < 0) { return(LibC.errno); } } return(0); }
public void open(string path, ref std::error_code ec) { if (isOpened()) { close(ref ec); if (ec != null) { return; } } //C++ TO C# CONVERTER TODO TASK: Only lambda expressions having all locals passed by reference can be converted to C#: //ORIGINAL LINE: Tools::ScopeExit failExitHandler([this, &ec] Tools.ScopeExit failExitHandler(() => { ec = std::error_code(errno, std::system_category()); std::error_code ignore = new std::error_code(); close(ref ignore); }); m_file = global::open(path, O_RDWR, S_IRUSR | S_IWUSR); if (m_file == -1) { return; } stat fileStat = new stat(); int result = global::fstat(m_file, fileStat); if (result == -1) { return; } //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: m_size = static_cast<uint64_t>(fileStat.st_size); m_size.CopyFrom((uint64_t)fileStat.st_size); //C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'reinterpret_cast' in C#: m_data = reinterpret_cast <uint8_t>(global::mmap(null, (size_t)m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_file, 0)); if (m_data == MAP_FAILED) { return; } m_path = path; ec = std::error_code(); failExitHandler.cancel(); }
public NeoVirtFSStat(stat st) { st_size = Convert.ToUInt64(st.st_size); st_uid = st.st_uid; st_gid = st.st_gid; st_mode = (NeoMode_T)Convert.ToUInt32(st.st_mode); st_ctim = st.st_ctim.ToDTO(); st_mtim = st.st_mtim.ToDTO(); st_atim = st.st_atim.ToDTO(); st_dtim = DateTimeOffset.MinValue; }
public IHttpActionResult get_pokedex() { using (PokedexDAL poke = new PokedexDAL()) { var list = poke.get_pokedex().ToList(); pokedexjson[] pokemodel = new pokedexjson[list.Count]; for (int i = 0; i < list.Count; i++) { pokemodel[i] = new pokedexjson(); pokemodel[i].pokedex_id = list[i].pokedex_id; pokemodel[i].pokemon_name = list[i].pokemon_name; pokemodel[i].species = list[i].species; pokemodel[i].height = list[i].height; pokemodel[i].weight = list[i].weight; pokemodel[i].abilities = list[i].abilities; pokemodel[i].image = list[i].image; pokemodel[i].req_move = list[i].req_move; var type = list[i].pokemon_type.ToArray(); string[] tipe = new string[type.Count()]; using (TypeDAL typedal = new TypeDAL()) { for (int u = 0; u < type.Count(); u++) { tipe[u] = typedal.get_type_name(type[u].type_id); } } pokemodel[i].type = tipe; var stat = list[i].stats.ToArray(); stat statmodel = new stat(); for (int o = 0; o < stat.Count(); o++) { statmodel = new stat(); statmodel.pokedex_id = list[i].pokedex_id; statmodel.hp = stat[o].hp; statmodel.attack = stat[o].attack; statmodel.defense = stat[o].defense; statmodel.spattack = stat[o].spattack; statmodel.spdefense = stat[o].spdefense; statmodel.speed = stat[o].speed; } pokemodel[i].stat = statmodel; } return(Json(pokemodel)); } }
public unsafe static FileInfo LStat(string path) { var bytes = Encoding.UTF8.GetBytes(path); stat stat = default; fixed(byte *pathname = bytes) { int rv = LibC.lstat(pathname, &stat); if (rv == -1) { PlatformException.Throw(); } } return(ToFileInfo(stat)); }
public string[] addpokedex(pokedex poke, stat stat, pokemon_type[] tipe) { try { db.pokedexes.Add(poke); db.stats.Add(stat); for (int i = 0; i < tipe.Count(); i++) { db.pokemon_type.Add(tipe[i]); } db.SaveChanges(); return(new string[] { "1", "success" }); } catch (Exception x) { return(new string[] { "-9", x.Message }); } }
internal static string map_file(string name, string suffix, ref ulong mapping) { FD fd = GlobalMembersTbcore.open_tb(name, suffix); if (fd == DefineConstants.FD_ERR) { return(null); } #if !_WIN32 stat statbuf = new stat(); fstat(fd, statbuf); mapping = statbuf.st_size; //C++ TO C# CONVERTER TODO TASK: C# does not have an equivalent for pointers to value types: //ORIGINAL LINE: sbyte *data = (sbyte *)mmap(null, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); sbyte data = (string)mmap(null, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); if (data == (string)(-1)) { Console.Write("Could not mmap() {0}.\n", name); Environment.Exit(1); } #else uint size_low; uint size_high; size_low = GetFileSize(fd, size_high); // *size = ((uint64)size_high) << 32 | ((uint64)size_low); System.IntPtr map = CreateFileMapping(fd, null, PAGE_READONLY, size_high, size_low, null); if (map == null) { Console.Write("CreateFileMapping() failed.\n"); Environment.Exit(1); } mapping = (ulong)map; //C++ TO C# CONVERTER TODO TASK: C# does not have an equivalent for pointers to value types: //ORIGINAL LINE: sbyte *data = (sbyte *)MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); sbyte data = (string)MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); if (data == null) { Console.Write("MapViewOfFile() failed, name = {0}{1}, error = {2:D}.\n", name, suffix, GetLastError()); Environment.Exit(1); } #endif GlobalMembersTbcore.close_tb(fd); return(data); }
private static async Task GetPRStats(List <stat> stats, ht.HttpClient client, string project) { var complete = false; var url = $"https://api.github.com/repos/xBimTeam/{project}/pulls"; int iPage = 1; while (!complete) { // Get the response. var t = url + "?page=" + iPage + "&per_page=30&state=all"; Debug.WriteLine(t); ht.HttpResponseMessage response = await client.GetAsync(t); // Get the response content. ht.HttpContent responseContent = response.Content; // Get the stream of the content. using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync())) { // Write the output. var content = await reader.ReadToEndAsync(); var items = JArray.Parse(content); // JArray comments = (JArray)data["channel"]["item"][0]["category"]; foreach (var item in items) { var user = item["user"]["login"].ToString(); var created = item["created_at"].ToString(); DateTime createdDate = DateTime.Parse(created); var s = new stat() { login = user, date = createdDate, project = project, type = "PR" }; stats.Add(s); } iPage++; complete = (items.Count < 30); } } }
public List <stat> getProductStat() { string query = "SELECT * FROM bitirme.amountperproductName;"; OpenConnection(); MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataReader dataReader = cmd.ExecuteReader(); List <stat> result = new List <stat>(); while (dataReader.Read()) { stat i1 = new stat(); i1.name = (string)dataReader["name"]; i1.amount = Int32.Parse(dataReader["amount"].ToString()); result.Add(i1); } dataReader.Close(); this.CloseConnection(); return(result); }
public override int GetAttr(ReadOnlySpan <byte> path, ref stat stat, FuseFileInfoRef fiRef) { if (path.SequenceEqual(RootPath)) { stat.st_mode = S_IFDIR | 0b111_101_101; // rwxr-xr-x stat.st_nlink = 2; // 2 + nr of subdirectories return(0); } else if (path.SequenceEqual(_helloFilePath)) { stat.st_mode = S_IFREG | 0b100_100_100; // r--r--r-- stat.st_nlink = 1; stat.st_size = _helloFileContent.Length; return(0); } else { return(-ENOENT); } }
public string[] editpokedex(string id, pokedex poke, stat stats, pokemon_type[] tipe) { var resultpoke = get_pokedex_byid(id); var resultstat = get_stat_byid(id); var resulttype = get_type_byid(id).ToList(); if (resultpoke != null) { resultpoke.pokemon_name = poke.pokemon_name; resultpoke.species = poke.species; resultpoke.height = poke.height; resultpoke.weight = poke.weight; resultpoke.image = poke.image; resultpoke.abilities = poke.abilities; } if (resultstat != null) { resultstat.hp = stats.hp; resultstat.attack = stats.attack; resultstat.defense = stats.defense; resultstat.spattack = stats.spattack; resultstat.spdefense = stats.spdefense; resultstat.speed = stats.speed; } if (resulttype != null) { for (int i = 0; i < resulttype.Count(); i++) { resulttype[i].type_id = tipe[i].type_id; } } try { db.SaveChanges(); return(new string[] { "1", "success" }); } catch (Exception x) { return(new string[] { "-9", x.Message }); } }
public override int GetAttr(ReadOnlySpan <byte> path, ref stat stat, FuseFileInfoRef fiRef) { if (path.SequenceEqual(Encoding.UTF8.GetBytes("/GetAttr_file1"))) { stat.st_atim = new DateTime(2000, 12, 1, 23, 13, 59, 200, DateTimeKind.Utc).ToTimespec(); stat.st_mtim = new DateTime(2001, 11, 2, 22, 12, 58, 199, DateTimeKind.Utc).ToTimespec(); stat.st_ctim = new DateTime(2002, 10, 3, 21, 11, 57, 198, DateTimeKind.Utc).ToTimespec(); stat.st_nlink = 10; stat.st_uid = 13; stat.st_gid = 15; stat.st_size = 200; stat.st_mode = S_IFREG | 0b100_010_001; return(0); } else if (path.SequenceEqual(Encoding.UTF8.GetBytes("/GetAttr_dir1"))) { stat.st_mode = S_IFDIR | 0b100_010_001; return(0); } return(-ENOENT); }
public void addStadistic(stat category, float value) { switch (category) { case stat.precision: precisionValues.Add(value); break; case stat.aimTime: aimTimeValues.Add(value); break; case stat.reactionTime: reactionTimeValues.Add(value); break; case stat.tracking: trackingValues.Add(value); break; } }
private void inv_bad(stat cause, stat effected) { if (stats[(int)cause] > 0) { if (stats[(int)cause] > -1 *stats[(int)effected]) { net[(int)effected]--; } } }
static void InsertRelax(List<Project> projectList, DateTime? startTime, DateTime? finishedTime, stat status, ref int index, int indexPlus, int insertPos = 1) { Relax re = new Relax { StartTime = startTime, FinishedTime = finishedTime }; re.UsedTime = (TimeSpan)(re.FinishedTime - re.StartTime); re.AssumeTime = re.UsedTime; switch (status) { case stat.间隔: re.Name = "间隔"; re.Remark += ProgressRecorder.GetRecordString(re); break; case stat.空闲: re.Name = "空闲"; break; } re.Status = status; if (re.UsedTime > TimeSpan.Parse("00:03:00")) { projectList.Insert(index + insertPos, re); index += indexPlus; } }
private void bad(stat cause, stat effected) { if (stats[(int)cause] < 0) { if (stats[(int)cause] < stats[(int)effected]) { net[(int)effected]--; } } }
private void norm(stat cause, stat effected) { if (stats[(int)cause] > 0) { if (stats[(int)cause] > stats[(int)effected]) { net[(int)effected]++; } } if (stats[(int)cause] < 0) { if (stats[(int)cause] < stats[(int)effected]) { net[(int)effected]--; } } }
private void good(stat cause, stat effected) { if (stats[(int)cause] > 0) { if (stats[(int)cause] > stats[(int)effected]) { net[(int)effected]++; } } }
public void StartProject(DateTime dt) { SetStartTime(dt); status = stat.正在进行; }
static extern int lstat (string path, out stat buf);
//Self Issue public string ReadFileSelfIssue(string FileLocation) { List<stat> hs = new List<stat>(); var result = ""; using (StreamReader sr = new StreamReader(FileLocation)) { while ((result = sr.ReadLine()) != null) { //User //Issue Book if (result.Contains("|AA") && result.Contains("|AB")) { var x = new stat(); var line = (result.IndexOf("|AA") + 3); var raw = result.Remove(0, line); var end = raw.IndexOf("|"); raw = raw.Remove(end); x.user = raw; //Item var line2 = (result.IndexOf("|AB") + 3); var raw2 = result.Remove(0, line2); var end2 = raw2.IndexOf("|"); raw2 = raw2.Remove(end); x.item = raw2; x.type = "issue"; x.date = ReturnDate(result); if (hs.Any(m => m.item == x.item) == false) { hs.Add(x); } } if (result.Contains("|AB") && !result.Contains("|AA")) { var x = new stat(); var line = (result.IndexOf("|AB") + 3); var raw = result.Remove(0, line); var end = raw.IndexOf("|"); raw = raw.Remove(end); x.item = raw; //Item x.user = "******"; x.type = "renewal"; x.date = ReturnDate(result); if (hs.Any(m => m.item == x.item) == false) { hs.Add(x); } } } } var processedFile = MyDocuments() + "\\self-issue-processed" + DateTime.Now.ToFileTime().ToString() + ".txt"; StreamWriter sw = new StreamWriter(processedFile); foreach (var item in hs) { sw.WriteLine(item.date + "," + item.type + "," + item.user + "," + item.item); } sw.Close(); return processedFile; }
private void inv(stat cause, stat effected) { if (stats[(int)cause] > 0) { if (stats[(int)cause] > -1 * stats[(int)effected]) { net[(int)effected]--; } } if (stats[(int)cause] < 0) { if (stats[(int)cause] < -1 * stats[(int)effected]) { net[(int)effected]++; } } }
public Result getattr(string path, out stat stbuf) { Logger.WriteLine("getattr: '{0}'", path); stbuf = default(stat); try { var Entry = Tree.GetFileInFolder(new EntryPath(path)); stbuf.st_ctime = new time_t() { tv_sec = (uint)Entry.ctime }; stbuf.st_mtime = new time_t() { tv_sec = (uint)Entry.ctime }; switch (Entry.type) { case FileEntryType.Folder: stbuf.st_mode = (uint)Mode.S_IFDIR | 0755; stbuf.st_nlink = (IntPtr)2; break; case FileEntryType.File: stbuf.st_mode = (uint)Mode.S_IFREG | 0444; stbuf.st_nlink = (IntPtr)1; stbuf.st_size = 100; break; } return Result.OK; } catch (Exception) { return Result.ENOENT; } }