Exemplo n.º 1
0
    static void Main(String[] args)
    {
        var     a = new Junk();
        dynamic b = new Junk();

        a.Hello();

        b.Hello();
    }
Exemplo n.º 2
0
        static public void phwangAbend(string str0_val, string str1_val)
        {
            Debug.WriteLine("Abend+++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            Debug.WriteLine(str0_val + " " + str1_val);
            Debug.WriteLine("Abend+++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            Junk junk = null;

            junk.data = 1;
        }
 public void RandomPopulate()
 {
     junkList = new Junk[Capacity];
     for (int i = 0; i < Capacity; i++)
     {
         junkList[i] = new Junk();
         junkList[i].RandomPopulate();
     }
 }
Exemplo n.º 4
0
        public static JToken ToJson(Junk junk)
        {
            var obj = (JObject)ToJson((Entry)junk);

            obj["annotations"] = new JArray(junk.Annotations.Select(
                                                x => ToJson(x)));
            obj["type"]    = "Junk";
            obj["content"] = junk.Content;
            return(obj);
        }
Exemplo n.º 5
0
        void ProcessMessage(ClientConnection client, CreatePhysicalObject message)
        {
            var m = new Junk()
            {
                Position           = message.Position,
                Rotation           = message.Rotation,
                TemplateObjectId   = message.TemplateId,
                ObjectInstanceId   = Global.Rand.Next(),
                TemplateObjectName = "CreatedJunk"
            };

            _world.Add(m);
        }
Exemplo n.º 6
0
        public void ItemClassToString()
        {
            Junk junk = new Junk(
                Guid.NewGuid(),
                "Leather Scraps",
                null,
                false,
                .5f,
                InventorySlotId.UNEQUIPPABLE,
                1);

            Assert.AreEqual($"{junk.Name}", junk.ToString());
        }
    // Helper for the SimpleJSON lib
    public void SimpleJSONParse(SimpleJSON.JSONNode node)
    {
        SimpleJSON.JSONArray arr = node.AsArray;
        junkList = new Junk[arr.Count];
        int i = 0;

        foreach (var n in arr)
        {
            junkList[i] = new Junk();
            junkList[i].SimpleJSONParse(n);
            i++;
        }
    }
Exemplo n.º 8
0
        public IActionResult SubmitJunk(string name, string details, string phone)
        {
            Junk junk = new Junk
            {
                Name    = name,
                Details = details,
                Phone   = phone
            };
            DbManager db    = new DbManager(_connectionString);
            int       newId = db.AddJunk(junk);

            if (HttpContext.Session.Get <List <int> >("ListOfIds") == null)
            {
                List <int> idList = new List <int>();
                HttpContext.Session.Set("ListOfIds", idList);
            }
            List <int> idListToAddTo = HttpContext.Session.Get <List <int> >("ListOfIds");

            idListToAddTo.Add(newId);
            HttpContext.Session.Set("ListOfIds", idListToAddTo);
            return(Redirect($"/home/index"));
        }
Exemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        if (!GameController.active || Input.GetMouseButtonUp(0))
        {
            //Debug.Log("Mouse up!");
            if (selected)
            {
                selected.Deselect();
            }
            selected = null;
        }

        float rotate = Input.GetAxisRaw("Rotate");

        if (rotate != 0)
        {
            //Debug.Log("Rotate is currently " + rotate);
            if (selected)
            {
                selected.Rotate(rotate);
            }
        }
    }
Exemplo n.º 10
0
 static void Main()
 {
     try
     {
         Console.WriteLine("Testing serialization");
         DataContractSerializer formatter = new DataContractSerializer(typeof(Junk));
         MemoryStream           stream    = new MemoryStream();
         Junk junk = new Junk();
         junk.Name  = "Junk";
         junk.Value = 15;
         formatter.WriteObject(stream, junk);
         Console.WriteLine("Wrote object to stream");
         stream.Seek(0, SeekOrigin.Begin);
         Junk savedJunk = formatter.ReadObject(stream) as Junk;
         Console.WriteLine("Deserialized name = {0}", savedJunk.Name);
         Console.WriteLine("Deserialized value = {0}", savedJunk.Value);
         Console.WriteLine("Testing complete");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.WriteLine(ex.StackTrace);
     }
 }
Exemplo n.º 11
0
    //  Get @n items in inventory corresponding to the @item:
    //      if there are @n items,
    //      otherwise null.
    public List <Item> GetItems(Item item, int n)
    {
        List <Item> list = new List <Item>();
        Consumable  c    = item as Consumable;

        if (c != null)
        {
            foreach (Consumable tmp in consumables)
            {
                if (tmp.IsSameAs(c) && n > 0)
                {
                    list.Add(tmp);
                    n--;
                }
            }
        }
        Gear g = item as Gear;

        if (g != null)
        {
            foreach (Gear tmp in equipment)
            {
                if (tmp.IsSameAs(g) && n > 0)
                {
                    list.Add(tmp);
                    n--;
                }
            }
        }
        Resource r = item as Resource;

        if (r != null)
        {
            foreach (Resource tmp in resources)
            {
                if (tmp.IsSameAs(r) && n > 0)
                {
                    list.Add(tmp);
                    n--;
                }
            }
        }
        Junk j = item as Junk;

        if (j != null)
        {
            foreach (Junk tmp in junks)
            {
                if (tmp.IsSameAs(j) && n > 0)
                {
                    list.Add(tmp);
                    n--;
                }
            }
        }
        if (n != 0)
        {
            return(null);
        }
        else
        {
            return(list);
        }
    }
Exemplo n.º 12
0
 public AddJunk(Junk junk)
 {
     Junk = junk;
 }
Exemplo n.º 13
0
 private void Start()
 {
     junkItem = allPossibleJunk[Random.Range(0, allPossibleJunk.Length)];
     GetComponent <SpriteRenderer>().sprite = junkItem.sprite;
 }
Exemplo n.º 14
0
        private void Compile(object data)
        {
            int progress = 4;

            string outputName = Junk.RandomString(25) + ".exe";

            SetProgressBar(0, progress);
            SetStatus("Unzipping..");
            HackFile hackFile  = (HackFile)data;
            string   directory = string.Concat(Path.GetFileNameWithoutExtension(fileName), "/");
            char     encKey    = Junk.RandomString(1).ToCharArray()[0];

            hackFile.Unzip(directory, encKey);
            StringEnc.SetKey(encKey);

            SetProgressBar(1, progress);
            SetStatus("Randomizing and Encrypting..");

            string str1 = string.Concat(Path.GetFileNameWithoutExtension(fileName), "_R/");

            hackFile.RandomizeAllFiles(directory, str1);
            SetProgressBar(2, progress);

            SetStatus("Compiling..");
            string str2 = string.Concat(Path.GetDirectoryName(txtCompilerPath.Text), "\\");

            ProcessStartInfo processStartInfo = new ProcessStartInfo()
            {
                FileName = "cmd.exe"
            };

            string str3 = "/C ";

            str3 = string.Concat(str3, "cd ", str1, "&");
            str3 = string.Concat(str3, "\"", str2, "vcvars32.bat\"&");
            string str4 = str3;

            string[] strArrays = new string[] { str4, "\"", str2, "cl.exe\" ", txtCompilerArgs.Text };

            str3 = string.Concat(strArrays);
            if (!chkboxDebug.Checked)
            {
                processStartInfo.UseShellExecute       = false;
                processStartInfo.RedirectStandardInput = true;
                processStartInfo.WindowStyle           = ProcessWindowStyle.Hidden;
                processStartInfo.CreateNoWindow        = true;
            }
            else
            {
                str3 = string.Concat(str3, "&pause");
            }

            processStartInfo.Arguments = str3;
            // MessageBox.Show(str3);
            Process.Start(processStartInfo).WaitForExit();
            SetProgressBar(3, progress);
            SetStatus("Finishing up..");

            if (File.Exists(outputName))
            {
                File.Delete(outputName);
            }

            bool flag = false;

            if (File.Exists(string.Concat(str1, outEXEName)))
            {
                File.Move(string.Concat(str1, outEXEName), outputName);
                flag = true;
            }

            if (chkBoxDeleteFolders.Checked)
            {
                Directory.Delete(directory, true);
                Directory.Delete(str1, true);
            }

            SetProgressBar(4, progress);
            SetStatus("Done with " + safeFileName);


            if (!flag)
            {
                if (chkBox_PromptMsg.Checked)
                {
                    MessageBox.Show("Something went wrong when compiling the randomized source!", "Error");
                }
            }
            else
            {
                if (chkBox_PromptMsg.Checked)
                {
                    MessageBox.Show(string.Concat("File saved as: ", outputName), "Compiling has been completed.");
                }

                if (num_Copies.Value == 1)
                {
                    if (chkBox_PromptMsg.Checked)
                    {
                        DialogResult msgBox = MessageBox.Show("Would you like to run this right now?", "Question", MessageBoxButtons.YesNo);

                        if (msgBox == System.Windows.Forms.DialogResult.Yes)
                        {
                            processStartInfo = new ProcessStartInfo()
                            {
                                FileName = outputName
                            };

                            Process.Start(processStartInfo).WaitForExit();
                        }
                    }
                }
            }

            isCompiling = false;
        }
Exemplo n.º 15
0
    private void LoadGame()
    {
        GameData data = SaveSystem.Load();

        if (data != null)
        {
            PlayerController.IS_FIRST_GAME = data.is_firstGame;
            loaded = data;
            PlayerController.Player.currentStats[(int)StatType.Health] = data.health;
            PlayerController.Player.currentStats[(int)StatType.Hunger] = data.hunger;
            PlayerController.Player.currentStats[(int)StatType.Thirst] = data.thirst;
            PlayerController.Player.currentStats[(int)StatType.Energy] = data.energy;

            UpdateGameClock(data.gameClock);

            foreach (string s in data.consumables)
            {
                Consumable c = Instantiate(Resources.Load("Items/Consumables/" + s) as Consumable);
                if (c != null)
                {
                    InventoryManager.Inventory.AddItem(c);
                }
            }

            for (int i = 0; i < data.equipment.Count; i++)
            {
                Gear g = Instantiate(Resources.Load("Items/Gear/" + data.equipment[i]) as Gear);
                g.liveGear = data.equipementLife[i];
                if (g != null)
                {
                    InventoryManager.Inventory.AddItem(g);
                }
            }

            foreach (string s in data.junks)
            {
                Junk j = Instantiate(Resources.Load("Items/Junks/" + s) as Junk);
                if (j != null)
                {
                    InventoryManager.Inventory.AddItem(j);
                }
            }
            foreach (string s in data.resources)
            {
                Resource r = Instantiate(Resources.Load("Items/Resources/" + s) as Resource);
                if (r != null)
                {
                    InventoryManager.Inventory.AddItem(r);
                }
            }

            for (int i = 0; i < data.equippedGear.Count; i++)
            {
                Gear equipped = Resources.Load("Items/Gear/" + data.equippedGear[i]) as Gear;
                if (equipped != null)
                {
                    Debug.Log(equipped + " is equipped");
                    foreach (Gear g in InventoryManager.Inventory.GetItems(typeof(Gear)))
                    {
                        if (g.IsSameAs(equipped) && g.liveGear == data.equippedGearLife[i])
                        {
                            Debug.Log(g + " is equivalent to " + equipped);
                            PlayerController.Player.EquipGear(g);
                        }
                    }
                }
            }

            Debug.Log("Save loaded!");
            NewGame = false;

            if (data.isSleeping)
            {
                BackgroundTasks.Tasks.IsSleeping    = true;
                BackgroundTasks.Tasks.StartSleeping = GameData.ConvertStringToDateTime(data.sleepingStartTime);
                BackgroundTasks.Tasks.EndSleeping   = GameData.ConvertStringToDateTime(data.sleepingEndTime);
            }

            /*=====    SCAVENGING    =======*/
            if (data.isScavenging)
            {
                BackgroundTasks.Tasks.actualScavengingStep = data.scavengingActualStep;
                BackgroundTasks.Tasks.totalScavengingSteps = data.scavengingTotalSteps;

                Scavenging scavenging = new Scavenging();
                //load itemsfound
                List <(Item item, Item.ItemClass itemClass)> itemsFound = new List <(Item item, Item.ItemClass itemClass)>();
                for (int i = 0; i < data.scavengingItemsFound_itemName.Count; i++)
                {
                    Item.ItemClass itemC = Item.ConvertStringToItemCLass(data.scavengingItemsFound_itemClass[i]);
                    itemsFound.Add((Item.LoadItem(data.scavengingItemsFound_itemName[i], itemC), itemC));
                }

                scavenging.itemsFound   = itemsFound;
                scavenging.scavengeLog  = data.ScavengeLog;
                scavenging.oldStatusBar = (data.scavengingOldStatusBar[0], data.scavengingOldStatusBar[1],
                                           data.scavengingOldStatusBar[2], data.scavengingOldStatusBar[3]);

                BackgroundTasks.Tasks.lastScavenging = scavenging;

                List <DateTime> scavengepalier = new List <DateTime>();
                foreach (var palier in data.scavengingPalier)
                {
                    scavengepalier.Add(GameData.ConvertStringToDateTime(palier));
                }


                if (data.scavengingStartTime != null && data.scavengingEndTime != null)
                {
                    BackgroundTasks.Tasks.StartScavenging = GameData.ConvertStringToDateTime(data.scavengingStartTime);
                    BackgroundTasks.Tasks.EndScavenging   = GameData.ConvertStringToDateTime(data.scavengingEndTime);
                    Debug.Log("After loading : " + BackgroundTasks.Tasks.StartScavenging + " - " + BackgroundTasks.Tasks.EndScavenging);
                }


                BackgroundTasks.Tasks.scavengingPalier = scavengepalier;
                BackgroundTasks.Tasks.IsScavenging     = true;
            }
            else
            {
                BackgroundTasks.Tasks.IsScavenging = false;
            }
            Debug.Log("New State Of IsScavenging because loaddata" + BackgroundTasks.Tasks.IsScavenging);

            /*========    END SCAVENGING    ========*/
        }
        else
        {
            NewGame = true;
        }
    }
Exemplo n.º 16
0
        protected void CheckAll()
        {
            bool      i;
            ParseItem fromStack;
            string    str;
            string    str1 = "";

            // Check for strings
            if (Match("\""))
            {
                int currentCursor = cursor;
                for (i = false; !i; i = fileData[currentCursor - 1] != '\\')
                {
                    currentCursor++;
                    currentCursor = fileData.IndexOf("\"", currentCursor);

                    if (currentCursor == -1)
                    {
                        break;
                    }
                }

                if (i == true)
                {
                    string literal = ToLiteral(fileData.Substring(cursor + 1, currentCursor - cursor - 1));

                    if (literal == "Failed")
                    {
                        MessageBox.Show("Error at cursor position: " + currentCursor.ToString());
                        return;
                    }

                    if (!escapeString)
                    {
                        cursor = currentCursor + 1;
                    }
                    else
                    {
                        // Handle replacing strings with Decrypt method
                        int    litLength     = literal.Length;
                        string decryptString = "Decrypt(" + litLength.ToString();

                        int[] encrypted = StringEnc.Encrypt(literal);

                        for (int currentLit = 0; currentLit < literal.Length; currentLit++)
                        {
                            decryptString += "," + encrypted[currentLit];
                        }

                        decryptString += ")";
                        SafeRemove(cursor, currentCursor - cursor + 1);
                        SafeInsert(cursor, decryptString);
                    }
                }
            }
            // Check for tags
            if (Match("["))
            {
                int num1 = fileData.IndexOf("]", cursor + 1);
                str1 = fileData.Substring(cursor + 1, num1 - cursor - 1);
                string[] tagArgs = str1.Split(new char[] { ' ' });
                string   tag     = tagArgs[0];

                if (IsTag(tag))
                {
                    SafeRemove(cursor, num1 - cursor + 1);
                    bool   flag = (str1.EndsWith("/") ? false : !str1.StartsWith("/"));
                    string str4 = tag;
                    string str5 = str4;

                    if (str4 != null)
                    {
                        switch (str5)
                        {
                        case "junk_enable":
                        {
                            junkEnabled      = true;
                            junkDeclaresOnly = false;

                            // If arguments are listed, (min and max lines)
                            if (tagArgs.Length != 3)
                            {
                                if (tagArgs.Length != 4)
                                {
                                    break;
                                }
                                this.junkMinLines = int.Parse(tagArgs[1]);
                                this.junkMaxLines = int.Parse(tagArgs[2]);
                                break;
                            }
                            else
                            {
                                // One parameter
                                junkMaxLines = junkMinLines = int.Parse(tagArgs[1]);
                                break;
                            }
                        }

                        case "add_junk":
                        {
                            int minLines = 5;
                            int maxLines = 10;

                            if (tagArgs.Length == 3)
                            {
                                maxLines = minLines = int.Parse(tagArgs[1]);
                            }
                            else if (tagArgs.Length == 4)
                            {
                                minLines = int.Parse(tagArgs[1]);
                                maxLines = int.Parse(tagArgs[2]);
                            }
                            SafeInsert(cursor, Junk.GenerateCode(minLines, maxLines));
                            break;
                        }

                        case "add_junk_datamembers":
                        {
                            int minLines = 5;
                            int maxLines = 10;

                            if (tagArgs.Length == 3)
                            {
                                maxLines = minLines = int.Parse(tagArgs[1]);
                            }
                            else if (tagArgs.Length == 4)
                            {
                                minLines = int.Parse(tagArgs[1]);
                                maxLines = int.Parse(tagArgs[2]);
                            }
                            SafeInsert(cursor, Junk.GenerateDeclares(minLines, maxLines, false));
                            break;
                        }

                        case "add_junk_function":
                        {
                            int minArgs = 1;
                            int maxArgs = 6;

                            if (tagArgs.Length == 3)
                            {
                                maxArgs = minArgs = int.Parse(tagArgs[1]);
                            }
                            else if (tagArgs.Length == 4)
                            {
                                minArgs = int.Parse(tagArgs[1]);
                                maxArgs = int.Parse(tagArgs[2]);
                            }
                            SafeInsert(cursor, Junk.GenerateFunctions(minArgs, maxArgs));
                            break;
                        }

                        case "add_junk_lambda":
                        {
                            int minArgs = 1;
                            int maxArgs = 6;

                            if (tagArgs.Length == 3)
                            {
                                maxArgs = minArgs = int.Parse(tagArgs[1]);
                            }
                            else if (tagArgs.Length == 4)
                            {
                                minArgs = int.Parse(tagArgs[1]);
                                maxArgs = int.Parse(tagArgs[2]);
                            }
                            SafeInsert(cursor, Junk.GenerateLambda(minArgs, maxArgs));
                            break;
                        }

                        case "enc_string_enable":
                        {
                            escapeString = true;
                            break;
                        }

                        case "enc_string_disable":
                        {
                            escapeString = false;
                            break;
                        }

                        case "/swap_lines":
                        {
                            fromStack = GetFromStack("swap_lines");
                            string str6 = fileData.Substring(fromStack.pos, cursor - fromStack.pos);

                            string[] newLine    = new string[] { "\n" };
                            string[] strArrays1 = str6.Split(newLine, StringSplitOptions.None);
                            string[] strArrays2 = new string[(int)strArrays1.Length - 2];

                            for (int k = 1; k < (int)strArrays1.Length - 1; k++)
                            {
                                strArrays2[k - 1] = strArrays1[k];
                            }

                            strArrays2 = RandomStringArrays.RandomizeStrings(strArrays2);
                            str        = string.Concat(Environment.NewLine, string.Join(Environment.NewLine, strArrays2), Environment.NewLine);
                            SafeRemove(fromStack.pos, fileData.Substring(fromStack.pos, cursor - fromStack.pos).Length);
                            cursor = fromStack.pos;
                            SafeInsert(fromStack.pos, str);

                            break;
                        }
                        }
                    }

                    if (flag)
                    {
                        ParseItem parseItem = new ParseItem(tag, cursor);
                        parseStack.Push(parseItem);
                    }
                    return;
                }
            }

            if (Match(";"))
            {
                int num6 = fileData.IndexOf("\n", cursor + 1);
                if (junkEnabled)
                {
                    cursor = num6 + 1;
                    SafeInsert(cursor, AddCode());
                }
            }
        }
Exemplo n.º 17
0
 public static void SetJunk(Junk junk)
 {
     selected = junk;
 }
Exemplo n.º 18
0
 private void testShitHereToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MessageBox.Show(Junk.GenerateCode());
 }
Exemplo n.º 19
0
 public void _SetExplosive()
 {
     Junk.SetActive(true);
     Structure.SetActive(false);
 }