Example #1
0
        static void Main(string[] args)
        {
            Debug.Listeners.Add(new ConsoleTraceListener());

            int numeroDeEsclavos;
            int cantidadDeNumeros;

            if (ProgramHelper.ParsearParametrosMaestro(args, out numeroDeEsclavos, out cantidadDeNumeros, USO_CORRECTO))
            {
                return;
            }

            int[]  numbers   = Enumerable.Range(1, cantidadDeNumeros).ToArray();
            var    stopWatch = Stopwatch.StartNew();
            double resultado = 0;

            using (var ctx = new Context())
            {
                /* Crear socket de envío */
                uint PUERTO_ENVIO = ProgramHelper.PUERTO_ENVIO_MASTER;
                var  sendSocket   = ctx.Socket(SocketType.PUB);
                sendSocket.Bind(Transport.TCP, "*", PUERTO_ENVIO);

                /* Crear socket de recepción */
                uint   PUERTO_RECEPCION = ProgramHelper.PUERTO_RECEPCION_MASTER;
                Socket recvSocket       = ctx.Socket(SocketType.PULL);
                recvSocket.Bind(Transport.TCP, "*", PUERTO_RECEPCION);

                /* Inicializando esclavos */
                Debug.WriteLine("Master: Inicializando esclavos");
                Task.Factory.StartNew(() => SlaveProgram.EjecutarEsclavos(numeroDeEsclavos));
                Thread.Sleep(5);
                Debug.WriteLine("Master: Esperando a que se inicializen los esclavos.");
                SlaveProgram.EsperarEsclavosListos();
                Debug.WriteLine("Master: Esclavos listos, empieza inicialización de maestro.");

                using (var master = new SumadorBroadcastMaestro(numbers, ctx, sendSocket, recvSocket))
                {
                    Debug.WriteLine("Master: new SumadorBroadcastMaestro(int[{0}], ctx, sendSocket, recvSocket)", numbers.Length);
                    Console.WriteLine("Master: Ejecutando operación maestro.");
                    Debug.Indent();
                    master.RecepcionesEsperadas = numeroDeEsclavos;
                    master.EjecutarOperacion();

                    Debug.WriteLine("Master: Esperando a que termine la operacion...");
                    master.SenalDeFinalizacion.Wait();
                    Debug.WriteLine("Master: Se recibió la senal de finalización.");
                    Debug.Unindent();
                    resultado = master.Resultado;
                }
            }

            stopWatch.Stop();

            Console.WriteLine("Se tardó: {0} milisegundos", stopWatch.ElapsedMilliseconds);
            Console.WriteLine("Se tardó: {0} ticks de reloj", stopWatch.ElapsedTicks);
            Console.WriteLine("Resultado de sumar del 1 al {1}: {0}", resultado, numbers[numbers.Length - 1]);

            Console.ReadLine();
        }
Example #2
0
        public App()
        {
            ProgramHelper.Initialize(Assembly.GetExecutingAssembly(), "daramkun", "DaramRenamer");
            ownLocalizer = new StringTable();

            if (Environment.OSVersion.Version <= new Version(5, 0))
            {
                MessageBox.Show(StringTable.SharedStrings ["os_notice"], StringTable.SharedStrings ["daram_renamer"],
                                MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown(-1);
            }

            TextWriterTraceListener textWriterTraceListner = new TextWriterTraceListener(Console.Out);

            Debug.Listeners.Add(textWriterTraceListner);

            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                //Daramkun.DaramRenamer.MainWindow.SharedWindow.UndoManager.Backup ();

                Daramkun.DaramRenamer.MainWindow.MessageBox(StringTable.SharedStrings ["error_raised"], StringTable.SharedStrings ["please_check_log"],
                                                            TaskDialogIcon.Error, TaskDialogCommonButtonFlags.OK);
                using (StreamWriter sw = File.AppendText("error.log"))
                {
                    TextWriterTraceListener textWriterTraceListnerForFile = new TextWriterTraceListener(sw);
                    Debug.Listeners.Add(textWriterTraceListnerForFile);
                    sw.WriteLine($"Error: {DateTime.Now.ToString ( "yyyy-MM-dd hh/mm/ss" )} - from Daram Renamer");
                    sw.WriteLine("----");
                    sw.WriteLine(args.ExceptionObject.ToString());
                    sw.WriteLine("==========================================================");
                    Debug.Listeners.Remove(textWriterTraceListnerForFile);
                }
            };
        }
Example #3
0
            void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
            {
                ProgramHelper.RevertToSelf();
                MainForm form = MainForm as MainForm;

                form.ProcessArguments(e.CommandLine.ToArray());
            }
Example #4
0
        public static ParsedLog ParseLog(string location)
        {
            var parser = new ParsingController(new TestParserSettings());

            var row = new GridRow(location as string, "Ready to parse")
            {
                BgWorker = new System.ComponentModel.BackgroundWorker()
                {
                    WorkerReportsProgress = true
                }
            };


            var fInfo = new FileInfo(row.Location);

            if (!fInfo.Exists)
            {
                throw new FileNotFoundException("Error Encountered: File does not exist", fInfo.FullName);
            }
            if (!ProgramHelper.IsSupportedFormat(fInfo.Name))
            {
                throw new InvalidDataException("Error Encountered: Not EVTC");
            }

            return(parser.ParseLog(row, fInfo.FullName));
        }
Example #5
0
        static void Main()
        {
            if (ProgramHelper.HasExist())
            {
                Application.Exit();
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                FormLogin frmL = new FormLogin();
                frmL.ShowDialog();

                if (GlobalVar.Oper == null)
                {
                    return;
                }
                if (GlobalVar.Oper.OperCode == "" || GlobalVar.Oper == null)
                {
                    return;
                }
                try
                {
                    Application.Run(new FormMain());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Example #6
0
 //Main Parse method------------------------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Parses the given log
 /// </summary>
 /// <param name="operation">Operation object bound to the UI</param>
 /// <param name="evtc">The path to the log to parse</param>
 /// <returns>the ParsedLog</returns>
 public ParsedLog ParseLog(OperationController operation, string evtc)
 {
     operation.UpdateProgressWithCancellationCheck("Reading Binary");
     using (var fs = new FileStream(evtc, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         if (ProgramHelper.IsCompressedFormat(evtc))
         {
             using (var arch = new ZipArchive(fs, ZipArchiveMode.Read))
             {
                 if (arch.Entries.Count != 1)
                 {
                     throw new InvalidDataException("Invalid Archive");
                 }
                 using (Stream data = arch.Entries[0].Open())
                 {
                     using (var ms = new MemoryStream())
                     {
                         data.CopyTo(ms);
                         ms.Position = 0;
                         ParseLog(operation, ms);
                     };
                 }
             }
         }
         else
         {
             ParseLog(operation, fs);
         }
     }
     operation.UpdateProgressWithCancellationCheck("Data parsed");
     return(new ParsedLog(_buildVersion, _fightData, _agentData, _skillData, _combatItems, _playerList, _logEndTime - _logStartTime, _parserSettings, operation));
 }
Example #7
0
    public void StartLearning()
    {
        learning = true;
        Debug.Log("PLACE_TO_POSE STARTED LEARNING STANDALONE");

        //if (objectToPlace == null) {
        //    objectToPlace = Instantiate(BasicObjectManipulatablePrefab, world_anchor.transform);
        //}

        Visualize();

        UISoundManager.Instance.PlaySnap();
        objectToPlace.GetComponent <ObjectManipulationEnabler>().EnableManipulation();
        objectToPlace.transform.GetChild(0).GetComponent <Collider>().enabled = false;
        objectToPlace.GetComponent <PlaceRotateConfirm>().snapLocalRotation   = objectToPlace.transform.rotation;
        objectToPlace.transform.parent        = cursor.transform;
        objectToPlace.transform.localPosition = new Vector3(0, 0, objectToPlace.transform.GetChild(0).transform.localScale.x / 2);
        //objectToPlace.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
        ProgramItemMsg referenceItem = ProgramHelper.GetProgramItemById(interfaceStateMsg.GetBlockID(), programItemMsg.GetRefID()[0]);

        objectToPlace.GetComponent <PlaceRotateConfirm>().Arm =
            (ROSUnityCoordSystemTransformer.ConvertVector(referenceItem.GetPose()[0].GetPose().GetPosition().GetPoint()).x > MainMenuManager.Instance.currentSetup.GetTableWidth() / 2) ?
            RobotHelper.RobotArmType.LEFT_ARM : RobotHelper.RobotArmType.RIGHT_ARM;

        objectToPlace.GetComponent <PlaceRotateConfirm>().object_attached = true;

        //objectToPlace.transform.localPosition = placePose;
        //objectToPlace.transform.localRotation = placeOrientation;
        //objectToPlace.transform.GetChild(0).transform.localScale = objectDims;
    }
Example #8
0
    public void Visualize()
    {
        if (ProgramHelper.ItemLearned(programItemMsg))
        {
            //TODO get reference ID of previous PICK and get ObjectType
            ProgramItemMsg referenceItem    = ProgramHelper.GetProgramItemById(interfaceStateMsg.GetBlockID(), programItemMsg.GetRefID()[0]);
            Vector3        placePose        = ROSUnityCoordSystemTransformer.ConvertVector(programItemMsg.GetPose()[0].GetPose().GetPosition().GetPoint());
            Quaternion     placeOrientation = ROSUnityCoordSystemTransformer.ConvertQuaternion(programItemMsg.GetPose()[0].GetPose().GetOrientation().GetQuaternion());
            Vector3        objectDims       = ObjectsManager.Instance.GetObjectTypeDimensions(referenceItem.GetObject()[0]);

            //objectToPlaceUnmanipulatable = Instantiate(BasicObjectUnmanipulatablePrefab, world_anchor.transform);
            //objectToPlaceUnmanipulatable.transform.localPosition = placePose;
            //objectToPlaceUnmanipulatable.transform.localRotation = placeOrientation;
            //objectToPlaceUnmanipulatable.transform.GetChild(0).transform.localScale = objectDims;

            if (objectToPlace == null || objectToPlace.Equals(null))
            {
                objectToPlace = Instantiate(BasicObjectManipulatablePrefab, world_anchor.transform);
                Debug.Log("Instantiating object");
            }
            objectToPlace.GetComponent <ObjectManipulationEnabler>().DisableManipulation();
            objectToPlace.transform.localPosition = placePose;
            objectToPlace.transform.localRotation = placeOrientation;
            objectToPlace.transform.GetChild(0).transform.localScale = objectDims;
        }
    }
Example #9
0
        public async Task Run()
        {
            WriteLine("1. Use UDF");
            WriteLine("2. Create");

            UDFOption option = (UDFOption)ProgramHelper.EnterInt("");

            switch (option)
            {
            case UDFOption.Use:
            {
                // The function work with zips collection and msnet18sql database.
                // If you need a different collection or database, please write a piece of code to input data into the program.
                string       id    = ProgramHelper.EnterText("Id ");
                SqlQuerySpec query = new SqlQuerySpec()
                {
                    QueryText  = "SELECT c.id, c.loc, udf.udfCityState(c) as CityState FROM c where c.id = @id",
                    Parameters = new SqlParameterCollection()
                    {
                        new SqlParameter("@id", id)
                    }
                };

                Document document = _documentRepository.ReadDocumentByQuery <Document>(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), query).ToList().FirstOrDefault();

                WriteLine(document.ToString());

                break;
            }

            case UDFOption.Create:
            {
                UserDefinedFunction udfDefinition = new UserDefinedFunction
                {
                    Id   = "udfRegex",
                    Body = File.ReadAllText(@"Scripts\udfRegex.js")
                };

                string             databaseName   = "";
                DocumentCollection collectionName = null;

                if (!InsertCollAndDatabase(ref databaseName, ref collectionName))
                {
                    Warning("Collection >>> " + collectionName + " <<< don't exist.");
                    collectionName = await _collectionRepository.CreateCollection(databaseName, collectionName.Id);

                    ProgramHelper.Wait();
                }

                UserDefinedFunction newUDFunction = await _udfRepository.CreateUDFAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName.Id), udfDefinition);

                WriteLine(string.Format("Created trigger {0}; RID: {1}", newUDFunction.Id, newUDFunction.ResourceId));

                break;
            }

            default:
                break;
            }
        }
Example #10
0
        static void Main()
        {
            ProgramConverter[] converters = ProgramConverterGenerator(10);


            for (int i = 0; i < converters.Length; i++)
            {
                if (converters[i] is ICodeChecker)
                {
                    ProgramHelper programHelper = converters[i] as ProgramHelper;
                    Console.WriteLine("Code check complete: " + programHelper.CheckCodeSyntax("dim next", "vb"));
                    Console.WriteLine("Converting to C#. Before conversion: var a");
                    Console.WriteLine("After conversion: " + programHelper.ConvertToCSharp("var a"));
                    Console.WriteLine("Converting to VB. Before conversion: int a");
                    Console.WriteLine("After conversion: " + programHelper.ConvertToCSharp("int a"));
                }

                else
                {
                    Console.WriteLine("Converting to C#. Before conversion: var a");
                    System.Console.WriteLine(converters[i].ConvertToCSharp("var a"));
                    Console.WriteLine("Converting to VB. Before conversion: int a");
                    System.Console.WriteLine(converters[i].ConvertToVB("int a"));
                }
            }
        }
Example #11
0
        /// <summary>
        /// Cancel the lot, return asset to owner
        /// </summary>
        /// <param name="lotId"> Id of the lot </param>
        /// <remarks>
        /// If the lot is closed, it is not to be shown
        /// in Expload Auction UI (eXPept for lot creator's lot history).
        /// The lot is permanently closed and archived, it can't be reopened.
        /// </remarks>
        public void CloseLot(long lotId)
        {
            // Check if sender has permission to do this
            AssertIsLotCreator(lotId);

            // Get the lot object
            var lot = GetLot(lotId);

            // Check if the lot is already closed
            if (lot.Closed)
            {
                Error.Throw("The lot is already closed.");
            }

            // Change the lot state and write it to the storage
            lot.Closed       = true;
            _new_lots[lotId] = lot;

            // Return the asset to the owner
            var gameAddress = _GetGameAddress(lot.GameId, lot.IsXG);

            if (lot.IsXG)
            {
                ProgramHelper.Program <TradableXGAsset>(gameAddress).TransferXGAsset(lot.AssetId, lot.Owner);
            }
            else
            {
                ProgramHelper.Program <TradableXPAsset>(gameAddress).TransferXPAsset(lot.AssetId, lot.Owner);
            }

            // Emit an event
            Log.Event("lotClosed", lot.Id);
        }
Example #12
0
        public void TestUpdateCheck()
        {
            String s = ProgramHelper.UpdateCheck();

            String[] temp = s.Split(',');
            Assert.AreEqual(4, temp.Length);
        }
 //Main Parse method------------------------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Parses the given log
 /// </summary>
 /// <param name="row">GridRow object bound to the UI</param>
 /// <param name="evtc">The path to the log to parse</param>
 /// <returns>the ParsedLog</returns>
 public ParsedLog ParseLog(GridRow row, string evtc)
 {
     row.BgWorker.UpdateProgress(row, "10% - Reading Binary...", 10);
     using (var fs = new FileStream(evtc, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         if (ProgramHelper.IsCompressedFormat(evtc))
         {
             using (var arch = new ZipArchive(fs, ZipArchiveMode.Read))
             {
                 if (arch.Entries.Count != 1)
                 {
                     throw new InvalidDataException("Error Encountered: Invalid Archive");
                 }
                 using (Stream data = arch.Entries[0].Open())
                 {
                     using (var ms = new MemoryStream())
                     {
                         data.CopyTo(ms);
                         ms.Position = 0;
                         ParseLog(row, ms);
                     };
                 }
             }
         }
         else
         {
             ParseLog(row, fs);
         }
     }
     row.BgWorker.ThrowIfCanceled(row);
     row.BgWorker.UpdateProgress(row, "45% - Data parsed", 45);
     return(new ParsedLog(_buildVersion, _fightData, _agentData, _skillData, _combatItems, _playerList, _logEndTime - _logStartTime, _parserSettings));
 }
Example #14
0
 //Main Parse method------------------------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Parses the given log
 /// </summary>
 /// <param name="row">GridRow object bound to the UI</param>
 /// <param name="evtc">The path to the log to parse</param>
 /// <returns>the ParsedLog</returns>
 public ParsedLog ParseLog(GridRow row, string evtc)
 {
     row.BgWorker.UpdateProgress(row, "10% - Reading Binary...", 10);
     using (var fs = new FileStream(evtc, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         if (ProgramHelper.IsCompressedFormat(evtc))
         {
             using (var arch = new ZipArchive(fs, ZipArchiveMode.Read))
             {
                 if (arch.Entries.Count != 1)
                 {
                     throw new InvalidDataException("Invalid Archive");
                 }
                 using (var data = arch.Entries[0].Open())
                 {
                     ParseLog(row, data);
                 }
             }
         }
         else
         {
             ParseLog(row, fs);
         }
     }
     row.BgWorker.ThrowIfCanceled(row);
     row.BgWorker.UpdateProgress(row, "40% - Data parsed", 40);
     return(new ParsedLog(_buildVersion, _fightData, _agentData, _skillData, _combatItems, _playerList));
 }
Example #15
0
        public Asset[] test_UsersItems()
        {
            // Init addresses and get program by address
            Bytes programOwner = new Bytes("fb75559bb4bb172ca0795e50b390109a50ce794466a14c24c73acdb40604065b");
            Bytes assetOwner   = new Bytes("a1fe824f193bcee32f33b9e01245bd41f05a157eca73daf65d70ebd27430836d");

            // Set auction address to this contract address
            ProgramHelper.Program <TradableXGAsset>(programOwner).SetAuction(Info.ProgramAddress());

            // Emit 3 assets
            Bytes classId    = new Bytes("0000000000000000000000000000000000000000000000000000000000000001");
            Bytes instanceId = new Bytes("0000000000000000000000000000000000000000000000000000000000000001");
            long  assetId    = ProgramHelper.Program <TradableXGAsset>(programOwner).EmitXGAsset(
                assetOwner, classId, instanceId
                );

            classId    = new Bytes("0000000000000000000000000000000000000000000000000000000000000002");
            instanceId = new Bytes("0000000000000000000000000000000000000000000000000000000000000002");
            assetId    = ProgramHelper.Program <TradableXGAsset>(programOwner).EmitXGAsset(
                assetOwner, classId, instanceId
                );

            classId    = new Bytes("0000000000000000000000000000000000000000000000000000000000000003");
            instanceId = new Bytes("0000000000000000000000000000000000000000000000000000000000000003");
            assetId    = ProgramHelper.Program <TradableXGAsset>(programOwner).EmitXGAsset(
                assetOwner, classId, instanceId
                );

            // Return list of asset objects
            return(ProgramHelper.Program <TradableXGAsset>(programOwner).GetUsersAllXGAssetsData(assetOwner));
        }
 public AddGroupSubjectModel(School injectedContext)
 {
     db            = injectedContext;
     helper        = new ProgramHelper(db);
     GroupSubjects = db.GroupSubjects;
     Groups        = db.SchoolGroups;
     Subjects      = db.Subjects;
 }
Example #17
0
 public AddTeacherSubjectModel(School injectedContext)
 {
     db              = injectedContext;
     helper          = new ProgramHelper(db);
     TeacherSubjects = db.TeacherSubjects;
     Teachers        = db.Teachers;
     Subjects        = db.Subjects;
 }
Example #18
0
        /// <summary>
        /// Buy desired lot
        /// </summary>
        /// <param name="lotId"> Id of the lot </param>
        public void BuyLot(long lotId)
        {
            // Get the lot object
            Lot lot = GetLot(lotId);

            // Check if the lot is not closed yet
            if (lot.Closed)
            {
                Error.Throw("The lot is already closed.");
            }

            // Take the money from buyer and transfer the asset to him
            Bytes gameAddress = _GetGameAddress(lot.GameId, lot.IsXG);

            long ownerFee = (long)(lot.Price / (1 + ((double)(lot.AuctionCommission + lot.GameCommission)) / 100));
            long gameFee  = (long)(ownerFee * (1 + ((double)lot.GameCommission) / 100)) - ownerFee;

            if (lot.IsXG)
            {
                ProgramHelper.Program <XGold>(XGAddress).Spend(Info.ProgramAddress(), lot.Price);
                ProgramHelper.Program <XGold>(XGAddress).Refund(Info.ProgramAddress(), lot.Owner, ownerFee);

                if (gameFee > 0)
                {
                    ProgramHelper.Program <XGold>(XGAddress).Refund(Info.ProgramAddress(), gameAddress, gameFee);
                }

                ProgramHelper.Program <TradableXGAsset>(gameAddress).TransferXGAsset(lot.AssetId, Info.Sender());
            }
            else
            {
                Actions.Transfer(Info.ProgramAddress(), lot.Price);
                Actions.TransferFromProgram(lot.Owner, ownerFee);

                if (gameFee > 0)
                {
                    Actions.TransferFromProgram(gameAddress, gameFee);
                }

                ProgramHelper.Program <TradableXPAsset>(gameAddress).TransferXPAsset(lot.AssetId, Info.Sender());
            }

            // Alter the lot state and write it to the storage
            lot.Closed       = true;
            lot.Buyer        = Info.Sender();
            lot.PurchaseTime = Info.LastBlockTime();
            _new_lots[lotId] = lot;

            // Put the lot into buyer storage (for history log)
            var userStorageLastId = _userLotsCount.GetOrDefault(Info.Sender(), 0);
            var userLotsKey       = GetUserLotKey(Info.Sender(), userStorageLastId);

            _userLots[userLotsKey]        = lotId;
            _userLotsCount[Info.Sender()] = userStorageLastId + 1;

            // Emit an event
            Log.Event("lotBought", lot.Id);
        }
        public void Calculate(object obj)
        {
            try
            {
                var programConverters = new ProgramConverter[ConvertersCount];

                for (var i = 0; i < programConverters.Length / 2; i++)
                {
                    programConverters[i] = new ProgramConverter();
                }
                for (var i = programConverters.Length / 2; i < programConverters.Length; i++)
                {
                    programConverters[i] = new ProgramHelper();
                }
                OutputWriteLine($"[0 - {-1 + programConverters.Length / 2}] elements is {nameof(ProgramConverter)}");
                OutputWriteLine(
                    $"[{programConverters.Length / 2} - {programConverters.Length - 1}] elements is {nameof(ProgramHelper)}");
                OutputWriteLine(string.Empty);

                const string vbCode = "var";

                for (var i = 0; i < programConverters.Length; i++)
                {
                    var converter = programConverters[i];
                    if (converter is ICodeChecker)
                    {
                        var codeChecker = converter as ICodeChecker;

                        OutputWriteLine($"[{i}] is ICodeChecker");

                        if (codeChecker.CheckCodeSyntax(vbCode, Language.CSharp_Code))
                        {
                            OutputWriteLine($"\t{vbCode} -> {converter.ConvertToVB(vbCode)}");
                        }
                        else if (codeChecker.CheckCodeSyntax(vbCode, Language.VB_Code))
                        {
                            OutputWriteLine($"\t{vbCode} -> {converter.ConvertToCSharp(vbCode)}");
                        }
                        else
                        {
                            OutputWriteLine("\t{str} - Unknown language");
                        }
                    }
                    else
                    {
                        OutputWriteLine($"[{i}] is not ICodeChecker");
                        OutputWriteLine($"\t{programConverters[i].ConvertToCSharp(vbCode)}");
                        OutputWriteLine($"\t{programConverters[i].ConvertToVB(vbCode)}");
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }

            OnPropertyChanged(nameof(Output));
        }
Example #20
0
        public int TestPcall()
        {
            Bytes address1 = new Bytes("1eaed20b7ce2b336043e4b340b031f95bb1ce6d935ef733ae4df1b66e1e3d91f");
            int   a        = ProgramHelper.Program <PcallProgram>(address1).Add(1, 2);
            Bytes address2 = new Bytes(new sbyte[] { 30, -82, -46, 11, 124, -30, -77, 54, 4, 62, 75, 52, 11, 3, 31, -107, -69, 28, -26, -39, 53, -17, 115, 58, -28, -33, 27, 102, -31, -29, -39, 31 });
            int   b        = ProgramHelper.Program <PcallProgram>(address2).Add(3, 4);

            return(a + b);
        }
Example #21
0
        public int TestPcall()
        {
            Bytes address1 = new Bytes("1eaed20b7ce2b336043e4b340b031f95bb1ce6d935ef733ae4df1b66e1e3d91f");
            int   a        = ProgramHelper.Program <PcallProgram>(address1).Add(1, 2);
            Bytes address2 = new Bytes(new byte[] { 30, 174, 210, 11, 124, 226, 179, 54, 4, 62, 75, 52, 11, 3, 31, 149, 187, 28, 230, 217, 53, 239, 115, 58, 228, 223, 27, 102, 225, 227, 217, 31 });
            int   b        = ProgramHelper.Program <PcallProgram>(address2).Add(3, 4);

            return(a + b);
        }
Example #22
0
        private static Project GetProject(IEnumerable <string> sourceFiles, bool runInSerial)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Analysing project block structure... ");
            var proj = ProgramHelper.ParseProject(sourceFiles, runInSerial);

            SaveTiming("project-parsing", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
            return(proj);
        }
Example #23
0
        public void ProcessArguments(string[] args)
        {
            argumentDictionary = ProgramHelper.GetArgumentPair(args.ToList());

            ValidateArguments();

            titelLabel.Text = argumentDictionary["programname"];
            Text            = argumentDictionary["programname"];
            webSiteUrl.Text = argumentDictionary["activationurl"];
        }
Example #24
0
        /// <summary>
        /// Returns a reference to the ProgramHelper of a program.
        /// </summary>
        /// <returns>ProgramHelper.</returns>
        /// <param name="programName">Program name.</param>
        public ProgramHelper WithName(string programName)
        {
            var           program       = homegenie.ProgramManager.Programs.Find(p => p.Name.ToLower() == programName.ToLower());
            ProgramHelper programHelper = null;

            if (program != null)
            {
                programHelper = new ProgramHelper(homegenie, program.Address);
            }
            return(programHelper);
        }
Example #25
0
        /// <summary>
        /// Returns a reference to the ProgramHelper of a program.
        /// </summary>
        /// <returns>ProgramHelper.</returns>
        /// <param name="programAddress">Program address (id).</param>
        public ProgramHelper WithAddress(int programAddress)
        {
            var           program       = homegenie.ProgramManager.Programs.Find(p => p.Address == programAddress);
            ProgramHelper programHelper = null;

            if (program != null)
            {
                programHelper = new ProgramHelper(homegenie, program.Address);
            }
            return(programHelper);
        }
Example #26
0
    public void SaveObjectPosition(Vector3 position, Quaternion rotation)
    {
        learning = false;
        ProgramHelper.LoadProgram = true;

        PlacePosition = new Vector3(position.x, position.y,
                                    ObjectsManager.Instance.GetObjectTypeDimensions(ProgramHelper.GetProgramItemById(interfaceStateMsg.GetBlockID(), programItemMsg.GetRefID()[0]).GetObject()[0]).x / 2);
        PlaceOrientation = rotation;

        StartCoroutine(SaveToROS());
    }
Example #27
0
        static void Main()
        {
            ProgramHelper.MainWrapper(() => {
                CultureInfo culture = CultureInfo.InvariantCulture;
                CultureInfo.DefaultThreadCurrentCulture   = culture;
                CultureInfo.DefaultThreadCurrentUICulture = culture;

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            });
        }
Example #28
0
    public new static void CallBack(ROSBridgeMsg msg)
    {
        InterfaceStateMsg Imsg = (InterfaceStateMsg)msg;

        VisualizationManager.Instance.SetInterfaceStateMsgFromROS(Imsg);
        //InteractiveEditManager.Instance.SetInterfaceStateMsgFromROS(Imsg);
        //PickFromPolygonIE.Instance.SetInterfaceStateMsgFromROS(Imsg);
        //PlaceToPoseIE.Instance.SetInterfaceStateMsgFromROS(Imsg);

        //InteractiveProgrammingManager.Instance.SetInterfaceStateMsgFromROS(Imsg);
        ProgramHelper.SetInterfaceStateMsgFromROS(Imsg);
    }
Example #29
0
 private static void Main()
 {
     if (ProgramHelper.HasExist())
     {
         Application.Exit();
     }
     else
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new FormMain());
     }
 }
Example #30
0
        // Checks if caller owns a particular asset
        private void AssertIsItemOwner(long gameId, long assetId, bool isXG)
        {
            var gameAddress = _GetGameAddress(gameId, isXG);

            var assetOwner = isXG ?
                             ProgramHelper.Program <TradableXGAsset>(gameAddress).GetXGAssetOwner(assetId) :
                             ProgramHelper.Program <TradableXPAsset>(gameAddress).GetXPAssetOwner(assetId);

            if (Info.Sender() != assetOwner)
            {
                Error.Throw("Only asset owner can do this.");
            }
        }