Example #1
0
        static Platform()
        {
            var p = (int) Environment.OSVersion.Platform;
            OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows;

            Runtime = (Type.GetType("Mono.Runtime") == null) ? Runtime.Mono : Runtime.DotNet;
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(OS.Model.configs.yl_temp model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into yl_temp(");
            strSql.Append("name,title,status)");
            strSql.Append(" values (");
            strSql.Append("@name,@title,@status)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@name", SqlDbType.NVarChar,100),
                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                    new SqlParameter("@status", SqlDbType.Int,4)};
            parameters[0].Value = model.name;
            parameters[1].Value = model.title;
            parameters[2].Value = model.status;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Example #3
0
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        //validação no servidor
        if ( String.IsNullOrEmpty( txtLoja.Text.Trim() ))
        {
            lblMensagem.Text = "Digite uma loja!";
            return;
        }

        OS os = new OS();
        OSBD bd = new OSBD();

        os.Loja = txtLoja.Text;
        os.Observacao = txtObs.Text;
        os.Ativado = true;

        if ( bd.Insert(os) )
        {
            Session["LOJA"] = null;
            Session["OBS"] = null;
            lblMensagem.Text = "OS Cadastrada com Sucesso!";
            txtLoja.Text = "";
            txtObs.Text = "";
            Session["OS"] = ProximaOs();
            txtOs.Text = Convert.ToString(Session["OS"]);
            gvAlianca.DataSource = null;
            gvAlianca.DataBind();
        }
        else
        {
            lblMensagem.Text = "Houve um erro ao cadastrar!";
        }
    }
 public override void OnViewCreated(Views.View p0, OS.Bundle p1)
 {
     if (DialogAdapter == null) return;
     DialogAdapter.List = ListView;
     DialogAdapter.RegisterListView();
     base.OnViewCreated(p0, p1);
 }
Example #5
0
 public PathItem(OS.OSInformation osInformation, string key, string path)
 {
     _osName = osInformation.OSName;
     _version = osInformation.Version;
     _key = key;
     _path = path;
 }
Example #6
0
      static Platform()
      {
         int p = (int)Environment.OSVersion.Platform;
         _os = ((p == 4) || (p == 128)) ? OS.Linux : OS.Windows;

         _runtime = (Type.GetType("System.MonoType", false) != null) ? Runtime.Mono : Runtime.DotNet;
      }
        public NewAzureQuickVMCmdletInfo(OS os, string name, string serviceName, string imageName, string userName, string password)
        {
            cmdletName = Utilities.NewAzureQuickVMCmdletName;

            if (os == OS.Windows)
            {
                cmdletParams.Add(new CmdletParam("Windows", null));
                if (!string.IsNullOrWhiteSpace(userName))
                {
                    cmdletParams.Add(new CmdletParam("AdminUsername", userName));
                }
            }
            else
            {
                cmdletParams.Add(new CmdletParam("Linux", null));
                if (!string.IsNullOrWhiteSpace(userName))
                {
                    cmdletParams.Add(new CmdletParam("LinuxUser", userName));
                }
            }
            cmdletParams.Add(new CmdletParam("ImageName", imageName));
            cmdletParams.Add(new CmdletParam("Name", name));
            cmdletParams.Add(new CmdletParam("ServiceName", serviceName));
            if (!string.IsNullOrEmpty(password))
            {
                cmdletParams.Add(new CmdletParam("Password", password));
            }
        }
Example #8
0
    protected void gvOS_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = 0;
        switch (e.CommandName)
        {
            case "fechar":
                index = Convert.ToInt32(e.CommandArgument);
                OS os = new OS();
                OSBD bd = new OSBD();
                os = bd.Select(index);
                string Data = os.HoraSaida.ToShortDateString();
                if (Data == "01/01/0001")
                {
                    Session["OS"] = index;
                    Response.Redirect("Fechar.aspx");
                    lblMensagem.Text = "";

                }
                else
                {
                    lblMensagem.Text = "OS já encerrada!";
                }

                break;
            default:
                break;
        }
    }
 public NewAzureQuickVMCmdletInfo(OS os, string name, string serviceName, string imageName, string instanceSize,
     string userName, string password, string vNetName, string[] subnetNames, string affinityGroup, string reservedIP)
     : this(os, name, serviceName, imageName, userName, password)
 {
     if (!string.IsNullOrEmpty(affinityGroup))
     {
         cmdletParams.Add(new CmdletParam("AffinityGroup", affinityGroup));
     }
     if (!string.IsNullOrEmpty(instanceSize))
     {
         cmdletParams.Add(new CmdletParam("InstanceSize", instanceSize));
     }
     if (!string.IsNullOrEmpty(vNetName))
     {
         cmdletParams.Add(new CmdletParam("VNetName", vNetName));
     }
     if (subnetNames != null)
     {
         cmdletParams.Add(new CmdletParam("SubnetNames", subnetNames));
     }
     if (!string.IsNullOrEmpty(reservedIP))
     {
         cmdletParams.Add(new CmdletParam("ReservedIPName", reservedIP));
     }
 }
 public void DrawUI(Rectangle dest, OS os)
 {
     var ButtonHeight = (int) (GuiData.ActiveFontConfig.tinyFontCharHeight + 10.0);
     if (panel.PanelHeight != ButtonHeight + 4)
         panel = new ScrollableSectionedPanel(ButtonHeight + 4, GuiData.spriteBatch.GraphicsDevice);
     var items =
         BuildDirectoryDrawList(
             os.connectedComp == null ? os.thisComputer.files.root : os.connectedComp.files.root, 0, 0, os);
     panel.NumberOfPanels = items.Count;
     var width = dest.Width - 25;
     Action<int, Rectangle, SpriteBatch> DrawSection = (index, bounds, sb) =>
     {
         var lsItem = items[index];
         if (lsItem.IsEmtyDisplay)
         {
             TextItem.doFontLabel(new Vector2(bounds.X + 5 + lsItem.indent, bounds.Y + 2), "-Empty-",
                 GuiData.tinyfont, new Color?(), width, ButtonHeight);
         }
         else
         {
             if (
                 !Button.doButton(300000 + index, bounds.X + 5 + lsItem.indent, bounds.Y + 2,
                     width - lsItem.indent, ButtonHeight, lsItem.DisplayName, new Color?()))
                 return;
             lsItem.Clicked();
         }
     };
     Button.DisableIfAnotherIsActive = true;
     panel.Draw(DrawSection, GuiData.spriteBatch, dest);
     Button.DisableIfAnotherIsActive = false;
 }
 public AddAzureVMImageCmdletInfo(
     string imageName,
     string mediaLocation,
     OS os,
     string label,
     string recommendedSize,
     string description,
     string eula,
     string imageFamily,
     Uri privacyUri,
     DateTime publishedDate)
     : this(imageName, mediaLocation, os, label, recommendedSize)
 {
     if(!string.IsNullOrEmpty(description))
     {
         cmdletParams.Add(new CmdletParam("Description", description));
     }
     if(!string.IsNullOrEmpty(eula))
     {
         cmdletParams.Add(new CmdletParam("Eula", eula));
     }
     if(!string.IsNullOrEmpty(imageFamily))
     {
         cmdletParams.Add(new CmdletParam("ImageFamily", imageFamily));
     }
     if(privacyUri != null)
     {
         cmdletParams.Add(new CmdletParam("PrivacyUri", privacyUri.ToString()));
     }
     if(publishedDate != null)
     {
         cmdletParams.Add(new CmdletParam("PublishedDate", publishedDate.ToString()));
     }
 }
Example #12
0
 public static string TestSaveLoadOnFile(ScreenManager screenMan)
 {
     var text = "__hacknettestaccount";
     var pass = "******";
     SaveFileManager.AddUser(text, pass);
     var saveFileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(text);
     OS.TestingPassOnly = true;
     var text2 = "";
     var oS = new OS();
     oS.SaveGameUserName = saveFileNameForUsername;
     oS.SaveUserAccountName = text;
     screenMan.AddScreen(oS, screenMan.controllingPlayer);
     oS.threadedSaveExecute();
     var nodes = oS.netMap.nodes;
     screenMan.RemoveScreen(oS);
     OS.WillLoadSave = true;
     oS = new OS();
     oS.SaveGameUserName = saveFileNameForUsername;
     oS.SaveUserAccountName = text;
     screenMan.AddScreen(oS, screenMan.controllingPlayer);
     var text3 = "Serialization and Integrity Test Report:\r\n";
     Console.WriteLine(text3);
     text2 += text3;
     new List<string>();
     new List<string>();
     var num = 0;
     text2 += getTestingReportForLoadComparison(oS, nodes, num, out num);
     text2 = text2 + "\r\n" + TestMissions(oS);
     for (var i = 0; i < oS.netMap.nodes.Count; i++)
     {
         var root = oS.netMap.nodes[i].files.root;
         DeleteAllFilesRecursivley(root);
     }
     oS.SaveGameUserName = saveFileNameForUsername;
     oS.SaveUserAccountName = text;
     oS.threadedSaveExecute();
     nodes = oS.netMap.nodes;
     screenMan.RemoveScreen(oS);
     OS.WillLoadSave = true;
     oS = new OS();
     oS.SaveGameUserName = saveFileNameForUsername;
     oS.SaveUserAccountName = text;
     screenMan.AddScreen(oS, screenMan.controllingPlayer);
     var num2 = num;
     var testingReportForLoadComparison = getTestingReportForLoadComparison(oS, nodes, num, out num);
     if (num2 != num)
     {
         text2 = text2 + "\r\nAll Files Deleted pass:\r\n" + testingReportForLoadComparison;
     }
     screenMan.RemoveScreen(oS);
     OS.TestingPassOnly = false;
     SaveFileManager.DeleteUser(text);
     var text4 = string.Concat("\r\nTest complete - ", num, " errors found.\r\nTested ", nodes.Count,
         " generated nodes vs ", oS.netMap.nodes.Count, " loaded nodes");
     text2 += text4;
     Console.WriteLine(text4);
     MusicManager.stop();
     return text2;
 }
 public NewAzureQuickVMCmdletInfo(OS os, string name, string serviceName, string imageName, string userName, string password, string locationName)
     : this(os, name, serviceName, imageName, userName, password)
 {
     if (!string.IsNullOrEmpty(locationName))
     {
         cmdletParams.Add(new CmdletParam("Location", locationName));
     }
 }
 public NewAzureQuickVMCmdletInfo(OS os, string name, string serviceName, string imageName, string userName, string password, string locationName, InstanceSize? instanceSize)
     : this(os, name, serviceName, imageName, userName, password, locationName)
 {
     if (instanceSize.HasValue)
     {
         cmdletParams.Add(new CmdletParam("InstanceSize", instanceSize.ToString()));
     }               
 }
 public AddAzureVMImageCmdletInfo(string imageName, string mediaLocation, OS os, string label, InstanceSize? recommendedSize)
     : this(imageName, mediaLocation, os, label)
 {
     if (recommendedSize.HasValue)
     {
         cmdletParams.Add(new CmdletParam("RecommendedVMSize", recommendedSize));
     }
 }
 public AddAzureVMImageCmdletInfo(string imageName, string mediaLocation, OS os, string label, string recommendedSize)
     : this(imageName, mediaLocation, os, label)
 {
     if (!string.IsNullOrEmpty(recommendedSize))
     {
         cmdletParams.Add(new CmdletParam("RecommendedVMSize", recommendedSize));
     }
 }
Example #17
0
 public OSModel(OS os)
 {
     this.OSId = os.OSId;
     this.Version = os.Version;
     this.Desc = os.Desc;
     this.ReleaseDate = os.ReleaseDate;
     this.ExpirationDate = (os.ExpirationDate.HasValue) ? os.ExpirationDate : null;
 }
Example #18
0
 /// <summary>Static constructor to setup OSVersion</summary>
 static OSDependent() {
   int p = (int) Environment.OSVersion.Platform;
   if ((p == 4) || (p == 128)) {
     OSVersion = OS.Linux;
   }
   else {
     OSVersion = OS.Windows;
   }
 }
 public AzureProvisioningConfigInfo(OS os, CertificateSettingList certs, string password)
 {
     this.OS = os;
     this.Password = password;
     foreach (CertificateSetting cert in certs)
     {
         Certs.Add(cert);
     }
 }
 public DeathRowRecordRemovalMission(string firstName, string lastName, OS _os)
 {
     os = _os;
     fname = firstName;
     lname = lastName;
     var computer = Programs.getComputer(os, "deathRow");
     deathRowDatabase = computer;
     container = computer.getFolderFromPath("dr_database/Records", false);
 }
 public NewAzureQuickVMCmdletInfo(OS os, string name, string serviceName, string imageName, string userName,
     string password, string locationName, string instanceSize, string disableWinRMHttps)
     : this(os, name, serviceName, imageName, userName, password, locationName, instanceSize)
 {
     if (!string.IsNullOrEmpty(disableWinRMHttps))
     {
         cmdletParams.Add(new CmdletParam("DisableWinRMHttps",disableWinRMHttps));
     }
 }
Example #22
0
 static SystemManager()
 {
     if (Path.DirectorySeparatorChar == '\\')
         operating_system = OS.Windows;
     else if (IsRunningOnMac ())
         operating_system = OS.Mac;
     else if (Environment.OSVersion.Platform == PlatformID.Unix)
         operating_system = OS.X11;
     else
         operating_system = OS.Other;
 }
 public TraceDangerSequence(ContentManager content, SpriteBatch sb, Rectangle fullscreenRect, OS os)
 {
     titleFont = GuiData.titlefont;
     bodyFont = GuiData.font;
     fullscreen = fullscreenRect;
     spriteBatch = sb;
     scaleupSpriteBatch = new SpriteBatch(sb.GraphicsDevice);
     this.os = os;
     spinDownSound = os.content.Load<SoundEffect>("Music/Ambient/spiral_gauge_down");
     spinUpSound = os.content.Load<SoundEffect>("Music/Ambient/spiral_gauge_up");
 }
Example #24
0
      static Platform()
      {
#if IOS || UNITY_IPHONE
         _os = OS.IOS;
         _runtime = ClrType.Mono;
#elif ANDROID || UNITY_ANDROID
         _os = OS.Android;
         _runtime = ClrType.Mono;
#elif WINDOWS_PHONE_APP
         _os = OS.WindowsPhone;
         _runtime = ClrType.NetFxCore;
#elif NETFX_CORE
         _os = OS.Windows;
         _runtime = ClrType.NetFxCore;
#else
         PlatformID pid = Environment.OSVersion.Platform;
         if (pid == PlatformID.MacOSX)
         {
            //This never works, it is a bug in Mono
            _os = OS.MacOSX;
         }
         else
         {
            int p = (int)pid;
            _os = ((p == 4) || (p == 128)) ? OS.Linux : OS.Windows;

            if (_os == OS.Linux)
            {  //Check if the OS is Mac OSX
               IntPtr buf = IntPtr.Zero;
               try
               {
                  buf = Marshal.AllocHGlobal(8192);
                  // This is a hacktastic way of getting sysname from uname () 
                  if (uname(buf) == 0)
                  {
                     string os = Marshal.PtrToStringAnsi(buf);
                     if (os == "Darwin")
                        _os = OS.MacOSX;
                  }
               }
               catch
               {
                  //Some unix system may not be able to call "libc"
                  //such as Ubuntu 13.04, we provide a safe catch here
               }
               finally
               {
                  if (buf != IntPtr.Zero) Marshal.FreeHGlobal(buf);
               }
            }
         }
         _runtime = (Type.GetType("System.MonoType", false) != null) ? ClrType.Mono : ClrType.DotNet;
#endif
      }
        public override void OnViewCreated(Views.View p0, OS.Bundle p1)
        {
            if (DialogAdapter == null)
            {
                ListAdapter = DialogAdapter = new DialogAdapter(Activity, _root, ListView);
                _root = null;
            }

            DialogAdapter.List = ListView;
            DialogAdapter.RegisterListView();
            base.OnViewCreated(p0, p1);
        }
 public void ExcluirOrdemServico()
 {
     try
     {
         OS ordemServico = new OS { Codigo = 43 };
         this.client.ExcluirOrdemServico(ordemServico);
         Assert.IsTrue(true);
     }
     catch
     {
         Assert.IsTrue(false);
     }
 }
 public AzureProvisioningConfigInfo(OS os, string user, string password)
 {
     this.OS = os;
     this.Password = password;
     if (os == OS.Windows)
     {
         this.AdminUsername = user;
     }
     else
     {
         this.LinuxUser = user;
     }
 }
        public AddAzureVMImageCmdletInfo(string imageName, string mediaLocation, OS os, string label)
        {
            cmdletName = Utilities.AddAzureVMImageCmdletName;

            cmdletParams.Add(new CmdletParam("ImageName", imageName));
            cmdletParams.Add(new CmdletParam("MediaLocation", mediaLocation));
            cmdletParams.Add(new CmdletParam("OS", os.ToString()));
                
            if (!string.IsNullOrEmpty(label))
            {
                cmdletParams.Add(new CmdletParam("Label", label));
            }
        }
Example #29
0
        static Platform()
        {
#if DOTNET_FRAMEWORK
            int p = (int)Environment.OSVersion.Platform;
            OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows;
#else
            OS = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
                 RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
                ? OS.Unix
                : OS.Windows;
#endif
            Runtime = (Type.GetType("Mono.Runtime") == null) ? Runtime.Mono : Runtime.DotNet;
        }
 public FileDeletionMission(string path, string filename, string computerIP, OS _os)
 {
     target = filename;
     os = _os;
     var computer = Programs.getComputer(os, computerIP);
     targetComp = computer;
     container = computer.getFolderFromPath(path, false);
     for (var index = 0; index < container.files.Count; ++index)
     {
         if (container.files[index].name.Equals(target))
             targetData = container.files[index].data;
     }
 }
Example #31
0
        public MiniNode(string pathname,
                        int?tcpPort                      = null, int?tcpSecPort = null, int?httpPort = null,
                        ISubsystem[] subsystems          = null,
                        int?chunkSize                    = null, int?cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true,
                        int memTableSize                 = 1000,
                        bool inMemDb                     = true, bool disableFlushToDisk = false,
                        IPAddress advertisedExtIPAddress = null, int advertisedExtHttpPort = 0,
                        int hashCollisionReadLimit       = EventStore.Core.Util.Opts.HashCollisionReadLimitDefault,
                        byte indexBitnessVersion         = EventStore.Core.Util.Opts.IndexBitnessVersionDefault,
                        string dbPath                    = "")
        {
            if (_running)
            {
                throw new Exception("Previous MiniNode is still running!!!");
            }
            _running = true;

            RunningTime.Start();
            RunCount += 1;

            IPAddress ip = IPAddress.Loopback; //GetLocalIp();

            int extTcpPort    = tcpPort ?? PortsHelper.GetAvailablePort(ip);
            int extSecTcpPort = tcpSecPort ?? PortsHelper.GetAvailablePort(ip);
            int extHttpPort   = httpPort ?? PortsHelper.GetAvailablePort(ip);
            int intTcpPort    = PortsHelper.GetAvailablePort(ip);
            int intSecTcpPort = PortsHelper.GetAvailablePort(ip);
            int intHttpPort   = PortsHelper.GetAvailablePort(ip);

            if (String.IsNullOrEmpty(dbPath))
            {
                DbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}-{2}", extTcpPort, extSecTcpPort, extHttpPort));
            }
            else
            {
                DbPath = dbPath;
            }
            TcpEndPoint       = new IPEndPoint(ip, extTcpPort);
            TcpSecEndPoint    = new IPEndPoint(ip, extSecTcpPort);
            IntTcpEndPoint    = new IPEndPoint(ip, intTcpPort);
            IntSecTcpEndPoint = new IPEndPoint(ip, intSecTcpPort);
            IntHttpEndPoint   = new IPEndPoint(ip, intHttpPort);
            ExtHttpEndPoint   = new IPEndPoint(ip, extHttpPort);

            var builder = TestVNodeBuilder.AsSingleNode();

            if (inMemDb)
            {
                builder.RunInMemory();
            }
            else
            {
                builder.RunOnDisk(DbPath);
            }

            builder.WithInternalTcpOn(IntTcpEndPoint)
            .WithInternalSecureTcpOn(IntSecTcpEndPoint)
            .WithExternalTcpOn(TcpEndPoint)
            .WithExternalSecureTcpOn(TcpSecEndPoint)
            .WithInternalHttpOn(IntHttpEndPoint)
            .WithExternalHttpOn(ExtHttpEndPoint)
            .WithTfChunkSize(chunkSize ?? ChunkSize)
            .WithTfChunksCacheSize(cachedChunkSize ?? CachedChunkSize)
            .WithServerCertificate(ssl_connections.GetCertificate())
            .WithWorkerThreads(1)
            .DisableDnsDiscovery()
            .WithPrepareTimeout(TimeSpan.FromSeconds(2))
            .WithCommitTimeout(TimeSpan.FromSeconds(2))
            .WithStatsPeriod(TimeSpan.FromHours(1))
            .DisableScavengeMerging()
            .NoGossipOnPublicInterface()
            .WithInternalHeartbeatInterval(TimeSpan.FromSeconds(10))
            .WithInternalHeartbeatTimeout(TimeSpan.FromSeconds(10))
            .WithExternalHeartbeatInterval(TimeSpan.FromSeconds(10))
            .WithExternalHeartbeatTimeout(TimeSpan.FromSeconds(10))
            .MaximumMemoryTableSizeOf(memTableSize)
            .DoNotVerifyDbHashes()
            .WithStatsStorage(StatsStorage.None)
            .AdvertiseExternalIPAs(advertisedExtIPAddress)
            .AdvertiseExternalHttpPortAs(advertisedExtHttpPort)
            .WithHashCollisionReadLimitOf(hashCollisionReadLimit)
            .WithIndexBitnessVersion(indexBitnessVersion);

            if (enableTrustedAuth)
            {
                builder.EnableTrustedAuth();
            }
            if (disableFlushToDisk)
            {
                builder.WithUnsafeDisableFlushToDisk();
            }

            if (subsystems != null)
            {
                foreach (var subsystem in subsystems)
                {
                    builder.AddCustomSubsystem(subsystem);
                }
            }

            Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n"
                     + "{5,-25} {6} ({7})\n"
                     + "{8,-25} {9} ({10}-bit)\n"
                     + "{11,-25} {12}\n"
                     + "{13,-25} {14}\n"
                     + "{15,-25} {16}\n"
                     + "{17,-25} {18}\n"
                     + "{19,-25} {20}\n\n",
                     "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp,
                     "OS:", OS.OsFlavor, Environment.OSVersion,
                     "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8,
                     "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1),
                     "DBPATH:", DbPath,
                     "TCP ENDPOINT:", TcpEndPoint,
                     "TCP SECURE ENDPOINT:", TcpSecEndPoint,
                     "HTTP ENDPOINT:", ExtHttpEndPoint);

            Node = builder.Build();
            Db   = ((TestVNodeBuilder)builder).GetDb();

            Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue));
        }
Example #32
0
 public void Atualizar(OS oS)
 {
     _oSRepository.Atualizar(oS);
 }
Example #33
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     GetNode <Label>("OS_Label").Text     = "OS: " + OS.GetName();
     GetNode <Label>("Engine_Label").Text = "Godot version: " + Engine.GetVersionInfo()["string"];
     _fps = GetNode <Label>("FPS_Label");
 }
 public OSSaveWriteEvent(OS os, string fnam, string saveStr) : base(os, fnam)
 {
     SaveString = saveStr;
 }
Example #35
0
 public void Update(string id, string newId, string description, int seats, bool projector, bool board, bool smartBoard, OS operatingSystem)
 {
     if (id != newId)
     {
         Remove(id);
         Add(newId, description, seats, projector, board, smartBoard, operatingSystem);
     }
     else
     {
         classrooms[id] = new Classroom(id, description, seats, projector, board, smartBoard, operatingSystem);
     }
 }
Example #36
0
        public Classroom Add(string id, string description, int seats, bool projector, bool board, bool smartBoard, OS operatingSystem)
        {
            Classroom toAdd = new Classroom(id, description, seats, projector, board, smartBoard, operatingSystem);

            classrooms.Add(id, toAdd);
            return(toAdd);
        }
Example #37
0
        public static async Task <int> Main(string[] args)
        {
            ClusterVNodeOptions options;
            var exitCodeSource = new TaskCompletionSource <int>();
            var cts            = new CancellationTokenSource();

            Log.Logger = EventStoreLoggerConfiguration.ConsoleLog;
            try {
                try {
                    options = ClusterVNodeOptions.FromConfiguration(args, Environment.GetEnvironmentVariables());
                } catch (Exception ex) {
                    Log.Fatal($"Error while parsing options: {ex.Message}");
                    Log.Information($"Options:{Environment.NewLine}{ClusterVNodeOptions.HelpText}");

                    return(1);
                }

                var logsDirectory = string.IsNullOrWhiteSpace(options.Application.Log)
                                        ? Locations.DefaultLogDirectory
                                        : options.Application.Log;
                EventStoreLoggerConfiguration.Initialize(logsDirectory, options.GetComponentName());

                if (options.Application.Help)
                {
                    await Console.Out.WriteLineAsync(ClusterVNodeOptions.HelpText);

                    return(0);
                }

                Log.Information("\n{description,-25} {version} ({branch}/{hashtag}, {timestamp})", "ES VERSION:",
                                VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp);
                Log.Information("{description,-25} {osFlavor} ({osVersion})", "OS:", OS.OsFlavor,
                                Environment.OSVersion);
                Log.Information("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:",
                                OS.GetRuntimeVersion(),
                                Marshal.SizeOf(typeof(IntPtr)) * 8);
                Log.Information("{description,-25} {maxGeneration}", "GC:",
                                GC.MaxGeneration == 0
                                                ? "NON-GENERATION (PROBABLY BOEHM)"
                                                : $"{GC.MaxGeneration + 1} GENERATIONS");
                Log.Information("{description,-25} {logsDirectory}", "LOGS:", logsDirectory);
                Log.Information(options.DumpOptions());

                var deprecationWarnings = options.GetDeprecationWarnings();
                if (deprecationWarnings != null)
                {
                    Log.Warning($"DEPRECATED{Environment.NewLine}{deprecationWarnings}");
                }

                if (options.Application.Insecure)
                {
                    Log.Warning(
                        "\n==============================================================================================================\n" +
                        "INSECURE MODE IS ON. THIS MODE IS *NOT* RECOMMENDED FOR PRODUCTION USE.\n" +
                        "INSECURE MODE WILL DISABLE ALL AUTHENTICATION, AUTHORIZATION AND TRANSPORT SECURITY FOR ALL CLIENTS AND NODES.\n" +
                        "==============================================================================================================\n");
                }

                if (!options.Cluster.DiscoverViaDns && options.Cluster.GossipSeed.Length == 0 &&
                    options.Cluster.ClusterSize == 1)
                {
                    Log.Information(
                        "DNS discovery is disabled, but no gossip seed endpoints have been specified. Since "
                        + "the cluster size is set to 1, this may be intentional. Gossip seeds can be specified "
                        + "using the `GossipSeed` option.");
                }

                if (options.Application.Version || options.Application.WhatIf)
                {
                    await Console.Out.WriteLineAsync(VersionInfo.Text);

                    return(0);
                }

                Application.RegisterExitAction(code => {
                    cts.Cancel();
                    exitCodeSource.SetResult(code);
                });

                Console.CancelKeyPress += delegate {
                    Application.Exit(0, "Cancelled.");
                };
                using (var hostedService = new ClusterVNodeHostedService(options)) {
                    using var signal = new ManualResetEventSlim(false);
                    _ = Run(hostedService, signal);
                    // ReSharper disable MethodSupportsCancellation
                    signal.Wait();
                    // ReSharper restore MethodSupportsCancellation
                }

                return(await exitCodeSource.Task);

                async Task Run(ClusterVNodeHostedService hostedService, ManualResetEventSlim signal)
                {
                    try {
                        await new HostBuilder()
                        .ConfigureHostConfiguration(builder =>
                                                    builder.AddEnvironmentVariables("DOTNET_").AddCommandLine(args))
                        .ConfigureAppConfiguration(builder =>
                                                   builder.AddEnvironmentVariables().AddCommandLine(args))
                        .ConfigureServices(services => services.AddSingleton <IHostedService>(hostedService))
                        .ConfigureLogging(logging => logging.AddSerilog())
                        .ConfigureWebHostDefaults(builder => builder
                                                  .UseKestrel(server => {
                            server.Limits.Http2.KeepAlivePingDelay =
                                TimeSpan.FromMilliseconds(options.Grpc.KeepAliveInterval);
                            server.Limits.Http2.KeepAlivePingTimeout =
                                TimeSpan.FromMilliseconds(options.Grpc.KeepAliveTimeout);
                            server.Listen(options.Interface.ExtIp, options.Interface.HttpPort,
                                          listenOptions => {
                                if (hostedService.Node.DisableHttps)
                                {
                                    listenOptions.Use(next =>
                                                      new ClearTextHttpMultiplexingMiddleware(next).OnConnectAsync);
                                }
                                else
                                {
                                    listenOptions.UseHttps(new HttpsConnectionAdapterOptions {
                                        ServerCertificateSelector = delegate {
                                            return(hostedService.Node.CertificateSelector());
                                        },
                                        ClientCertificateMode       = ClientCertificateMode.AllowCertificate,
                                        ClientCertificateValidation = (certificate, chain, sslPolicyErrors) => {
                                            var(isValid, error) =
                                                hostedService.Node.InternalClientCertificateValidator(
                                                    certificate,
                                                    chain,
                                                    sslPolicyErrors);
                                            if (!isValid && error != null)
                                            {
                                                Log.Error("Client certificate validation error: {e}", error);
                                            }

                                            return(isValid);
                                        }
                                    });
                                }
                            });
                        })
                                                  .ConfigureServices(services => hostedService.Node.Startup.ConfigureServices(services))
                                                  .Configure(hostedService.Node.Startup.Configure))
                        .RunConsoleAsync(options => options.SuppressStatusMessages = true, cts.Token);
                    } finally {
                        signal.Set();
                    }
                }
            } catch (InvalidConfigurationException ex) {
                Log.Fatal("Invalid Configuration: " + ex.Message);
                return(1);
            }
            catch (Exception ex) {
                Log.Fatal(ex, "Host terminated unexpectedly.");
                return(1);
            } finally {
                Log.CloseAndFlush();
            }
        }
Example #38
0
    //Ensures folders exist, sets up defaults, processes command line arguments and builds menue
    public override void _Ready()
    {
        //First we make sure that the Saves folder exists
        {
            Directory Dir = new Directory();

            if (!Dir.DirExists("user://Saves"))
            {
                Dir.MakeDir("user://Saves");
            }
        }


        //Then defaults are set
        SetupDefaults();

        //Then command line arguments are processed
        bool ConnectFlag = false;

        string[] CmdArgs = OS.GetCmdlineArgs();
        foreach (string CurrentArg in CmdArgs)
        {
            Console.Log($"Command line argument '{CurrentArg}'");

            switch (CurrentArg)
            {
            case "-connect": {
                ConnectFlag = true;
                Net.ConnectTo("127.0.0.1");
                break;
            }

            case "-server": {
                Net.DedicatedServer = true;
                break;
            }
            }
        }

        if (OS.IsDebugBuild() && !ConnectFlag)
        {
            Game.Nickname = "me";
        }


        if (CmdArgs.Length > 0)
        {
            Console.LogLabel.Text += "\n";
        }


        if (!Net.DedicatedServer)
        {
            if (OS.IsDebugBuild())
            {
                Menu.BuildMain();
            }
            else
            {
                Menu.BuildIntro();
            }
        }
    }
        public override bool Execute()
        {
            if (String.IsNullOrEmpty(GCCBuild_ShellApp))
            {
                GCCBuild_ConvertPath = false;
            }
            if (!GCCBuild_ConvertPath)
            {
                GCCBuild_ShellApp = null;
            }
            if (!ObjectFiles.Any())
            {
                return(true);
            }



            Logger.Instance = new XBuildLogProvider(Log); // TODO: maybe initialise statically; this put in constructor causes NRE

            if (!ObjectFiles.Any())
            {
                return(true);
            }

            var lfiles = new List <string>();
            var ofiles = ObjectFiles.Select(x => x.ItemSpec);

            if (String.IsNullOrEmpty(GCCToolArchiverPath))
            {
                GCCToolArchiverPath = "";
            }

            string GCCToolArchiverCombined = GCCToolArchiverPath;

            ShellAppConversion shellApp = new ShellAppConversion(GCCBuild_SubSystem, GCCBuild_ShellApp, GCCBuild_PreRunApp,
                                                                 GCCBuild_ConvertPath, GCCBuild_ConvertPath_mntFolder, IntPath);

            if (OS.Equals("Windows_NT") && String.IsNullOrWhiteSpace(shellApp.shellapp))
            {
                GCCToolArchiverCombined = Utilities.FixAppPath(GCCToolArchiverCombined, GCCToolArchiverExe);
            }
            else
            {
                GCCToolArchiverCombined = Path.Combine(GCCToolArchiverPath, GCCToolArchiverExe);
            }

            string OutputFile_Converted = OutputFile;

            if (shellApp.convertpath)
            {
                OutputFile_Converted = shellApp.ConvertWinPathToWSL(OutputFile);
            }
            else if (!Directory.Exists(Path.GetDirectoryName(OutputFile)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(OutputFile));
            }


            // archiing - librerian
            Dictionary <string, string> Flag_overrides = new Dictionary <string, string>();

            Flag_overrides.Add("OutputFile", OutputFile_Converted);

            var flags = Utilities.GetConvertedFlags(GCCToolArchiver_Flags, GCCToolArchiver_AllFlags, ObjectFiles[0], Flag_overrides, shellApp);

            var runWrapper = new RunWrapper(GCCToolArchiverCombined, flags, shellApp);

            bool needRearchive = true;

            if (File.Exists(OutputFile))
            {
                needRearchive = false;
                FileInfo libInfo = fileinfoDict.GetOrAdd(OutputFile, (x) => new FileInfo(x));
                foreach (var obj in ObjectFiles.Select(x => x.ItemSpec).Concat(new string[] { ProjectFile }))
                {
                    string depfile = obj;

                    if (shellApp.convertpath)
                    {
                        depfile = shellApp.ConvertWSLPathToWin(obj);//here convert back to Windows path
                    }
                    FileInfo fi = fileinfoDict.GetOrAdd(depfile, (x) => new FileInfo(x));
                    if (fi.Exists == false || fi.Attributes == FileAttributes.Directory || fi.Attributes == FileAttributes.Device)
                    {
                        continue;
                    }
                    if (fi.LastWriteTime > libInfo.LastWriteTime)
                    {
                        needRearchive = true;
                        break;
                    }
                }
            }

            bool result = true;

            if (needRearchive)
            {
                TryDeleteFile(OutputFile);
                Logger.Instance.LogCommandLine($"{GCCToolArchiverCombined} {flags}");
                result = runWrapper.RunArchiver(String.IsNullOrEmpty(ObjectFiles[0].GetMetadata("SuppressStartupBanner")) || ObjectFiles[0].GetMetadata("SuppressStartupBanner").Equals("true") ? false : true);
            }

            if (result)
            {
                string allofiles = String.Join(",", ofiles);
                if (allofiles.Length > 100)
                {
                    allofiles = allofiles.Substring(0, 100) + "...";
                }
                if (needRearchive)
                {
                    Logger.Instance.LogMessage($"  ({allofiles}) => {OutputFile_Converted}");
                }
                else
                {
                    Logger.Instance.LogMessage($"  ({allofiles}) => {OutputFile_Converted} (not archive - already up to date)");
                }
            }

            return(result);
        }
Example #40
0
    public static bool Load(string SaveNameArg)
    {
        if (string.IsNullOrEmpty(SaveNameArg) || string.IsNullOrWhiteSpace(SaveNameArg))
        {
            throw new Exception("Invalid save name passed to World.Load");
        }
        if (!IsOpen)
        {
            throw new Exception("The world must be open to load a savefile");
        }

        Directory SaveDir = new Directory();

        if (SaveDir.DirExists($"user://Saves/{SaveNameArg}"))
        {
            string MetaPath = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/Meta.json";
            if (SaveDir.FileExists(MetaPath))
            {
                string    SerializedMeta = System.IO.File.ReadAllText(MetaPath);
                SavedMeta Meta           = Newtonsoft.Json.JsonConvert.DeserializeObject <SavedMeta>(SerializedMeta);

                TimeOfDay = Clamp(Meta.TimeOfDay, 0, 60f * DayNightMinutes);
            }

            Clear();
            Net.SteelRpc(Self, nameof(RequestClear));
            DefaultPlatforms();

            bool ChunksDir = false;
            if (SaveDir.DirExists($"user://Saves/{SaveNameArg}/Chunks"))
            {
                SaveDir.Open($"user://Saves/{SaveNameArg}/Chunks");
                ChunksDir = true;
            }
            else
            {
                SaveDir.Open($"user://Saves/{SaveNameArg}");
            }
            SaveDir.ListDirBegin(true, true);

            int PlaceCount = 0;
            while (true)
            {
                string FileName = SaveDir.GetNext();
                if (FileName.Empty())
                {
                    //Iterated through all files
                    break;
                }

                string Path;
                if (ChunksDir)
                {
                    Path = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/Chunks/{FileName}";
                }
                else
                {
                    Path = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/{FileName}";
                }
                LoadChunk(System.IO.File.ReadAllText(Path));                 //TODO: Try catch
            }

            SaveName = SaveNameArg;
            Console.Log($"Loaded {PlaceCount.ToString()} structures from save '{SaveNameArg}'");

            //TODO: Save/load player data in savefile
            Net.Players.Add(Self.GetTree().GetNetworkUniqueId(), new Net.PlayerData());

            if (Net.DedicatedServer)
            {
                Net.Nicknames[Net.ServerId] = "DedicatedServer";
            }
            else
            {
                Net.Nicknames[Net.ServerId] = Game.Nickname;
                Game.SpawnPlayer(Self.GetTree().GetNetworkUniqueId(), true);
            }

            return(true);
        }
        else
        {
            SaveName = null;
            Console.ThrowLog($"Failed to load save '{SaveNameArg}' as it does not exist");
            return(false);
        }
    }
 public OSPostLoadContentEvent(OS os) : base(os)
 {
 }
Example #42
0
        public void Execute()
        {
            bool newWindow = _process == null || _process.HasExited;

            var args = new List <string>();

            string command;

            if (OS.IsMacOS)
            {
                string bundleId = BundleIds[_editorId];

                if (Internal.IsMacOSAppBundleInstalled(bundleId))
                {
                    command = "open";

                    args.Add("-b");
                    args.Add(bundleId);

                    // The 'open' process must wait until the application finishes
                    if (newWindow)
                    {
                        args.Add("--wait-apps");
                    }

                    args.Add("--args");
                }
                else
                {
                    command = OS.PathWhich(ExecutableNames[_editorId]);
                }
            }
            else
            {
                command = OS.PathWhich(ExecutableNames[_editorId]);
            }

            args.Add("--ipc-tcp");

            if (newWindow)
            {
                args.Add("\"" + Path.GetFullPath(_solutionFile) + "\"");
            }

            if (command == null)
            {
                throw new FileNotFoundException();
            }

            LaunchTime = DateTime.Now;

            if (newWindow)
            {
                _process = Process.Start(new ProcessStartInfo
                {
                    FileName        = command,
                    Arguments       = string.Join(" ", args),
                    UseShellExecute = true
                });
            }
            else
            {
                Process.Start(new ProcessStartInfo
                {
                    FileName        = command,
                    Arguments       = string.Join(" ", args),
                    UseShellExecute = true
                })?.Dispose();
            }
        }
Example #43
0
        public Error SendWebRequest()
        {
            if (!clientCache.TryGetValue(uri.Host, out HTTPClient client))
            {
                client = new HTTPClient();
                clientCache[uri.Host] = client;
            }
            err = client.ConnectToHost(uri.Host, uri.Port);
            if (err != Error.Ok)
            {
                throw new InvalidOperationException($"Failed to connect to host: {uri}. Error: {err}.");
            }

            while (client.GetStatus() == HTTPClient.Status.Connecting || client.GetStatus() == HTTPClient.Status.Resolving)
            {
                client.Poll();
                OS.DelayMsec(10);
            }
            if (client.GetStatus() != HTTPClient.Status.Connected)
            {
                throw new InvalidOperationException($"Failed to connect to host: {uri}. Error: {err}.");
            }

            err = client.Request(method, uri.PathAndQuery, headers.ToArray());
            if (err != Error.Ok)
            {
                throw new InvalidOperationException($"Failed to Sends a request to the connected host: {uri}. Error: {err}.");
            }

            while (client.GetStatus() == HTTPClient.Status.Requesting)
            {
                client.Poll();
                OS.DelayMsec(10);
            }
            if (client.GetStatus() != HTTPClient.Status.Body && client.GetStatus() != HTTPClient.Status.Connected)
            {
                throw new InvalidOperationException($"Failed to Sends a request to the connected host: {uri}. Error: {err}.");
            }

            if (client.HasResponse())
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    while (client.GetStatus() == HTTPClient.Status.Body)
                    {
                        client.Poll();
                        byte[] chunk = client.ReadResponseBodyChunk();
                        if (chunk.Length == 0)
                        {
                            OS.DelayMsec(10);
                        }
                        else
                        {
                            stream.Write(chunk, 0, chunk.Length);
                        }
                    }
                    stream.Position = 0;
                    if (stream.Length > 0)
                    {
                        downloadHandler.ParseData(stream);
                    }
                }
            }

            responseCode = client.GetResponseCode();
            responseHeadersDictionary = client.GetResponseHeadersAsDictionary();
            client.Close();

            return(err);
        }
        public static void BugReport(string at, string pri, string sec, string sData = "")
        {
            var targetUrl = "https://github.com/ImaginaryDevelopment/imaginary-hero-designer/issues";

            try
            {
                if (sData.Length > 0)
                {
                    sData = sData.Replace("\r\n", "-");
                    if (sData.Length > 96)
                    {
                        sData = sData.Substring(0, 96);
                    }
                }
                string str = "?" + "body=" + Strings.Format(Base.Master_Classes.MidsContext.AppVersion, "##0.#####") + "&db=" + Strings.Format(DatabaseAPI.Database.Version, "##0.#####") + " (" + Strings.Format(DatabaseAPI.Database.Date, "dd/MM/yy") + ")" + "&at=" + at + "&p=" + pri + "&s=" + sec + "&OS=" + OS.GetQuickOsid();
                if (sData != "")
                {
                    str = str + "&data=" + sData;
                }
                Process.Start(targetUrl);
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                Interaction.MsgBox(@"There was an error launching the default web browser to visit:"
                                   + "\r\n" + targetUrl + "\r\n"
                                   + ex.Message, MsgBoxStyle.Critical, "Error");
                ProjectData.ClearProjectError();
            }
        }
Example #45
0
        public Classroom Add(string id, string description, int seats, bool projector, bool board, bool smartBoard, OS operatingSystem, MainWindow context)
        {
            Classroom added = Add(id, description, seats, projector, board, smartBoard, operatingSystem);

            context.NotifyAll("Classrooms");
            return(added);
        }
Example #46
0
 public static bool IsWindowsServer()
 {
     return(OS.IsOS(OS.OS_ANYSERVER));
 }
Example #47
0
 public void Update(string id, string newId, string description, int seats, bool projector, bool board, bool smartBoard, OS operatingSystem, MainWindow context)
 {
     Update(id, newId, description, seats, projector, board, smartBoard, operatingSystem);
     SetSelectedClassroom(newId, context);
     // may exist list change
     context.NotifyAll("Classrooms");
 }
Example #48
0
 public TraceDangerSequence(ContentManager content, SpriteBatch sb, Rectangle fullscreenRect, OS os)
 {
     titleFont          = GuiData.titlefont;
     bodyFont           = GuiData.font;
     fullscreen         = fullscreenRect;
     spriteBatch        = sb;
     scaleupSpriteBatch = new SpriteBatch(sb.GraphicsDevice);
     this.os            = os;
     spinDownSound      = os.content.Load <SoundEffect>("Music/Ambient/spiral_gauge_down");
     spinUpSound        = os.content.Load <SoundEffect>("Music/Ambient/spiral_gauge_up");
 }
 private void SendRequestToPlayer(int ReuqestNumber)
 {
     GameSynchronizer.RpcId(PeerId, MDGameSynchronizer.METHOD_REQUEST_TICKS_MSEC, ReuqestNumber, OS.GetTicksMsec());
 }
 public OSLoadSaveFileEvent(OS os, XmlReader xmlReader, Stream stream) : base(os)
 {
     Reader = xmlReader;
     Stream = stream;
 }
        /// <summary>
        /// Called when the ping timer times out, sends a ping request to the given client.
        /// </summary>
        public void OnPingTimerTimeout()
        {
            // Check if network is still active
            if (!MDStatics.IsNetworkActive())
            {
                MDLog.Trace(LOG_CAT, $"Network is no longer active");
                return;
            }

            // Send ping request
            if (GameSynchronizer.GameClock == null)
            {
                GameSynchronizer.RpcId(PeerId, MDGameSynchronizer.METHOD_REQUEST_PING, OS.GetTicksMsec());
            }
            else
            {
                int  maxPlayerPing = GameSynchronizer.GetMaxPlayerPing() + (int)Ping;
                uint estimate      = GameSynchronizer.GetPlayerTicksMsec(PeerId) + (uint)Ping;
                GameSynchronizer.RpcId(PeerId, MDGameSynchronizer.METHOD_REQUEST_PING, OS.GetTicksMsec(), estimate,
                                       GameSynchronizer.GameClock.GetTickAtTimeOffset(Ping), maxPlayerPing);
            }
        }
 public OSUnloadContentEvent(OS os) : base(os)
 {
 }
 public OSSaveFileEvent(OS os, string fnam) : base(os)
 {
     Filename = fnam;
 }
Example #54
0
        /// <summary>
        /// Assigns, asynchronously, a license to a specific user or e-mail address and specified <see cref="OS"/>.
        /// </summary>
        /// <param name="user">The user id (required unless e-mail is specified).</param>
        /// <param name="email">The user's e-mail address (required unless user is specified).</param>
        /// <param name="os">The <see cref="OS"/> to assign the license to.</param>
        /// <returns>Returns a <see cref="AssignLicenseResponse"/>.</returns>
        /// <seealso href="https://pushover.net/api/licensing#assign">Pushover API documentation</seealso>
        /// <exception cref="InvalidOperationException">When user and email are both null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Invalid <see cref="OS"/> specified.</exception>
        public async Task <AssignLicenseResponse> AssignLicenseAsync(string user, string email, OS os)
        {
            if (user != null)
            {
                (this.UserOrGroupKeyValidator ?? new UserOrGroupKeyValidator()).Validate("user", user);
            }
            if (email != null)
            {
                (this.EmailValidator ?? new EMailValidator()).Validate("email", email);
            }

            if (user == null && email == null)
            {
                throw new InvalidOperationException("User or Email required");
            }

            if (!Enum.IsDefined(typeof(OS), os))
            {
                throw new ArgumentOutOfRangeException("os");
            }

            var parameters = new NameValueCollection {
                { "token", this.ApplicationKey },
            };

            parameters.AddConditional("user", user);
            parameters.AddConditional("email", email);
            parameters.AddConditional("os", os);

            return(await this.Post <AssignLicenseResponse>(GetV1APIUriFromBase("licenses/assign.json"), parameters).ConfigureAwait(false));
        }
Example #55
0
 public virtual void Init(OS os, ref ComputerHolder comp)
 {
     Os    = os;
     _comp = comp;
 }
Example #56
0
 public override void _Ready()
 {
     SetProcessInput(OS.IsDebugBuild());
 }
 public OSEndDrawEvent(OS os, GameTime time) : base(os, time)
 {
 }
Example #58
0
 public void Adicionar(OS oS)
 {
     _oSRepository.Adicionar(oS);
 }
Example #59
0
    public static bool Load(string SaveNameArg)
    {
        if (string.IsNullOrEmpty(SaveNameArg) || string.IsNullOrWhiteSpace(SaveNameArg))
        {
            throw new Exception("Invalid save name passed to World.Load");
        }
        if (!IsOpen)
        {
            throw new Exception("The world must be open to load a savefile");
        }

        Directory SaveDir = new Directory();

        if (SaveDir.DirExists($"user://Saves/{SaveNameArg}"))
        {
            string MetaPath = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/Meta.json";
            if (SaveDir.FileExists(MetaPath))
            {
                string    SerializedMeta = System.IO.File.ReadAllText(MetaPath);
                SavedMeta Meta           = Newtonsoft.Json.JsonConvert.DeserializeObject <SavedMeta>(SerializedMeta);

                TimeOfDay = Clamp(Meta.TimeOfDay, 0, 60f * DayNightMinutes);
            }

            Clear();
            Net.SteelRpc(Self, nameof(RequestClear));
            DefaultPlatforms();

            bool ChunksDir = false;
            if (SaveDir.DirExists($"user://Saves/{SaveNameArg}/Chunks"))
            {
                SaveDir.Open($"user://Saves/{SaveNameArg}/Chunks");
                ChunksDir = true;
            }
            else
            {
                SaveDir.Open($"user://Saves/{SaveNameArg}");
            }
            SaveDir.ListDirBegin(true, true);

            int PlaceCount = 0;
            while (true)
            {
                string FileName = SaveDir.GetNext();
                if (FileName.Empty())
                {
                    //Iterated through all files
                    break;
                }

                string Path;
                if (ChunksDir)
                {
                    Path = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/Chunks/{FileName}";
                }
                else
                {
                    Path = $"{OS.GetUserDataDir()}/Saves/{SaveNameArg}/{FileName}";
                }
                Tuple <bool, int> Returned = LoadChunk(System.IO.File.ReadAllText(Path));
                PlaceCount += Returned.Item2;
                if (!Returned.Item1)
                {
                    Console.ThrowLog($"Invalid chunk file {FileName} loading save '{SaveNameArg}'");
                }
            }

            SaveName = SaveNameArg;
            Console.Log($"Loaded {PlaceCount.ToString()} structures from save '{SaveNameArg}'");
            return(true);
        }
        else
        {
            SaveName = null;
            Console.ThrowLog($"Failed to load save '{SaveNameArg}' as it does not exist");
            return(false);
        }
    }
 public OSEndDrawEvent(OS os, GameTime time, Type type) : base(os, time, type)
 {
 }