示例#1
0
	public static void Main ()
	{
		Call (delegate (MainClass o) {
			n = o;
			MainClass n = new MainClass ();
		});
	}
        public static void Run()
        {
            var setCtx = typeof(TestExecutionContext).GetMethod ("SetCurrentContext", BindingFlags.Static | BindingFlags.NonPublic);
            setCtx.Invoke (null, new object[] { new TestExecutionContext () });

            var main = new MainClass ();
            main.TestServer ();
        }
        public void ShouldAcceptUpperAndLowerCaseLetters()
        {
            var main = new MainClass();
            var expected = "Player 1 wins!";

            var actual = main.RockPaperScissors("ROCK", "ScIsSoRs");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ShouldReturnDrawRockvsRock()
        {
            var main = new MainClass();
            var expected = "It is a tie!";

            var actual = main.RockPaperScissors("rock", "rock");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ShouldReturnErrorIfNotCorrectOptionForPlayerTwo()
        {
            var main = new MainClass();
            var expected = "You must enter rock, paper or scissors.";

            var actual = main.RockPaperScissors("rock", "oranges");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ShouldReturnOneWinsRockvsScissors()
        {
            var main = new MainClass();
            var expected = "Player 1 wins!";

            var actual = main.RockPaperScissors("rock", "scissors");

            CollectionAssert.AreEqual(expected, actual);
        }
示例#7
0
	public static int Main ()
	{
		var obj = new MainClass ();
		var s = "x";
		var res = (string) obj ?? s;
		if (res != "x")
			return 1;

		return 0;
	}
示例#8
0
 public void Init(MainClass Main)
 {
     //Text reading and intro setup.
     string text = "";
     using (StreamReader r = new StreamReader("res/readme.txt")) {
         text = r.ReadToEnd();
     }
     _ren = new FullScreenTextRender(text, Brushes.Gold, Brushes.Indigo);
     Main.Mouse.ButtonDown += ButtonDown;
 }
示例#9
0
    public static MainClass Build(decimal g, int G)
    {
        // Long processing !!!
        // Many validations
        var mainClass = new MainClass();
        mainClass.g = g;
        mainClass.G = G;

        return mainClass;
    }
示例#10
0
        public static void Main(string[] args)
        {
            Console.Write ("Enter Port: ");
            string port = Console.ReadLine ();

            Console.Write ("Enter Baud Rate: ");
            string baudRate = Console.ReadLine ();

            MainClass main = new MainClass (port, Int32.Parse (baudRate));
            main.Forward (1.0);
        }
示例#11
0
	public static void Main()
	{
		MainClass mc = new MainClass ();
		VoidDelegate del = new VoidDelegate (delegate {
			StringSender ss = delegate (string s) {
				SimpleCallback(mc, s);
			};
			ss("Yo!");
		});
		del();
	}
        public void RegisterInstance_InstanceIsInStore()
        {
            // Assign
            DefaultDependencyContainer container = new DefaultDependencyContainer(this.store);
            MainClass instance = new MainClass();

            // Act
            container.RegisterInstance(typeof(IMainClass), instance);

            // Assert
            Assert.AreEqual(1, this.store.Count);
        }
 public SplashScreen(MainClass main)
 {
     //
         // Required for Windows Form Designer support
         //
         InitializeComponent();
         this.mainClass = main;
         radioButton3.Checked = true;
         checkBox1.Checked = true;
         mainClass.GameFormSize = new Size(1024,768);
         mainClass.FullScreen = true;
 }
示例#14
0
        public override AstNode VisitMainClass(MainClass ast)
        {
            //main class must be the first class.
            Debug.Assert(m_types.Count == 0);
            var name = ast.Name.Value;

            var mainclassType = new CodeClassType() { Name = name, IsStatic = true };

            m_types.Add(mainclassType);
            ast.Type = mainclassType;

            return ast;
        }
示例#15
0
文件: test-543.cs 项目: nobled/mono
 public static void Main(string[] args)
 {
     MainClass t = new MainClass();
     t [2, "foo", "doo"] = 2;
     t [3, new object[3]] = null;
     t [2, new int[] { 1 }, new string[] { "c", "b", "a" }] = null;
     t [0, true] = t [0, true];
     t [1, false, "foo"] = t [0, false, "foo", "doo"];
     
     ExternClass e = new ExternClass ();
     e ["a", "b", "b"] = false;
     
     BetterMethod bm = new BetterMethod ();
     Console.WriteLine (bm[true, false]);
 }
示例#16
0
    //Requette
    //Constructeur
    /* public SerialPort getPort()
    {

        return port;
    }*/
    static void Main(string[] args)
    {
        MainClass mClass = new MainClass ();
        mClass.sensor = KinectSensor.KinectSensors [0];
        mClass.sensor.Start ();
        VoiceCommander voiceCommander = new VoiceCommander ("start", "close", "move");
        voiceCommander.OrderDetected += mClass.voiceCommander_OrderDetected;

        voiceCommander.Start (mClass.sensor);
           // mClass.getPort().Open();
        while (true)
        {

        }
    }
		public void IfNotNullTest()
		{
			// Nothing null.
			DummyObject dummy = new DummyObject();
			MainClass notNull = new MainClass
			{
				Inner = new InnerClass
				{
					Dummy = dummy
				}
			};
			DummyObject inner = notNull.IfNotNull( x => x.Inner ).IfNotNull( x => x.Dummy );
			Assert.AreEqual( dummy, inner );

			// Halfway null.
			MainClass halfwayNull = new MainClass
			{
				Inner = new InnerClass()
			};
			inner = halfwayNull.IfNotNull( x => x.Inner ).IfNotNull( x => x.Dummy );
			Assert.IsNull( inner );

			// All null.
			MainClass isNull = null;
			inner = isNull.IfNotNull( x => x.Inner ).IfNotNull( x => x.Dummy );
			Assert.IsNull( inner );

			// Value type.
			const int setValue = 10;
			MainClass value = new MainClass
			{
				Inner = new InnerClass
				{
					Dummy = new DummyObject
					{
						Value = setValue
					}
				}
			};
			int innerValue = value.IfNotNull( x => x.Inner ).IfNotNull( x => x.Dummy ).IfNotNull( x => x.Value );
			Assert.AreEqual( setValue, innerValue );
		}
示例#18
0
 static void Main(string[] args)
 {
     string code = @"
     program p
     {
     declaration
     double x = 3,14;
     double x1 = 2;
     double y = -5;
     double t;
     double z1;
     evaluation
     t = 3 + 2;
     z1 = x + x1;
     output
     print(z1);
     }";
     MainClass mc = new MainClass();
     mc.CompileIt(code);
 }
示例#19
0
        static void Main()
        {
            var scanner = new Scanner( @"Rules\Main.txt" );
            var parser = new Parser( scanner );

            parser.Parse();

            var mainClass = new MainClass();

            try
            {
                Console.WriteLine( mainClass.Main( new object[] { "Id", "Name" } ) );
            }
            catch (Exception e)
            {
                Console.WriteLine( e );
            }
            var code = new Generator().Generate( null, parser.ruleClassStatement, "test.rule" ).ToString();

            using (var stream = new StreamWriter( "../../GeneratedClass.cs" ))
            {
                stream.WriteLine( code );
            }
        }
示例#20
0
        public static int Invoke(bool debug, bool verbose, string imagePath)
        {
            MainClass.PrintCopyright();

            if (debug)
            {
                DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }

            if (verbose)
            {
                DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }

            Statistics.AddCommand("image-info");

            DicConsole.DebugWriteLine("Analyze command", "--debug={0}", debug);
            DicConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath);
            DicConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose);

            var     filtersList = new FiltersList();
            IFilter inputFilter = filtersList.GetFilter(imagePath);

            if (inputFilter == null)
            {
                DicConsole.ErrorWriteLine("Cannot open specified file.");

                return((int)ErrorNumber.CannotOpenFile);
            }

            try
            {
                IMediaImage imageFormat = ImageFormat.Detect(inputFilter);

                if (imageFormat == null)
                {
                    DicConsole.WriteLine("Image format not identified.");

                    return((int)ErrorNumber.UnrecognizedFormat);
                }

                DicConsole.WriteLine("Image format identified by {0} ({1}).", imageFormat.Name, imageFormat.Id);
                DicConsole.WriteLine();

                try
                {
                    if (!imageFormat.Open(inputFilter))
                    {
                        DicConsole.WriteLine("Unable to open image format");
                        DicConsole.WriteLine("No error given");

                        return((int)ErrorNumber.CannotOpenFormat);
                    }

                    ImageInfo.PrintImageInfo(imageFormat);

                    Statistics.AddMediaFormat(imageFormat.Format);
                    Statistics.AddMedia(imageFormat.Info.MediaType, false);
                    Statistics.AddFilter(inputFilter.Name);
                }
                catch (Exception ex)
                {
                    DicConsole.ErrorWriteLine("Unable to open image format");
                    DicConsole.ErrorWriteLine("Error: {0}", ex.Message);
                    DicConsole.DebugWriteLine("Image-info command", "Stack trace: {0}", ex.StackTrace);

                    return((int)ErrorNumber.CannotOpenFormat);
                }
            }
            catch (Exception ex)
            {
                DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
                DicConsole.DebugWriteLine("Image-info command", ex.StackTrace);

                return((int)ErrorNumber.UnexpectedException);
            }

            return((int)ErrorNumber.NoError);
        }
        public void ShouldReturnOneWinsScissorsvsScissors()
        {
            var main = new MainClass();
            var expected = "It is a tie!";

            var actual = main.RockPaperScissors("scissors", "scissors");

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ShouldThrowExceptionEmpty_SetCardinalPoint()
        {
            var ex = Assert.Throws <Exception>(() => MainClass.SetCardinalPoint(' ', _position));

            Assert.That(ex.Message, Is.EqualTo("El comando viene vacío"));
        }
 public static void Main(string[] args)
 {
     MainClass program = new MainClass ();
     program.run ();
 }
示例#24
0
        internal static void ForgeMenuPatch(ForgeMenu __instance)
        {
            try
            {
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                string toSpeak = " ";

                if (__instance.leftIngredientSpot != null && __instance.leftIngredientSpot.containsPoint(x, y))
                {
                    if (__instance.leftIngredientSpot.item == null)
                    {
                        toSpeak = "Input weapon or tool here";
                    }
                    else
                    {
                        Item item = __instance.leftIngredientSpot.item;
                        toSpeak = $"Weapon slot: {item.Stack} {item.DisplayName}";
                    }
                }
                else if (__instance.rightIngredientSpot != null && __instance.rightIngredientSpot.containsPoint(x, y))
                {
                    if (__instance.rightIngredientSpot.item == null)
                    {
                        toSpeak = "Input gemstone here";
                    }
                    else
                    {
                        Item item = __instance.rightIngredientSpot.item;
                        toSpeak = $"Gemstone slot: {item.Stack} {item.DisplayName}";
                    }
                }
                else if (__instance.startTailoringButton != null && __instance.startTailoringButton.containsPoint(x, y))
                {
                    toSpeak = "Star forging button";
                }
                else if (__instance.unforgeButton != null && __instance.unforgeButton.containsPoint(x, y))
                {
                    toSpeak = "Unforge button";
                }
                else if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
                {
                    toSpeak = "Trashcan";
                }
                else if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
                {
                    toSpeak = "ok button";
                }
                else if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
                {
                    toSpeak = "drop item";
                }
                else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[0].containsPoint(x, y))
                {
                    toSpeak = "Left ring Slot";

                    if (Game1.player.leftRing.Value != null)
                    {
                        toSpeak = $"{toSpeak}: {Game1.player.leftRing.Value.DisplayName}";
                    }
                }
                else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[1].containsPoint(x, y))
                {
                    toSpeak = "Right ring Slot";

                    if (Game1.player.rightRing.Value != null)
                    {
                        toSpeak = $"{toSpeak}: {Game1.player.rightRing.Value.DisplayName}";
                    }
                }
                else
                {
                    for (int i = 0; i < __instance.inventory.inventory.Count; i++)
                    {
                        if (!__instance.inventory.inventory[i].containsPoint(x, y))
                        {
                            continue;
                        }

                        if (__instance.inventory.actualInventory[i] == null)
                        {
                            toSpeak = "Empty slot";
                        }
                        else
                        {
                            toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}";
                        }

                        if (forgeMenuQuery != $"{toSpeak}:{i}")
                        {
                            forgeMenuQuery = $"{toSpeak}:{i}";
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }

                        return;
                    }
                }


                if (forgeMenuQuery != toSpeak)
                {
                    forgeMenuQuery = toSpeak;
                    MainClass.ScreenReader.Say(toSpeak, true);

                    if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
                    {
                        Game1.playSound("drop_item");
                    }
                }
            }
            catch (System.Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
示例#25
0
 public void Tick(MainClass Win, double Delta)
 {
 }
示例#26
0
        public override int Invoke(IEnumerable <string> arguments)
        {
            var extra = Options.Parse(arguments);

            if (showHelp)
            {
                Options.WriteOptionDescriptions(CommandSet.Out);
                return((int)ErrorNumber.HelpRequested);
            }

            MainClass.PrintCopyright();
            if (MainClass.Debug)
            {
                DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }
            if (MainClass.Verbose)
            {
                DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }
            Statistics.AddCommand("list-devices");

            string dicRemote = null;

            if (extra.Count > 1)
            {
                DicConsole.ErrorWriteLine("Too many arguments.");
                return((int)ErrorNumber.UnexpectedArgumentCount);
            }

            if (extra.Count == 1)
            {
                dicRemote = extra[0];
            }

            DicConsole.DebugWriteLine("List-Devices command", "--debug={0}", MainClass.Debug);
            DicConsole.DebugWriteLine("List-Devices command", "--verbose={0}", MainClass.Verbose);

            var devices = Device.ListDevices(dicRemote);

            if (devices == null || devices.Length == 0)
            {
                DicConsole.WriteLine("No known devices attached.");
            }
            else
            {
                devices = devices.OrderBy(d => d.Path).ToArray();

                if (dicRemote is null)
                {
                    DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", "Path", "Vendor", "Model",
                                         "Serial", "Bus", "Supported?");
                    DicConsole.WriteLine("{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", "----------------------",
                                         "----------------", "------------------------", "------------------------",
                                         "----------", "----------");
                    foreach (var dev in devices)
                    {
                        DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", dev.Path, dev.Vendor,
                                             dev.Model, dev.Serial, dev.Bus, dev.Supported);
                    }
                }
                else
                {
                    DicConsole.WriteLine("{0,-48}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", "Path", "Vendor", "Model",
                                         "Serial", "Bus", "Supported?");
                    DicConsole.WriteLine("{0,-48}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}",
                                         "------------------------------------------------",
                                         "----------------", "------------------------", "------------------------",
                                         "----------", "----------");
                    foreach (var dev in devices)
                    {
                        DicConsole.WriteLine("{0,-48}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", dev.Path, dev.Vendor,
                                             dev.Model, dev.Serial, dev.Bus, dev.Supported);
                    }
                }
            }

            return((int)ErrorNumber.NoError);
        }
示例#27
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     MainClass.addItemWindow(ItemList);
 }
示例#28
0
 public Program(MainClass main)
 {
     this.main = main;
 }
示例#29
0
        // TODO: Create Command interface
        public DataTable executeStatement(string strSql)
        {
            DataTable dtReturn = new DataTable();

            // TODO: Think how to track multiple tables/TableContexts
            // Note that the constructor will set up the table named
            // in the SELECT statement in _table.
            CommandParts selectParts = new CommandParts(_database, _table, strSql, CommandParts.COMMAND_TYPES.SELECT);

            if (MainClass.bDebug)
            {
                string strDebug = "SELECT: " + selectParts.strSelect + "\n";
                strDebug += "FROM: " + selectParts.strFrom + "\n";
                if (!string.IsNullOrEmpty(selectParts.strInnerJoinKludge))
                {
                    strDebug += "INNER JOIN: " + selectParts.strInnerJoinKludge + "\n";
                }
                strDebug += "WHERE: " + selectParts.strWhere + "\n";    // Note that WHEREs aren't applied to inner joined tables right now.
                strDebug += "ORDER BY: " + selectParts.strOrderBy + "\n";

                SqlDbSharpLogger.LogMessage(strDebug, "SelectCommand executeStatement");
            }

            _table = _database.getTableByName(selectParts.strTableName);
            Queue <TableContext> qAllTables = new Queue <TableContext>();

            qAllTables.Enqueue(_table);
            dtReturn = _initDataTable(selectParts);

            WhereProcessor.ProcessRows(ref dtReturn, _table, selectParts);


            //=====================================================================
            // POST-PROCESS INNER JOINS
            // (Joins are only in selects, so this isn't part of WhereProcessing.)
            //
            // To take account of joins, we basically need to create a SelectParts
            // per inner join.  So we need to create a WHERE from the table we
            // just selected and then send those values down to a new _selectRows.
            //=====================================================================
            if (selectParts.strInnerJoinKludge.Length > 0)
            {
                if (selectParts.qInnerJoinFields.Count < 1)
                {
                    selectParts.qInnerJoinFields.EnqueueIfNotContains("*");  // Kludge for "SELECT * FROM Table1 INNER JOIN..." or "SELECT test, * From...", etc
                }

                // TODO: Why aren't we just throwing in the whole selectParts again?
                dtReturn = _processInnerJoin(qAllTables, dtReturn, selectParts.strInnerJoinKludge, selectParts.strTableName, selectParts.strOrderBy, selectParts.qInnerJoinFields);

                // Now we need to make sure the order of the DataColumns reflects what we had
                // in the original SQL. At least initially, column order wasn't guaranteed in
                // _processInnerJoin, as it would add columns first for the "main" table and then
                // for each "inner SELECT".
                string strFromSelect = string.Join(", ", selectParts.qstrAllColumnNames.ToArray());
                string strInTable    = string.Join(", ", dtReturn.Columns.Cast <DataColumn>().Select(c => c.ColumnName).ToArray());
                MainClass.logIt(string.Format(@"Select fields: {0}
Fields pushed into dtReturn: {1}", strFromSelect, strInTable));

                try
                {
                    string[] astrFromSelect = selectParts.qstrAllColumnNames.ToArray();
                    for (int i = 0; i < astrFromSelect.Length; i++)
                    {
                        dtReturn.Columns[astrFromSelect[i]].SetOrdinal(i);
                    }

                    // TODO: There are better ways to do this.
                    // TODO: Figure out if this handles all fuzzy name translations
                    // earlier in the SELECT process.
                    if (selectParts.lstrJoinONLYFields.Count() > 0)
                    {
                        foreach (string colName in selectParts.lstrJoinONLYFields)
                        {
                            dtReturn.Columns.Remove(colName);
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new SyntaxException("Problem reordering columns in inner join -- " + e.ToString());
                }
            }
            //=====================================================================
            // EO POST-PROCESS INNER JOINS
            //=====================================================================


            // strOrderBy has had all whitespace shortened to one space, so we can get away with the hardcoded 9.
            if (null != selectParts.strOrderBy && selectParts.strOrderBy.Length > 9)
            {
                // ORDER BY needs to make sure it's not sorting on a fuzzy named column
                // that may not have been explicitly selected in the SELECT.
                string[] astrOrderByFields = selectParts.strOrderBy.Substring(9).Split(',');    // Substring(9) to get rid of "ORDER BY " <<< But, ultimately, why not tokenize here too?
                string   strCleanedOrderBy = string.Empty;

                foreach (string orderByClause in astrOrderByFields)
                {
                    bool ascNotDesc = true;

                    string strOrderByClause = orderByClause.Trim();
                    string strField         = orderByClause.Trim();

                    if (strField.Split().Length > 1)
                    {
                        strField = strOrderByClause.Substring(0, strOrderByClause.IndexOf(' ')).Trim();
                        string strAscDesc = strOrderByClause.Substring(strOrderByClause.IndexOf(' ')).Trim();
                        ascNotDesc = (-1 == strAscDesc.IndexOf("DESC", StringComparison.CurrentCultureIgnoreCase));
                    }

                    strOrderByClause += ",";    // This is the default value if there's no fuzziness, and it needs the comma put back.

                    // TODO: Integrate fields prefixed by specific table names.
                    if (!dtReturn.Columns.Contains(strField))
                    {
                        // Check for fuzziness.
                        foreach (TableContext table in qAllTables)
                        {
                            if (!table.containsColumn(strField, false) && table.containsColumn(strField, true))
                            {
                                strOrderByClause = table.getRawColName(strField)
                                                   + (ascNotDesc ? " ASC" : " DESC")
                                                   + ",";
                                break;
                            }
                        }
                    }

                    strCleanedOrderBy += " " + strOrderByClause;
                }

                dtReturn.DefaultView.Sort = strCleanedOrderBy.Trim(',');
                dtReturn = dtReturn.DefaultView.ToTable();
            }

            if (selectParts.dictRawNamesToASNames.Count > 0)
            {
                try
                {
                    foreach (KeyValuePair <string, string> kvp in selectParts.dictRawNamesToASNames)
                    {
                        dtReturn.Columns[kvp.Key].ColumnName = kvp.Value;
                    }
                }
                catch (Exception e)
                {
                    throw new SyntaxException("Illegal AS usage: " + e.ToString());
                }
            }

            return(dtReturn);
        }
示例#30
0
        private DataTable _processInnerJoin(Queue <TableContext> qAllTables, DataTable dtReturn, string strJoinText,
                                            string strParentTable, string strOrderBy, Queue <string> qInnerJoinFields)
        {
            SqlDbSharpLogger.LogMessage("Note that WHERE clauses are not yet applied to JOINed tables.", "SelectCommnd _processInnerJoin");

            string strNewTable = null;
            string strNewField = null;
            string strOldField = null;
            string strOldTable = null;

            string strErrLoc = "init";

            Queue <string> qColsToSelectInNewTable = new Queue <string>();

            MainClass.logIt("join fields: " + string.Join("\n", qInnerJoinFields.ToArray()));

            try
            {
                strJoinText = System.Text.RegularExpressions.Regex.Replace(strJoinText, @"\s\n+", " ");
                string[] astrInnerJoins = strJoinText.ToLower().Split(new string[] { "inner join" }, StringSplitOptions.RemoveEmptyEntries);
                Dictionary <string, DataTable> dictTables = new Dictionary <string, DataTable>();
                dictTables.Add(strParentTable.ToLower(), dtReturn);

                strErrLoc = "starting inner join array";
                foreach (string strInnerJoin in astrInnerJoins)
                {
                    // "from table1 inner join" <<< already removed
                    // "table2 on table1.field = table2.field2"
                    string[] astrTokens = strInnerJoin.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                    if (!"=".Equals(astrTokens[3]))
                    {
                        throw new Exception("We're only supporting inner equi joins right now: " + strInnerJoin);
                    }

                    // Kludge alert -- must have table prefixes for now.
                    if (!astrTokens[2].Contains(".") || !astrTokens[4].Contains("."))
                    {
                        throw new Exception(string.Format(
                                                "For now, joined fields must include table prefixes: {0} {1}",
                                                astrTokens[2],
                                                astrTokens[2])
                                            );
                    }

                    strErrLoc = "determine old and new tables and fields";
                    string field1Parent = astrTokens[2].Substring(0, astrTokens[2].IndexOf("."));
                    string field2Parent = astrTokens[4].Substring(0, astrTokens[4].IndexOf("."));
                    string field1       = astrTokens[2].Substring(astrTokens[2].IndexOf(".") + 1);
                    string field2       = astrTokens[4].Substring(astrTokens[4].IndexOf(".") + 1);

                    if (dictTables.ContainsKey(field1Parent))   // TODO: Should probably check to see if they're both known and at least bork.
                    {
                        strNewTable = field2Parent;
                        strNewField = field2;
                        strOldTable = field1Parent;
                        strOldField = field1;
                    }
                    else
                    {
                        strNewTable = field1Parent;
                        strNewField = field1;
                        strOldTable = field2Parent;
                        strOldField = field2;
                    }

                    MainClass.logIt(string.Format(@"old table: {0} 
old field: {1} 
new table: {2} 
new field: {3}",
                                                  strOldTable, strOldField, strNewTable, strNewField));

                    string strInClause = string.Empty;

                    TableContext tableOld = _database.getTableByName(strOldTable);
                    TableContext tableNew = _database.getTableByName(strNewTable);
                    qAllTables.Enqueue(tableNew);   // we need this to figure out column parents later.

                    // Now that we know the new table to add, we need to get a list of columns
                    // to select from it.
                    // Sources for these fields could be...
                    // 1.) The joining field.
                    // 2.) ORDER BY fields for the entire statement
                    // 3.) conventional SELECT fields.
                    //
                    // To prevent column name collision, let's go ahead and prefix them
                    // all with the table name.  A little unexpected, but a decent shortcut
                    // for now, I think.

                    strErrLoc = "beginning inner join select construction";

                    // 1.) Add the joining field.
                    qColsToSelectInNewTable.EnqueueIfNotContains(strNewField);

                    // 2.) ORDER BY fields that belong to this table.
                    if (!string.IsNullOrWhiteSpace(strOrderBy))
                    {
                        MainClass.logIt(strOrderBy);

                        strErrLoc = "constructing order by";
                        string[] astrOrderTokens = strOrderBy.StringToNonWhitespaceTokens2();
                        for (int i = 2; i < astrOrderTokens.Length; i++)
                        {
                            string strOrderField = astrOrderTokens[i].Trim(' ', ',');
                            string strOrderTable = strNewTable; // just to pretend. We'll skip it if the field doesn't exist here.  Course this means we might dupe some non-table prefixed fields.

                            if (strOrderField.Contains("."))
                            {
                                strOrderTable = strOrderField.Substring(0, strOrderField.IndexOf("."));
                                strOrderField = strOrderField.Substring(strOrderField.IndexOf(".") + 1);
                            }

                            if (strNewTable.Equals(strOrderTable, StringComparison.CurrentCultureIgnoreCase) &&
                                !tableNew.containsColumn(strOrderField, false) &&
                                tableNew.containsColumn(strOrderField, true))
                            {
                                qColsToSelectInNewTable.EnqueueIfNotContains(strNewTable + "." + strOrderField);
                            }
                        }
                    }

                    // 3.) Conventional SELECT fields
                    strErrLoc = "Creating select clause";
                    if (qInnerJoinFields.Count > 0)
                    {
                        if (qInnerJoinFields.Any(fld => fld.Equals(strNewTable + ".*", StringComparison.CurrentCultureIgnoreCase) || fld.Equals("*")))
                        {
                            qColsToSelectInNewTable.EnqueueIfNotContains("*");
                        }
                        else
                        {
                            foreach (string strTableDotCol in qInnerJoinFields)
                            {
                                string[] astrTableDotCol = strTableDotCol.Split('.');
                                if (strNewTable.Equals(astrTableDotCol[0], StringComparison.CurrentCultureIgnoreCase))
                                {
                                    MainClass.logIt("Adding field to join SELECT: " + astrTableDotCol[1].ScrubValue());
                                    qColsToSelectInNewTable.EnqueueIfNotContains(astrTableDotCol[1].ScrubValue()); // again, offensive parsing is the rule.
                                }
                            }
                        }
                    }

                    // TODO: Consider grabbing every column up front, perhaps, and
                    // then cutting out those columns that we didn't select -- but
                    // do SELECT fields as a post-processing task, rather than this
                    // inline parsing. Also allows us to bork on fields that aren't
                    // in tables a little easier; right now you could include bogus
                    // joined fields without error.

                    dictTables[strOldTable].CaseSensitive = false;  // TODO: If we keep this, do it in a smarter place.
                    // Right now, strOldField has the name that's in the DataTable from the previous select.

                    strErrLoc = @"Create WHERE IN clause for join ""inner"" SELECT";
                    // Now construct the `WHERE joinedField IN (X,Y,Z)` portion of the inner select
                    // we're about to fire off.
                    string strOperativeOldField = strOldField;
                    if (!dictTables[strOldTable].Columns.Contains(strOldField))
                    {
                        // Allow fuzzy names in join, if not the DataTable -- yet.
                        strOperativeOldField = tableOld.getRawColName(strOldField);
                    }

                    if (MainClass.bDebug)
                    {
                        Console.WriteLine("Looking for " + strOperativeOldField + " in the columns");
                        foreach (DataColumn column in dictTables[strOldTable].Columns)
                        {
                            Console.WriteLine(column.ColumnName);
                        }
                    }

                    foreach (DataRow row in dictTables[strOldTable].Rows)
                    {
                        strInClause += row[strOperativeOldField].ToString() + ",";
                    }

                    strErrLoc   = "Completing SELECT construction";
                    strInClause = strInClause.Trim(',');
                    if (string.IsNullOrEmpty(strInClause))
                    {
                        dtReturn = new DataTable();
                    }
                    else
                    {
                        MainClass.logIt("Columns in inner JOIN select: " + string.Join(", ", qColsToSelectInNewTable.ToArray()));
                        string strInnerSelect = string.Format("SELECT {0} FROM {1} WHERE {2} IN ({3});",
                                                              string.Join(",", qColsToSelectInNewTable.ToArray()),
                                                              strNewTable,
                                                              strNewField,
                                                              strInClause
                                                              );
                        qColsToSelectInNewTable = new Queue <string>();
                        strErrLoc = strInnerSelect;

                        // TODO: Figure out the best time to handle the portion of the WHERE
                        // that impacts the tables mentioned in the join portion of the SQL.
                        // Note: I think now we treat it just like the ORDER BY.  Not that
                        // complicated to pull out table-specific WHERE fields and send along
                        // with the reconsitituted "inner" SQL statement.

                        MainClass.logIt("Inner join: " + strInnerSelect + "\n\n", "select command _processInnerJoin");

                        SelectCommand selectCommand = new SelectCommand(_database);
                        object        objReturn     = selectCommand.executeStatement(strInnerSelect);

                        if (objReturn is DataTable)
                        {
                            DataTable dtInnerJoinResult = (DataTable)objReturn;
                            dtReturn = InfrastructureUtils.equijoinTables(
                                dtReturn,
                                dtInnerJoinResult,
                                strOperativeOldField,
                                strNewField
                                );
                        }
                        else
                        {
                            strErrLoc = "Datatable not returned: " + strInnerSelect;
                            throw new SyntaxException("Illegal inner select: " + strInnerSelect);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (e.GetType() == typeof(SyntaxException))
                {
                    throw e;
                }
                else
                {
                    throw new SyntaxException(string.Format(@"Uncaptured join syntax error -- {0}: 
{1} 
{2}", strErrLoc, strJoinText, e.ToString()));
                }
            }

            return(dtReturn);
        }
 private void GetPositionRover()
 {
     MainClass.AddDraph(mapPositions, mapStatus, width);
 }
示例#32
0
        static void CheckMediaCardType(string devPath, Device dev)
        {
            byte   feature = 0;
            string strDev;
            int    item;

parameters:
            while (true)
            {
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                DicConsole.WriteLine("Parameters for CHECK MEDIA CARD TYPE command:");
                DicConsole.WriteLine("Feature: {0}", feature);
                DicConsole.WriteLine();
                DicConsole.WriteLine("Choose what to do:");
                DicConsole.WriteLine("1.- Change parameters.");
                DicConsole.WriteLine("2.- Send command with these parameters.");
                DicConsole.WriteLine("0.- Return to Media Card Pass Through commands menu.");

                strDev = System.Console.ReadLine();
                if (!int.TryParse(strDev, out item))
                {
                    DicConsole.WriteLine("Not a number. Press any key to continue...");
                    System.Console.ReadKey();
                    continue;
                }

                switch (item)
                {
                case 0:
                    DicConsole.WriteLine("Returning to Media Card Pass Through commands menu...");
                    return;

                case 1:
                    DicConsole.Write("Feature?: ");
                    strDev = System.Console.ReadLine();
                    if (!byte.TryParse(strDev, out feature))
                    {
                        DicConsole.WriteLine("Not a number. Press any key to continue...");
                        feature = 0;
                        System.Console.ReadKey();
                    }

                    break;

                case 2: goto start;
                }
            }

start:
            System.Console.Clear();
            bool sense = dev.CheckMediaCardType(feature, out AtaErrorRegistersChs errorRegisters, dev.Timeout,
                                                out double duration);

menu:
            DicConsole.WriteLine("Device: {0}", devPath);
            DicConsole.WriteLine("Sending CHECK MEDIA CARD TYPE to the device:");
            DicConsole.WriteLine("Command took {0} ms.", duration);
            DicConsole.WriteLine("Sense is {0}.", sense);
            DicConsole.WriteLine("CHECK MEDIA CARD TYPE status registers:");
            DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
            DicConsole.WriteLine();
            DicConsole.WriteLine("Choose what to do:");
            DicConsole.WriteLine("1.- Send command again.");
            DicConsole.WriteLine("2.- Change parameters.");
            DicConsole.WriteLine("0.- Return to Media Card Pass Through commands menu.");
            DicConsole.Write("Choose: ");

            strDev = System.Console.ReadLine();
            if (!int.TryParse(strDev, out item))
            {
                DicConsole.WriteLine("Not a number. Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                goto menu;
            }

            switch (item)
            {
            case 0:
                DicConsole.WriteLine("Returning to Media Card Pass Through commands menu...");
                return;

            case 1: goto start;

            case 2: goto parameters;

            default:
                DicConsole.WriteLine("Incorrect option. Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                goto menu;
            }
        }
示例#33
0
 public IGameState LeaveTo(MainClass Win)
 {
     Win.Mouse.ButtonDown -= ButtonDown;
     return _next;
 }
示例#34
0
    public static void Main()
    {
        MainClass mc = new MainClass();

        TechnicalTeam techManager   = new TechnicalTeam();
        MarketingTeam marketManager = new MarketingTeam();

        //Technical Manager sets the target
        techManager.setTarget(3000);

        //Marketing Manager sets the target
        marketManager.setTarget(50);

login:

        Console.WriteLine("******************************LOGIN PORTAL***********************************");
        Console.WriteLine("Enter the name : ");
        String name = Console.ReadLine();

        Console.WriteLine("Enter the password : "******"Enter the details of the Technical Employee to Review");
            Console.Write("Enter the name");
            Console.WriteLine();
            tt.Name = Console.ReadLine();
            Console.Write("Enter the GID");
            tt.GID = Int32.Parse(Console.ReadLine());
            Console.WriteLine();
            Console.Write("Enter the Bill Amount");
            tt.billAmt = Int32.Parse(Console.ReadLine());
            Console.WriteLine();
tech:
            Console.WriteLine("Enter the number of technology upgrages");
            tt.techNum = Int32.Parse(Console.ReadLine());
            if (tt.techNum > 3)
            {
                Console.WriteLine("Cannot have upgrades more than 3");
                goto tech;
            }
cert:
            Console.WriteLine("Enter the number of certificates");
            tt.certNum = Int32.Parse(Console.ReadLine());
            if (tt.certNum > 1)
            {
                Console.WriteLine("Cannot have certtificates more than 1");
                goto cert;
            }

            Console.WriteLine();

            Console.WriteLine("Enter the details of the Marketing Employee to Review");
            Console.Write("Enter the name");
            mt.Name = Console.ReadLine();
            Console.WriteLine();
            Console.Write("Enter the GID");
            mt.GID = Int32.Parse(Console.ReadLine());
            Console.WriteLine();
            Console.WriteLine("Enter the Business Volume");
            mt.busVolume = Int32.Parse(Console.ReadLine());
            Console.WriteLine();

            mc.evaluateTechPer(tt, techManager);

            mc.evaluateMarkPer(mt, marketManager);
        }
        else
        {
            Console.WriteLine("Invalid User..!!");
            goto login;
        }
    }
示例#35
0
        internal static void AnimalQueryMenuPatch(AnimalQueryMenu __instance, bool ___confirmingSell, FarmAnimal ___animal, TextBox ___textBox, string ___parentName)
        {
            try
            {
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true);                                               // Mouse x and y position
                bool   isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed();                                         // For narrating animal details
                bool   isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box
                string toSpeak = " ", details = " ";

                if (___textBox.Selected)
                {
                    toSpeak = ___textBox.Text;

                    if (isEscPressed)
                    {
                        ___textBox.Selected = false;
                    }
                }
                else
                {
                    if (isCPressed & !isNarratingAnimalInfo)
                    {
                        string name    = ___animal.displayName;
                        string type    = ___animal.displayType;
                        int    age     = (___animal.GetDaysOwned() + 1) / 28 + 1;
                        string ageText = (age <= 1) ? Game1.content.LoadString("Strings\\UI:AnimalQuery_Age1") : Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeN", age);
                        string parent  = "";
                        if ((int)___animal.age.Value < (byte)___animal.ageWhenMature.Value)
                        {
                            ageText += Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeBaby");
                        }
                        if (___parentName != null)
                        {
                            parent = Game1.content.LoadString("Strings\\UI:AnimalQuery_Parent", ___parentName);
                        }

                        details = $"Name: {name} Type: {type} \n\t Age: {ageText} {parent}";
                        animalQueryMenuQuery = " ";

                        isNarratingAnimalInfo = true;
                        Task.Delay(200).ContinueWith(_ => { isNarratingAnimalInfo = false; });
                    }

                    if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
                    {
                        toSpeak = "OK button";
                    }
                    else if (__instance.sellButton != null && __instance.sellButton.containsPoint(x, y))
                    {
                        toSpeak = $"Sell for {___animal.getSellPrice()}g button";
                    }
                    else if (___confirmingSell && __instance.yesButton != null && __instance.yesButton.containsPoint(x, y))
                    {
                        toSpeak = "Confirm selling animal";
                    }
                    else if (___confirmingSell && __instance.noButton != null && __instance.noButton.containsPoint(x, y))
                    {
                        toSpeak = "Cancel selling animal";
                    }
                    else if (__instance.moveHomeButton != null && __instance.moveHomeButton.containsPoint(x, y))
                    {
                        toSpeak = "Change home building button";
                    }
                    else if (__instance.allowReproductionButton != null && __instance.allowReproductionButton.containsPoint(x, y))
                    {
                        toSpeak = ((___animal.allowReproduction.Value) ? "Enabled" : "Disabled") + " allow reproduction button";
                    }
                    else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
                    {
                        toSpeak = "Animal name text box";
                    }
                }

                if (animalQueryMenuQuery != toSpeak)
                {
                    animalQueryMenuQuery = toSpeak;
                    MainClass.ScreenReader.Say($"{details} {toSpeak}", true);
                }
            }
            catch (System.Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
示例#36
0
        protected override string ReadSourceCode()
        {
            string file = Path.Combine(NodePath, MainClass.Replace('.', Path.DirectorySeparatorChar) + ".java");

            if (!File.Exists(file))
            {
                return(null);
            }

            //Found the File -> Read!
            string[] lines             = File.ReadAllLines(file);
            int      startLine         = -1;
            int      endLine           = lines.Length - 1;
            int      curlyBreaketsOpen = 0;

            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i];

                //Skip empty lines:
                if (startLine < 0 && string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }

                //First find the start of the Method:
                if (startLine < 0 &&
                    line.Contains("public ") &&
                    line.Contains(" " + Method) &&
                    line.Contains("static ") == IsStatic)
                {
                    startLine          = i;
                    curlyBreaketsOpen += line.Count(c => c == '{');
                    curlyBreaketsOpen -= line.Count(c => c == '}');
                    continue;
                }

                //Now try to find the End:
                if (startLine >= 0)
                {
                    curlyBreaketsOpen += line.Count(c => c == '{');
                    curlyBreaketsOpen -= line.Count(c => c == '}');

                    if (curlyBreaketsOpen <= 0)
                    {
                        endLine = i;
                        break;
                    }
                }
            }

            //Did not find start:
            if (startLine < 0)
            {
                return(lines.StringJoin(Environment.NewLine));
            }

            //Get only the lines wanted:
            return(lines
                   .Skip(startLine)
                   .Take(endLine - startLine + 1)
                   .StringJoin(Environment.NewLine));
        }
示例#37
0
        internal static void PondQueryMenuPatch(PondQueryMenu __instance, StardewValley.Object ____fishItem, FishPond ____pond, string ____statusText, bool ___confirmingEmpty)
        {
            try
            {
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                bool   isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed();
                string toSpeak = " ", extra = "";

                if (___confirmingEmpty)
                {
                    if (__instance.yesButton != null && __instance.yesButton.containsPoint(x, y))
                    {
                        toSpeak = "Confirm button";
                    }
                    else if (__instance.noButton != null && __instance.noButton.containsPoint(x, y))
                    {
                        toSpeak = "Cancel button";
                    }
                }
                else
                {
                    if (isCPressed && !isNarratingPondInfo)
                    {
                        string pond_name_text       = Game1.content.LoadString("Strings\\UI:PondQuery_Name", ____fishItem.DisplayName);
                        string population_text      = Game1.content.LoadString("Strings\\UI:PondQuery_Population", string.Concat(____pond.FishCount), ____pond.maxOccupants.Value);
                        bool   has_unresolved_needs = ____pond.neededItem.Value != null && ____pond.HasUnresolvedNeeds() && !____pond.hasCompletedRequest.Value;
                        string bring_text           = "";

                        if (has_unresolved_needs && ____pond.neededItem.Value != null)
                        {
                            bring_text = Game1.content.LoadString("Strings\\UI:PondQuery_StatusRequest_Bring") + $": {____pond.neededItemCount} {____pond.neededItem.Value.DisplayName}";
                        }

                        extra = $"{pond_name_text} {population_text} {bring_text} Status: {____statusText}";
                        pondQueryMenuQuery = " ";

                        isNarratingPondInfo = true;
                        Task.Delay(200).ContinueWith(_ => { isNarratingPondInfo = false; });
                    }

                    if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
                    {
                        toSpeak = "Ok button";
                    }
                    else if (__instance.changeNettingButton != null && __instance.changeNettingButton.containsPoint(x, y))
                    {
                        toSpeak = "Change netting button";
                    }
                    else if (__instance.emptyButton != null && __instance.emptyButton.containsPoint(x, y))
                    {
                        toSpeak = "Empty pond button";
                    }
                }

                if (pondQueryMenuQuery != toSpeak)
                {
                    pondQueryMenuQuery = toSpeak;
                    MainClass.ScreenReader.Say(extra + " \n\t" + toSpeak, true);
                }
            }
            catch (System.Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
示例#38
0
 /// <summary>
 /// Shutdowns this instance.
 /// </summary>
 public static void Shutdown()
 {
     MainClass.Shutdown();
 }
        public void GoForwardNorthOnePosition_GoForward()
        {
            PositionModel position = new PositionModel
            {
                X             = 0,
                Y             = 0,
                CardinalPoint = "NORTE"
            };
            PositionModel expected = new PositionModel
            {
                X             = 0,
                Y             = 1,
                CardinalPoint = "NORTE"
            };
            PositionModel actual = MainClass.GoForward(position);

            Assert.AreEqual(expected.Y, actual.Y);
            Assert.AreEqual(expected.X, actual.X);
            Assert.AreEqual(expected.CardinalPoint, actual.CardinalPoint);


            position = new PositionModel
            {
                X             = 0,
                Y             = 0,
                CardinalPoint = "SUR"
            };
            expected = new PositionModel
            {
                X             = 0,
                Y             = -1,
                CardinalPoint = "SUR"
            };
            actual = MainClass.GoForward(position);
            Assert.AreEqual(expected.Y, actual.Y);
            Assert.AreEqual(expected.X, actual.X);
            Assert.AreEqual(expected.CardinalPoint, actual.CardinalPoint);

            position = new PositionModel
            {
                X             = 0,
                Y             = 0,
                CardinalPoint = "OESTE"
            };
            expected = new PositionModel
            {
                X             = -1,
                Y             = 0,
                CardinalPoint = "OESTE"
            };
            actual = MainClass.GoForward(position);
            Assert.AreEqual(expected.Y, actual.Y);
            Assert.AreEqual(expected.X, actual.X);
            Assert.AreEqual(expected.CardinalPoint, actual.CardinalPoint);

            position = new PositionModel
            {
                X             = 0,
                Y             = 0,
                CardinalPoint = "ESTE"
            };
            expected = new PositionModel
            {
                X             = 1,
                Y             = 0,
                CardinalPoint = "ESTE"
            };
            actual = MainClass.GoForward(position);
            Assert.AreEqual(expected.Y, actual.Y);
            Assert.AreEqual(expected.X, actual.X);
            Assert.AreEqual(expected.CardinalPoint, actual.CardinalPoint);
        }
示例#40
0
 /// <summary>
 /// Restarts this instance.
 /// </summary>
 public static void Restart()
 {
     MainClass.Restart();
 }
示例#41
0
        public override AstNode VisitMainClass(MainClass ast)
        {
            m_currentType = ast.Type as CodeClassType;

            Debug.Assert(m_currentType.Methods.Count == 0);
            Debug.Assert(m_currentType.StaticMethods.Count == 1);
            m_currentMethod = m_currentType.StaticMethods[0];
            m_currentVariableIndex = 0;
            m_currentMethodParameters = new VariableCollection<Parameter>() { new Parameter() { Name = ast.ArgName.Value, Type = ArrayType.StrArray } };
            m_currentMethodVariables = new VariableCollection<VariableInfo>();

            foreach (var statement in ast.Statements)
            {
                Visit(statement);
            }

            return ast;
        }
示例#42
0
        public static int Invoke(bool debug, bool verbose, string encoding, bool xattrs, string imagePath,
                                 string @namespace, string outputDir, string options)
        {
            MainClass.PrintCopyright();

            if (debug)
            {
                AaruConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }

            if (verbose)
            {
                AaruConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }

            Statistics.AddCommand("extract-files");

            AaruConsole.DebugWriteLine("Extract-Files command", "--debug={0}", debug);
            AaruConsole.DebugWriteLine("Extract-Files command", "--encoding={0}", encoding);
            AaruConsole.DebugWriteLine("Extract-Files command", "--input={0}", imagePath);
            AaruConsole.DebugWriteLine("Extract-Files command", "--options={0}", options);
            AaruConsole.DebugWriteLine("Extract-Files command", "--output={0}", outputDir);
            AaruConsole.DebugWriteLine("Extract-Files command", "--verbose={0}", verbose);
            AaruConsole.DebugWriteLine("Extract-Files command", "--xattrs={0}", xattrs);

            var     filtersList = new FiltersList();
            IFilter inputFilter = filtersList.GetFilter(imagePath);

            Dictionary <string, string> parsedOptions = Core.Options.Parse(options);

            AaruConsole.DebugWriteLine("Extract-Files command", "Parsed options:");

            foreach (KeyValuePair <string, string> parsedOption in parsedOptions)
            {
                AaruConsole.DebugWriteLine("Extract-Files command", "{0} = {1}", parsedOption.Key, parsedOption.Value);
            }

            parsedOptions.Add("debug", debug.ToString());

            if (inputFilter == null)
            {
                AaruConsole.ErrorWriteLine("Cannot open specified file.");

                return((int)ErrorNumber.CannotOpenFile);
            }

            Encoding encodingClass = null;

            if (encoding != null)
            {
                try
                {
                    encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);

                    if (verbose)
                    {
                        AaruConsole.VerboseWriteLine("Using encoding for {0}.", encodingClass.EncodingName);
                    }
                }
                catch (ArgumentException)
                {
                    AaruConsole.ErrorWriteLine("Specified encoding is not supported.");

                    return((int)ErrorNumber.EncodingUnknown);
                }
            }

            PluginBase plugins = GetPluginBase.Instance;

            try
            {
                IMediaImage imageFormat = ImageFormat.Detect(inputFilter);

                if (imageFormat == null)
                {
                    AaruConsole.WriteLine("Image format not identified, not proceeding with analysis.");

                    return((int)ErrorNumber.UnrecognizedFormat);
                }

                if (verbose)
                {
                    AaruConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
                                                 imageFormat.Id);
                }
                else
                {
                    AaruConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
                }

                if (outputDir == null)
                {
                    AaruConsole.WriteLine("Output directory missing.");

                    return((int)ErrorNumber.MissingArgument);
                }

                if (Directory.Exists(outputDir) ||
                    File.Exists(outputDir))
                {
                    AaruConsole.ErrorWriteLine("Destination exists, aborting.");

                    return((int)ErrorNumber.DestinationExists);
                }

                Directory.CreateDirectory(outputDir);

                try
                {
                    if (!imageFormat.Open(inputFilter))
                    {
                        AaruConsole.WriteLine("Unable to open image format");
                        AaruConsole.WriteLine("No error given");

                        return((int)ErrorNumber.CannotOpenFormat);
                    }

                    AaruConsole.DebugWriteLine("Extract-Files command", "Correctly opened image file.");

                    AaruConsole.DebugWriteLine("Extract-Files command", "Image without headers is {0} bytes.",
                                               imageFormat.Info.ImageSize);

                    AaruConsole.DebugWriteLine("Extract-Files command", "Image has {0} sectors.",
                                               imageFormat.Info.Sectors);

                    AaruConsole.DebugWriteLine("Extract-Files command", "Image identifies disk type as {0}.",
                                               imageFormat.Info.MediaType);

                    Statistics.AddMediaFormat(imageFormat.Format);
                    Statistics.AddMedia(imageFormat.Info.MediaType, false);
                    Statistics.AddFilter(inputFilter.Name);
                }
                catch (Exception ex)
                {
                    AaruConsole.ErrorWriteLine("Unable to open image format");
                    AaruConsole.ErrorWriteLine("Error: {0}", ex.Message);

                    return((int)ErrorNumber.CannotOpenFormat);
                }

                List <Partition> partitions = Core.Partitions.GetAll(imageFormat);
                Core.Partitions.AddSchemesToStats(partitions);

                if (partitions.Count == 0)
                {
                    AaruConsole.DebugWriteLine("Ls command", "No partitions found");

                    partitions.Add(new Partition
                    {
                        Description = "Whole device",
                        Length      = imageFormat.Info.Sectors,
                        Offset      = 0,
                        Size        = imageFormat.Info.SectorSize * imageFormat.Info.Sectors,
                        Sequence    = 1,
                        Start       = 0
                    });
                }

                AaruConsole.WriteLine("{0} partitions found.", partitions.Count);

                for (int i = 0; i < partitions.Count; i++)
                {
                    AaruConsole.WriteLine();
                    AaruConsole.WriteLine("Partition {0}:", partitions[i].Sequence);

                    AaruConsole.WriteLine("Identifying filesystem on partition");

                    Core.Filesystems.Identify(imageFormat, out List <string> idPlugins, partitions[i]);

                    if (idPlugins.Count == 0)
                    {
                        AaruConsole.WriteLine("Filesystem not identified");
                    }
                    else
                    {
                        IReadOnlyFilesystem plugin;
                        Errno error;

                        if (idPlugins.Count > 1)
                        {
                            AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins");

                            foreach (string pluginName in idPlugins)
                            {
                                if (plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin))
                                {
                                    AaruConsole.WriteLine($"As identified by {plugin.Name}.");

                                    var fs = (IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?.
                                             Invoke(new object[]
                                                    {});

                                    error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions,
                                                     @namespace);

                                    if (error == Errno.NoError)
                                    {
                                        string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME"
                                                                : fs.XmlFsType.VolumeName;

                                        ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);

                                        Statistics.AddFilesystem(fs.XmlFsType.Type);
                                    }
                                    else
                                    {
                                        AaruConsole.ErrorWriteLine("Unable to mount device, error {0}",
                                                                   error.ToString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin);

                            if (plugin == null)
                            {
                                continue;
                            }

                            AaruConsole.WriteLine($"Identified by {plugin.Name}.");

                            var fs = (IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?.
                                     Invoke(new object[]
                                            {});

                            error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace);

                            if (error == Errno.NoError)
                            {
                                string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME"
                                                        : fs.XmlFsType.VolumeName;

                                ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);

                                Statistics.AddFilesystem(fs.XmlFsType.Type);
                            }
                            else
                            {
                                AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AaruConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
                AaruConsole.DebugWriteLine("Extract-Files command", ex.StackTrace);

                return((int)ErrorNumber.UnexpectedException);
            }

            return((int)ErrorNumber.NoError);
        }
 public void TestWoopsaClientSubscriptionDisappearingProperty()
 {
     bool isValueChanged = false;
     MainClass objectServer = new MainClass();
     InnerClass inner = new InnerClass();
     objectServer.Inner = inner;
     using (WoopsaServer server = new WoopsaServer(objectServer))
     {
         using (WoopsaClient client = new WoopsaClient("http://localhost/woopsa"))
         {
             WoopsaBoundClientObject root = client.CreateBoundRoot();
             WoopsaObject Inner = root.Items.ByName(nameof(MainClass.Inner)) as WoopsaObject;
             WoopsaClientProperty propertyInfo = Inner.Properties.ByName(nameof(InnerClass.Info)) as WoopsaClientProperty;
             WoopsaClientSubscription subscription = propertyInfo.Subscribe(
                 (sender, e) =>
                 {
                     isValueChanged = true;
                 },
                 TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(20));
             inner.Info = "Test";
             Stopwatch watch = new Stopwatch();
             watch.Start();
             while ((!isValueChanged) && (watch.Elapsed < TimeSpan.FromSeconds(20)))
                 Thread.Sleep(10);
             if (isValueChanged)
                 Console.WriteLine("Notification after {0} ms", watch.Elapsed.TotalMilliseconds);
             else
                 Console.WriteLine("No notification received");
             isValueChanged = false;
             objectServer.Inner = new BaseInnerClass();
     //                    objectServer.Inner = new object();
             while ((!isValueChanged) && (watch.Elapsed < TimeSpan.FromSeconds(20)))
                 Thread.Sleep(10);
             subscription.Unsubscribe();
             Assert.AreEqual(true, isValueChanged);
         }
     }
 }
示例#44
0
        internal static void JunimoNoteMenuPatch(JunimoNoteMenu __instance, bool ___specificBundlePage, int ___whichArea, Bundle ___currentPageBundle)
        {
            try
            {
                int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                if (!___specificBundlePage)
                {
                    currentIngredientListItem = -1;
                    isUsingCustomButtons      = false;

                    string areaName = __instance.scrambledText ? CommunityCenter.getAreaEnglishDisplayNameFromNumber(___whichArea) : CommunityCenter.getAreaDisplayNameFromNumber(___whichArea);
                    string reward   = __instance.getRewardNameForArea(___whichArea);

                    if (__instance.scrambledText)
                    {
                        string toSpeak = "Scrambled Text";
                        if (junimoNoteMenuQuery != toSpeak)
                        {
                            junimoNoteMenuQuery = toSpeak;
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }
                        return;
                    }

                    if (currentJunimoArea != areaName)
                    {
                        currentJunimoArea = areaName;
                        MainClass.DebugLog(areaName);
                        MainClass.ScreenReader.Say($"Area {areaName}, {reward}", true);
                        return;
                    }

                    for (int i = 0; i < __instance.bundles.Count; i++)
                    {
                        if (__instance.bundles[i].containsPoint(x, y))
                        {
                            string toSpeak = $"{__instance.bundles[i].name} bundle";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                    }
                    if (__instance.presentButton != null && __instance.presentButton.containsPoint(x, y))
                    {
                        string toSpeak = "Present Button";
                        if (junimoNoteMenuQuery != toSpeak)
                        {
                            junimoNoteMenuQuery = toSpeak;
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }
                        return;
                    }
                    if (__instance.fromGameMenu)
                    {
                        if (__instance.areaNextButton.visible && __instance.areaNextButton.containsPoint(x, y))
                        {
                            string toSpeak = "Next Area Button";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                        if (__instance.areaBackButton.visible && __instance.areaBackButton.containsPoint(x, y))
                        {
                            string toSpeak = "Previous Area Button";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                    }
                }
                else
                {
                    bool isIPressed         = MainClass.Config.BundleMenuIngredientsInputSlotKey.JustPressed(); // For the ingredients
                    bool isCPressed         = MainClass.Config.BundleMenuInventoryItemsKey.JustPressed();       // For the items in inventory
                    bool isPPressed         = MainClass.Config.BundleMenuPurchaseButtonKey.JustPressed();       // For the Purchase Button
                    bool isVPressed         = MainClass.Config.BundleMenuIngredientsInputSlotKey.JustPressed(); // For the ingredient input slots
                    bool isBackPressed      = MainClass.Config.BundleMenuBackButtonKey.JustPressed();           // For the back button
                    bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);

                    if (isIPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 0, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isVPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 1, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isCPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 2, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isBackPressed && __instance.backButton != null && !__instance.backButton.containsPoint(x, y))
                    {
                        __instance.backButton.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say("Back Button", true);
                    }
                    else if (isPPressed && __instance.purchaseButton != null && !__instance.purchaseButton.containsPoint(x, y))
                    {
                        __instance.purchaseButton.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say("Purchase Button", true);
                    }
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
 public void ShouldNotThrowException_SetCardinalPoint()
 {
     Assert.DoesNotThrow(() => MainClass.SetCardinalPoint('I', _position));
     Assert.DoesNotThrow(() => MainClass.SetCardinalPoint('D', _position));
 }
示例#46
0
        public override int Invoke(IEnumerable <string> arguments)
        {
            List <string> extra = Options.Parse(arguments);

            if (showHelp)
            {
                Options.WriteOptionDescriptions(CommandSet.Out);
                return((int)ErrorNumber.HelpRequested);
            }

            MainClass.PrintCopyright();
            if (MainClass.Debug)
            {
                DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }
            if (MainClass.Verbose)
            {
                DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }
            Statistics.AddCommand("print-hex");

            if (extra.Count > 1)
            {
                DicConsole.ErrorWriteLine("Too many arguments.");
                return((int)ErrorNumber.UnexpectedArgumentCount);
            }

            if (extra.Count == 0)
            {
                DicConsole.ErrorWriteLine("Missing input image.");
                return((int)ErrorNumber.MissingArgument);
            }

            if (startSector is null)
            {
                DicConsole.ErrorWriteLine("Missing starting sector.");
                return((int)ErrorNumber.MissingArgument);
            }

            inputFile = extra[0];

            DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", MainClass.Debug);
            DicConsole.DebugWriteLine("PrintHex command", "--input={0}", inputFile);
            DicConsole.DebugWriteLine("PrintHex command", "--length={0}", length);
            DicConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", longSectors);
            DicConsole.DebugWriteLine("PrintHex command", "--start={0}", startSector);
            DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", MainClass.Verbose);
            DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", widthBytes);

            FiltersList filtersList = new FiltersList();
            IFilter     inputFilter = filtersList.GetFilter(inputFile);

            if (inputFilter == null)
            {
                DicConsole.ErrorWriteLine("Cannot open specified file.");
                return((int)ErrorNumber.CannotOpenFile);
            }

            IMediaImage inputFormat = ImageFormat.Detect(inputFilter);

            if (inputFormat == null)
            {
                DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying");
                return((int)ErrorNumber.UnrecognizedFormat);
            }

            inputFormat.Open(inputFilter);

            for (ulong i = 0; i < length; i++)
            {
                DicConsole.WriteLine("Sector {0}", startSector + i);

                if (inputFormat.Info.ReadableSectorTags == null)
                {
                    DicConsole
                    .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");
                    longSectors = false;
                }
                else
                {
                    if (inputFormat.Info.ReadableSectorTags.Count == 0)
                    {
                        DicConsole
                        .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");
                        longSectors = false;
                    }
                }

                byte[] sector = longSectors
                                    ? inputFormat.ReadSectorLong(startSector.Value + i)
                                    : inputFormat.ReadSector(startSector.Value + i);

                PrintHex.PrintHexArray(sector, widthBytes);
            }

            return((int)ErrorNumber.NoError);
        }
示例#47
0
        static void TranslateSectorLba(string devPath, Device dev)
        {
            uint   lba = 0;
            string strDev;
            int    item;

parameters:
            while (true)
            {
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                DicConsole.WriteLine("Parameters for TRANSLATE SECTOR command:");
                DicConsole.WriteLine("LBA: {0}", lba);
                DicConsole.WriteLine();
                DicConsole.WriteLine("Choose what to do:");
                DicConsole.WriteLine("1.- Change parameters.");
                DicConsole.WriteLine("2.- Send command with these parameters.");
                DicConsole.WriteLine("0.- Return to CompactFlash commands menu.");

                strDev = System.Console.ReadLine();
                if (!int.TryParse(strDev, out item))
                {
                    DicConsole.WriteLine("Not a number. Press any key to continue...");
                    System.Console.ReadKey();
                    continue;
                }

                switch (item)
                {
                case 0:
                    DicConsole.WriteLine("Returning to CompactFlash commands menu...");
                    return;

                case 1:
                    DicConsole.Write("What logical block address?: ");
                    strDev = System.Console.ReadLine();
                    if (!uint.TryParse(strDev, out lba))
                    {
                        DicConsole.WriteLine("Not a number. Press any key to continue...");
                        lba = 0;
                        System.Console.ReadKey();
                        continue;
                    }

                    if (lba > 0xFFFFFFF)
                    {
                        DicConsole
                        .WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
                                   0xFFFFFFF);
                        lba = 0xFFFFFFF;
                    }
                    break;

                case 2: goto start;
                }
            }

start:
            System.Console.Clear();
            bool sense = dev.TranslateSector(out byte[] buffer, out AtaErrorRegistersLba28 errorRegisters, lba,
                                             dev.Timeout, out double duration);

menu:
            DicConsole.WriteLine("Device: {0}", devPath);
            DicConsole.WriteLine("Sending TRANSLATE SECTOR to the device:");
            DicConsole.WriteLine("Command took {0} ms.", duration);
            DicConsole.WriteLine("Sense is {0}.", sense);
            DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
            DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
            DicConsole.WriteLine();
            DicConsole.WriteLine("Choose what to do:");
            DicConsole.WriteLine("1.- Print buffer.");
            DicConsole.WriteLine("2.- Decode error registers.");
            DicConsole.WriteLine("3.- Send command again.");
            DicConsole.WriteLine("4.- Change parameters.");
            DicConsole.WriteLine("0.- Return to CompactFlash commands menu.");
            DicConsole.Write("Choose: ");

            strDev = System.Console.ReadLine();
            if (!int.TryParse(strDev, out item))
            {
                DicConsole.WriteLine("Not a number. Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                goto menu;
            }

            switch (item)
            {
            case 0:
                DicConsole.WriteLine("Returning to CompactFlash commands menu...");
                return;

            case 1:
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                DicConsole.WriteLine("TRANSLATE SECTOR response:");
                if (buffer != null)
                {
                    PrintHex.PrintHexArray(buffer, 64);
                }
                DicConsole.WriteLine("Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                goto menu;

            case 2:
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                DicConsole.WriteLine("TRANSLATE SECTOR status registers:");
                DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
                DicConsole.WriteLine("Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                DicConsole.WriteLine("Device: {0}", devPath);
                goto menu;

            case 3: goto start;

            case 4: goto parameters;

            default:
                DicConsole.WriteLine("Incorrect option. Press any key to continue...");
                System.Console.ReadKey();
                System.Console.Clear();
                goto menu;
            }
        }
示例#48
0
        public static int Invoke(bool verbose, bool debug, string encoding, bool filesystems, bool partitions,
                                 string imagePath)
        {
            MainClass.PrintCopyright();

            if (debug)
            {
                AaruConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }

            if (verbose)
            {
                AaruConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }

            Statistics.AddCommand("analyze");

            AaruConsole.DebugWriteLine("Analyze command", "--debug={0}", debug);
            AaruConsole.DebugWriteLine("Analyze command", "--encoding={0}", encoding);
            AaruConsole.DebugWriteLine("Analyze command", "--filesystems={0}", filesystems);
            AaruConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath);
            AaruConsole.DebugWriteLine("Analyze command", "--partitions={0}", partitions);
            AaruConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose);

            var     filtersList = new FiltersList();
            IFilter inputFilter = filtersList.GetFilter(imagePath);

            if (inputFilter == null)
            {
                AaruConsole.ErrorWriteLine("Cannot open specified file.");

                return((int)ErrorNumber.CannotOpenFile);
            }

            Encoding encodingClass = null;

            if (encoding != null)
            {
                try
                {
                    encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);

                    if (verbose)
                    {
                        AaruConsole.VerboseWriteLine("Using encoding for {0}.", encodingClass.EncodingName);
                    }
                }
                catch (ArgumentException)
                {
                    AaruConsole.ErrorWriteLine("Specified encoding is not supported.");

                    return((int)ErrorNumber.EncodingUnknown);
                }
            }

            PluginBase plugins = GetPluginBase.Instance;

            bool checkRaw = false;

            try
            {
                IMediaImage imageFormat = ImageFormat.Detect(inputFilter);

                if (imageFormat == null)
                {
                    AaruConsole.WriteLine("Image format not identified, not proceeding with analysis.");

                    return((int)ErrorNumber.UnrecognizedFormat);
                }

                if (verbose)
                {
                    AaruConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
                                                 imageFormat.Id);
                }
                else
                {
                    AaruConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
                }

                AaruConsole.WriteLine();

                try
                {
                    if (!imageFormat.Open(inputFilter))
                    {
                        AaruConsole.WriteLine("Unable to open image format");
                        AaruConsole.WriteLine("No error given");

                        return((int)ErrorNumber.CannotOpenFormat);
                    }

                    if (verbose)
                    {
                        ImageInfo.PrintImageInfo(imageFormat);
                        AaruConsole.WriteLine();
                    }

                    Statistics.AddMediaFormat(imageFormat.Format);
                    Statistics.AddMedia(imageFormat.Info.MediaType, false);
                    Statistics.AddFilter(inputFilter.Name);
                }
                catch (Exception ex)
                {
                    AaruConsole.ErrorWriteLine("Unable to open image format");
                    AaruConsole.ErrorWriteLine("Error: {0}", ex.Message);
                    AaruConsole.DebugWriteLine("Analyze command", "Stack trace: {0}", ex.StackTrace);

                    return((int)ErrorNumber.CannotOpenFormat);
                }

                List <string> idPlugins;
                IFilesystem   plugin;
                string        information;

                if (partitions)
                {
                    List <Partition> partitionsList = Core.Partitions.GetAll(imageFormat);
                    Core.Partitions.AddSchemesToStats(partitionsList);

                    if (partitionsList.Count == 0)
                    {
                        AaruConsole.DebugWriteLine("Analyze command", "No partitions found");

                        if (!filesystems)
                        {
                            AaruConsole.WriteLine("No partitions founds, not searching for filesystems");

                            return((int)ErrorNumber.NothingFound);
                        }

                        checkRaw = true;
                    }
                    else
                    {
                        AaruConsole.WriteLine("{0} partitions found.", partitionsList.Count);

                        for (int i = 0; i < partitionsList.Count; i++)
                        {
                            AaruConsole.WriteLine();
                            AaruConsole.WriteLine("Partition {0}:", partitionsList[i].Sequence);
                            AaruConsole.WriteLine("Partition name: {0}", partitionsList[i].Name);
                            AaruConsole.WriteLine("Partition type: {0}", partitionsList[i].Type);

                            AaruConsole.WriteLine("Partition start: sector {0}, byte {1}", partitionsList[i].Start,
                                                  partitionsList[i].Offset);

                            AaruConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitionsList[i].Length,
                                                  partitionsList[i].Size);

                            AaruConsole.WriteLine("Partition scheme: {0}", partitionsList[i].Scheme);
                            AaruConsole.WriteLine("Partition description:");
                            AaruConsole.WriteLine(partitionsList[i].Description);

                            if (!filesystems)
                            {
                                continue;
                            }

                            AaruConsole.WriteLine("Identifying filesystem on partition");

                            Core.Filesystems.Identify(imageFormat, out idPlugins, partitionsList[i]);

                            if (idPlugins.Count == 0)
                            {
                                AaruConsole.WriteLine("Filesystem not identified");
                            }
                            else if (idPlugins.Count > 1)
                            {
                                AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins");

                                foreach (string pluginName in idPlugins)
                                {
                                    if (plugins.PluginsList.TryGetValue(pluginName, out plugin))
                                    {
                                        AaruConsole.WriteLine($"As identified by {plugin.Name}.");

                                        plugin.GetInformation(imageFormat, partitionsList[i], out information,
                                                              encodingClass);

                                        AaruConsole.Write(information);
                                        Statistics.AddFilesystem(plugin.XmlFsType.Type);
                                    }
                                }
                            }
                            else
                            {
                                plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);

                                if (plugin == null)
                                {
                                    continue;
                                }

                                AaruConsole.WriteLine($"Identified by {plugin.Name}.");
                                plugin.GetInformation(imageFormat, partitionsList[i], out information, encodingClass);
                                AaruConsole.Write("{0}", information);
                                Statistics.AddFilesystem(plugin.XmlFsType.Type);
                            }
                        }
                    }
                }

                if (checkRaw)
                {
                    var wholePart = new Partition
                    {
                        Name = "Whole device", Length = imageFormat.Info.Sectors,
                        Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
                    };

                    Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);

                    if (idPlugins.Count == 0)
                    {
                        AaruConsole.WriteLine("Filesystem not identified");
                    }
                    else if (idPlugins.Count > 1)
                    {
                        AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins");

                        foreach (string pluginName in idPlugins)
                        {
                            if (plugins.PluginsList.TryGetValue(pluginName, out plugin))
                            {
                                AaruConsole.WriteLine($"As identified by {plugin.Name}.");
                                plugin.GetInformation(imageFormat, wholePart, out information, encodingClass);
                                AaruConsole.Write(information);
                                Statistics.AddFilesystem(plugin.XmlFsType.Type);
                            }
                        }
                    }
                    else
                    {
                        plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);

                        if (plugin != null)
                        {
                            AaruConsole.WriteLine($"Identified by {plugin.Name}.");
                            plugin.GetInformation(imageFormat, wholePart, out information, encodingClass);
                            AaruConsole.Write(information);
                            Statistics.AddFilesystem(plugin.XmlFsType.Type);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AaruConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
                AaruConsole.DebugWriteLine("Analyze command", ex.StackTrace);

                return((int)ErrorNumber.UnexpectedException);
            }

            return((int)ErrorNumber.NoError);
        }
示例#49
0
    public void Street()
    {
        Console.WriteLine(MainClass.g.streetText);

        bool st = false;

        while (st == false)
        {
            string choice = MainClass.p.Interact();

            if (choice == "IRON GATE")
            {
                Console.WriteLine(MainClass.g.gateText);

                choice = MainClass.p.Interact();
                if (choice == "CONFUSE")
                {
                    Console.WriteLine(MainClass.g.confuseText);

                    choice = MainClass.p.Interact();

                    if (choice == "BIG PARTY")
                    {
                        Console.WriteLine(MainClass.g.partyText);

                        MainClass.mansion = true;
                        st = true;
                    }
                    else if (choice == "FAKEY POCKET")
                    {
                        MainClass.p.Ability(choice);

                        if (MainClass.fakeUse == true)
                        {
                            Console.WriteLine(MainClass.g.fakeSuccess);
                            Console.WriteLine("\r\n The guards look at Fakey Pocket and start taking to it like if it was you. That was easy. You go into the mansion, hoping the rest of this heist is as easy.");
                            MainClass.mansion = true;
                            st = true;
                        }
                        else
                        {
                            Console.WriteLine(MainClass.g.fakeFail);
                            Console.WriteLine(MainClass.g.gameOver);
                            st = true;
                        }
                    }
                    else
                    {
                        //Reiterate to the player to type exactly what is written to Interact().
                        Console.WriteLine("You need to be more specific. Don't forget to CAPITALIZE!");
                    }
                }
                else if (choice == "SNEAK")
                {
                    MainClass.p.Ability(choice);

                    if (MainClass.sneakUse == true)
                    {
                        Console.WriteLine(MainClass.g.sneakSuccess);
                        Console.WriteLine("\r\n You take advantage of the fact that the guards are trying to tell the birds on the arch that they are trespassing to do a little trespassing of your own. Into the mansion you go!");
                        MainClass.mansion = true;
                        st = true;
                    }
                    else
                    {
                        Console.WriteLine(MainClass.g.sneakFail);
                        Console.WriteLine(MainClass.g.gameOver);
                        Console.Write("Would you like to play again? Type YES or NO");
                        string restart = Console.ReadLine();
                        if (restart == "YES")
                        {
                            MainClass.Reset();
                        }
                        else
                        {
                            MainClass.End();
                        }
                    }
                }
                else
                {
                    //Reiterate to the player to type exactly what is written to Interact().
                    Console.WriteLine("You need to be more specific. Don't forget to CAPITALIZE!");
                }
            }
            else if (choice == "OPENING")
            {
            }
            else
            {
                //Reiterate to the player to type exactly what is written to Interact().
                Console.WriteLine("You need to be more specific. Don't forget to CAPITALIZE!");
            }
        }
    }
示例#50
0
    static void Main(string[] args)
    {
        MainClass.UnitTest();

        Console.ReadLine();
    }
示例#51
0
 public void Render(MainClass Win)
 {
     _ren.Render(Win);
 }
示例#52
0
        public override int Invoke(IEnumerable <string> arguments)
        {
            List <string> extra = Options.Parse(arguments);

            if (showHelp)
            {
                Options.WriteOptionDescriptions(CommandSet.Out);
                return((int)ErrorNumber.HelpRequested);
            }

            MainClass.PrintCopyright();
            if (MainClass.Debug)
            {
                DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
            }
            if (MainClass.Verbose)
            {
                DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
            }
            Statistics.AddCommand("media-scan");

            if (extra.Count > 1)
            {
                DicConsole.ErrorWriteLine("Too many arguments.");
                return((int)ErrorNumber.UnexpectedArgumentCount);
            }

            if (extra.Count == 0)
            {
                DicConsole.ErrorWriteLine("Missing device path.");
                return((int)ErrorNumber.MissingArgument);
            }

            devicePath = extra[0];

            DicConsole.DebugWriteLine("Media-Scan command", "--debug={0}", MainClass.Debug);
            DicConsole.DebugWriteLine("Media-Scan command", "--device={0}", devicePath);
            DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", ibgLogPath);
            DicConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", mhddLogPath);
            DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", MainClass.Verbose);

            if (devicePath.Length == 2 && devicePath[1] == ':' && devicePath[0] != '/' && char.IsLetter(devicePath[0]))
            {
                devicePath = "\\\\.\\" + char.ToUpper(devicePath[0]) + ':';
            }

            Device dev = new Device(devicePath);

            if (dev.Error)
            {
                DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError);
                return((int)ErrorNumber.CannotOpenDevice);
            }

            Statistics.AddDevice(dev);

            MediaScan scanner = new MediaScan(mhddLogPath, ibgLogPath, devicePath, dev);

            scanner.UpdateStatus          += Progress.UpdateStatus;
            scanner.StoppingErrorMessage  += Progress.ErrorMessage;
            scanner.UpdateProgress        += Progress.UpdateProgress;
            scanner.PulseProgress         += Progress.PulseProgress;
            scanner.InitProgress          += Progress.InitProgress;
            scanner.EndProgress           += Progress.EndProgress;
            System.Console.CancelKeyPress += (sender, e) =>
            {
                e.Cancel = true;
                scanner.Abort();
            };
            ScanResults results = scanner.Scan();

            DicConsole.WriteLine("Took a total of {0} seconds ({1} processing commands).", results.TotalTime,
                                 results.ProcessingTime);
            DicConsole.WriteLine("Average speed: {0:F3} MiB/sec.", results.AvgSpeed);
            DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", results.MaxSpeed);
            DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", results.MinSpeed);
            DicConsole.WriteLine("Summary:");
            DicConsole.WriteLine("{0} sectors took less than 3 ms.", results.A);
            DicConsole.WriteLine("{0} sectors took less than 10 ms but more than 3 ms.", results.B);
            DicConsole.WriteLine("{0} sectors took less than 50 ms but more than 10 ms.", results.C);
            DicConsole.WriteLine("{0} sectors took less than 150 ms but more than 50 ms.", results.D);
            DicConsole.WriteLine("{0} sectors took less than 500 ms but more than 150 ms.", results.E);
            DicConsole.WriteLine("{0} sectors took more than 500 ms.", results.F);
            DicConsole.WriteLine("{0} sectors could not be read.",
                                 results.UnreadableSectors.Count);
            if (results.UnreadableSectors.Count > 0)
            {
                foreach (ulong bad in results.UnreadableSectors)
                {
                    DicConsole.WriteLine("Sector {0} could not be read", bad);
                }
            }

            DicConsole.WriteLine();

            #pragma warning disable RECS0018     // Comparison of floating point numbers with equality operator
            if (results.SeekTotal != 0 || results.SeekMin != double.MaxValue || results.SeekMax != double.MinValue)
                #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
            {
                DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)",
                                     results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000);
            }

            dev.Close();
            return((int)ErrorNumber.NoError);
        }
 /// <summary>
 // Main entry point of the application.
 /// </summary>
 public static void Main()
 {
     MainClass m = new MainClass();
 }
示例#54
0
        public override AstNode VisitMainClass(MainClass ast)
        {
            m_currentType = m_module.DefineType(ast.Type.Name, TypeAttributes.Class | TypeAttributes.Abstract | TypeAttributes.Sealed);
            m_currentMethod = m_currentType.DefineMethod("Main", MethodAttributes.Public | MethodAttributes.Static, typeof(void), new[] { typeof(string[]) });

            m_ilgen = m_currentMethod.GetILGenerator();

            foreach (var s in ast.Statements)
            {
                Visit(s);
            }

            m_ilgen.Emit(OpCodes.Ret);

            m_currentType.CreateType();
            m_mainMethod = m_currentMethod;
            return ast;
        }
示例#55
0
        public bool UploadSP3D(string filePath)
        {
            MainClass main = new MainClass(filePath);
            main.Upload(1);

            return true;
        }
示例#56
0
        internal static void LevelUpMenuPatch(LevelUpMenu __instance, List <int> ___professionsToChoose, List <string> ___leftProfessionDescription, List <string> ___rightProfessionDescription, List <string> ___extraInfoForLevel, List <CraftingRecipe> ___newCraftingRecipes, string ___title, bool ___isActive, bool ___isProfessionChooser)
        {
            try
            {
                int    x = Game1.getMouseX(true), y = Game1.getMouseY(true);
                string leftProfession = " ", rightProfession = " ", extraInfo = " ", newCraftingRecipe = " ", toSpeak = " ";

                if (!__instance.informationUp)
                {
                    return;
                }
                if (__instance.isProfessionChooser)
                {
                    if (___professionsToChoose.Count() == 0)
                    {
                        return;
                    }
                    for (int j = 0; j < ___leftProfessionDescription.Count; j++)
                    {
                        leftProfession += ___leftProfessionDescription[j] + ", ";
                    }
                    for (int i = 0; i < ___rightProfessionDescription.Count; i++)
                    {
                        rightProfession += ___rightProfessionDescription[i] + ", ";
                    }

                    if (__instance.leftProfession.containsPoint(x, y))
                    {
                        if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
                        {
                            Game1.player.professions.Add(___professionsToChoose[0]);
                            __instance.getImmediateProfessionPerk(___professionsToChoose[0]);
                            ___isActive = false;
                            __instance.informationUp = false;
                            ___isProfessionChooser   = false;
                            __instance.RemoveLevelFromLevelList();
                            __instance.exitThisMenu();
                            return;
                        }

                        toSpeak = $"Selected: {leftProfession} Left click to choose.";
                    }

                    if (__instance.rightProfession.containsPoint(x, y))
                    {
                        if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
                        {
                            Game1.player.professions.Add(___professionsToChoose[1]);
                            __instance.getImmediateProfessionPerk(___professionsToChoose[1]);
                            ___isActive = false;
                            __instance.informationUp = false;
                            ___isProfessionChooser   = false;
                            __instance.RemoveLevelFromLevelList();
                            __instance.exitThisMenu();
                            return;
                        }

                        toSpeak = $"Selected: {rightProfession} Left click to choose.";
                    }
                }
                else
                {
                    foreach (string s2 in ___extraInfoForLevel)
                    {
                        extraInfo += s2 + ", ";
                    }
                    foreach (CraftingRecipe s in ___newCraftingRecipes)
                    {
                        string cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_" + (s.isCookingRecipe ? "cooking" : "crafting"));
                        string message           = Game1.content.LoadString("Strings\\UI:LevelUp_NewRecipe", cookingOrCrafting, s.DisplayName);

                        newCraftingRecipe += $"{message}, ";
                    }
                }

                if (__instance.okButton.containsPoint(x, y))
                {
                    if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
                    {
                        __instance.okButtonClicked();
                    }

                    toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close.";
                }

                if (toSpeak != " ")
                {
                    MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
                }
                else if (__instance.isProfessionChooser && currentLevelUpTitle != $"{___title}. Select a new profession.")
                {
                    MainClass.ScreenReader.SayWithMenuChecker($"{___title}. Select a new profession.", true);
                    currentLevelUpTitle = $"{___title}. Select a new profession.";
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
示例#57
0
        public override AstNode VisitMainClass(MainClass ast)
        {
            var mainMethod = new Method() { Name = "Main", IsStatic = true };
            mainMethod.ReturnType = PrimaryType.Void;

            var codeType = ast.Type as CodeClassType;

            codeType.StaticMethods.Add(mainMethod);

            return ast;
        }
示例#58
0
        private static void JunimoNoteCustomButtons(JunimoNoteMenu __instance, Bundle ___currentPageBundle, int signal, bool isLeftShiftPressed = false)
        {
            try
            {
                switch (signal)
                {
                case 0:     // For ingredient list
                {
                    if (___currentPageBundle.ingredients.Count >= 0)
                    {
                        currentIngredientListItem = currentIngredientListItem + (isLeftShiftPressed ? -1 : 1);
                        if (currentIngredientListItem >= ___currentPageBundle.ingredients.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientListItem = ___currentPageBundle.ingredients.Count - 1;
                            }
                            else
                            {
                                currentIngredientListItem = 0;
                            }
                        }

                        if (currentIngredientListItem < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientListItem = ___currentPageBundle.ingredients.Count - 1;
                            }
                            else
                            {
                                currentIngredientListItem = 0;
                            }
                        }

                        ClickableTextureComponent   c          = __instance.ingredientList[currentIngredientListItem];
                        BundleIngredientDescription ingredient = ___currentPageBundle.ingredients[currentIngredientListItem];

                        Item item      = new StardewValley.Object(ingredient.index, ingredient.stack, isRecipe: false, -1, ingredient.quality);
                        bool completed = false;
                        if (___currentPageBundle != null && ___currentPageBundle.ingredients != null && currentIngredientListItem < ___currentPageBundle.ingredients.Count && ___currentPageBundle.ingredients[currentIngredientListItem].completed)
                        {
                            completed = true;
                        }

                        string toSpeak = item.DisplayName;

                        if (!completed)
                        {
                            int quality = ingredient.quality;
                            if (quality == 1)
                            {
                                toSpeak = $"Silver quality {toSpeak}";
                            }
                            else if (quality == 2 || quality == 3)
                            {
                                toSpeak = $"Gold quality {toSpeak}";
                            }
                            else if (quality >= 4)
                            {
                                toSpeak = $"Iridium quality {toSpeak}";
                            }

                            toSpeak = $"{ingredient.stack} {toSpeak}";
                        }

                        if (completed)
                        {
                            toSpeak = $"Completed {toSpeak}";
                        }

                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;

                case 1:     // For input slot list
                {
                    if (__instance.ingredientSlots.Count >= 0)
                    {
                        currentIngredientInputSlot = currentIngredientInputSlot + (isLeftShiftPressed ? -1 : 1);
                        if (currentIngredientInputSlot >= __instance.ingredientSlots.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientInputSlot = __instance.ingredientSlots.Count - 1;
                            }
                            else
                            {
                                currentIngredientInputSlot = 0;
                            }
                        }

                        if (currentIngredientInputSlot < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentIngredientInputSlot = __instance.ingredientSlots.Count - 1;
                            }
                            else
                            {
                                currentIngredientInputSlot = 0;
                            }
                        }

                        ClickableTextureComponent c = __instance.ingredientSlots[currentIngredientInputSlot];
                        Item   item = c.item;
                        string toSpeak;

                        if (item == null)
                        {
                            toSpeak = $"Input Slot {currentIngredientInputSlot + 1}";
                        }
                        else
                        {
                            toSpeak = item.DisplayName;
                        }

                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;

                case 2:     // For inventory slots
                {
                    if (__instance.inventory != null && __instance.inventory.actualInventory.Count >= 0)
                    {
                        int prevSlotIndex = currentInventorySlot;
                        currentInventorySlot = currentInventorySlot + (isLeftShiftPressed ? -1 : 1);
                        if (currentInventorySlot >= __instance.inventory.actualInventory.Count)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentInventorySlot = __instance.inventory.actualInventory.Count - 1;
                            }
                            else
                            {
                                currentInventorySlot = 0;
                            }
                        }

                        if (currentInventorySlot < 0)
                        {
                            if (isLeftShiftPressed)
                            {
                                currentInventorySlot = __instance.inventory.actualInventory.Count - 1;
                            }
                            else
                            {
                                currentInventorySlot = 0;
                            }
                        }

                        Item item            = __instance.inventory.actualInventory[currentInventorySlot];
                        ClickableComponent c = __instance.inventory.inventory[currentInventorySlot];
                        string             toSpeak;
                        if (item != null)
                        {
                            toSpeak = item.DisplayName;

                            if ((item as StardewValley.Object) != null)
                            {
                                int quality = ((StardewValley.Object)item).Quality;
                                if (quality == 1)
                                {
                                    toSpeak = $"Silver quality {toSpeak}";
                                }
                                else if (quality == 2 || quality == 3)
                                {
                                    toSpeak = $"Gold quality {toSpeak}";
                                }
                                else if (quality >= 4)
                                {
                                    toSpeak = $"Iridium quality {toSpeak}";
                                }
                            }
                            toSpeak = $"{item.Stack} {toSpeak}";
                        }
                        else
                        {
                            toSpeak = "Empty Slot";
                        }
                        c.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say(toSpeak, true);
                    }
                }
                break;
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }
        public static void Main(string[] args)
        {
            MainClass tc = new MainClass();

            tc.run();
        }
示例#60
0
 public EmailThread(MainClass owner)
 {
     this.Owner = owner;
 }