Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        private static void ExecuteSelectedAutoType(EcasAction a, EcasContext ctx)
        {
            try
            {
                // Do not Spr-compile the sequence here; it'll be compiled by
                // the auto-type engine (and this expects an auto-type sequence
                // as input, not a data string; compiling it here would e.g.
                // result in broken '%' characters in passwords)
                string strSeq = EcasUtil.GetParamString(a.Parameters, 0, false);
                if (string.IsNullOrEmpty(strSeq))
                {
                    strSeq = null;
                }

                PwEntry pe = Program.MainForm.GetSelectedEntry(true);
                if (pe == null)
                {
                    return;
                }
                PwDatabase pd = Program.MainForm.DocumentManager.SafeFindContainerOf(pe);

                IntPtr hFg = NativeMethods.GetForegroundWindowHandle();
                if (AutoType.IsOwnWindow(hFg))
                {
                    AutoType.PerformIntoPreviousWindow(Program.MainForm, pe,
                                                       pd, strSeq);
                }
                else
                {
                    AutoType.PerformIntoCurrentWindow(pe, pd, strSeq);
                }
            }
            catch (Exception) { Debug.Assert(false); }
        }
Ejemplo n.º 2
0
        public void NativeTypedefStructsGenerator_PositiveMultipleInvalidHandleValues_ValidAttributesGenerated()
        {
            // Arrange
            var methodNameToNamespacesMap = new Dictionary <string, string>
            {
                { "JET_INSTANCE", "Windows.Win32.Storage.StructuredStorage" },
            };

            var autoTypes = new AutoType[]
            {
                new AutoType
                {
                    Name                = "FAUX_HANDLE",
                    ValueType           = "IntPtr",
                    Namespace           = "Windows.Win32.Nonexistent",
                    InvalidHandleValues = new long[] { long.MinValue, 0, long.MaxValue }
                }
            };

            using var stream = new MemoryStream();
            var expectedAttributes = new[] {
                "[InvalidHandleValue(-9223372036854775808)]",
                "[InvalidHandleValue(0)]",
                "[InvalidHandleValue(9223372036854775807)]",
            };

            // Act
            NativeTypedefStructsCreator.WriteToStream(methodNameToNamespacesMap, autoTypes, stream);

            // Assert
            AssertGeneratedStructStreamContainsAttributes(stream, expectedAttributes);
        }
Ejemplo n.º 3
0
        public void NativeTypedefStructsGenerator_NegativeMultipleInvalidHandleValues_ValidAttributesGenerated()
        {
            // Arrange
            var methodNameToNamespacesMap = new Dictionary <string, string>
            {
                { "FindVolumeClose", "Windows.Win32.Storage.FileSystem" },
            };

            var autoTypes = new AutoType[]
            {
                new AutoType
                {
                    Name                = "FindVolumeHandle",
                    ValueType           = "IntPtr",
                    CloseApi            = "FindVolumeClose",
                    InvalidHandleValues = new long[] { long.MinValue, -1 }
                }
            };

            using var stream = new MemoryStream();
            var expectedAttributes = new[] {
                "[InvalidHandleValue(-9223372036854775808)]",
                "[InvalidHandleValue(-1)]",
            };

            // Act
            NativeTypedefStructsCreator.WriteToStream(methodNameToNamespacesMap, autoTypes, stream);

            // Assert
            AssertGeneratedStructStreamContainsAttributes(stream, expectedAttributes);
        }
Ejemplo n.º 4
0
        public override void PopulateChildren(XElement xml, IRandomNumberGenerator rng, KdbxSerializationParameters parameters)
        {
            xml.Add(
                GetKeePassNode("UUID", Uuid, parameters),
                GetKeePassNode("IconID", IconID, parameters)
                );

            if (CustomIconUuid != null)
            {
                xml.Add(GetKeePassNode("CustomIconUUID", CustomIconUuid, parameters));
            }

            xml.Add(
                GetKeePassNode("ForegroundColor", ToKeePassColor(ForegroundColor), parameters),
                GetKeePassNode("BackgroundColor", ToKeePassColor(BackgroundColor), parameters),
                GetKeePassNode("OverrideURL", OverrideUrl, parameters),
                GetKeePassNode("Tags", Tags, parameters),
                Times.ToXml(rng, parameters)
                );

            foreach (IProtectedString str in Fields)
            {
                xml.Add(str.ToXml(rng, parameters));
            }

            if (Notes != null)
            {
                xml.Add(
                    Notes.ToXml(rng, parameters)
                    );
            }

            xml.Add(
                Password.ToXml(rng, parameters),
                Title.ToXml(rng, parameters),
                Url.ToXml(rng, parameters),
                UserName.ToXml(rng, parameters)
                );

            foreach (IKeePassBinAttachment bin in Binaries)
            {
                xml.Add(bin.ToXml(rng, parameters));
            }

            if (AutoType != null)
            {
                xml.Add(AutoType.ToXml(rng, parameters));
            }

            if (History != null)
            {
                DebugHelper.Assert(!this.isHistoryEntry);
                xml.Add(History.ToXml(rng, parameters));
            }

            if (CustomData != null)
            {
                xml.Add(CustomData.ToXml(rng, parameters));
            }
        }
Ejemplo n.º 5
0
 public void PlayText(ref AutoType typer)
 {
     //typer.Stop();
     State = DisplayStringState.Running;
     typer.SetText(texts[currentIndex]);
     typer.PlayText();
 }
Ejemplo n.º 6
0
        private static void AddWindowProc(EditAutoTypeItemForm f, IntPtr h,
                                          string strWndName, Image img)
        {
            if (f == null)
            {
                Debug.Assert(false); return;
            }
            if (h == IntPtr.Zero)
            {
                Debug.Assert(false); return;
            }

            try
            {
                if (!AutoType.IsValidAutoTypeWindow(h, false))
                {
                    return;
                }

                lock (f.m_objDialogSync)
                {
                    if (!f.m_bDialogClosed)
                    {
                        f.m_vWndImages.Add(img);
                        f.m_cmbWindow.Items.Add(strWndName);
                    }
                }
            }
            catch (Exception) { Debug.Assert(false); }
        }
Ejemplo n.º 7
0
        public List <Type> GetTypes(AutoType autoType)
        {
            var types = GetPublicExportedTypes();

            return(autoType == AutoType.Abstraction
                                ? types.Where(x => x.IsInterface).ToList()
                                : types);
        }
Ejemplo n.º 8
0
 public Volkswagen(string newName, int newWeight, double newWidth, double newLength, int newMaxSpeed, typeTransport newTypeTransport,
                   int newWheels, int newDoors, double newClearance, AutoType newType, Engine newEngine,
                   ModelVolkswagen newModel)
     : base(newName, newWeight, newWidth, newLength, newMaxSpeed, newTypeTransport,
            newWheels, newDoors, newClearance, newType, newEngine)
 {
     model = newModel;
 }
Ejemplo n.º 9
0
        public async Task <IEnumerable <AutoDto> > GetAutosByTypeAsync(AutoType type)
        {
            var items = (await _database.AutoRepository.GetAllAsync())
                        .ToList()
                        .Where(x => x.AutoTypeLookupId == type && x.AutoStatusLookupId == AutoStatus.Usable)
                        .ToDto();

            return(items);
        }
Ejemplo n.º 10
0
    void SoundFinished()
    {
        audioDone = true;
        blop.Play();
        AutoType a = autoType.GetComponent <AutoType> ();

        cover.GetComponent <SpriteRenderer> ().sortingOrder = -10;
        a.Play();
    }
Ejemplo n.º 11
0
 public Automobile(string model, int py, string name, AutoType at, int gn, List <Part> parts, bool status = true)
 {
     Model = model; ProdYear = py; Name = name; Type = at; GarageNumber = gn;
     for (int i = 0; i < 6; i++)
     {
         parts.Add(new Part(i, true));
     }
     Status = status;
 }
Ejemplo n.º 12
0
 public Driver(string fio, LicenseType licenseType, string model, AutoType autoType, string number, int year)
 {
     this.fio         = fio;
     this.licenseType = licenseType;
     this.model       = model;
     this.autoType    = autoType;
     this.number      = number;
     this.year        = year;
 }
Ejemplo n.º 13
0
        public void PopulateAutoTest(string distancesString,
                                     string loadsString,
                                     string fullDamage,
                                     AutoType autoType,
                                     RoadType roadType,
                                     bool isFederal,
                                     bool isKlimat,
                                     float inaccuracyScales,
                                     float inaccuracyRoulette)
        {
            Settings.Default.Klimat_usloviya       = isKlimat;
            Settings.Default.YearIndex             = 1.9749f;
            Settings.Default.DopustimiyProcentAxis = 5;
            Settings.Default.DopustimiyProcentAxis = 5;
            var auto = new Auto {
                InaccuracyRoulette = inaccuracyRoulette,
                AutoType           = autoType,
                Road =
                {
                    RoadType      = roadType,
                    Distance      =       100,
                    IsFederalRoad = isFederal,
                    IsSoftClothes = false
                },
                Scales =
                {
                    Inaccuracy = inaccuracyScales
                }
            };

            string[] distances = distancesString.Split(' ');
            string[] loads     = loadsString.Split(' ');

            for (int i = 0; i < loads.Length; i++)
            {
                var   state       = AxisType.Single;
                float distance    = i < distances.Length ? float.Parse(distances[i]) : 0;
                float weightValue = float.Parse(string.Concat(loads[i].Where(c => !char.IsLetter(c))));

                if (loads[i].Contains("D"))
                {
                    state = AxisType.Double;
                }
                if (loads[i].Contains("P"))
                {
                    state = state == AxisType.Double ? AxisType.DoubleAndPnevmo : AxisType.SingleAndPnevmo;
                }
                auto.AddNewAxis(state, distance, weightValue);
            }
            Calculator.Populate(auto);

            float damage = float.Parse(fullDamage);

            Assert.AreEqual(Math.Round(auto.FullAutoDamage), Math.Round(damage), $"Масса:{Environment.NewLine}{auto.FullWeightData}{Environment.NewLine}" +
                            $"Нагрузки:{Environment.NewLine}{string.Join(Environment.NewLine, auto.AxisList.Select(a => a.ToString()))}");
        }
Ejemplo n.º 14
0
 public Auto(string newName, int newWeight, double newWidth, double newLength, int newMaxSpeed, typeTransport newTypeTransport,
             int newWheels, int newDoors, double newClearance, AutoType newType, Engine newEngine)
     : base(newName, newWeight, newWidth, newLength, newMaxSpeed, newTypeTransport)
 {
     wheels    = newWheels;
     doors     = newDoors;
     clearance = newClearance;
     type      = newType;
     engine    = newEngine;
 }
Ejemplo n.º 15
0
 public Opel(AutoType autoType, string manufacurer, Gas gas, int doors, double consumption, int price)
 {
     this.AutoType     = autoType;
     this.Model        = Model.Opel;
     this.Manufacturer = manufacurer;
     this.Gas          = gas;
     this.Doors        = doors;
     this.Consumption  = consumption;
     this.Price        = price;
 }
Ejemplo n.º 16
0
 internal static void PasswordType(ProtectedString ps)
 {
     /* The password string may contain special chars and/or field references
      * Easiest way is to set the provided value as new string field
      * and have KeePass do the rest
      */
     SetPasswordField(ps);
     AutoType.PerformIntoPreviousWindow(Program.MainForm, SelectedEntry,
                                        Program.MainForm.ActiveDatabase, Config.PCAPluginFieldRef);
     SetPasswordField(null);
 }
Ejemplo n.º 17
0
 public BMW(AutoType autoType, string manufacurer, Gas gas, int doors, double consumption, int price, bool sunroof)
 {
     this.AutoType     = autoType;
     this.Model        = Model.BMW;
     this.Manufacturer = manufacurer;
     this.Gas          = gas;
     this.Doors        = doors;
     this.Consumption  = consumption;
     this.Price        = price;
     this.SunRoof      = sunroof;
 }
Ejemplo n.º 18
0
 public BMW(string model, bool sunroof, AutoType autoType, Gas gas, int doors, double consumption, int price)
 {
     this.Model        = model;
     this.Manufacturer = Manufacturer.BMW;
     this.SunRoof      = sunroof;
     this.AutoType     = autoType;
     this.Gas          = gas;
     this.Doors        = doors;
     this.Consumption  = consumption;
     this.Price        = price;
 }
Ejemplo n.º 19
0
 public Opel(string model, string origin, AutoType autoType, Gas gas, int doors, double consumption, int price)
 {
     this.Model           = model;
     this.Manufacturer    = Manufacturer.Opel;
     this.CountryOfOrigin = origin;
     this.AutoType        = autoType;
     this.Gas             = gas;
     this.Doors           = doors;
     this.Consumption     = consumption;
     this.Price           = price;
 }
Ejemplo n.º 20
0
 public Audi(string model, string color, AutoType autoType, Gas gas, int doors, double consumption, int price)
 {
     this.Model        = model;
     this.Manufacturer = Manufacturer.Audi;
     this.Color        = color;
     this.AutoType     = autoType;
     this.Gas          = gas;
     this.Doors        = doors;
     this.Consumption  = consumption;
     this.Price        = price;
 }
Ejemplo n.º 21
0
        private void miItem_AutoType(object sender, EventArgs e)
        {
            ToolStripMenuItem Item  = (ToolStripMenuItem)sender;
            PwEntry           Entry = (PwEntry)Item.Tag;

            try {
                AutoType.PerformIntoPreviousWindow(this, Entry, Host.Database);
            }
            catch (Exception ex) {
                MessageService.ShowWarning(ex);
            }
        }
Ejemplo n.º 22
0
 internal static void SequenceType(ProtectedString ps, string sequence)
 {
     /* The password string may contain special chars and/or field references
      * Easiest way is to set the provided value as new string field
      * and have KeePass do the rest
      */
     SetPasswordField(ps);
     sequence = sequence.Replace(Config.PlaceholderOldPW, "{PASSWORD}");
     sequence = sequence.Replace(Config.PlaceholderNewPW, Config.PCAPluginFieldRef);
     AutoType.PerformIntoPreviousWindow(Program.MainForm, SelectedEntry,
                                        Program.MainForm.ActiveDatabase, sequence);
     SetPasswordField(null);
 }
Ejemplo n.º 23
0
        private void performAutoType(String chosenCharactersFromPassword)
        {
            //Needs for printing special chars
            String passwordElement = chosenCharactersFromPassword.Replace("~", "{~}")
                                     .Replace("+", "{+}")
                                     .Replace("^", "{^}")
                                     .Replace("%", "{%}");

            PwEntry pe = new PwEntry(false, false);

            pe.AutoType.Enabled = true;
            Thread.Sleep(3000);
            AutoType.PerformIntoCurrentWindow(pe, Program.MainForm.DocumentManager.FindContainerOf(pe), passwordElement);
        }
Ejemplo n.º 24
0
 public IAutoMobile Make(AutoType autoType)
 {
     if (autoType.Equals(AutoType.AUDI))
     {
         return(new Audi());
     }
     if (autoType.Equals(AutoType.BMW))
     {
         return(new BMW());
     }
     if (autoType.Equals(AutoType.TESLA))
     {
         return(new Tesla());
     }
     return(null);
 }
 public IAutomobile Make(AutoType type)
 {
     if (type == AutoType.AUDI)
     {
         return(new Audi());
     }
     if (type == AutoType.BMW)
     {
         return(new BMW());
     }
     if (type == AutoType.TESALA)
     {
         return(new Tesala());
     }
     return(null);
 }
Ejemplo n.º 26
0
 public static string AutoTypeToString(AutoType autoType)
 {
     if (autoType == AutoType.Passanger)
     {
         return("Легковой");
     }
     if (autoType == AutoType.Truck)
     {
         return("Грузовой");
     }
     if (autoType == AutoType.Bus)
     {
         return("Автобус");
     }
     return("Неизвестно");
 }
Ejemplo n.º 27
0
 public IAutoMobile Make(AutoType type)
 {
     if (type == AutoType.AUDI)
     {
         return(new Audi());
     }
     else if (type == AutoType.BMW)
     {
         return(new BMW());
     }
     else if (type == AutoType.TESLA)
     {
         return(new Tesla());
     }
     return(null);
 }
Ejemplo n.º 28
0
        private void CellClick(object sender, MouseEventArgs e)
        {
            Form f = (sender as Control).FindForm();
            ListViewHitTestInfo info = (sender as ListView).HitTest(e.X, e.Y);
            int col = info.Item.SubItems.IndexOf(info.SubItem);

            if ((col < 0) || ((sender as ListView).Columns.Count <= col))
            {
                return;
            }
            string column   = (sender as ListView).Columns[col].Text;
            string sequence = string.Empty;

            if (column == KeePass.Resources.KPRes.UserName)
            {
                sequence = "{USERNAME}";
            }
            else if (column == KeePass.Resources.KPRes.Password || column == Config.PWColumnHeader)
            {
                sequence = "{PASSWORD}";
                if (Config.SpecialColumnsRespectPWEnter && Config.PWEnter)
                {
                    sequence += "{ENTER}";
                }
            }
            else
            {
                return;
            }
            AutoTypeCtx ctx = info.Item.Tag as AutoTypeCtx;

            if (ctx == null)
            {
                return;
            }
            if (Config.KeepATOpen)
            {
                (sender as ListView).SelectedItems.Clear();                 //ugly hack to avoid KeePass performing the standard behaviour
                f.DialogResult = DialogResult.None;
                AutoType.PerformIntoPreviousWindow(f, ctx.Entry, m_host.MainWindow.DocumentManager.SafeFindContainerOf(ctx.Entry), sequence);
                f.Activate();
            }
            else
            {
                ctx.Sequence = sequence;
            }
        }
        public AutoInstanceController(string name, List <MultiPolygon> multiPolygon, AutoType type, int timezoneOffset, ushort minLevel, ushort maxLevel, int spinLimit, byte retryLimit, bool ignoreBootstrap, string groupName = null, bool isEvent = false)
        {
            Name                  = name;
            MultiPolygon          = multiPolygon;
            Type                  = type;
            TimezoneOffset        = timezoneOffset;
            MinimumLevel          = minLevel;
            MaximumLevel          = maxLevel;
            SpinLimit             = spinLimit;
            RetryLimit            = retryLimit;
            IgnoreS2CellBootstrap = ignoreBootstrap;
            GroupName             = groupName;
            IsEvent               = isEvent;

            _logger = new Logger <AutoInstanceController>(LoggerFactory.Create(x => x.AddConsole()));

            _allStops         = new List <Pokestop>();
            _todayStops       = new Dictionary <string, Pokestop>();
            _todayStopsTries  = new Dictionary <string, int>();
            _bootstrapCellIds = new List <ulong>();

            _accountRepository  = new AccountRepository(DbContextFactory.CreateDeviceControllerContext(Startup.DbConfig.ToString()));
            _pokestopRepository = new PokestopRepository(DbContextFactory.CreateDeviceControllerContext(Startup.DbConfig.ToString()));
            _cellRepository     = new CellRepository(DbContextFactory.CreateDeviceControllerContext(Startup.DbConfig.ToString()));

            var timeLeft = DateTime.Now.SecondsUntilMidnight();

            _timer          = new System.Timers.Timer(timeLeft * 1000);
            _timer.Elapsed += async(sender, e) => await ClearQuests().ConfigureAwait(false);

            _timer.Start();
            // TODO: Get 12am DateTime
            _logger.LogInformation($"[{Name}] Clearing Quests in {timeLeft:N0}s at 12:00 AM (Currently: {DateTime.Now})");

            Update().ConfigureAwait(false)
            .GetAwaiter()
            .GetResult();
            if (!IgnoreS2CellBootstrap)
            {
                Bootstrap().ConfigureAwait(false)
                .GetAwaiter()
                .GetResult();
            }
        }
Ejemplo n.º 30
0
 public IAutomobile make(AutoType type)
 {
     if (type == AutoType.AUDI)
     {
         return(new Audi());
     }
     else if (type == AutoType.BMW)
     {
         return(new BMW());
     }
     else if (type == AutoType.TESLA)
     {
         return(new Tesla());
     }
     else
     {
         throw new UnspecifiedVehicleException();
     }
 }
Ejemplo n.º 31
0
        public List <Auto> GetAutosByType(ATDbEntities atDbEntities, AutoType type, int filialId, short month, short year, short monthEnd, short yearEnd, int departmentId = 0)
        {
            var startD = new DateTime(year, month, 1);
            var endD   = new DateTime(yearEnd, monthEnd, 1);

            if (departmentId > 0)
            {
                if (type == AutoType.All)
                {
                    return(atDbEntities.Autos.Where(p => p.FilialId == filialId && p.DepartmentId == departmentId && p.Date >= startD && p.Date <= endD).OrderBy(p => p.Number).ToList());
                }
                else
                {
                    return(atDbEntities.Autos.Where(p => p.FilialId == filialId && p.DepartmentId == departmentId && p.Date >= startD && p.Date <= endD && p.Type == type).OrderBy(p => p.Number).ToList());
                }
            }

            return(type == AutoType.All ? atDbEntities.Autos.Where(p => p.FilialId == filialId && p.Date >= startD && p.Date <= endD).OrderBy(p => p.Number).ToList()
                : atDbEntities.Autos.Where(p => p.FilialId == filialId && p.Date >= startD && p.Date <= endD && p.Type == type).OrderBy(p => p.Number).ToList());
        }
Ejemplo n.º 32
0
        public void Continue(ref AutoType typer)
        {
            if(State == DisplayStringState.Pause)
            {
                currentIndex++;

                if (currentIndex >= texts.Count)
                {
                    State = DisplayStringState.Ended;
                    typer.Stop();
                    return;
                }
                PlayText(ref typer);
                return;
            }
            if(State == DisplayStringState.Running)
            {
                State = DisplayStringState.Pause;
                typer.Skip();
            }
        }
 // Use this for initialization
 void Start()
 {
     typer = dialogText.GetComponent<AutoType>();
     StaticDialogText = dialogText;
     StaticTyper = typer;
 }
Ejemplo n.º 34
0
 public AutoAttribute(AutoType type = AutoType.NewGuid)
 {
     Type = type;
 }
 // Use this for initialization
 void Start()
 {
     typer = systemText.GetComponent<AutoType>();
     StaticTyper = typer;
 }
Ejemplo n.º 36
0
        static BuiltinType()
        {
            i8  = new IntegerType { Name = "i8",  FullyQualifiedName = "i8",  SymbolName = "int8_t",  Size = 1, Alignment = 1, Signed = true/*, Context = BindingContext.EmptyContext */};
            i16 = new IntegerType { Name = "i16", FullyQualifiedName = "i16", SymbolName = "int16_t", Size = 2, Alignment = 2, Signed = true/*, Context = BindingContext.EmptyContext */};
            i32 = new IntegerType { Name = "i32", FullyQualifiedName = "i32", SymbolName = "int32_t", Size = 4, Alignment = 4, Signed = true/*, Context = BindingContext.EmptyContext */};
            i64 = new IntegerType { Name = "i64", FullyQualifiedName = "i64", SymbolName = "int64_t", Size = 8, Alignment = 8, Signed = true/*, Context = BindingContext.EmptyContext */};

            u8  = new IntegerType { Name = "u8",  FullyQualifiedName = "u8",  SymbolName = "uint8_t",  Size = 1, Alignment = 1, Signed = false/*, Context = BindingContext.EmptyContext */};
            u16 = new IntegerType { Name = "u16", FullyQualifiedName = "u16", SymbolName = "uint16_t", Size = 2, Alignment = 2, Signed = false/*, Context = BindingContext.EmptyContext */};
            u32 = new IntegerType { Name = "u32", FullyQualifiedName = "u32", SymbolName = "uint32_t", Size = 4, Alignment = 4, Signed = false/*, Context = BindingContext.EmptyContext */};
            u64 = new IntegerType { Name = "u64", FullyQualifiedName = "u64", SymbolName = "uint64_t", Size = 8, Alignment = 8, Signed = false/*, Context = BindingContext.EmptyContext */};

            f32 = new FloatType { Name = "f32", FullyQualifiedName = "f32", SymbolName = "float",  Size = 4, Alignment = 4 /*, Context = BindingContext.EmptyContext */};
            f64 = new FloatType { Name = "f64", FullyQualifiedName = "f64", SymbolName = "double", Size = 8, Alignment = 8 /*, Context = BindingContext.EmptyContext */};

            Void = new VoidType { Name = "void", FullyQualifiedName = "void", SymbolName = "void" /*, Context = BindingContext.EmptyContext */};
            Auto = new AutoType();

            VoidPtr = new PointerType { PointsTo = Void };
            CharPtr = new PointerType { PointsTo = i8 };
        }