Beispiel #1
0
 public static void Show(string text, InfoTypes type)
 {
     Application.Current?.Dispatcher?.Invoke(() =>
     {
         InformationAdded?.Invoke(new InformationModel(type, DateTime.Now, text));
     });
 }
Beispiel #2
0
 public void SafeUpdateLog(string s, InfoTypes type)
 {
     if (form != null)
     {
         form.UpdateLogger(s, type);
     }
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] InfoTypes infoTypes)
        {
            if (id != infoTypes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(infoTypes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InfoTypesExists(infoTypes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(infoTypes));
        }
        public LuaInfo(string path, InfoTypes type, string race)
        {
            Path = path;
            Type = type;

            Race = race;
        }
 public InfoItem(
     InfoTypes infoType,
     InfoSubTypes infoSubType,
     int offset,
     string value)
 {
     this.InfoType    = infoType;
     this.InfoSubType = infoSubType;
     this.Offset      = offset;
     this.Value       = value;
 }
        public async Task <IActionResult> Create([Bind("Id,Name")] InfoTypes infoTypes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(infoTypes);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(infoTypes));
        }
 public int CompareTypes(InfoTypes type)
 {
     if (Type < type)
     {
         return(-1);
     }
     if (Type == type)
     {
         return(0);
     }
     return(1);
 }
Beispiel #8
0
 public void UpdateOutPut(string s, InfoTypes infoType = InfoTypes.Info)
 {
     outText.text = s;
     if (infoType == InfoTypes.Error)
     {
         outBg.color = Color.red;
     }
     else if (infoType == InfoTypes.Wram)
     {
         outBg.color = Color.yellow;
     }
     else if (infoType == InfoTypes.Info)
     {
         outBg.color = Color.white;
     }
 }
Beispiel #9
0
 public void UpdateLogger(string s, InfoTypes infoType)
 {
     logger.text = s;
     if (infoType == InfoTypes.Error)
     {
         loggerBg.color = Color.red;
     }
     else if (infoType == InfoTypes.Wram)
     {
         loggerBg.color = Color.yellow;
     }
     else if (infoType == InfoTypes.Info)
     {
         loggerBg.color = Color.white;
     }
 }
Beispiel #10
0
        // Load File Index from previous saved index
        public static bool LoadFilesList()
        {
            FilesTable = new Hashtable();

            string file = Path.Combine(Directory.GetCurrentDirectory(), "Config/FilesIndex.def");

            if (File.Exists(file))
            {
                StreamReader reader = new StreamReader(File.OpenRead(file));
                while (reader.Peek() > -1)
                {
                    string line = reader.ReadLine();

                    Match m = Regex.Match(line, @"<(?<type>.*)\>\s\<(?<race>.*)\>\s\<(?<file>.*)\>");
                    if (m.Success)
                    {
                        Group typeGr = m.Groups["type"];
                        Group raceGr = m.Groups["race"];
                        Group fileGr = m.Groups["file"];

                        string lua = fileGr.Value;

                        InfoTypes infoType = GetInfoType(typeGr.Value);
                        if (!FilesTable.Contains(lua))
                        {
                            try
                            {
                                string path = DataPath.GetPath(DataPath.GetCategoryPath(lua, infoType, raceGr.Value));
                                FilesTable.Add(/*Regex.Replace(file, @"^.*\\", "")*/ lua, new LuaInfo(path, infoType, raceGr.Value));
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }
                }
                reader.Close();
                return(true);
            }
            return(false);
        }
Beispiel #11
0
        public static string GetCategoryPath(string lua, InfoTypes infoType, string race)
        {
            string prefix = "";

            switch (infoType)
            {
            case InfoTypes.Unit:
                prefix = "sbps\\races\\" + race + "\\";
                break;

            case InfoTypes.Building:
                prefix = "ebps\\races\\" + race + "\\structures\\";
                break;

            case InfoTypes.Research:
                prefix = "research\\";
                break;
            }

            return(Path.Combine(prefix, lua));
        }
        public void ManagerProcess(InfoTypes types, string account, string password)
        {
            string encryptPassword = new AES256().AESEncrypt256(password);

            switch (types)
            {
            case InfoTypes.Gamezone:
                main.gamezoneAccount   = account;
                main.gamezonePassword  = encryptPassword;
                panel_Gamezone.Visible = false;
                OutSystemMessage($"{main.gamezoneAccount}, {main.gamezonePassword}");
                main.toolStripMenuItem_ProcessStart.Enabled = true;
                main.needView = checkBox_needView.Checked;
                TodayPanel_Initialize();
                break;

            case InfoTypes.Today:
                main.todayAccount   = account;
                main.todayPassword  = encryptPassword;
                panel_Today.Visible = false;
                OutSystemMessage($"{main.todayAccount}, {main.todayPassword}");
                main.needView1 = checkBox_needView1.Checked;
                this.Close();
                //NaverPanel_Initialize();
                break;

            case InfoTypes.Naver:
                main.naverAccount  = account;
                main.naverPassword = encryptPassword;
                OutSystemMessage($"{main.naverAccount}, {password} => {main.naverPassword}");
                main.needView2 = checkBox_needView2.Checked;
                main.toolStripMenuItem_ProcessStart.Enabled = true;
                this.Close();
                break;

            default:
                MessageBox.Show("Exec Error");
                break;
            }
        }
Beispiel #13
0
        internal virtual void Reload(Rainmeter.API api, ref double maxValue)
        {
            //@TODO Use this port
            int port = api.ReadInt("Port", 58932);

            string playerTypeString = api.ReadString("PlayerType", "Status");

            try
            {
                playerType = (InfoTypes)Enum.Parse(typeof(InfoTypes), playerTypeString, true);

                if (playerType == InfoTypes.Cover)
                {
                    //Unused @TODO Implement using this. Probably would be cleanest to null all other music info locations during write to disk
                    //defaultCoverLocation = api.ReadPath("DefaultPath", "");
                    string temp = api.ReadPath("CoverPath", null);
                    if (temp.Length > 0)
                    {
                        CoverOutputLocation = temp;
                    }
                    temp = api.ReadPath("DefaultPath", null);
                    if (temp.Length > 0)
                    {
                        CoverDefaultLocation = temp;
                    }
                }
                else if (playerType == InfoTypes.Progress)
                {
                    maxValue = 100;
                }
            }
            catch (Exception e)
            {
                API.Log(API.LogType.Error, "WebNowPlaying.dll - Unknown PlayerType:" + playerTypeString);
                API.Log(API.LogType.Debug, "Error:" + e.ToString());
                playerType = InfoTypes.Status;
            }
        }
Beispiel #14
0
    public int GetInfoIconCount(ResourceTypes resourceType, InfoTypes infoType)
    {
        //used to decide how many pictographs to show based on the consumption/production/capacity
        //when infoType is "rate", can return a negative which means consuming resources.
        if (infoType == InfoTypes.rate)
        {
            float rate = rates[resourceType];
            return(RoundAwayFromZero(rate));
        }
        else if (infoType == InfoTypes.optimum)
        {
            if (resourceType == ResourceTypes.electricity)
            {
                return(RoundAwayFromZero(optimums[resourceType]));
            }
            if (resourceType == ResourceTypes.inspiration)
            {
                return(0);
            }

            return(RoundAwayFromZero(optimums[resourceType] / 100));
        }
        else if (infoType == InfoTypes.capacity)
        {
            float capacity = capacities[resourceType];
            if (resourceType == ResourceTypes.water || resourceType == ResourceTypes.oxygen)
            {
                capacity /= 1000;
            }

            return(Mathf.CeilToInt(Mathf.Sqrt(capacity)));
        }

        Debug.LogError("GetInfoIconCount infoType is not implemented. infoType=" + infoType);
        return(0);
    }
Beispiel #15
0
 public InformationModel(InfoTypes type, DateTime time, string message)
 {
     Type    = type.ToString();
     Time    = time;
     Message = message;
 }
Beispiel #16
0
            public int unpack(Reader reader, bool isPacked)
            {
                int pos = (int)reader.BaseStream.Position;

                info = (InfoTypes)reader.ReadByte();
                byte flags = reader.ReadByte();

                if (isPacked)
                {
                    bool flag = info == InfoTypes.StateChange || info == InfoTypes.PassedTimeAttackGate;

                    if ((flags & (byte)FlagTypes.InputChange) != 0 || flag)
                    {
                        inputs = reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.PositionChange) != 0 || flag)
                    {
                        position.x = reader.ReadInt32();
                        position.y = reader.ReadInt32();
                    }
                    if ((flags & (byte)FlagTypes.VelocityChange) != 0 || flag)
                    {
                        velocity.x = reader.ReadInt32();
                        velocity.y = reader.ReadInt32();
                    }

                    if ((flags & (byte)FlagTypes.RotationChange) != 0 || flag)
                    {
                        rotation = reader.ReadByte() << 1;
                    }

                    if ((flags & (byte)FlagTypes.DirectionChange) != 0 || flag)
                    {
                        direction = (Directions)reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.AnimationChange) != 0 || flag)
                    {
                        anim = reader.ReadByte();
                    }

                    if ((flags & (byte)FlagTypes.FrameChange) != 0 || flag)
                    {
                        frame = reader.ReadByte();
                    }
                }
                else
                {
                    inputs     = reader.ReadByte();
                    position.x = reader.ReadInt32();
                    position.y = reader.ReadInt32();
                    velocity.x = reader.ReadInt32();
                    velocity.y = reader.ReadInt32();
                    rotation   = reader.ReadInt32();
                    direction  = (Directions)reader.ReadByte();
                    anim       = reader.ReadByte();
                    frame      = reader.ReadByte();
                }

                this.flags = (FlagTypes)flags;

                return((int)reader.BaseStream.Position - pos);
            }
Beispiel #17
0
 public static void Show(string text, InfoTypes type)
 {
     InformationAdded?.Invoke(new InformationModel(type, DateTime.Now, text));
 }