Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void createNewTemplateXML(String paramString) throws Exception
        public virtual void createNewTemplateXML(string paramString)
        {
            ProjectTemplate projectTemplate = new ProjectTemplate();

            projectTemplate.ProjectName        = paramString;
            projectTemplate.ProjectDescription = paramString + " description";
            projectTemplate.ProjectBasementSqm = 0.0D;
            projectTemplate.ProjectMainSqm     = 0.0D;
            projectTemplate.ProjectType        = "construction";
            projectTemplate.ProjectSubtype     = "office";
            File file1 = new File("templates" + File.separator + paramString);

            file1.mkdirs();
            File file2 = new File("templates" + File.separator + paramString + File.separator + "template-info.xml");

            file2.createNewFile();
            XStream xStream = new XStream();

            ProjectTemplate.FieldAliases = xStream;
            StreamWriter fileWriter = new StreamWriter(file2);

            xStream.toXML(projectTemplate, fileWriter);
            fileWriter.Flush();
            fileWriter.Close();
        }
Exemplo n.º 2
0
        public static void decrementTrialDays(Session paramSession)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            System.Collections.IList list = paramSession.createQuery("from ConcLicenseTable").list();
            XStream xStream = new XStream();

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.Version == 2 && licenseRowItem.IsTrial)
                {
                    if (licenseRowItem.TrialDays < -1)
                    {
                        licenseRowItem.TrialDays = -1;
                    }
                    if (licenseRowItem.TrialDays != -1 && licenseRowItem.TrialDays != 0)
                    {
                        licenseRowItem.TrialDays = licenseRowItem.TrialDays - 10;
                        string str = xStream.toXML(licenseRowItem);
                        concLicenseTable.HashKey = str;
                        paramSession.update(concLicenseTable);
                    }
                }
            }
            if (paramSession.Open)
            {
                paramSession.flush();
                paramSession.close();
            }
        }
Exemplo n.º 3
0
        public static bool?unRegisterUserBySerial(Session paramSession, string paramString1, string paramString2, string paramString3)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            bool? @bool = Convert.ToBoolean(false);

            System.Collections.IList list = paramSession.createQuery("from ConcLicenseTable").list();
            XStream xStream = new XStream();
            License license = new License();

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.hasSameSerial(paramString3).Value&& licenseRowItem.CheckedIn)
                {
                    LicenseRowItem licenseRowItem1 = createRow("NULL", "NULL", paramString3, licenseRowItem, Convert.ToBoolean(false), "NULL");
                    string         str             = xStream.toXML(licenseRowItem1);
                    concLicenseTable.HashKey = str;
                    paramSession.update(concLicenseTable);
                    paramSession.flush();
                    @bool = Convert.ToBoolean(true);
                }
            }
            if (paramSession.Open)
            {
                paramSession.flush();
            }
            return(@bool);
        }
Exemplo n.º 4
0
        public static bool?registerUserBySerial(Session paramSession, string paramString1, string paramString2, string paramString3)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            bool? @bool = Convert.ToBoolean(false);

            System.Collections.IList list = paramSession.createQuery("from ConcLicenseTable").list();
            XStream xStream = new XStream();
            License license = new License();

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.hasSameSerial(paramString3).Value&& !licenseRowItem.CheckedIn)
                {
                    try
                    {
                        bool?bool1 = Convert.ToBoolean(false);
                        System.Collections.IEnumerator enumeration = NetworkInterface.NetworkInterfaces;
                        List <object> arrayList = new List <object>();
                        foreach (NetworkInterface networkInterface in Collections.list(enumeration))
                        {
                            foreach (InetAddress inetAddress in Collections.list(networkInterface.InetAddresses))
                            {
                                arrayList.Add(inetAddress);
                                if (inetAddress.HostAddress.equalsIgnoreCase(licenseRowItem.ServerIP))
                                {
                                    bool1 = Convert.ToBoolean(true);
                                    InetAddress inetAddress1 = inetAddress;
                                }
                            }
                        }
                        if (!bool1.Value)
                        {
                            @bool = Convert.ToBoolean(false);
                            break;
                        }
                    }
                    catch (SocketException socketException)
                    {
                        Console.WriteLine(socketException.ToString());
                        Console.Write(socketException.StackTrace);
                    }
                    DateTime         date             = DateTime.Now;
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyyMMddHHmmssZ");
                    string           str1             = simpleDateFormat.format(date);
                    LicenseRowItem   licenseRowItem1  = createRow(paramString1, paramString2, paramString3, licenseRowItem, Convert.ToBoolean(true), str1);
                    string           str2             = xStream.toXML(licenseRowItem1);
                    concLicenseTable.HashKey = str2;
                    paramSession.update(concLicenseTable);
                    @bool = Convert.ToBoolean(true);
                }
            }
            paramSession.flush();
            return(@bool);
        }
Exemplo n.º 5
0
        public static void storeToTable(Session paramSession, License paramLicense)
        {
            validateTableAndFixTable(paramSession);
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            XStream xStream = new XStream();

            foreach (LicenseRowItem licenseRowItem in paramLicense.RowItems)
            {
                ConcLicenseTable concLicenseTable = new ConcLicenseTable();
                string           str = xStream.toXML(licenseRowItem);
                concLicenseTable.HashKey = str;
                paramSession.save(concLicenseTable);
            }
        }
Exemplo n.º 6
0
        public static bool updateDate(PongEvent paramPongEvent, Session paramSession)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            System.Collections.IList list     = paramSession.createQuery("from ConcLicenseTable").list();
            XStream          xStream          = new XStream();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyyMMddHHmmssZ");
            bool             @bool            = false;

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.CheckedIn && licenseRowItem.Serial.Equals(paramPongEvent.Serial) && licenseRowItem.Userid.Equals(paramPongEvent.UserId, StringComparison.OrdinalIgnoreCase))
                {
                    @bool = true;
                    string str1 = simpleDateFormat.format(DateTime.Now);
                    licenseRowItem.CheckedInDate = str1;
                    string str2 = xStream.toXML(licenseRowItem);
                    concLicenseTable.HashKey = str2;
                    paramSession.update(concLicenseTable);
                }
            }
            return(@bool);
        }